blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
2820cd5f94bb685e12a0ae573cfb2c5a62114125
4f58c2962c2af1124fcabbf309ea7be8ffb51ca4
/src/core/audio/Visualizer.cpp
df4675ee1354fa19e0a52700cbd58c0ad35df8bf
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
donovan68/musikcube
e324c19c702e4dec5e3cb90f24ca8fa488782e55
37cd0da85f1dfdcf61c477762458f5268be73f77
refs/heads/master
2020-06-17T23:26:06.104608
2019-07-08T00:59:03
2019-07-08T01:55:15
196,097,729
0
1
BSD-3-Clause
2019-07-09T23:29:56
2019-07-09T23:29:56
null
UTF-8
C++
false
false
5,410
cpp
////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2004-2019 musikcube team // // 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 the author nor the names of other 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 "pch.hpp" #include "Visualizer.h" #include <core/plugin/PluginFactory.h> #include <atomic> #include <algorithm> using namespace musik::core::audio; using namespace musik::core::sdk; static std::vector<std::shared_ptr<IVisualizer > > visualizers; static std::atomic<bool> initialized; static std::shared_ptr<IVisualizer> selectedVisualizer; static ISpectrumVisualizer* spectrumVisualizer = nullptr; static IPcmVisualizer* pcmVisualizer = nullptr; #define LOWER(x) std::transform(x.begin(), x.end(), x.begin(), tolower); namespace musik { namespace core { namespace audio { namespace vis { static void init() { /* spectrum visualizers */ typedef PluginFactory::ReleaseDeleter<ISpectrumVisualizer> SpectrumDeleter; std::vector<std::shared_ptr<ISpectrumVisualizer> > spectrum; spectrum = PluginFactory::Instance() .QueryInterface<ISpectrumVisualizer, SpectrumDeleter>("GetSpectrumVisualizer"); for (auto it = spectrum.begin(); it != spectrum.end(); it++) { visualizers.push_back(*it); } /* pcm visualizers */ typedef PluginFactory::ReleaseDeleter<IPcmVisualizer> PcmDeleter; std::vector<std::shared_ptr<IPcmVisualizer> > pcm; pcm = PluginFactory::Instance() .QueryInterface<IPcmVisualizer, PcmDeleter>("GetPcmVisualizer"); for (auto it = pcm.begin(); it != pcm.end(); it++) { visualizers.push_back(*it); } /* sort 'em by name */ using V = std::shared_ptr<IVisualizer>; std::sort( visualizers.begin(), visualizers.end(), [](V left, V right) -> bool { std::string l = left->Name(); LOWER(l); std::string r = right->Name(); LOWER(r); return l < r; }); initialized = true; } void HideSelectedVisualizer() { if (selectedVisualizer) { selectedVisualizer->Hide(); SetSelectedVisualizer(std::shared_ptr<IVisualizer>()); } } ISpectrumVisualizer* SpectrumVisualizer() { return spectrumVisualizer; } IPcmVisualizer* PcmVisualizer() { return pcmVisualizer; } std::shared_ptr<IVisualizer> GetVisualizer(size_t index) { return visualizers.at(index); } size_t VisualizerCount() { if (!initialized) { init(); } return visualizers.size(); } void SetSelectedVisualizer(std::shared_ptr<IVisualizer> visualizer) { selectedVisualizer = visualizer; pcmVisualizer = dynamic_cast<IPcmVisualizer*>(visualizer.get()); spectrumVisualizer = dynamic_cast<ISpectrumVisualizer*>(visualizer.get()); } std::shared_ptr<IVisualizer> SelectedVisualizer() { return selectedVisualizer; } } } } }
[ "casey.langen@gmail.com" ]
casey.langen@gmail.com
414bf67ff4ab6bc7b0690c44d005fc2bb519b577
8b218c0a182950b7e9cdbc021fdde19bb4f64aca
/src/game/CJoyInput.cpp
254768707ec8ca79e71bb2dbe878a787ee6fc04d
[]
no_license
stupid-genius/TreadMarks
0e5a8abdf1ac7418f90b4a8652385d68a0169524
11af4c63000a8984593d56531f7cdfb1fa9be8b1
refs/heads/master
2021-01-13T15:37:39.350105
2017-01-20T16:12:49
2017-01-20T16:12:49
80,081,772
1
0
null
2017-01-26T03:12:10
2017-01-26T03:12:10
null
UTF-8
C++
false
false
5,487
cpp
// This file is part of Tread Marks // // Tread Marks is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Tread Marks 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 Tread Marks. If not, see <http://www.gnu.org/licenses/>. #include "CJoyInput.h" #include <cmath> #include <SFML/Window.hpp> using namespace std; CJoyInput::CJoyInput() : idJoystick(-1) { } CJoyInput::~CJoyInput() { } CStr getJoystickName(int iId) { // SFML doesn't currently support retrieving the name of a joystick, so we'll make our own. return "Joystick " + String(iId+1); } bool CJoyInput::InitController ( int iController ) { // Default controller in SFML-talk is 0 if(iController == -1) iController = 0; if(m_rController.iName == iController) return true; if(!sf::Joystick::isConnected(iController)) return false; memset(LastButtons, 0, sizeof(LastButtons)); memset(&m_rController, 0, sizeof(trControllerStatus)); m_rController.iName = iController; m_rController.iAxes = 0; for(auto it = 0; it <= sf::Joystick::AxisCount; ++it) m_rController.iAxes += sf::Joystick::hasAxis(iController, sf::Joystick::Axis(it)); m_rController.iButtons = sf::Joystick::getButtonCount(iController); m_rController.rDeviceID.iDevID = m_rController.iName; m_rController.rDeviceID.sDevName = getJoystickName(iController); if(sf::Joystick::hasAxis(iController, sf::Joystick::PovX) || sf::Joystick::hasAxis(iController, sf::Joystick::PovY)) m_rController.bHasHat = true; else m_rController.bHasHat = false; m_rController.aHatVector[0] = m_rController.aHatVector[1] = 0; if (m_rController.iAxes <= 0) return false; if (sf::Joystick::hasAxis(iController, sf::Joystick::X)) m_rController.aAxes[_XAXIS].bActive = true; if (sf::Joystick::hasAxis(iController, sf::Joystick::Y)) m_rController.aAxes[_YAXIS].bActive = true; if (sf::Joystick::hasAxis(iController, sf::Joystick::Z)) m_rController.aAxes[_ZAXIS].bActive = true; if (sf::Joystick::hasAxis(iController, sf::Joystick::R)) m_rController.aAxes[_RAXIS].bActive = true; if (sf::Joystick::hasAxis(iController, sf::Joystick::U)) m_rController.aAxes[_UAXIS].bActive = true; if (sf::Joystick::hasAxis(iController, sf::Joystick::V)) m_rController.aAxes[_VAXIS].bActive = true; idJoystick = iController; return true; } int CJoyInput::UnInitController ( void ) { idJoystick = -1; memset(&m_rController, 0, sizeof(trControllerStatus)); return 0; } int CJoyInput::GetFirstControllerID ( void ) { if(GetNumberOfControllers() > 0) return 0; return -1; } bool CJoyInput::GetDeviceInfo(trDeviceID *pDevInfo, int iID ) { if (iID == -1) { if (idJoystick == -1) // if no controller then try to init the defalut if (!InitController()) // if it don't exist we need to bail return false; // copy the current controlers setup to the sruct pDevInfo->iDevID = m_rController.rDeviceID.iDevID; pDevInfo->sDevName = m_rController.rDeviceID.sDevName; return true; } if(!sf::Joystick::isConnected(iID)) return false; pDevInfo->iDevID = iID; pDevInfo->sDevName = getJoystickName(iID); return true; } int CJoyInput::GetDevIDFromInfo ( trDeviceID *pDevInfo ) { if (!pDevInfo) return -1; for (int i = 0; i < sf::Joystick::Count; i ++) { if(getJoystickName(i) == pDevInfo->sDevName) { pDevInfo->iDevID = i; return i; } } return -1; } bool CJoyInput::GetControllerName ( int id, CStr* Name ) { if ( (GetNumberOfControllers() <= 0) || (id > GetNumberOfControllers()) ) return false; if (!Name) return false; if (id == -1) { if (idJoystick == -1) // if no controller then try to init the defalut if (!InitController()) // if it don't exist we need to bail return false; // copy the name of the defalut *Name = m_rController.rDeviceID.sDevName; return true; } *Name = getJoystickName(id); return true; } int CJoyInput::GetNumberOfControllers( void ) { int i = 0; for(; i < sf::Joystick::Count; ++i) if(!sf::Joystick::isConnected(i)) return i; return i; } void CJoyInput::Update(void) { bool bError = false; if(idJoystick != -1) { memcpy(LastButtons, m_rController.aButtons, sizeof(LastButtons)); for(int i = _XAXIS; i <= _VAXIS; ++i) { if (m_rController.aAxes[i].bActive) { m_rController.aAxes[i].position = sf::Joystick::getAxisPosition(idJoystick, sf::Joystick::Axis(i)) / 100.0f; } } if (m_rController.bHasHat) { m_rController.aHatVector[0] = sf::Joystick::getAxisPosition(idJoystick, sf::Joystick::PovX) / 100.0f; m_rController.aHatVector[1] = sf::Joystick::getAxisPosition(idJoystick, sf::Joystick::PovY) / 100.0f; } else m_rController.aHatVector[0] = m_rController.aHatVector[1] = 0; for (int i = 0; i < m_rController.iButtons; i ++) m_rController.aButtons[i] = sf::Joystick::isButtonPressed(idJoystick, i); } }
[ "rick@firefang.com" ]
rick@firefang.com
3056517ebb9bbf9cfea7992f7b8b80d9dd371fe2
04c3a5591d688fdf688d6791fb6d8742a0f86826
/inode_manager.h
116c12ea8240f5718b41bd74b427d652bd0b4bc5
[]
no_license
snake0/lab-cse
69632a63abd25c6f0e78ac8f036f2ca48b58dd46
a90ecac2f1ab69d25d40171f6275f5fb53fe4147
refs/heads/master
2020-04-08T15:44:48.361880
2018-11-28T11:43:47
2018-11-28T11:43:47
159,490,196
2
0
null
null
null
null
UTF-8
C++
false
false
2,293
h
// inode layer interface. #ifndef inode_h #define inode_h #include <stdint.h> #include <ctime> #include "extent_protocol.h" // TODO: delete it #define DISK_SIZE 1024*1024*16 #define BLOCK_SIZE 512 #define BLOCK_NUM (DISK_SIZE/BLOCK_SIZE) typedef uint32_t blockid_t; // disk layer ----------------------------------------- class disk { private: unsigned char blocks[BLOCK_NUM][BLOCK_SIZE]; public: disk(); void read_block(uint32_t id, char *buf); void write_block(uint32_t id, const char *buf); }; // block layer ----------------------------------------- typedef struct superblock { uint32_t size; uint32_t nblocks; uint32_t ninodes; } superblock_t; class block_manager { private: disk *d; std::map<uint32_t, int> using_blocks; public: block_manager(); struct superblock sb; uint32_t alloc_block(); void free_block(uint32_t id); void read_block(uint32_t id, char *buf); void write_block(uint32_t id, const char *buf); }; // inode layer ----------------------------------------- #define INODE_NUM 1024 // Inodes per block. #define IPB 1 //(BLOCK_SIZE / sizeof(struct inode)) // Block containing inode i #define IBLOCK(i, nblocks) ((nblocks)/BPB + (i)/IPB + 3) // Bitmap bits per block #define BPB (BLOCK_SIZE*8) // Block containing bit for block b #define BBLOCK(b) ((b)/BPB + 2) // Blocks needed to contain b bytes #define BLOCKS(b) ((uint)((b + BLOCK_SIZE - 1) / BLOCK_SIZE)) #define NDIRECT 32 #define NINDIRECT (BLOCK_SIZE / sizeof(uint)) #define MIN(a, b) ((a)<(b) ? (a) : (b)) typedef struct inode { short type; unsigned int size; unsigned int atime; unsigned int mtime; unsigned int ctime; blockid_t blocks[NDIRECT + 1]; // Data block addresses } inode_t; class inode_manager { private: block_manager *bm; struct inode *get_inode(uint32_t inum); void put_inode(uint32_t inum, struct inode *ino); public: inode_manager(); uint32_t alloc_inode(uint32_t type); void free_inode(uint32_t inum); void read_file(uint32_t inum, char **buf, int *size); void write_file(uint32_t inum, const char *buf, int size); void remove_file(uint32_t inum); void getattr(uint32_t inum, extent_protocol::attr &a); }; #endif
[ "1260865816@qq.com" ]
1260865816@qq.com
d5a412340c38aaee217bf2b3987e1e6b2b0ff5cd
04837d51eb7226c541de05f33033ef7ea977906b
/waspmote-pro-ide-v04-windows/hardware/waspmote/cores/waspmote-api/sd_utilities/SdStream.h
19c428cf1ba362405b9ad875f8360d5a41e829a2
[]
no_license
trinoy/sensorWork
df0dff008977543f83b0096bedcfdec1de73ca67
6249efd0ec961a47130f86995563d87fc536dbfc
refs/heads/master
2021-05-03T07:52:29.506231
2017-04-27T01:07:22
2017-04-27T01:07:22
63,273,387
0
1
null
null
null
null
UTF-8
C++
false
false
7,796
h
/* Arduino SdFat Library * Copyright (C) 2012 by William Greiman * * This file is part of the Arduino SdFat Library * * This Library is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This Library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the Arduino SdFat Library. If not, see * <http://www.gnu.org/licenses/>. */ #ifndef SdStream_h #define SdStream_h /** * \file * \brief \ref fstream, \ref ifstream, and \ref ofstream classes */ #include "SdBaseFile.h" #include "iostream.h" //============================================================================== /** * \class SdStreamBase * \brief Base class for SD streams */ class SdStreamBase : protected SdBaseFile, virtual public ios { protected: /// @cond SHOW_PROTECTED int16_t getch(); void putch(char c); void putstr(const char *str); void open(const char* path, ios::openmode mode); /** Internal do not use * \return mode */ ios::openmode getmode() {return m_mode;} /** Internal do not use * \param[in] mode */ void setmode(ios::openmode mode) {m_mode = mode;} bool seekoff(off_type off, seekdir way); bool seekpos(pos_type pos); int write(const void* buf, size_t n); void write(char c); /// @endcond private: ios::openmode m_mode; }; //============================================================================== /** * \class fstream * \brief SD file input/output stream. */ class fstream : public iostream, SdStreamBase { public: using iostream::peek; fstream() {} /** Constructor with open * * \param[in] path path to open * \param[in] mode open mode */ explicit fstream(const char* path, openmode mode = in | out) { open(path, mode); } #if DESTRUCTOR_CLOSES_FILE ~fstream() {} #endif // DESTRUCTOR_CLOSES_FILE /** Clear state and writeError * \param[in] state new state for stream */ void clear(iostate state = goodbit) { ios::clear(state); SdBaseFile::writeError = false; } /** Close a file and force cached data and directory information * to be written to the storage device. */ void close() {SdBaseFile::close();} /** Open a fstream * \param[in] path file to open * \param[in] mode open mode * * Valid open modes are (at end, ios::ate, and/or ios::binary may be added): * * ios::in - Open file for reading. * * ios::out or ios::out | ios::trunc - Truncate to 0 length, if existent, * or create a file for writing only. * * ios::app or ios::out | ios::app - Append; open or create file for * writing at end-of-file. * * ios::in | ios::out - Open file for update (reading and writing). * * ios::in | ios::out | ios::trunc - Truncate to zero length, if existent, * or create file for update. * * ios::in | ios::app or ios::in | ios::out | ios::app - Append; open or * create text file for update, writing at end of file. */ void open(const char* path, openmode mode = in | out) { SdStreamBase::open(path, mode); } /** \return True if stream is open else false. */ bool is_open () {return SdBaseFile::isOpen();} protected: /// @cond SHOW_PROTECTED /** Internal - do not use * \return */ int16_t getch() {return SdStreamBase::getch();} /** Internal - do not use * \param[out] pos */ void getpos(FatPos_t* pos) {SdBaseFile::getpos(pos);} /** Internal - do not use * \param[in] c */ void putch(char c) {SdStreamBase::putch(c);} /** Internal - do not use * \param[in] str */ void putstr(const char *str) {SdStreamBase::putstr(str);} /** Internal - do not use * \param[in] pos */ bool seekoff(off_type off, seekdir way) { return SdStreamBase::seekoff(off, way); } bool seekpos(pos_type pos) {return SdStreamBase::seekpos(pos);} void setpos(FatPos_t* pos) {SdBaseFile::setpos(pos);} bool sync() {return SdStreamBase::sync();} pos_type tellpos() {return SdStreamBase::curPosition();} /// @endcond }; //============================================================================== /** * \class ifstream * \brief SD file input stream. */ class ifstream : public istream, SdStreamBase { public: using istream::peek; ifstream() {} /** Constructor with open * \param[in] path file to open * \param[in] mode open mode */ explicit ifstream(const char* path, openmode mode = in) { open(path, mode); } #if DESTRUCTOR_CLOSES_FILE ~ifstream() {} #endif // DESTRUCTOR_CLOSES_FILE /** Close a file and force cached data and directory information * to be written to the storage device. */ void close() {SdBaseFile::close();} /** \return True if stream is open else false. */ bool is_open() {return SdBaseFile::isOpen();} /** Open an ifstream * \param[in] path file to open * \param[in] mode open mode * * \a mode See fstream::open() for valid modes. */ void open(const char* path, openmode mode = in) { SdStreamBase::open(path, mode | in); } protected: /// @cond SHOW_PROTECTED /** Internal - do not use * \return */ int16_t getch() {return SdStreamBase::getch();} /** Internal - do not use * \param[out] pos */ void getpos(FatPos_t* pos) {SdBaseFile::getpos(pos);} /** Internal - do not use * \param[in] pos */ bool seekoff(off_type off, seekdir way) { return SdStreamBase::seekoff(off, way); } bool seekpos(pos_type pos) {return SdStreamBase::seekpos(pos);} void setpos(FatPos_t* pos) {SdBaseFile::setpos(pos);} pos_type tellpos() {return SdStreamBase::curPosition();} /// @endcond }; //============================================================================== /** * \class ofstream * \brief SD card output stream. */ class ofstream : public ostream, SdStreamBase { public: ofstream() {} /** Constructor with open * \param[in] path file to open * \param[in] mode open mode */ explicit ofstream(const char* path, ios::openmode mode = out) { open(path, mode); } #if DESTRUCTOR_CLOSES_FILE ~ofstream() {} #endif // DESTRUCTOR_CLOSES_FILE /** Clear state and writeError * \param[in] state new state for stream */ void clear(iostate state = goodbit) { ios::clear(state); SdBaseFile::writeError = false; } /** Close a file and force cached data and directory information * to be written to the storage device. */ void close() {SdBaseFile::close();} /** Open an ofstream * \param[in] path file to open * \param[in] mode open mode * * \a mode See fstream::open() for valid modes. */ void open(const char* path, openmode mode = out) { SdStreamBase::open(path, mode | out); } /** \return True if stream is open else false. */ bool is_open() {return SdBaseFile::isOpen();} protected: /// @cond SHOW_PROTECTED /** * Internal do not use * \param[in] c */ void putch(char c) {SdStreamBase::putch(c);} void putstr(const char* str) {SdStreamBase::putstr(str);} bool seekoff(off_type off, seekdir way) { return SdStreamBase::seekoff(off, way); } bool seekpos(pos_type pos) {return SdStreamBase::seekpos(pos);} /** * Internal do not use * \param[in] b */ bool sync() {return SdStreamBase::sync();} pos_type tellpos() {return SdStreamBase::curPosition();} /// @endcond }; //------------------------------------------------------------------------------ #endif // SdStream_h
[ "trinoy@Trinoys-MacBook-Pro.local" ]
trinoy@Trinoys-MacBook-Pro.local
a9a6e9e6be3f8d45052a46f25d6d526a7053b28f
1189a5028438c243e899d0f50179780ace5e2185
/ga/core/ga-module.cpp
6ed60e1da899ce59fcf91702a759d78c852fa918
[]
no_license
Ljinod/gaminganywhere
baba62f7285438afb46238e0dfa7e1256dbe6a89
ca2f8d8562eea554f431a486dd9c1cda03e3828e
refs/heads/master
2020-12-26T01:50:14.774440
2014-12-18T15:42:43
2014-12-18T15:42:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,968
cpp
/* * Copyright (c) 2013 Chun-Ying Huang * * This file is part of GamingAnywhere (GA). * * GA is free software; you can redistribute it and/or modify it * under the terms of the 3-clause BSD License as published by the * Free Software Foundation: http://directory.fsf.org/wiki/License:BSD_3Clause * * GA 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. * * You should have received a copy of the 3-clause BSD License along with GA; * if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <map> #include <pthread.h> #ifndef WIN32 #include <dlfcn.h> #endif #include "ga-common.h" #include "ga-module.h" using namespace std; static map<ga_module_t *, HMODULE> mlist; ga_module_t * ga_load_module(const char *modname, const char *prefix) { char fn[1024]; ga_module_t *m; HMODULE handle; ga_module_t * (*do_module_load)(); #ifdef WIN32 snprintf(fn, sizeof(fn), "%s.dll", modname); #elif defined __APPLE__ snprintf(fn, sizeof(fn), "%s.dylib", modname); #else snprintf(fn, sizeof(fn), "%s.so", modname); #endif // if((handle = dlopen(fn, RTLD_NOW|RTLD_LOCAL)) == NULL) { ga_error("ga_load_module: load module (%s) failed - %s.\n", fn, dlerror()); return NULL; } if((do_module_load = (ga_module_t * (*)()) dlsym(handle, "module_load")) == NULL) { ga_error("ga_load_module: [%s] is not a valid module.\n", fn); dlclose(handle); return NULL; } if((m = do_module_load()) != NULL) { mlist[m] = handle; } // return m; } void ga_unload_module(ga_module_t *m) { map<ga_module_t *, HMODULE>::iterator mi; if(m == NULL) return; if((mi = mlist.find(m)) == mlist.end()) return; dlclose(mi->second); mlist.erase(mi); return; } int ga_init_single_module(const char *name, ga_module_t *m, void *arg) { if(m->init == NULL) return 0; if(m->init(arg) < 0) { ga_error("%s init failed.\n", name); return -1; } return 0; } void ga_init_single_module_or_quit(const char *name, ga_module_t *m, void *arg) { if(ga_init_single_module(name, m, arg) < 0) exit(-1); return; } int ga_run_single_module(const char *name, void * (*threadproc)(void*), void *arg) { pthread_t t; if(threadproc == NULL) return 0; if(pthread_create(&t, NULL, threadproc, arg) != 0) { ga_error("cannot create %s thread\n", name); return -1; } pthread_detach(t); return 0; } void ga_run_single_module_or_quit(const char *name, void * (*threadproc)(void*), void *arg) { if(ga_run_single_module(name, threadproc, arg) < 0) exit(-1); return; } int ga_module_ioctl(ga_module_t *m, int command, int argsize, void *arg) { if(m == NULL) return GA_IOCTL_ERR_NULLMODULE; if(m->ioctl == NULL) return GA_IOCTL_ERR_NOIOCTL; return m->ioctl(command, argsize, arg); }
[ "chuang@ntou.edu.tw" ]
chuang@ntou.edu.tw
3fc65fa91dec0e1a96bfe72f6d3d1df46514f17e
b254a0fc76f4fdec626a1019ff877dc12f72242f
/OPRoSFiles/OPRoSInc/ArchiveFactory.h
92c2b3c15b3775db0116848afbe243a68e31f119
[]
no_license
OPRoS/ComponentComposer
bcd1641f2f8260043e7364ae1d597337ae7ef0df
e92c36e884ca19fa2f1191b08a0e1b93c16201ea
refs/heads/master
2016-09-06T02:01:37.633694
2013-11-08T02:36:07
2013-11-08T02:36:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,871
h
/* * OPRoS Component Engine (OCE) * Copyright (c) 2008 ETRI. http://www.etri.re.kr. * Distributed under the OPRoS License, Version 1.0. * * @Created : 2009. 2. 19 * @Author : sby (sby@etri.re.kr) * * @File : ArchiveFactory.h * * */ #ifndef ARCHIVEFACTORY_H_ #define ARCHIVEFACTORY_H_ #include <sstream> #include <boost/archive/polymorphic_oarchive.hpp> #include <boost/archive/polymorphic_iarchive.hpp> /** * ArchiveFactory is the abstract base class for all boost archive instance creation factory * */ class ArchiveFactory { public: /** * Create boost output archive instance related to output stream * * @param str stream reference used by boost output archive. * After serialization process, the engine gets string from str and * send a message including the string to target host */ virtual boost::archive::polymorphic_oarchive *getOutputArchive(std::ostream &str) =0; /** * Create boost input archive instance related to input stream * * @param str stream reference used by boost input archive. * There are serialized data in the stream from other hosts or components. */ virtual boost::archive::polymorphic_iarchive *getInputArchive(std::istream &str) =0; /** * Release output archive instance * * @param arc polymorphic_oarchive instance pointer. * the pointer had to be created from getOutputArchive() function. */ virtual void release(boost::archive::polymorphic_oarchive *arc)=0; /** * Release input archive instance * * @param arc polymorphic_iarchive instance pointer. * the pointer had to be created from getInputArchive() function. */ virtual void release(boost::archive::polymorphic_iarchive *arc)=0; ArchiveFactory(); virtual ~ArchiveFactory(); }; #endif /* ARCHIVEFACTORY_H_ */
[ "yudonguk@naver.com" ]
yudonguk@naver.com
21015984c553dbd688cfe798855f6343a72fa40c
43fd9eb33464b178cbe2a5a93f79d5a73bccc976
/BW/Source/BlackWall/Manager/QuestSystemManager.h
c5f8abf75f55c25109ac169303994f3ef20f88e3
[]
no_license
JJIKKYU/GraduationGame_BlackWall
c295171f3e5640b90f39252792729f515bf750db
c68c6a789d2978c66a2d0f6799deda8df721c3d5
refs/heads/master
2023-01-11T05:04:02.226586
2020-11-20T15:49:37
2020-11-20T15:49:37
214,791,181
0
1
null
null
null
null
UTF-8
C++
false
false
551
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "UObject/NoExportTypes.h" #include "QuestSystemManager.generated.h" /** * */ UCLASS() class BLACKWALL_API UQuestSystemManager : public UObject { GENERATED_BODY() class UMainGameInstance* MainGameInstance; public: UQuestSystemManager(); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Quset") class UDataTable* questTable; int MonsterCountByTag(UWorld* world, FName monsterTag); void Test(); };
[ "jjikkyu@naver.com" ]
jjikkyu@naver.com
fcf992390c0a3f86016f76ee45cf14aaf3f545c2
3aea271be15dead5e497ce3406f8ff62c5fd04b7
/src/Nave.cpp
5009f66eaf2350c783b6e0cb1296e7d0b5d91149
[]
no_license
MCheca/BuckRogersSFML
a121c5e1825834d8d730e6742ae88efdaddd7f5d
498e2f979ff23570d66a9678506b38d59c3aa9ad
refs/heads/master
2020-05-19T19:27:07.235667
2019-05-06T11:11:53
2019-05-06T11:11:53
185,180,593
0
0
null
null
null
null
UTF-8
C++
false
false
6,886
cpp
#include "Nave.h" #include <iostream> #include <Game.h> #include <stdlib.h> int width = 1024; int height = 768; vector<Disparo*> balas(0); Nave::Nave() { velocidad = 0.3; //TEXTURAS DEL MODO DIOS g1 = new sf::Texture(); g1->loadFromFile("images/god1.png"); g2 = new sf::Texture(); g2->loadFromFile("images/god2.png"); g3 = new sf::Texture(); g3->loadFromFile("images/god3.png"); //Cargamos el sprite de la nave texture = new sf::Texture(); texture->loadFromFile("images/pusat.png"); texture2 = new sf::Texture(); texture2->loadFromFile("images/pusat2.png"); sprite = new sf::Sprite(*texture); sprite->setOrigin(82/2,97/2); sprite->setPosition(width/2, 600); //Cargamos la sombra de la nave text = new sf::Texture(); text->loadFromFile("images/pusatsombra.png"); sombra = new sf::Sprite(*text); sombra->setOrigin(82/2,97/2); sombra->setPosition(width/2, 715); sombra->scale(0.8f,0.8f); lastX = 0; lastY = 0; newX = 40; } //Getters int Nave::getPuntos(){return puntos;} int Nave::getVidas(){return vidas;} int Nave::getDireccion(){return direccion;} bool Nave::getMoviendose(){return moviendose;} bool Nave::getGanador(){return ganador;} float Nave::getVelocidad(){return velocidad;} float Nave::getNewX(){return newX;} sf::Sprite* Nave::getSprite(){return sprite;} sf::Sprite* Nave::getSombra(){return sombra;} vector<Disparo*> Nave::getBalas(){return balas;} void Nave::limpiarBalas(){ if(balas.size()>0){ for(int i=0;i<balas.size();i++){ if(balas.at(i)->getSprite()->getPosition().y<150){ balas.erase(balas.begin()); //cout << "Begin: " << balas.begin()->getSprite()->getPosition().y <<endl; } } } } void Nave::disparar(sf::RenderWindow& window){ Disparo *dsp = new Disparo(sprite->getPosition().x, sprite->getPosition().y); balas.push_back(dsp); //window.draw(*sprite); std::cout << "HAS DISPARADO" <<endl; } void Nave::puntosAlien(alien *a, Nivel *n, int t){ for(int i=0;i<balas.size();i++){ if(a->getSprite()->getGlobalBounds().intersects(balas.at(i)->getSprite()->getGlobalBounds())){ balas.erase(balas.begin()); n->borrarAlien(0, t); sumaPuntos(50); cout << "*** Alien muerto ***" <<endl; } } } void Nave::puntosSaltador(Saltador *s, Nivel *n){ for(int i=0;i<balas.size();i++){ if(s->getSprite()->getGlobalBounds().intersects(balas.at(i)->getSprite()->getGlobalBounds())){ balas.erase(balas.begin()); n->borrarSaltador(0); sumaPuntos(100); cout << "*** Saltador muerto ***" <<endl; } } } bool Nave::puntosBoss(Boss *b, Nivel *n){ for(int i=0;i<balas.size();i++){ if(b->getSprite()->getGlobalBounds().intersects(balas.at(i)->getSprite()->getGlobalBounds())){ balas.erase(balas.begin()); sumaPuntos(500); cout << "*** Boss muerto ***" <<endl; return true; } } return false; } //Setters void Nave::moverse(float _deltaTime, bool g){ int ra = rand() % 10; if(!g){ if(ra>5){ sprite->setTexture(*texture); } else{ sprite->setTexture(*texture2); } } else{ //Modo dios if(ra>=3 && ra<6){ sprite->setTexture(*g1); } else if(ra>=6){ sprite->setTexture(*g2); } else{ sprite->setTexture(*g3); } } //std::cout << moviendose << endl; if(moviendose){ if((sprite->getPosition().x>100 && direccion==-1)||(sprite->getPosition().x<924 && direccion==1)){ sprite->move(direccion*velocidad* _deltaTime,0); sombra->move(direccion*velocidad* _deltaTime,0); } } } void Nave::setGanador(){ ganador=true; } void Nave::setVelocidad(float v){ velocidad=velocidad+v; } void Nave::sumaPuntos(int p){ puntos=puntos+p; } void Nave::vidaMenos(){ vidas--; } bool Nave::puntosTorre(sf::ConvexShape m){ sf::FloatRect n = this->getSprite()->getGlobalBounds(); //Guarda la posicion de la nave sf::FloatRect meta = m.getGlobalBounds(); if(meta.intersects(n)){ return true; } return false; } bool Nave::choqueTorre(Torre *torreI, Torre *torreD){ sf::FloatRect shape1 = torreI->getSprite()->getGlobalBounds(); //Guarda la posicion de la torreI sf::FloatRect shape2 = torreD->getSprite()->getGlobalBounds(); //Guarda la posicion de la torreD sf::FloatRect shape3 = this->getSprite()->getGlobalBounds(); //Guarda la posicion de la nave if (shape1.intersects(shape3) || shape2.intersects(shape3)){ return true; } else return false; } bool Nave::choqueAlien(alien *a){ sf::FloatRect shape1 = a->getSprite()->getGlobalBounds(); //Guarda la posicion del alien sf::FloatRect shape2 = this->getSprite()->getGlobalBounds(); //Guarda la posicion de la nave if (shape1.intersects(shape2)){ return true; } else return false; } bool Nave::choqueMisil(Misil *m, Boss *b){ sf::FloatRect shape1 = m->getSprite()->getGlobalBounds(); //Guarda la posicion del alien sf::FloatRect shape2 = this->getSprite()->getGlobalBounds(); //Guarda la posicion de la nave if (shape1.intersects(shape2)){ b->limpiarBalas(); return true; } else return false; } bool Nave::choqueSaltador(Saltador *s){ sf::FloatRect shape1 = s->getSprite()->getGlobalBounds(); //Guarda la posicion del Saltador sf::FloatRect shape2 = this->getSprite()->getGlobalBounds(); //Guarda la posicion de la nave if (shape1.intersects(shape2)){ return true; } else return false; } void Nave::setDireccion(int _dir){ direccion = _dir; //Flipeamos el sprite if(direccion==-1){ //Izquierda sprite->setRotation(-5.f); sprite->setRotation(-15.f); sombra->setRotation(-5.f); sombra->setRotation(-15.f); }else if(direccion==1){ //Derecha sprite->setRotation(5.f); sprite->setRotation(15.f); sombra->setRotation(5.f); sombra->setRotation(15.f); } else if(direccion==2){ //Arriba if(sprite->getPosition().y>=height/1.5){ sprite->move(0,-5); } } else if(direccion==-2){ //Abajo if(sprite->getPosition().y>=height/1.5){ sprite->move(0,5); } } else{ //Quieto sprite->setRotation(0.f); sombra->setRotation(0.f); } } void Nave::setMoviendose(bool _moviendose){moviendose = _moviendose;} void Nave::setNewX(float _x){newX = _x;} Nave::~Nave() { //dtor }
[ "marcoscheca1@hotmail.com" ]
marcoscheca1@hotmail.com
3489d0e5e847cb8eca87781dfaab5f9d0b0cba64
3b56423a34de9b4adae13d0fee4905609a9e2410
/src/test/util_tests.cpp
5cbdadde4c006fb7ece5070232b0833fe2c69594
[ "MIT" ]
permissive
mulecore/mule
5302db1cb6596475f9496495dba12b4d1cfd0d2c
9b2d9bf0ffc47963b5c0ce9b760cfff757961533
refs/heads/master
2023-03-27T02:25:49.455321
2021-03-26T10:31:13
2021-03-26T10:31:13
351,247,550
0
0
null
null
null
null
UTF-8
C++
false
false
32,623
cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers // Copyright (c) 2017-2020 The Mule Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" #include "clientversion.h" #include "primitives/transaction.h" #include "sync.h" #include "utilstrencodings.h" #include "utilmoneystr.h" #include "test/test_mule.h" #include <stdint.h> #include <vector> #include <boost/test/unit_test.hpp> BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(util_criticalsection_test) { BOOST_TEST_MESSAGE("Running Util CrriticalSection Test"); CCriticalSection cs; do { LOCK(cs); break; BOOST_ERROR("break was swallowed!"); } while (0); do { TRY_LOCK(cs, lockTest); if (lockTest) break; BOOST_ERROR("break was swallowed!"); } while (0); } static const unsigned char ParseHex_expected[65] = { 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f }; BOOST_AUTO_TEST_CASE(util_ParseHex_test) { BOOST_TEST_MESSAGE("Running Util ParseHex Test"); std::vector<unsigned char> result; std::vector<unsigned char> expected(ParseHex_expected, ParseHex_expected + sizeof(ParseHex_expected)); // Basic test vector result = ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"); BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end()); // Spaces between bytes must be supported result = ParseHex("12 34 56 78"); BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78); // Leading space must be supported (used in CDBEnv::Salvage) result = ParseHex(" 89 34 56 78"); BOOST_CHECK(result.size() == 4 && result[0] == 0x89 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78); // Stop parsing at invalid value result = ParseHex("1234 invalid 1234"); BOOST_CHECK(result.size() == 2 && result[0] == 0x12 && result[1] == 0x34); } BOOST_AUTO_TEST_CASE(util_HexStr) { BOOST_TEST_MESSAGE("Running Util ParseHex Test"); BOOST_CHECK_EQUAL( HexStr(ParseHex_expected, ParseHex_expected + sizeof(ParseHex_expected)), "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"); BOOST_CHECK_EQUAL( HexStr(ParseHex_expected, ParseHex_expected + 5, true), "04 67 8a fd b0"); BOOST_CHECK_EQUAL( HexStr(ParseHex_expected, ParseHex_expected, true), ""); std::vector<unsigned char> ParseHex_vec(ParseHex_expected, ParseHex_expected + 5); BOOST_CHECK_EQUAL( HexStr(ParseHex_vec, true), "04 67 8a fd b0"); } BOOST_AUTO_TEST_CASE(util_DateTimeStrFormat_test) { BOOST_TEST_MESSAGE("Running Util DateTimeStrFormat Test"); BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", 0), "1970-01-01 00:00:00"); BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", 0x7FFFFFFF), "2038-01-19 03:14:07"); BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", 1317425777), "2011-09-30 23:36:17"); BOOST_CHECK_EQUAL(DateTimeStrFormat("%Y-%m-%d %H:%M", 1317425777), "2011-09-30 23:36"); BOOST_CHECK_EQUAL(DateTimeStrFormat("%a, %d %b %Y %H:%M:%S +0000", 1317425777), "Fri, 30 Sep 2011 23:36:17 +0000"); } class TestArgsManager : public ArgsManager { public: std::map<std::string, std::string> &GetMapArgs() { return mapArgs; }; const std::map<std::string, std::vector<std::string> > &GetMapMultiArgs() { return mapMultiArgs; }; }; BOOST_AUTO_TEST_CASE(util_ParseParameters_test) { BOOST_TEST_MESSAGE("Running Util ParseParameters Test"); TestArgsManager testArgs; const char *argv_test[] = {"-ignored", "-a", "-b", "-ccc=argument", "-ccc=multiple", "f", "-d=e"}; testArgs.ParseParameters(0, (char **) argv_test); BOOST_CHECK(testArgs.GetMapArgs().empty() && testArgs.GetMapMultiArgs().empty()); testArgs.ParseParameters(1, (char **) argv_test); BOOST_CHECK(testArgs.GetMapArgs().empty() && testArgs.GetMapMultiArgs().empty()); testArgs.ParseParameters(5, (char **) argv_test); // expectation: -ignored is ignored (program name argument), // -a, -b and -ccc end up in map, -d ignored because it is after // a non-option argument (non-GNU option parsing) BOOST_CHECK(testArgs.GetMapArgs().size() == 3 && testArgs.GetMapMultiArgs().size() == 3); BOOST_CHECK(testArgs.IsArgSet("-a") && testArgs.IsArgSet("-b") && testArgs.IsArgSet("-ccc") && !testArgs.IsArgSet("f") && !testArgs.IsArgSet("-d")); BOOST_CHECK(testArgs.GetMapMultiArgs().count("-a") && testArgs.GetMapMultiArgs().count("-b") && testArgs.GetMapMultiArgs().count("-ccc") && !testArgs.GetMapMultiArgs().count("f") && !testArgs.GetMapMultiArgs().count("-d")); BOOST_CHECK(testArgs.GetMapArgs()["-a"] == "" && testArgs.GetMapArgs()["-ccc"] == "multiple"); BOOST_CHECK(testArgs.GetArgs("-ccc").size() == 2); } BOOST_AUTO_TEST_CASE(util_GetArg_test) { BOOST_TEST_MESSAGE("Running Util GetArg Test"); TestArgsManager testArgs; testArgs.GetMapArgs().clear(); testArgs.GetMapArgs()["strtest1"] = "string..."; // strtest2 undefined on purpose testArgs.GetMapArgs()["inttest1"] = "12345"; testArgs.GetMapArgs()["inttest2"] = "81985529216486895"; // inttest3 undefined on purpose testArgs.GetMapArgs()["booltest1"] = ""; // booltest2 undefined on purpose testArgs.GetMapArgs()["booltest3"] = "0"; testArgs.GetMapArgs()["booltest4"] = "1"; BOOST_CHECK_EQUAL(testArgs.GetArg("strtest1", "default"), "string..."); BOOST_CHECK_EQUAL(testArgs.GetArg("strtest2", "default"), "default"); BOOST_CHECK_EQUAL(testArgs.GetArg("inttest1", -1), 12345); BOOST_CHECK_EQUAL(testArgs.GetArg("inttest2", -1), 81985529216486895LL); BOOST_CHECK_EQUAL(testArgs.GetArg("inttest3", -1), -1); BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest1", false), true); BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest2", false), false); BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest3", false), false); BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest4", false), true); } BOOST_AUTO_TEST_CASE(util_FormatMoney_test) { BOOST_TEST_MESSAGE("Running Util FormatMoney Test"); BOOST_CHECK_EQUAL(FormatMoney(0), "0.00"); BOOST_CHECK_EQUAL(FormatMoney((COIN / 10000) * 123456789), "12345.6789"); BOOST_CHECK_EQUAL(FormatMoney(-COIN), "-1.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 100000000), "100000000.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 10000000), "10000000.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 1000000), "1000000.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 100000), "100000.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 10000), "10000.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 1000), "1000.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 100), "100.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN * 10), "10.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN), "1.00"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 10), "0.10"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 100), "0.01"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 1000), "0.001"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 10000), "0.0001"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 100000), "0.00001"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 1000000), "0.000001"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 10000000), "0.0000001"); BOOST_CHECK_EQUAL(FormatMoney(COIN / 100000000), "0.00000001"); } BOOST_AUTO_TEST_CASE(util_ParseMoney_test) { BOOST_TEST_MESSAGE("Running Util ParseMoney Test"); CAmount ret = 0; BOOST_CHECK(ParseMoney("0.0", ret)); BOOST_CHECK_EQUAL(ret, 0); BOOST_CHECK(ParseMoney("12345.6789", ret)); BOOST_CHECK_EQUAL(ret, (COIN / 10000) * 123456789); BOOST_CHECK(ParseMoney("100000000.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 100000000); BOOST_CHECK(ParseMoney("10000000.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 10000000); BOOST_CHECK(ParseMoney("1000000.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 1000000); BOOST_CHECK(ParseMoney("100000.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 100000); BOOST_CHECK(ParseMoney("10000.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 10000); BOOST_CHECK(ParseMoney("1000.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 1000); BOOST_CHECK(ParseMoney("100.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 100); BOOST_CHECK(ParseMoney("10.00", ret)); BOOST_CHECK_EQUAL(ret, COIN * 10); BOOST_CHECK(ParseMoney("1.00", ret)); BOOST_CHECK_EQUAL(ret, COIN); BOOST_CHECK(ParseMoney("1", ret)); BOOST_CHECK_EQUAL(ret, COIN); BOOST_CHECK(ParseMoney("0.1", ret)); BOOST_CHECK_EQUAL(ret, COIN / 10); BOOST_CHECK(ParseMoney("0.01", ret)); BOOST_CHECK_EQUAL(ret, COIN / 100); BOOST_CHECK(ParseMoney("0.001", ret)); BOOST_CHECK_EQUAL(ret, COIN / 1000); BOOST_CHECK(ParseMoney("0.0001", ret)); BOOST_CHECK_EQUAL(ret, COIN / 10000); BOOST_CHECK(ParseMoney("0.00001", ret)); BOOST_CHECK_EQUAL(ret, COIN / 100000); BOOST_CHECK(ParseMoney("0.000001", ret)); BOOST_CHECK_EQUAL(ret, COIN / 1000000); BOOST_CHECK(ParseMoney("0.0000001", ret)); BOOST_CHECK_EQUAL(ret, COIN / 10000000); BOOST_CHECK(ParseMoney("0.00000001", ret)); BOOST_CHECK_EQUAL(ret, COIN / 100000000); // Attempted 63 bit overflow should fail BOOST_CHECK(!ParseMoney("92233720368.54775808", ret)); // Parsing negative amounts must fail BOOST_CHECK(!ParseMoney("-1", ret)); } BOOST_AUTO_TEST_CASE(util_IsHex_test) { BOOST_TEST_MESSAGE("Running Util_IsHex Test"); BOOST_CHECK(IsHex("00")); BOOST_CHECK(IsHex("00112233445566778899aabbccddeeffAABBCCDDEEFF")); BOOST_CHECK(IsHex("ff")); BOOST_CHECK(IsHex("FF")); BOOST_CHECK(!IsHex("")); BOOST_CHECK(!IsHex("0")); BOOST_CHECK(!IsHex("a")); BOOST_CHECK(!IsHex("eleven")); BOOST_CHECK(!IsHex("00xx00")); BOOST_CHECK(!IsHex("0x0000")); } BOOST_AUTO_TEST_CASE(util_IsHexNumber_test) { BOOST_TEST_MESSAGE("Running IsHexNumber Test"); BOOST_CHECK(IsHexNumber("0x0")); BOOST_CHECK(IsHexNumber("0")); BOOST_CHECK(IsHexNumber("0x10")); BOOST_CHECK(IsHexNumber("10")); BOOST_CHECK(IsHexNumber("0xff")); BOOST_CHECK(IsHexNumber("ff")); BOOST_CHECK(IsHexNumber("0xFfa")); BOOST_CHECK(IsHexNumber("Ffa")); BOOST_CHECK(IsHexNumber("0x00112233445566778899aabbccddeeffAABBCCDDEEFF")); BOOST_CHECK(IsHexNumber("00112233445566778899aabbccddeeffAABBCCDDEEFF")); BOOST_CHECK(!IsHexNumber("")); // empty string not allowed BOOST_CHECK(!IsHexNumber("0x")); // empty string after prefix not allowed BOOST_CHECK(!IsHexNumber("0x0 ")); // no spaces at end, BOOST_CHECK(!IsHexNumber(" 0x0")); // or beginning, BOOST_CHECK(!IsHexNumber("0x 0")); // or middle, BOOST_CHECK(!IsHexNumber(" ")); // etc. BOOST_CHECK(!IsHexNumber("0x0ga")); // invalid character BOOST_CHECK(!IsHexNumber("x0")); // broken prefix BOOST_CHECK(!IsHexNumber("0x0x00")); // two prefixes not allowed } BOOST_AUTO_TEST_CASE(util_seed_insecure_rand_test) { BOOST_TEST_MESSAGE("Running Util Seed Insecure Rand Test"); SeedInsecureRand(true); for (int mod = 2; mod < 11; mod++) { int mask = 1; // Really rough binomial confidence approximation. int err = 30 * 10000. / mod * sqrt((1. / mod * (1 - 1. / mod)) / 10000.); //mask is 2^ceil(log2(mod))-1 while (mask < mod - 1)mask = (mask << 1) + 1; int count = 0; //How often does it get a zero from the uniform range [0,mod)? for (int i = 0; i < 10000; i++) { uint32_t rval; do { rval = InsecureRand32() & mask; } while (rval >= (uint32_t) mod); count += rval == 0; } BOOST_CHECK(count <= 10000 / mod + err); BOOST_CHECK(count >= 10000 / mod - err); } } BOOST_AUTO_TEST_CASE(util_TimingResistantEqual_test) { BOOST_TEST_MESSAGE("Running TimingResistantEqual Test"); BOOST_CHECK(TimingResistantEqual(std::string(""), std::string(""))); BOOST_CHECK(!TimingResistantEqual(std::string("abc"), std::string(""))); BOOST_CHECK(!TimingResistantEqual(std::string(""), std::string("abc"))); BOOST_CHECK(!TimingResistantEqual(std::string("a"), std::string("aa"))); BOOST_CHECK(!TimingResistantEqual(std::string("aa"), std::string("a"))); BOOST_CHECK(TimingResistantEqual(std::string("abc"), std::string("abc"))); BOOST_CHECK(!TimingResistantEqual(std::string("abc"), std::string("aba"))); } /* Test strprintf formatting directives. * Put a string before and after to ensure sanity of element sizes on stack. */ #define B "check_prefix" #define E "check_postfix" BOOST_AUTO_TEST_CASE(strprintf_numbers_test) { BOOST_TEST_MESSAGE("Running StrPrintf Numbers Test"); int64_t s64t = -9223372036854775807LL; /* signed 64 bit test value */ uint64_t u64t = 18446744073709551615ULL; /* unsigned 64 bit test value */ BOOST_CHECK(strprintf("%s %d %s", B, s64t, E) == B" -9223372036854775807 " E); BOOST_CHECK(strprintf("%s %u %s", B, u64t, E) == B" 18446744073709551615 " E); BOOST_CHECK(strprintf("%s %x %s", B, u64t, E) == B" ffffffffffffffff " E); size_t st = 12345678; /* unsigned size_t test value */ ssize_t sst = -12345678; /* signed size_t test value */ BOOST_CHECK(strprintf("%s %d %s", B, sst, E) == B" -12345678 " E); BOOST_CHECK(strprintf("%s %u %s", B, st, E) == B" 12345678 " E); BOOST_CHECK(strprintf("%s %x %s", B, st, E) == B" bc614e " E); ptrdiff_t pt = 87654321; /* positive ptrdiff_t test value */ ptrdiff_t spt = -87654321; /* negative ptrdiff_t test value */ BOOST_CHECK(strprintf("%s %d %s", B, spt, E) == B" -87654321 " E); BOOST_CHECK(strprintf("%s %u %s", B, pt, E) == B" 87654321 " E); BOOST_CHECK(strprintf("%s %x %s", B, pt, E) == B" 5397fb1 " E); } #undef B #undef E /* Check for mingw/wine issue #3494 * Remove this test before time.ctime(0xffffffff) == 'Sun Feb 7 07:28:15 2106' */ BOOST_AUTO_TEST_CASE(gettime_test) { BOOST_TEST_MESSAGE("Running GetTime Test"); BOOST_CHECK((GetTime() & ~0xFFFFFFFFLL) == 0); } BOOST_AUTO_TEST_CASE(ParseInt32_test) { BOOST_TEST_MESSAGE("Running ParseInt32 Test"); int32_t n; // Valid values BOOST_CHECK(ParseInt32("1234", nullptr)); BOOST_CHECK(ParseInt32("0", &n) && n == 0); BOOST_CHECK(ParseInt32("1234", &n) && n == 1234); BOOST_CHECK(ParseInt32("01234", &n) && n == 1234); // no octal BOOST_CHECK(ParseInt32("2147483647", &n) && n == 2147483647); BOOST_CHECK(ParseInt32("-2147483648", &n) && n == (-2147483647 - 1)); // (-2147483647 - 1) equals INT_MIN BOOST_CHECK(ParseInt32("-1234", &n) && n == -1234); // Invalid values BOOST_CHECK(!ParseInt32("", &n)); BOOST_CHECK(!ParseInt32(" 1", &n)); // no padding inside BOOST_CHECK(!ParseInt32("1 ", &n)); BOOST_CHECK(!ParseInt32("1a", &n)); BOOST_CHECK(!ParseInt32("aap", &n)); BOOST_CHECK(!ParseInt32("0x1", &n)); // no hex BOOST_CHECK(!ParseInt32("0x1", &n)); // no hex const char test_bytes[] = {'1', 0, '1'}; std::string teststr(test_bytes, sizeof(test_bytes)); BOOST_CHECK(!ParseInt32(teststr, &n)); // no embedded NULs // Overflow and underflow BOOST_CHECK(!ParseInt32("-2147483649", nullptr)); BOOST_CHECK(!ParseInt32("2147483648", nullptr)); BOOST_CHECK(!ParseInt32("-32482348723847471234", nullptr)); BOOST_CHECK(!ParseInt32("32482348723847471234", nullptr)); } BOOST_AUTO_TEST_CASE(ParseInt64_test) { BOOST_TEST_MESSAGE("Running ParseInt64 Test"); int64_t n; // Valid values BOOST_CHECK(ParseInt64("1234", nullptr)); BOOST_CHECK(ParseInt64("0", &n) && n == 0LL); BOOST_CHECK(ParseInt64("1234", &n) && n == 1234LL); BOOST_CHECK(ParseInt64("01234", &n) && n == 1234LL); // no octal BOOST_CHECK(ParseInt64("2147483647", &n) && n == 2147483647LL); BOOST_CHECK(ParseInt64("-2147483648", &n) && n == -2147483648LL); BOOST_CHECK(ParseInt64("9223372036854775807", &n) && n == (int64_t) 9223372036854775807); BOOST_CHECK(ParseInt64("-9223372036854775808", &n) && n == (int64_t) -9223372036854775807 - 1); BOOST_CHECK(ParseInt64("-1234", &n) && n == -1234LL); // Invalid values BOOST_CHECK(!ParseInt64("", &n)); BOOST_CHECK(!ParseInt64(" 1", &n)); // no padding inside BOOST_CHECK(!ParseInt64("1 ", &n)); BOOST_CHECK(!ParseInt64("1a", &n)); BOOST_CHECK(!ParseInt64("aap", &n)); BOOST_CHECK(!ParseInt64("0x1", &n)); // no hex const char test_bytes[] = {'1', 0, '1'}; std::string teststr(test_bytes, sizeof(test_bytes)); BOOST_CHECK(!ParseInt64(teststr, &n)); // no embedded NULs // Overflow and underflow BOOST_CHECK(!ParseInt64("-9223372036854775809", nullptr)); BOOST_CHECK(!ParseInt64("9223372036854775808", nullptr)); BOOST_CHECK(!ParseInt64("-32482348723847471234", nullptr)); BOOST_CHECK(!ParseInt64("32482348723847471234", nullptr)); } BOOST_AUTO_TEST_CASE(ParseUInt32_test) { BOOST_TEST_MESSAGE("Running ParseUInt32 Test"); uint32_t n; // Valid values BOOST_CHECK(ParseUInt32("1234", nullptr)); BOOST_CHECK(ParseUInt32("0", &n) && n == 0); BOOST_CHECK(ParseUInt32("1234", &n) && n == 1234); BOOST_CHECK(ParseUInt32("01234", &n) && n == 1234); // no octal BOOST_CHECK(ParseUInt32("2147483647", &n) && n == 2147483647); BOOST_CHECK(ParseUInt32("2147483648", &n) && n == (uint32_t) 2147483648); BOOST_CHECK(ParseUInt32("4294967295", &n) && n == (uint32_t) 4294967295); // Invalid values BOOST_CHECK(!ParseUInt32("", &n)); BOOST_CHECK(!ParseUInt32(" 1", &n)); // no padding inside BOOST_CHECK(!ParseUInt32(" -1", &n)); BOOST_CHECK(!ParseUInt32("1 ", &n)); BOOST_CHECK(!ParseUInt32("1a", &n)); BOOST_CHECK(!ParseUInt32("aap", &n)); BOOST_CHECK(!ParseUInt32("0x1", &n)); // no hex BOOST_CHECK(!ParseUInt32("0x1", &n)); // no hex const char test_bytes[] = {'1', 0, '1'}; std::string teststr(test_bytes, sizeof(test_bytes)); BOOST_CHECK(!ParseUInt32(teststr, &n)); // no embedded NULs // Overflow and underflow BOOST_CHECK(!ParseUInt32("-2147483648", &n)); BOOST_CHECK(!ParseUInt32("4294967296", &n)); BOOST_CHECK(!ParseUInt32("-1234", &n)); BOOST_CHECK(!ParseUInt32("-32482348723847471234", nullptr)); BOOST_CHECK(!ParseUInt32("32482348723847471234", nullptr)); } BOOST_AUTO_TEST_CASE(ParseUInt64_test) { BOOST_TEST_MESSAGE("Running ParseUInt64 Test"); uint64_t n; // Valid values BOOST_CHECK(ParseUInt64("1234", nullptr)); BOOST_CHECK(ParseUInt64("0", &n) && n == 0LL); BOOST_CHECK(ParseUInt64("1234", &n) && n == 1234LL); BOOST_CHECK(ParseUInt64("01234", &n) && n == 1234LL); // no octal BOOST_CHECK(ParseUInt64("2147483647", &n) && n == 2147483647LL); BOOST_CHECK(ParseUInt64("9223372036854775807", &n) && n == 9223372036854775807ULL); BOOST_CHECK(ParseUInt64("9223372036854775808", &n) && n == 9223372036854775808ULL); BOOST_CHECK(ParseUInt64("18446744073709551615", &n) && n == 18446744073709551615ULL); // Invalid values BOOST_CHECK(!ParseUInt64("", &n)); BOOST_CHECK(!ParseUInt64(" 1", &n)); // no padding inside BOOST_CHECK(!ParseUInt64(" -1", &n)); BOOST_CHECK(!ParseUInt64("1 ", &n)); BOOST_CHECK(!ParseUInt64("1a", &n)); BOOST_CHECK(!ParseUInt64("aap", &n)); BOOST_CHECK(!ParseUInt64("0x1", &n)); // no hex const char test_bytes[] = {'1', 0, '1'}; std::string teststr(test_bytes, sizeof(test_bytes)); BOOST_CHECK(!ParseUInt64(teststr, &n)); // no embedded NULs // Overflow and underflow BOOST_CHECK(!ParseUInt64("-9223372036854775809", nullptr)); BOOST_CHECK(!ParseUInt64("18446744073709551616", nullptr)); BOOST_CHECK(!ParseUInt64("-32482348723847471234", nullptr)); BOOST_CHECK(!ParseUInt64("-2147483648", &n)); BOOST_CHECK(!ParseUInt64("-9223372036854775808", &n)); BOOST_CHECK(!ParseUInt64("-1234", &n)); // HEX Tests (base 16) BOOST_CHECK(ParseUInt64("0x7FFFFFFFFFFFFFFF", &n, 16) && n == 9223372036854775807ULL); BOOST_CHECK(ParseUInt64("0x8000000000000000", &n, 16) && n == 9223372036854775808ULL); BOOST_CHECK(ParseUInt64("0xFFFFFFFFFFFFFFFF", &n, 16) && n == 18446744073709551615ULL); BOOST_CHECK(ParseUInt64("0x04D2", nullptr, 16)); BOOST_CHECK(ParseUInt64("0x0", &n, 16) && n == 0LL); BOOST_CHECK(ParseUInt64("0x04D2", &n, 16) && n == 1234LL); BOOST_CHECK(ParseUInt64("0x7FFFFFFF", &n, 16) && n == 2147483647LL); BOOST_CHECK(!ParseUInt64("9223372036854775807", &n, 16)); //no base 10 when base 16, } BOOST_AUTO_TEST_CASE(ParseDouble_test) { BOOST_TEST_MESSAGE("Running ParseDouble Test"); double n; // Valid values BOOST_CHECK(ParseDouble("1234", nullptr)); BOOST_CHECK(ParseDouble("0", &n) && n == 0.0); BOOST_CHECK(ParseDouble("1234", &n) && n == 1234.0); BOOST_CHECK(ParseDouble("01234", &n) && n == 1234.0); // no octal BOOST_CHECK(ParseDouble("2147483647", &n) && n == 2147483647.0); BOOST_CHECK(ParseDouble("-2147483648", &n) && n == -2147483648.0); BOOST_CHECK(ParseDouble("-1234", &n) && n == -1234.0); BOOST_CHECK(ParseDouble("1e6", &n) && n == 1e6); BOOST_CHECK(ParseDouble("-1e6", &n) && n == -1e6); // Invalid values BOOST_CHECK(!ParseDouble("", &n)); BOOST_CHECK(!ParseDouble(" 1", &n)); // no padding inside BOOST_CHECK(!ParseDouble("1 ", &n)); BOOST_CHECK(!ParseDouble("1a", &n)); BOOST_CHECK(!ParseDouble("aap", &n)); BOOST_CHECK(!ParseDouble("0x1", &n)); // no hex const char test_bytes[] = {'1', 0, '1'}; std::string teststr(test_bytes, sizeof(test_bytes)); BOOST_CHECK(!ParseDouble(teststr, &n)); // no embedded NULs // Overflow and underflow BOOST_CHECK(!ParseDouble("-1e10000", nullptr)); BOOST_CHECK(!ParseDouble("1e10000", nullptr)); } BOOST_AUTO_TEST_CASE(FormatParagraph_test) { BOOST_TEST_MESSAGE("Running FormatParagraph Test"); BOOST_CHECK_EQUAL(FormatParagraph("", 79, 0), ""); BOOST_CHECK_EQUAL(FormatParagraph("test", 79, 0), "test"); BOOST_CHECK_EQUAL(FormatParagraph(" test", 79, 0), " test"); BOOST_CHECK_EQUAL(FormatParagraph("test test", 79, 0), "test test"); BOOST_CHECK_EQUAL(FormatParagraph("test test", 4, 0), "test\ntest"); BOOST_CHECK_EQUAL(FormatParagraph("testerde test", 4, 0), "testerde\ntest"); BOOST_CHECK_EQUAL(FormatParagraph("test test", 4, 4), "test\n test"); // Make sure we don't indent a fully-new line following a too-long line ending BOOST_CHECK_EQUAL(FormatParagraph("test test\nabc", 4, 4), "test\n test\nabc"); BOOST_CHECK_EQUAL(FormatParagraph("This_is_a_very_long_test_string_without_any_spaces_so_it_should_just_get_returned_as_is_despite_the_length until it gets here", 79), "This_is_a_very_long_test_string_without_any_spaces_so_it_should_just_get_returned_as_is_despite_the_length\nuntil it gets here"); // Test wrap length is exact BOOST_CHECK_EQUAL(FormatParagraph("a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de f g h i j k l m n o p", 79), "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de\nf g h i j k l m n o p"); BOOST_CHECK_EQUAL(FormatParagraph("x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de f g h i j k l m n o p", 79), "x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de\nf g h i j k l m n o p"); // Indent should be included in length of lines BOOST_CHECK_EQUAL(FormatParagraph("x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 a b c d e fg h i j k", 79, 4), "x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de\n f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 a b c d e fg\n h i j k"); BOOST_CHECK_EQUAL(FormatParagraph("This is a very long test string. This is a second sentence in the very long test string.", 79), "This is a very long test string. This is a second sentence in the very long\ntest string."); BOOST_CHECK_EQUAL(FormatParagraph("This is a very long test string.\nThis is a second sentence in the very long test string. This is a third sentence in the very long test string.", 79), "This is a very long test string.\nThis is a second sentence in the very long test string. This is a third\nsentence in the very long test string."); BOOST_CHECK_EQUAL(FormatParagraph("This is a very long test string.\n\nThis is a second sentence in the very long test string. This is a third sentence in the very long test string.", 79), "This is a very long test string.\n\nThis is a second sentence in the very long test string. This is a third\nsentence in the very long test string."); BOOST_CHECK_EQUAL(FormatParagraph("Testing that normal newlines do not get indented.\nLike here.", 79), "Testing that normal newlines do not get indented.\nLike here."); } BOOST_AUTO_TEST_CASE(FormatSubVersion_Test) { BOOST_TEST_MESSAGE("Running FormatSubVersion Test"); std::vector<std::string> comments; comments.push_back(std::string("comment1")); std::vector<std::string> comments2; comments2.push_back(std::string("comment1")); comments2.push_back(SanitizeString(std::string("Comment2; .,_?@-; !\"#$%&'()*+/<=>[]\\^`{|}~"), SAFE_CHARS_UA_COMMENT)); // Semicolon is discouraged but not forbidden by BIP-0014 BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()), std::string("/Test:0.9.99/")); BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments), std::string("/Test:0.9.99(comment1)/")); BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2), std::string("/Test:0.9.99(comment1; Comment2; .,_?@-; )/")); } BOOST_AUTO_TEST_CASE(ParseFixedPoint_test) { BOOST_TEST_MESSAGE("Running ParseFixedPoint Test"); int64_t amount = 0; BOOST_CHECK(ParseFixedPoint("0", 8, &amount)); BOOST_CHECK_EQUAL(amount, 0LL); BOOST_CHECK(ParseFixedPoint("1", 8, &amount)); BOOST_CHECK_EQUAL(amount, 100000000LL); BOOST_CHECK(ParseFixedPoint("0.0", 8, &amount)); BOOST_CHECK_EQUAL(amount, 0LL); BOOST_CHECK(ParseFixedPoint("-0.1", 8, &amount)); BOOST_CHECK_EQUAL(amount, -10000000LL); BOOST_CHECK(ParseFixedPoint("1.1", 8, &amount)); BOOST_CHECK_EQUAL(amount, 110000000LL); BOOST_CHECK(ParseFixedPoint("1.10000000000000000", 8, &amount)); BOOST_CHECK_EQUAL(amount, 110000000LL); BOOST_CHECK(ParseFixedPoint("1.1e1", 8, &amount)); BOOST_CHECK_EQUAL(amount, 1100000000LL); BOOST_CHECK(ParseFixedPoint("1.1e-1", 8, &amount)); BOOST_CHECK_EQUAL(amount, 11000000LL); BOOST_CHECK(ParseFixedPoint("1000", 8, &amount)); BOOST_CHECK_EQUAL(amount, 100000000000LL); BOOST_CHECK(ParseFixedPoint("-1000", 8, &amount)); BOOST_CHECK_EQUAL(amount, -100000000000LL); BOOST_CHECK(ParseFixedPoint("0.00000001", 8, &amount)); BOOST_CHECK_EQUAL(amount, 1LL); BOOST_CHECK(ParseFixedPoint("0.0000000100000000", 8, &amount)); BOOST_CHECK_EQUAL(amount, 1LL); BOOST_CHECK(ParseFixedPoint("-0.00000001", 8, &amount)); BOOST_CHECK_EQUAL(amount, -1LL); BOOST_CHECK(ParseFixedPoint("1000000000.00000001", 8, &amount)); BOOST_CHECK_EQUAL(amount, 100000000000000001LL); BOOST_CHECK(ParseFixedPoint("9999999999.99999999", 8, &amount)); BOOST_CHECK_EQUAL(amount, 999999999999999999LL); BOOST_CHECK(ParseFixedPoint("-9999999999.99999999", 8, &amount)); BOOST_CHECK_EQUAL(amount, -999999999999999999LL); BOOST_CHECK(!ParseFixedPoint("", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("a-1000", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-a1000", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-1000a", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-01000", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("00.1", 8, &amount)); BOOST_CHECK(!ParseFixedPoint(".1", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("--0.1", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("0.000000001", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-0.000000001", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("0.00000001000000001", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-10000000000.00000000", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("10000000000.00000000", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-10000000000.00000001", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("10000000000.00000001", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-10000000000.00000009", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("10000000000.00000009", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-99999999999.99999999", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("99999909999.09999999", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("92233720368.54775807", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("92233720368.54775808", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-92233720368.54775808", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("-92233720368.54775809", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("1.1e", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("1.1e-", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("1.", 8, &amount)); BOOST_CHECK(ParseFixedPoint("21000000000", 8, &amount)); BOOST_CHECK(ParseFixedPoint("42000000000", 8, &amount)); BOOST_CHECK(!ParseFixedPoint("42000000001", 8, &amount)); } BOOST_AUTO_TEST_SUITE_END()
[ "mule@muleda.com" ]
mule@muleda.com
538169c1cefdc08fa1dfdb85de7c0de3a09e007e
0eaadb5502818a456466926e74cc8c648c2c8f80
/UltimateKnightsTour/UltimateKnightsTour/Knight.h
19d28ec0b47b92ffe2894dce1a3511cc6cd80558
[]
no_license
jesseklijn/ChessTheFinalTour
65af0598deb7f07f4429c5fbd40439b79efd6891
f3768db168e25ada8fb1926e74331e271344c1a3
refs/heads/master
2021-01-24T12:00:05.657031
2018-03-08T01:21:31
2018-03-08T01:21:31
123,112,568
0
0
null
null
null
null
UTF-8
C++
false
false
305
h
#pragma once #include "Tile.h" #include <iostream> #include "Board.h" using namespace std; class Knight { public: Knight(); ~Knight(); bool Move(Board board, Tile currentTile); Tile Check(vector<Tile> connectedTiles, vector<vector<Tile>> tileMap); bool checkIfWon(vector<vector<Tile>> tileMap); };
[ "jesseklijn@hotmail.com" ]
jesseklijn@hotmail.com
92a8057fe70c231bc964427202f2fcf61a667701
dc38c8a3b0e9b13afb83fbe78269638c60bd32cd
/507. Perfect Number/main.cpp
d21f013a18c74ca135d8d45b48f8bb780818dbdd
[]
no_license
TG-yang/LeetCode
603da8e8121ad2ed7d05bac0d4ee6d61378eeff3
1749b35170636830b3f91777ac57d049278b2b2e
refs/heads/master
2020-04-09T09:20:13.129761
2019-08-16T17:10:42
2019-08-16T17:10:42
160,229,673
0
1
null
null
null
null
UTF-8
C++
false
false
715
cpp
#include <iostream> #include <set> #include <cmath> using namespace std; class Solution { public: bool checkPerfectNumber(int num) { if(num == 1 || num <= 0) return false; set<int>divisors; for(int i = sqrt(num); i <= num; ++i){ if(i == num) divisors.insert(1); else{ if(num % i == 0){ divisors.insert(i); divisors.insert(num / i); } } } int sum = 0; for(auto val : divisors){ sum += val; } return sum == num; } }; int main() { std::cout << "Hello, World!" << std::endl; return 0; }
[ "zwenyang@outlook.com" ]
zwenyang@outlook.com
64c308315f23f23f8e15fc7530e5ffb21237d2c2
1f9e902a23803df57502d5543611990f85fbfab5
/final_work/student.cpp
d17b6c6119ca26f518a99a48e62369cc107373f6
[]
no_license
logan8866/cpp_experiment_wyq
e6ac983fe4a0c5e0634055d5033ca5aff08f148b
3643a8c343258c90df739492432fc6af577263d0
refs/heads/master
2023-04-11T10:00:06.409175
2021-04-24T14:10:05
2021-04-24T14:10:05
352,973,527
1
0
null
null
null
null
UTF-8
C++
false
false
6,117
cpp
#ifndef ST #define ST #include"student.h" #endif #include<iostream> #include<fstream> using namespace std; template<class T> Student<T>::Student(){ this->next = NULL; this->element = 0; this->name = "anonym"; } template<class T> Student<T>::Student(string name, T &element):ChainNode<T>(element){ this->next = NULL; this->name = name; } template<class T> Student<T>::Student(string name, T &element, ChainNode<T> *next):ChainNode<T>(element,next){ this->name = name; } template<class T> Student<T>::Student(Student<T> &st):ChainNode<T>(0){ this->next = st.next; this->name = st.name; this->element = st.element; } template<class T> StudentManagement<T>::StudentManagement():Chain5<T>(0){ cout<<"hello"<<endl; this->length = 0; T element; string name; cin>>element; cin>>name; this->head = new Student<T>(name,element); this->end = this->head; this->length++; while(true){ cin>>element; cin>>name; if (element==-1){ break; } this->end->next = new Student<T>(name,element); this->end = this->end->next; this->length++; } cout<<"end"<<endl; } template<class T> StudentManagement<T>::StudentManagement(StudentManagement<T>& sm):Chain5<T>(0){ this->length = sm.length; Student<T>* c1; Student<T>* c2; c1 = new Student<T>(*(Student<T>*)sm.head); this->head = c1; int i; for (i=0;i<this->length-1;i++){ c2 = new Student<T>(*(Student<T>*)(c1->next)); c1->next = c2; c1 = (Student<T>*)c1->next; } this->end = c2; } template<class T> StudentManagement<T>::StudentManagement(int i):Chain5<T>(i){ this->head = NULL; this->end = NULL; this->length = 0; } template<class T> StudentManagement<T>& StudentManagement<T>::search(){ cout<<"start search"<<endl; string::size_type idx; string search_str; cin>>search_str; Student<T> *now = (Student<T>*)this->head; cout<<"head:"<<this->head->element<<endl; StudentManagement<T> *c; c = new StudentManagement(0); while(now!=NULL){ idx = now->name.find(search_str); if (idx == string::npos){ now = (Student<T>*)now->next; } else{ Student<T> *cn; cn = new Student<T>(*now); c->end_insert(cn); now = (Student<T>*)now->next; } } c->end->next = NULL; //cout<<"end search"<<((Student<T>*)(c->end))->name<<endl; return *c; } template<class T> void StudentManagement<T>::show_all(){ Student<T>* cn1; cn1 = (Student<T>*)this->head; int i = 0; for (;cn1!=NULL;cn1=(Student<T>*)cn1->next){ std::cout<<"the "<<i<<"nd "<<"T: "<<cn1->element<<" name is:"<<cn1->name<<std::endl; i++; } } template<class T> void StudentManagement<T>::statitic(int n){ T max = this->head->element; T min = this->head->element; Student<T> *now = (Student<T>*)this->head; int i = 0; for (i=0;i<this->length;i++){ if (max<now->element){ max = now->element; } if (min>now->element){ min = now->element; } now = (Student<T>*)now->next; } double abstand = (max-min)/n; int j = 0; now = (Student<T>*)this->head; int up,down; for (j=0;j<n;j++){ if(j==n-1){ up = max+1; down = min+j*abstand; } else{ up = min+(j+1)*abstand; down = min+j*abstand; } std::cout<<"result between "<<down<<" and "<<up<<":"<<std::endl; now = (Student<T>*)this->head; for (i=0;i<this->length;i++){ if (now->element>=down&&now->element<up){ std::cout<<"the "<<i<<"nd "<<"T: "<<now->element<<" name is:"<<now->name<<std::endl; } now = (Student<T>*)now->next; } } } template<class T> void StudentManagement<T>::Sort(){ T max; int i,j; Student<T> *now = (Student<T>*)this->head; Student<T> *bevor; Student<T> *temp; for (i=0;i<this->length-1;i++){ now = (Student<T>*)this->head; //this->show_all(); for(j=0;j<this->length-i-1;j++){ if (j==0){ if(now->element>now->next->element){ //std::cout<<"0"<<std::endl; this->head = (Student<T>*)now->next; now->next = (Student<T>*)now->next->next; this->head->next = (Student<T>*)now; bevor = (Student<T>*)this->head; //this->show_all(); } else{ //std::cout<<"0"<<std::endl; now = (Student<T>*)now->next; bevor = (Student<T>*)this->head; } } if(j==this->length-2){ if (now->element>now->next->element){ //std::cout<<"e"<<std::endl; bevor->next = (Student<T>*)now->next; this->end = (Student<T>*)now; now->next = NULL; bevor->next->next = (Student<T>*)this->end; break; } else{ //std::cout<<"e"<<std::endl; break; } } if(j!=0&&j!=this->length-2){ if (now->element>now->next->element){ //std::cout<<"1"<<std::endl; bevor->next = (Student<T>*)now->next; bevor = (Student<T>*)now->next; now->next = (Student<T>*)bevor->next; bevor->next = (Student<T>*)now; } else{ //std::cout<<"1"<<std::endl; bevor = (Student<T>*)now; now = (Student<T>*)now->next; } } } } } template<class T> void StudentManagement<T>::save(){ int i; fstream f; f.open("./student.dat",ios::out | ios::trunc); if (!f){ ofstream fout("./student.dat"); if (fout){ fout.close(); f.open("./student.dat",ios::out | ios::trunc); } } Student<T> *now = (Student<T>*)this->head; f<<this->length<<std::endl; for (i=0;i<this->length;i++){ f<<now->element<<" "<<now->name<<std::endl; now = (Student<T>*)now->next; } } template<class T> void StudentManagement<T>::load(){ fstream f; f.open("./student.dat",ios::in); f>>this->length; int i; Student<T>* st; string name; T element; f>>element; f>>name; st = new Student<T>(name,element); this->head = st; this->end = st; for (i=1;i<this->length;i++){ f>>element; f>>name; st = new Student<T>(name,element); this->end->next = st; this->end = st; } } template<class T> StudentManagement<T>::~StudentManagement(){ this->save(); }
[ "1977820696@qq.com" ]
1977820696@qq.com
ca025492f7ca23525ba596a3e23ea3e6eb9c30a3
bcedfa7a5d643b438c5b8486440291c3c1dc7243
/quick.cpp
dc114b2735035169ccd03b7c937ef714413cab4c
[]
no_license
liqingqiya/C
7a4fe5b5c5f3d75803545eaa2d539da41dd0e530
211f7a322683a883f611bd1c91bba5cbd599a175
refs/heads/master
2016-08-03T23:23:57.141327
2015-02-21T14:31:01
2015-02-21T14:31:01
24,839,123
0
1
null
null
null
null
UTF-8
C++
false
false
882
cpp
#include<iostream> //归并排序 void quick(int* p , int p, int r){ } //归并 void merge(int* s, int p, int q, int r){ /* 0, 2, 4 3+1 2+1 5 */ int n_1 = q-p+2; int n_2 = r-q+1; int n_3 = r-p+1; int* a=new int[n_1]; int* b=new int[n_2]; for(int i=0;i<n_1;i++){ if(i==n_1-1){ a[i] = 9999; }else{ a[i] = s[i+p]; } } for(int i=0;i<n_2;i++){ if(i==n_2-1){ b[i] = 9999; }else{ b[i] = s[i+q+1]; } } int m=0; int n=0; for(int i=p;i<=r;i++){ if(a[m]>b[n]){ s[i]=b[n++]; }else{ s[i]=a[m++]; } } } void sort(int s[], int p, int q, int r){ // } int main(){ int size_n = 10; int a[size_n] = {12,3,1,3,12,134,45,74,1122,52}; return 0; }
[ "liqing.qiya@gmail.com" ]
liqing.qiya@gmail.com
224221ee7801cb61de6bb1b4ea137204d8759f84
154af226e35a9ba52db9560eca50b07f5ed661fd
/fatemeh/Assignment02fatemeh/Tests/TestAssignment02fatemeh.cpp
c98ec0f3fbce43fdff68724784a0075c57a48cd6
[]
no_license
jeffdk/SpecClass2011
9492e7386ef03914f2867391c3e5c3a7344bedd4
8598c47f3e99e6317285213d2c466eb9715c16fb
refs/heads/master
2016-09-06T03:33:20.952155
2012-09-10T22:29:27
2012-09-10T22:29:27
1,931,578
18
3
null
null
null
null
UTF-8
C++
false
false
1,279
cpp
#include <iostream> #include <cstdlib> #include<MyVector.hpp> #include<Assignment02fatemeh.hpp> #include <OptionParser.hpp> #include <ReadFileIntoString.hpp> #include <UtilsForTesting.hpp> int main(int /*argc*/, char** /*argv*/){ //MyVector<double> A(MV::fill, 3.0,4.0,5.0); //MyVector<double> B(MV::fill, 6.0,7.0,8.0); OptionParser p(ReadFileIntoString("Vectors.input")); MyVector<double> A = p.Get<MyVector<double> >("FirstVectorToAdd"); MyVector<double> B = p.Get<MyVector<double> >("SecondVectorToAdd"); double C = p.Get<double>("ConstantDoubleToDivide"); MyVector<double> result(MV::Size(A.Size()),0.0); result = div_sumVectors(A,B,C); std::cout<<"Vector A ="<<A<<std::endl; std::cout<<"Vector B ="<<B<<std::endl; std::cout<<"double C ="<<C<<std::endl; std::cout<<"sum vectors divided by a constant= "<<result<<std::endl; double resultMagnitudeSq = 0.0; for(int i=0;i<result.Size();++i) { resultMagnitudeSq += result[i]*result[i]; } UtilsForTesting u; UtilsForTesting w; IS_ZERO(resultMagnitudeSq,"Sum of vector and its negative nonzero."); //*** check if the double is zero. IS_TRUE(C!=0.0,"The constant double is zero."); return u.NumberOfTestsFailed(); return w.NumberOfTestsFailed(); //return EXIT_SUCCESS; }
[ "hcross@ubuntu.ubuntu-domain" ]
hcross@ubuntu.ubuntu-domain
3b0adbd702bca8131eb352ca39c672de04aa36eb
da0b3cbe328ce8bf18adedf7f544ef43f17eabe9
/src/SubSystem/InputSubSystem/InputSubSystem.h
d1e428fead38623c96cc8ebfc53913deba8572fc
[]
no_license
Stan-Lewry/Snake
6a45adc541be3d71369e8bdc82b9443040fca649
e084d15ac7ee51a6573ffe82939959976032ee1e
refs/heads/master
2022-12-01T02:35:36.059360
2020-07-25T14:24:00
2020-07-25T14:24:00
282,458,947
0
0
null
null
null
null
UTF-8
C++
false
false
1,390
h
#pragma once #include "../../Utils/SDLUtils.h" #include "../SubSystem.h" #include "../../Component/WorldComponent.h" #include "../../Component/InputComponent.h" class InputSubSystem : public SubSystem{ public: InputSubSystem(); virtual ~InputSubSystem(); void registerInputComponent(InputComponent* inputComp); protected: void doUpdate(double dTime) override; private: void _pollInputs(); std::list<InputComponent*> inputComponents; bool quitEvent; std::map<SDL_Keycode, std::pair<Button, bool>> inputStateMap = { {SDLK_UP, {upArrow, false}}, {SDLK_DOWN, {downArrow, false}}, {SDLK_LEFT, {leftArrow, false}}, {SDLK_RIGHT, {rightArrow, false}}, {SDLK_F1, {f1, false}}, {SDLK_F2, {f2, false}}, {SDLK_F3, {f3, false}}, {SDLK_F4, {f4, false}}, {SDLK_F5, {f5, false}}, {SDLK_F6, {f6, false}}, {SDLK_F7, {f7, false}}, {SDLK_F8, {f8, false}}, {SDLK_F9, {f9, false}}, {SDLK_F10, {f10, false}}, {SDLK_F11, {f11, false}}, {SDLK_F12, {f12, false}}, {SDLK_RIGHTBRACKET, {rightSquareBracket, false}}, {SDLK_LEFTBRACKET, {leftSquareBracket, false}}, {SDLK_w, {w, false}}, {SDLK_a, {a, false}}, {SDLK_s, {s, false}}, {SDLK_d, {d, false}}, {SDLK_SPACE, {space, false}}, }; };
[ "stanley.jml@gmail.com" ]
stanley.jml@gmail.com
4a7920fc15be331b9e07a758b5ccffc96566f5f8
e51d009c6c6a1633c2c11ea4e89f289ea294ec7e
/xr2-dsgn/sources/xray/editor/particle/sources/particle_graph_node_property.h
94c0f4fbec8ab69a686829b6da73bfdb4fb872ad
[]
no_license
avmal0-Cor/xr2-dsgn
a0c726a4d54a2ac8147a36549bc79620fead0090
14e9203ee26be7a3cb5ca5da7056ecb53c558c72
refs/heads/master
2023-07-03T02:05:00.566892
2021-08-06T03:10:53
2021-08-06T03:10:53
389,939,196
3
2
null
null
null
null
UTF-8
C++
false
false
1,130
h
//////////////////////////////////////////////////////////////////////////// // Created : 23.03.2010 // Author : // Copyright (C) GSC Game World - 2010 //////////////////////////////////////////////////////////////////////////// #ifndef PARTICLE_GRAPH_NODE_PROPERTY_H_INCLUDED #define PARTICLE_GRAPH_NODE_PROPERTY_H_INCLUDED #include "particle_graph_node.h" namespace xray { namespace particle_editor { public ref class particle_graph_node_property : public particle_graph_node{ typedef particle_graph_node super; public: particle_graph_node_property( particle_editor^ editor, images92x25 image_type_id, String^ entity_type, String^ node_id ): particle_graph_node(editor) { image_type = image_type_id; particle_entity_type = entity_type; id = node_id; } protected: virtual void OnPaint (PaintEventArgs^ e) override; public: virtual Boolean can_accept_node(particle_graph_node^ ) override {return false;}; }; // class particle_graph_node_property } // namespace particle_editor } // namespace xray #endif // #ifndef PARTICLE_GRAPH_NODE_PROPERTY_H_INCLUDED
[ "youalexandrov@icloud.com" ]
youalexandrov@icloud.com
e6a88ce19940147b3311b134afe7c1a22cc4a757
d06af17f8e2291d94e59cfddf44d6faf3198b58c
/src/shell.h
cd357eb1be4a9e87cb9466ac0a1e567754ef1ace
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
gxcsoccer/node-webkit
95fb764d6ca40c8300712f1d1948f77c2a577336
79c072893a5be43504d22213be3d7cded2bfe4e2
refs/heads/master
2020-12-25T11:42:17.977734
2012-09-14T07:48:17
2012-09-14T07:48:17
5,816,865
0
1
null
null
null
null
UTF-8
C++
false
false
10,289
h
// Copyright (c) 2012 Intel Corp // Copyright (c) 2012 The Chromium Authors // // 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 co // pies 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 al // l copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IM // PLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNES // S FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS // OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WH // ETHER 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. #ifndef CONTENT_NW_SRC_SHELL_H_ #define CONTENT_NW_SRC_SHELL_H_ #include <vector> #include "base/basictypes.h" #include "base/callback_forward.h" #include "base/memory/scoped_ptr.h" #include "base/string_piece.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/web_contents_delegate.h" #include "ipc/ipc_channel.h" #include "ui/gfx/native_widget_types.h" #if defined(TOOLKIT_GTK) #include <gtk/gtk.h> #include "ui/base/gtk/gtk_signal.h" typedef struct _GtkToolItem GtkToolItem; #elif defined(OS_ANDROID) #include "base/android/scoped_java_ref.h" #elif defined(USE_AURA) namespace views { class Widget; class ViewsDelegate; } namespace aura { namespace client { class StackingClient; } } #endif namespace base { class DictionaryValue; } class GURL; namespace content { class BrowserContext; class ShellJavaScriptDialogCreator; class SiteInstance; class WebContents; // This represents one window of the Content Shell, i.e. all the UI including // buttons and url bar, as well as the web content area. class Shell : public WebContentsDelegate, public NotificationObserver { public: virtual ~Shell(); void LoadURL(const GURL& url); void GoBackOrForward(int offset); void Reload(); void Stop(); void UpdateNavigationControls(); void Close(); void Move(const gfx::Rect& pos); void ShowDevTools(); // Do one time initialization at application startup. static void PlatformInitialize(); static Shell* CreateNewWindow(BrowserContext* browser_context, const GURL& url, SiteInstance* site_instance, int routing_id, WebContents* base_web_contents); // Returns the Shell object corresponding to the given RenderViewHost. static Shell* FromRenderViewHost(RenderViewHost* rvh); // Returns the currently open windows. static std::vector<Shell*>& windows() { return windows_; } // Closes all windows and returns. This runs a message loop. static void CloseAllWindows(); // Closes all windows and exits. static void PlatformExit(); // Used for content_browsertests. Called once. static void SetShellCreatedCallback( base::Callback<void(Shell*)> shell_created_callback); WebContents* web_contents() const { return web_contents_.get(); } gfx::NativeWindow window() { return window_; } #if defined(OS_MACOSX) // Public to be called by an ObjC bridge object. void ActionPerformed(int control); void URLEntered(std::string url_string); #elif defined(OS_ANDROID) // Registers the Android Java to native methods. static bool Register(JNIEnv* env); #endif // WebContentsDelegate virtual WebContents* OpenURLFromTab(WebContents* source, const OpenURLParams& params) OVERRIDE; virtual void LoadingStateChanged(WebContents* source) OVERRIDE; #if defined(OS_ANDROID) virtual void LoadProgressChanged(double progress) OVERRIDE; #endif virtual void ActivateContents(content::WebContents* contents) OVERRIDE; virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; virtual void CloseContents(WebContents* source) OVERRIDE; virtual void MoveContents(WebContents* source, const gfx::Rect& pos) OVERRIDE; virtual bool IsPopupOrPanel(const WebContents* source) const OVERRIDE; virtual bool TakeFocus(WebContents* soruce, bool reverse) OVERRIDE; virtual void LostCapture() OVERRIDE; virtual void WebContentsFocused(WebContents* contents) OVERRIDE; virtual void WebContentsCreated(WebContents* source_contents, int64 source_frame_id, const GURL& target_url, WebContents* new_contents) OVERRIDE; virtual void RunFileChooser( content::WebContents* web_contents, const content::FileChooserParams& params) OVERRIDE; virtual void EnumerateDirectory(content::WebContents* web_contents, int request_id, const FilePath& path) OVERRIDE; virtual void DidNavigateMainFramePostCommit( WebContents* web_contents) OVERRIDE; virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; #if defined(OS_MACOSX) virtual void HandleKeyboardEvent( WebContents* source, const NativeWebKeyboardEvent& event) OVERRIDE; #endif virtual bool AddMessageToConsole(WebContents* source, int32 level, const string16& message, int32 line_no, const string16& source_id) OVERRIDE; virtual void RequestMediaAccessPermission( content::WebContents* web_contents, const content::MediaStreamRequest* request, const content::MediaResponseCallback& callback) OVERRIDE; private: enum UIControl { BACK_BUTTON, FORWARD_BUTTON, STOP_BUTTON }; explicit Shell(WebContents* web_contents, base::DictionaryValue* manifest); // Helper to create a new Shell given a newly created WebContents. static Shell* CreateShell(WebContents* web_contents, base::DictionaryValue* manifest); // All the methods that begin with Platform need to be implemented by the // platform specific Shell implementation. // Called from the destructor to let each platform do any necessary cleanup. void PlatformCleanUp(); // Creates the main window GUI. void PlatformCreateWindow(int width, int height); // Links the WebContents into the newly created window. void PlatformSetContents(); // Resize the content area and GUI. void PlatformResizeSubViews(); // Enable/disable a button. void PlatformEnableUIControl(UIControl control, bool is_enabled); // Updates the url in the url bar. void PlatformSetAddressBarURL(const GURL& url); // Sets whether the spinner is spinning. void PlatformSetIsLoading(bool loading); // Set the title of shell window void PlatformSetTitle(const string16& title); // Resizes the main window to the given dimensions. #if defined(TOOLKIT_GTK) void SizeTo(int width, int height); #elif defined(OS_WIN) void SizeTo(int width, int height, int x = -1, int y = -1); #endif gfx::NativeView GetContentView(); // NotificationObserver virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; #if defined(OS_WIN) && !defined(USE_AURA) static ATOM RegisterWindowClass(); static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); #elif defined(TOOLKIT_GTK) CHROMEGTK_CALLBACK_0(Shell, void, OnBackButtonClicked); CHROMEGTK_CALLBACK_0(Shell, void, OnForwardButtonClicked); CHROMEGTK_CALLBACK_0(Shell, void, OnReloadButtonClicked); CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked); CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate); CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed); CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*, GObject*, guint, GdkModifierType); CHROMEG_CALLBACK_3(Shell, gboolean, OnNewWindowKeyPressed, GtkAccelGroup*, GObject*, guint, GdkModifierType); CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*, GObject*, guint, GdkModifierType); #endif scoped_ptr<ShellJavaScriptDialogCreator> dialog_creator_; scoped_ptr<WebContents> web_contents_; gfx::NativeWindow window_; gfx::NativeEditView url_edit_view_; // Notification manager NotificationRegistrar registrar_; // Window manifest base::DictionaryValue* window_manifest_; bool is_show_devtools_; bool is_toolbar_open_; int max_height_; int max_width_; int min_height_; int min_width_; #if defined(OS_WIN) && !defined(USE_AURA) WNDPROC default_edit_wnd_proc_; static HINSTANCE instance_handle_; #elif defined(TOOLKIT_GTK) GtkWidget* vbox_; GtkToolItem* back_button_; GtkToolItem* forward_button_; GtkToolItem* reload_button_; GtkToolItem* stop_button_; GtkWidget* spinner_; GtkToolItem* spinner_item_; int content_width_; int content_height_; #elif defined(OS_ANDROID) base::android::ScopedJavaGlobalRef<jobject> java_object_; #elif defined(USE_AURA) static aura::client::StackingClient* stacking_client_; static views::ViewsDelegate* views_delegate_; views::Widget* window_widget_; #endif // A container of all the open windows. We use a vector so we can keep track // of ordering. static std::vector<Shell*> windows_; static base::Callback<void(Shell*)> shell_created_callback_; // True if the destructur of Shell should post a quit closure on the current // message loop if the destructed Shell object was the last one. static bool quit_message_loop_; }; } // namespace content #endif // CONTENT_NW_SRC_SHELL_H_
[ "zcbenz@gmail.com" ]
zcbenz@gmail.com
61ca4c7140d145933676f438e7e36cfbef1905f6
d8fe53acc994b115d058eaed1339f1444f8a798a
/test/cctest/wasm/test-gc.cc
2ba2a2da401a2e5afbf9add197428f8a41d89d1e
[ "BSD-3-Clause", "Apache-2.0", "SunPro" ]
permissive
ZacharyZhang8910/v8
313ba793a375c4f3de04c54890479a93f03612d8
2b2d50d98115959aafb96dba1505ded61b447c4d
refs/heads/master
2023-02-13T13:36:03.384077
2021-02-08T21:33:53
2021-02-08T22:26:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
58,605
cc
// Copyright 2020 the V8 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. #include <stdint.h> #include "src/utils/utils.h" #include "src/utils/vector.h" #include "src/wasm/module-decoder.h" #include "src/wasm/struct-types.h" #include "src/wasm/wasm-arguments.h" #include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-objects-inl.h" #include "src/wasm/wasm-opcodes.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" #include "test/cctest/wasm/wasm-run-utils.h" #include "test/common/wasm/test-signatures.h" #include "test/common/wasm/wasm-macro-gen.h" #include "test/common/wasm/wasm-module-runner.h" namespace v8 { namespace internal { namespace wasm { namespace test_gc { using F = std::pair<ValueType, bool>; class WasmGCTester { public: explicit WasmGCTester( TestExecutionTier execution_tier = TestExecutionTier::kTurbofan) : flag_gc(&v8::internal::FLAG_experimental_wasm_gc, true), flag_reftypes(&v8::internal::FLAG_experimental_wasm_reftypes, true), flag_typedfuns(&v8::internal::FLAG_experimental_wasm_typed_funcref, true), flag_liftoff( &v8::internal::FLAG_liftoff, execution_tier == TestExecutionTier::kTurbofan ? false : true), flag_liftoff_only( &v8::internal::FLAG_liftoff_only, execution_tier == TestExecutionTier::kLiftoff ? true : false), flag_tierup(&v8::internal::FLAG_wasm_tier_up, false), zone(&allocator, ZONE_NAME), builder_(&zone), isolate_(CcTest::InitIsolateOnce()), scope(isolate_), thrower(isolate_, "Test wasm GC") { testing::SetupIsolateForWasmModule(isolate_); } byte AddGlobal(ValueType type, bool mutability, WasmInitExpr init) { return builder_.AddGlobal(type, mutability, std::move(init)); } byte DefineFunction(FunctionSig* sig, std::initializer_list<ValueType> locals, std::initializer_list<byte> code) { WasmFunctionBuilder* fun = builder_.AddFunction(sig); for (ValueType local : locals) { fun->AddLocal(local); } fun->EmitCode(code.begin(), static_cast<uint32_t>(code.size())); return fun->func_index(); } void DefineExportedFunction(const char* name, FunctionSig* sig, std::initializer_list<byte> code) { WasmFunctionBuilder* fun = builder_.AddFunction(sig); fun->EmitCode(code.begin(), static_cast<uint32_t>(code.size())); builder_.AddExport(CStrVector(name), fun); } MaybeHandle<Object> CallExportedFunction(const char* name, int argc, Handle<Object> args[]) { Handle<WasmExportedFunction> func = testing::GetExportedFunction(isolate_, instance_, name) .ToHandleChecked(); return Execution::Call(isolate_, func, isolate_->factory()->undefined_value(), argc, args); } byte DefineStruct(std::initializer_list<F> fields) { StructType::Builder type_builder(&zone, static_cast<uint32_t>(fields.size())); for (F field : fields) { type_builder.AddField(field.first, field.second); } return builder_.AddStructType(type_builder.Build()); } byte DefineArray(ValueType element_type, bool mutability) { return builder_.AddArrayType(zone.New<ArrayType>(element_type, mutability)); } byte DefineSignature(FunctionSig* sig) { return builder_.AddSignature(sig); } byte DefineTable(ValueType type, uint32_t min_size, uint32_t max_size) { return builder_.AddTable(type, min_size, max_size); } void CompileModule() { ZoneBuffer buffer(&zone); builder_.WriteTo(&buffer); MaybeHandle<WasmInstanceObject> maybe_instance = testing::CompileAndInstantiateForTesting( isolate_, &thrower, ModuleWireBytes(buffer.begin(), buffer.end())); if (thrower.error()) FATAL("%s", thrower.error_msg()); instance_ = maybe_instance.ToHandleChecked(); } void CallFunctionImpl(uint32_t function_index, const FunctionSig* sig, CWasmArgumentsPacker* packer) { WasmCodeRefScope scope; NativeModule* native_module = instance_->module_object().native_module(); WasmCode* code = native_module->GetCode(function_index); Address wasm_call_target = code->instruction_start(); Handle<Object> object_ref = instance_; Handle<Code> c_wasm_entry = compiler::CompileCWasmEntry(isolate_, sig, native_module->module()); Execution::CallWasm(isolate_, c_wasm_entry, wasm_call_target, object_ref, packer->argv()); } void CheckResult(uint32_t function_index, int32_t expected) { FunctionSig* sig = sigs.i_v(); DCHECK(*sig == *instance_->module()->functions[function_index].sig); CWasmArgumentsPacker packer(CWasmArgumentsPacker::TotalSize(sig)); CallFunctionImpl(function_index, sig, &packer); CHECK(!isolate_->has_pending_exception()); packer.Reset(); CHECK_EQ(expected, packer.Pop<int32_t>()); } void CheckResult(uint32_t function_index, int32_t expected, int32_t arg) { FunctionSig* sig = sigs.i_i(); DCHECK(*sig == *instance_->module()->functions[function_index].sig); CWasmArgumentsPacker packer(CWasmArgumentsPacker::TotalSize(sig)); packer.Push(arg); CallFunctionImpl(function_index, sig, &packer); CHECK(!isolate_->has_pending_exception()); packer.Reset(); CHECK_EQ(expected, packer.Pop<int32_t>()); } MaybeHandle<Object> GetResultObject(uint32_t function_index) { const FunctionSig* sig = instance_->module()->functions[function_index].sig; CWasmArgumentsPacker packer(CWasmArgumentsPacker::TotalSize(sig)); CallFunctionImpl(function_index, sig, &packer); CHECK(!isolate_->has_pending_exception()); packer.Reset(); return Handle<Object>(Object(packer.Pop<Address>()), isolate_); } void CheckHasThrown(uint32_t function_index) { const FunctionSig* sig = instance_->module()->functions[function_index].sig; CWasmArgumentsPacker packer(CWasmArgumentsPacker::TotalSize(sig)); CallFunctionImpl(function_index, sig, &packer); CHECK(isolate_->has_pending_exception()); isolate_->clear_pending_exception(); } void CheckHasThrown(uint32_t function_index, int32_t arg) { FunctionSig* sig = sigs.i_i(); DCHECK(*sig == *instance_->module()->functions[function_index].sig); CWasmArgumentsPacker packer(CWasmArgumentsPacker::TotalSize(sig)); packer.Push(arg); CallFunctionImpl(function_index, sig, &packer); CHECK(isolate_->has_pending_exception()); isolate_->clear_pending_exception(); } Handle<WasmInstanceObject> instance() { return instance_; } Isolate* isolate() { return isolate_; } WasmModuleBuilder* builder() { return &builder_; } TestSignatures sigs; private: const FlagScope<bool> flag_gc; const FlagScope<bool> flag_reftypes; const FlagScope<bool> flag_typedfuns; const FlagScope<bool> flag_liftoff; const FlagScope<bool> flag_liftoff_only; const FlagScope<bool> flag_tierup; v8::internal::AccountingAllocator allocator; Zone zone; WasmModuleBuilder builder_; Isolate* const isolate_; const HandleScope scope; Handle<WasmInstanceObject> instance_; ErrorThrower thrower; }; ValueType ref(uint32_t type_index) { return ValueType::Ref(type_index, kNonNullable); } ValueType optref(uint32_t type_index) { return ValueType::Ref(type_index, kNullable); } WASM_COMPILED_EXEC_TEST(WasmBasicStruct) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineStruct({F(kWasmI32, true), F(kWasmI32, true)}); const byte empty_struct_index = tester.DefineStruct({}); ValueType kRefType = ref(type_index); ValueType kEmptyStructType = ref(empty_struct_index); ValueType kOptRefType = optref(type_index); FunctionSig sig_q_v(1, 0, &kRefType); FunctionSig sig_qe_v(1, 0, &kEmptyStructType); // Test struct.new and struct.get. const byte kGet1 = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_STRUCT_GET( type_index, 0, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(64), WASM_RTT_CANON(type_index))), kExprEnd}); // Test struct.new and struct.get. const byte kGet2 = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_STRUCT_GET( type_index, 1, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(64), WASM_RTT_CANON(type_index))), kExprEnd}); // Test struct.new, returning struct reference. const byte kGetStruct = tester.DefineFunction( &sig_q_v, {}, {WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(64), WASM_RTT_CANON(type_index)), kExprEnd}); // Test struct.new, returning reference to an empty struct. const byte kGetEmptyStruct = tester.DefineFunction( &sig_qe_v, {}, {WASM_STRUCT_NEW_WITH_RTT(empty_struct_index, WASM_RTT_CANON(empty_struct_index)), kExprEnd}); // Test struct.set, struct refs types in locals. const byte j_local_index = 0; const byte j_field_index = 0; const byte kSet = tester.DefineFunction( tester.sigs.i_v(), {kOptRefType}, {WASM_LOCAL_SET( j_local_index, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(64), WASM_RTT_CANON(type_index))), WASM_STRUCT_SET(type_index, j_field_index, WASM_LOCAL_GET(j_local_index), WASM_I32V(-99)), WASM_STRUCT_GET(type_index, j_field_index, WASM_LOCAL_GET(j_local_index)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kGet1, 42); tester.CheckResult(kGet2, 64); CHECK(tester.GetResultObject(kGetStruct).ToHandleChecked()->IsWasmStruct()); CHECK(tester.GetResultObject(kGetEmptyStruct) .ToHandleChecked() ->IsWasmStruct()); tester.CheckResult(kSet, -99); } // Test struct.set, ref.as_non_null, // struct refs types in globals and if-results. WASM_COMPILED_EXEC_TEST(WasmRefAsNonNull) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineStruct({F(kWasmI32, true), F(kWasmI32, true)}); ValueType kRefTypes[] = {ref(type_index)}; ValueType kOptRefType = optref(type_index); FunctionSig sig_q_v(1, 0, kRefTypes); const byte global_index = tester.AddGlobal(kOptRefType, true, WasmInitExpr::RefNullConst( static_cast<HeapType::Representation>(type_index))); const byte field_index = 0; const byte kFunc = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_GLOBAL_SET( global_index, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(55), WASM_I32V(66), WASM_RTT_CANON(type_index))), WASM_STRUCT_GET( type_index, field_index, WASM_REF_AS_NON_NULL(WASM_IF_ELSE_R(kOptRefType, WASM_I32V(1), WASM_GLOBAL_GET(global_index), WASM_REF_NULL(type_index)))), kExprEnd}); tester.CompileModule(); tester.CheckResult(kFunc, 55); } WASM_COMPILED_EXEC_TEST(WasmBrOnNull) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineStruct({F(kWasmI32, true), F(kWasmI32, true)}); ValueType kRefTypes[] = {ref(type_index)}; ValueType kOptRefType = optref(type_index); FunctionSig sig_q_v(1, 0, kRefTypes); const byte l_local_index = 0; const byte kTaken = tester.DefineFunction( tester.sigs.i_v(), {kOptRefType}, {WASM_BLOCK_I(WASM_I32V(42), // Branch will be taken. // 42 left on stack outside the block (not 52). WASM_BR_ON_NULL(0, WASM_LOCAL_GET(l_local_index)), WASM_I32V(52), WASM_BR(0)), kExprEnd}); const byte m_field_index = 0; const byte kNotTaken = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_BLOCK_I( WASM_I32V(42), WASM_STRUCT_GET( type_index, m_field_index, // Branch will not be taken. // 52 left on stack outside the block (not 42). WASM_BR_ON_NULL(0, WASM_STRUCT_NEW_WITH_RTT( type_index, WASM_I32V(52), WASM_I32V(62), WASM_RTT_CANON(type_index)))), WASM_BR(0)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kTaken, 42); tester.CheckResult(kNotTaken, 52); } WASM_COMPILED_EXEC_TEST(BrOnCast) { WasmGCTester tester(execution_tier); ValueType kDataRefNull = ValueType::Ref(HeapType::kData, kNullable); const byte type_index = tester.DefineStruct({F(kWasmI32, true)}); const byte other_type_index = tester.DefineStruct({F(kWasmF32, true)}); const byte rtt_index = tester.AddGlobal(ValueType::Rtt(type_index, 0), false, WasmInitExpr::RttCanon( static_cast<HeapType::Representation>(type_index))); const byte kTestStruct = tester.DefineFunction( tester.sigs.i_v(), {kWasmI32, kDataRefNull}, {WASM_BLOCK_R(ValueType::Ref(type_index, kNullable), WASM_LOCAL_SET(0, WASM_I32V(111)), // Pipe a struct through a local so it's statically typed // as dataref. WASM_LOCAL_SET(1, WASM_STRUCT_NEW_WITH_RTT( other_type_index, WASM_F32(1.0), WASM_RTT_CANON(other_type_index))), WASM_LOCAL_GET(1), // The type check fails, so this branch isn't taken. WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)), WASM_DROP, WASM_LOCAL_SET(0, WASM_I32V(221)), // (Final result) - 1 WASM_LOCAL_SET(1, WASM_STRUCT_NEW_WITH_RTT( type_index, WASM_I32V(1), WASM_GLOBAL_GET(rtt_index))), WASM_LOCAL_GET(1), // This branch is taken. WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)), WASM_GLOBAL_GET(rtt_index), WASM_GC_OP(kExprRefCast), // Not executed due to the branch. WASM_LOCAL_SET(0, WASM_I32V(333))), WASM_GC_OP(kExprStructGet), type_index, 0, WASM_LOCAL_GET(0), kExprI32Add, kExprEnd}); const byte kTestNull = tester.DefineFunction( tester.sigs.i_v(), {kWasmI32, kDataRefNull}, {WASM_BLOCK_R(ValueType::Ref(type_index, kNullable), WASM_LOCAL_SET(0, WASM_I32V(111)), WASM_LOCAL_GET(1), // Put a nullref onto the value stack. // Not taken for nullref. WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)), WASM_RTT_CANON(type_index), WASM_GC_OP(kExprRefCast), WASM_LOCAL_SET(0, WASM_I32V(222))), // Final result. WASM_DROP, WASM_LOCAL_GET(0), kExprEnd}); const byte kTypedAfterBranch = tester.DefineFunction( tester.sigs.i_v(), {kWasmI32, kDataRefNull}, {WASM_LOCAL_SET(1, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_GLOBAL_GET(rtt_index))), WASM_BLOCK_I( // The inner block should take the early branch with a struct // on the stack. WASM_BLOCK_R(ValueType::Ref(type_index, kNonNullable), WASM_LOCAL_GET(1), WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)), // Returning 123 is the unreachable failure case. WASM_I32V(123), WASM_BR(1)), // The outer block catches the struct left behind by the inner block // and reads its field. WASM_GC_OP(kExprStructGet), type_index, 0), kExprEnd}); tester.CompileModule(); tester.CheckResult(kTestStruct, 222); tester.CheckResult(kTestNull, 222); tester.CheckResult(kTypedAfterBranch, 42); } WASM_COMPILED_EXEC_TEST(WasmRefEq) { WasmGCTester tester(execution_tier); byte type_index = tester.DefineStruct({F(kWasmI32, true), F(kWasmI32, true)}); ValueType kRefTypes[] = {ref(type_index)}; ValueType kOptRefType = optref(type_index); FunctionSig sig_q_v(1, 0, kRefTypes); byte local_index = 0; const byte kFunc = tester.DefineFunction( tester.sigs.i_v(), {kOptRefType}, {WASM_LOCAL_SET(local_index, WASM_STRUCT_NEW_WITH_RTT( type_index, WASM_I32V(55), WASM_I32V(66), WASM_RTT_CANON(type_index))), WASM_I32_ADD( WASM_I32_SHL( WASM_REF_EQ( // true WASM_LOCAL_GET(local_index), WASM_LOCAL_GET(local_index)), WASM_I32V(0)), WASM_I32_ADD( WASM_I32_SHL(WASM_REF_EQ( // false WASM_LOCAL_GET(local_index), WASM_STRUCT_NEW_WITH_RTT( type_index, WASM_I32V(55), WASM_I32V(66), WASM_RTT_CANON(type_index))), WASM_I32V(1)), WASM_I32_ADD(WASM_I32_SHL( // false WASM_REF_EQ(WASM_LOCAL_GET(local_index), WASM_REF_NULL(type_index)), WASM_I32V(2)), WASM_I32_SHL(WASM_REF_EQ( // true WASM_REF_NULL(type_index), WASM_REF_NULL(type_index)), WASM_I32V(3))))), kExprEnd}); tester.CompileModule(); tester.CheckResult(kFunc, 0b1001); } WASM_COMPILED_EXEC_TEST(WasmPackedStructU) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineStruct( {F(kWasmI8, true), F(kWasmI16, true), F(kWasmI32, true)}); ValueType struct_type = optref(type_index); const byte local_index = 0; int32_t expected_output_0 = 0x1234; int32_t expected_output_1 = -1; const byte kF0 = tester.DefineFunction( tester.sigs.i_v(), {struct_type}, {WASM_LOCAL_SET(local_index, WASM_STRUCT_NEW_WITH_RTT( type_index, WASM_I32V(expected_output_0), WASM_I32V(expected_output_1), WASM_I32V(0x12345678), WASM_RTT_CANON(type_index))), WASM_STRUCT_GET_U(type_index, 0, WASM_LOCAL_GET(local_index)), kExprEnd}); const byte kF1 = tester.DefineFunction( tester.sigs.i_v(), {struct_type}, {WASM_LOCAL_SET(local_index, WASM_STRUCT_NEW_WITH_RTT( type_index, WASM_I32V(expected_output_0), WASM_I32V(expected_output_1), WASM_I32V(0x12345678), WASM_RTT_CANON(type_index))), WASM_STRUCT_GET_U(type_index, 1, WASM_LOCAL_GET(local_index)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kF0, static_cast<uint8_t>(expected_output_0)); tester.CheckResult(kF1, static_cast<uint16_t>(expected_output_1)); } WASM_COMPILED_EXEC_TEST(WasmPackedStructS) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineStruct( {F(kWasmI8, true), F(kWasmI16, true), F(kWasmI32, true)}); ValueType struct_type = optref(type_index); const byte local_index = 0; int32_t expected_output_0 = 0x80; int32_t expected_output_1 = 42; const byte kF0 = tester.DefineFunction( tester.sigs.i_v(), {struct_type}, {WASM_LOCAL_SET( local_index, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(expected_output_0), WASM_I32V(expected_output_1), WASM_I32V(0), WASM_RTT_CANON(type_index))), WASM_STRUCT_GET_S(type_index, 0, WASM_LOCAL_GET(local_index)), kExprEnd}); const byte kF1 = tester.DefineFunction( tester.sigs.i_v(), {struct_type}, {WASM_LOCAL_SET( local_index, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(0x80), WASM_I32V(expected_output_1), WASM_I32V(0), WASM_RTT_CANON(type_index))), WASM_STRUCT_GET_S(type_index, 1, WASM_LOCAL_GET(local_index)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kF0, static_cast<int8_t>(expected_output_0)); tester.CheckResult(kF1, static_cast<int16_t>(expected_output_1)); } TEST(WasmLetInstruction) { WasmGCTester tester; const byte type_index = tester.DefineStruct({F(kWasmI32, true), F(kWasmI32, true)}); const byte let_local_index = 0; const byte let_field_index = 0; const byte kLetTest1 = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_LET_1_I( WASM_SEQ(kRefCode, type_index), WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(52), WASM_RTT_CANON(type_index)), WASM_STRUCT_GET(type_index, let_field_index, WASM_LOCAL_GET(let_local_index))), kExprEnd}); const byte let_2_field_index = 0; const byte kLetTest2 = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_LET_2_I( kI32Code, WASM_I32_ADD(WASM_I32V(42), WASM_I32V(-32)), WASM_SEQ(kRefCode, type_index), WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(52), WASM_RTT_CANON(type_index)), WASM_I32_MUL(WASM_STRUCT_GET(type_index, let_2_field_index, WASM_LOCAL_GET(1)), WASM_LOCAL_GET(0))), kExprEnd}); const byte kLetTestLocals = tester.DefineFunction( tester.sigs.i_i(), {kWasmI32}, {WASM_LOCAL_SET(1, WASM_I32V(100)), WASM_LET_2_I( kI32Code, WASM_I32V(1), kI32Code, WASM_I32V(10), WASM_I32_SUB(WASM_I32_ADD(WASM_LOCAL_GET(0), // 1st let-local WASM_LOCAL_GET(2)), // Parameter WASM_I32_ADD(WASM_LOCAL_GET(1), // 2nd let-local WASM_LOCAL_GET(3)))), // Function local kExprEnd}); // Result: (1 + 1000) - (10 + 100) = 891 const byte let_erase_local_index = 0; const byte kLetTestErase = tester.DefineFunction( tester.sigs.i_v(), {kWasmI32}, {WASM_LOCAL_SET(let_erase_local_index, WASM_I32V(0)), WASM_LET_1_V(kI32Code, WASM_I32V(1), WASM_NOP), WASM_LOCAL_GET(let_erase_local_index), kExprEnd}); // The result should be 0 and not 1, as local_get(0) refers to the original // local. const byte kLetInLoop = tester.DefineFunction( tester.sigs.i_i(), {}, {WASM_LOOP(WASM_LET_1_V( kI32Code, WASM_I32V(10), // -- WASM_LOCAL_SET(1, WASM_I32_SUB(WASM_LOCAL_GET(1), WASM_I32V(10))), WASM_BR_IF(1, WASM_I32_GES(WASM_LOCAL_GET(1), WASM_LOCAL_GET(0))))), WASM_LOCAL_GET(0), WASM_END}); const byte kLetInBlock = tester.DefineFunction( tester.sigs.i_i(), {}, {WASM_BLOCK(WASM_LET_1_V( kI32Code, WASM_I32V(10), // -- WASM_BR_IF(1, WASM_I32_GES(WASM_LOCAL_GET(1), WASM_LOCAL_GET(0))), WASM_LOCAL_SET(1, WASM_I32V(30)))), WASM_LOCAL_GET(0), WASM_END}); tester.CompileModule(); tester.CheckResult(kLetTest1, 42); tester.CheckResult(kLetTest2, 420); tester.CheckResult(kLetTestLocals, 891, 1000); tester.CheckResult(kLetTestErase, 0); tester.CheckResult(kLetInLoop, 2, 52); tester.CheckResult(kLetInLoop, -11, -1); tester.CheckResult(kLetInBlock, 15, 15); tester.CheckResult(kLetInBlock, 30, 5); } WASM_COMPILED_EXEC_TEST(WasmBasicArray) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineArray(wasm::kWasmI32, true); ValueType kRefTypes[] = {ref(type_index)}; FunctionSig sig_q_v(1, 0, kRefTypes); ValueType kOptRefType = optref(type_index); // f: a = [12, 12, 12]; a[1] = 42; return a[arg0] const byte local_index = 1; const byte kGetElem = tester.DefineFunction( tester.sigs.i_i(), {kOptRefType}, {WASM_LOCAL_SET(local_index, WASM_ARRAY_NEW_WITH_RTT( type_index, WASM_I32V(12), WASM_I32V(3), WASM_RTT_CANON(type_index))), WASM_ARRAY_SET(type_index, WASM_LOCAL_GET(local_index), WASM_I32V(1), WASM_I32V(42)), WASM_ARRAY_GET(type_index, WASM_LOCAL_GET(local_index), WASM_LOCAL_GET(0)), kExprEnd}); // Reads and returns an array's length. const byte kGetLength = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_ARRAY_LEN(type_index, WASM_ARRAY_NEW_WITH_RTT( type_index, WASM_I32V(0), WASM_I32V(42), WASM_RTT_CANON(type_index))), kExprEnd}); // Create an array of length 2, initialized to [42, 42]. const byte kAllocate = tester.DefineFunction( &sig_q_v, {}, {WASM_ARRAY_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_I32V(2), WASM_RTT_CANON(type_index)), kExprEnd}); const uint32_t kLongLength = 1u << 16; const byte kAllocateLarge = tester.DefineFunction( &sig_q_v, {}, {WASM_ARRAY_NEW_DEFAULT(type_index, WASM_I32V(kLongLength), WASM_RTT_CANON(type_index)), kExprEnd}); const uint32_t kTooLong = kV8MaxWasmArrayLength + 1; const byte kAllocateTooLarge = tester.DefineFunction( &sig_q_v, {}, {WASM_ARRAY_NEW_DEFAULT(type_index, WASM_I32V(kTooLong), WASM_RTT_CANON(type_index)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kGetElem, 12, 0); tester.CheckResult(kGetElem, 42, 1); tester.CheckResult(kGetElem, 12, 2); tester.CheckHasThrown(kGetElem, 3); tester.CheckHasThrown(kGetElem, -1); tester.CheckResult(kGetLength, 42); MaybeHandle<Object> h_result = tester.GetResultObject(kAllocate); CHECK(h_result.ToHandleChecked()->IsWasmArray()); #if OBJECT_PRINT h_result.ToHandleChecked()->Print(); #endif MaybeHandle<Object> maybe_large_result = tester.GetResultObject(kAllocateLarge); Handle<Object> large_result = maybe_large_result.ToHandleChecked(); CHECK(large_result->IsWasmArray()); CHECK(Handle<WasmArray>::cast(large_result)->Size() > kMaxRegularHeapObjectSize); tester.CheckHasThrown(kAllocateTooLarge); } WASM_COMPILED_EXEC_TEST(WasmPackedArrayU) { WasmGCTester tester(execution_tier); const byte array_index = tester.DefineArray(kWasmI8, true); ValueType array_type = optref(array_index); const byte param_index = 0; const byte local_index = 1; int32_t expected_output_3 = 258; const byte kF = tester.DefineFunction( tester.sigs.i_i(), {array_type}, {WASM_LOCAL_SET(local_index, WASM_ARRAY_NEW_WITH_RTT( array_index, WASM_I32V(0), WASM_I32V(4), WASM_RTT_CANON(array_index))), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(0), WASM_I32V(1)), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(1), WASM_I32V(10)), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(2), WASM_I32V(200)), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(3), WASM_I32V(expected_output_3)), WASM_ARRAY_GET_U(array_index, WASM_LOCAL_GET(local_index), WASM_LOCAL_GET(param_index)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kF, 1, 0); tester.CheckResult(kF, 10, 1); tester.CheckResult(kF, 200, 2); // Only the 2 lsb's of 258 should be stored in the array. tester.CheckResult(kF, static_cast<uint8_t>(expected_output_3), 3); } WASM_COMPILED_EXEC_TEST(WasmPackedArrayS) { WasmGCTester tester(execution_tier); const byte array_index = tester.DefineArray(kWasmI16, true); ValueType array_type = optref(array_index); int32_t expected_outputs[] = {0x12345678, 10, 0xFEDC, 0xFF1234}; const byte param_index = 0; const byte local_index = 1; const byte kF = tester.DefineFunction( tester.sigs.i_i(), {array_type}, {WASM_LOCAL_SET( local_index, WASM_ARRAY_NEW_WITH_RTT(array_index, WASM_I32V(0x12345678), WASM_I32V(4), WASM_RTT_CANON(array_index))), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(1), WASM_I32V(10)), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(2), WASM_I32V(0xFEDC)), WASM_ARRAY_SET(array_index, WASM_LOCAL_GET(local_index), WASM_I32V(3), WASM_I32V(0xFF1234)), WASM_ARRAY_GET_S(array_index, WASM_LOCAL_GET(local_index), WASM_LOCAL_GET(param_index)), kExprEnd}); tester.CompileModule(); // Exactly the 2 lsb's should be stored by array.new. tester.CheckResult(kF, static_cast<int16_t>(expected_outputs[0]), 0); tester.CheckResult(kF, static_cast<int16_t>(expected_outputs[1]), 1); // Sign should be extended. tester.CheckResult(kF, static_cast<int16_t>(expected_outputs[2]), 2); // Exactly the 2 lsb's should be stored by array.set. tester.CheckResult(kF, static_cast<int16_t>(expected_outputs[3]), 3); } WASM_COMPILED_EXEC_TEST(NewDefault) { WasmGCTester tester(execution_tier); const byte struct_type = tester.DefineStruct( {F(wasm::kWasmI32, true), F(wasm::kWasmF64, true), F(optref(0), true)}); const byte array_type = tester.DefineArray(wasm::kWasmI32, true); // Returns: struct[0] + f64_to_i32(struct[1]) + (struct[2].is_null ^ 1) == 0. const byte allocate_struct = tester.DefineFunction( tester.sigs.i_v(), {optref(struct_type)}, {WASM_LOCAL_SET(0, WASM_STRUCT_NEW_DEFAULT(struct_type, WASM_RTT_CANON(struct_type))), WASM_I32_ADD( WASM_I32_ADD(WASM_STRUCT_GET(struct_type, 0, WASM_LOCAL_GET(0)), WASM_I32_SCONVERT_F64(WASM_STRUCT_GET( struct_type, 1, WASM_LOCAL_GET(0)))), WASM_I32_XOR(WASM_REF_IS_NULL( WASM_STRUCT_GET(struct_type, 2, WASM_LOCAL_GET(0))), WASM_I32V(1))), kExprEnd}); const byte allocate_array = tester.DefineFunction( tester.sigs.i_v(), {optref(array_type)}, {WASM_LOCAL_SET(0, WASM_ARRAY_NEW_DEFAULT(array_type, WASM_I32V(2), WASM_RTT_CANON(array_type))), WASM_I32_ADD( WASM_ARRAY_GET(array_type, WASM_LOCAL_GET(0), WASM_I32V(0)), WASM_ARRAY_GET(array_type, WASM_LOCAL_GET(0), WASM_I32V(1))), kExprEnd}); tester.CompileModule(); tester.CheckResult(allocate_struct, 0); tester.CheckResult(allocate_array, 0); } TEST(BasicRtt) { WasmGCTester tester; const byte type_index = tester.DefineStruct({F(wasm::kWasmI32, true)}); const byte subtype_index = tester.DefineStruct({F(wasm::kWasmI32, true), F(wasm::kWasmI32, true)}); ValueType kRttTypes[] = {ValueType::Rtt(type_index, 0)}; FunctionSig sig_t_v(1, 0, kRttTypes); ValueType kRttSubtypes[] = {ValueType::Rtt(subtype_index, 1)}; FunctionSig sig_t2_v(1, 0, kRttSubtypes); ValueType kRttTypesDeeper[] = {ValueType::Rtt(type_index, 1)}; FunctionSig sig_t3_v(1, 0, kRttTypesDeeper); ValueType kRefTypes[] = {ref(type_index)}; FunctionSig sig_q_v(1, 0, kRefTypes); const byte kRttCanon = tester.DefineFunction( &sig_t_v, {}, {WASM_RTT_CANON(type_index), kExprEnd}); const byte kRttSub = tester.DefineFunction( &sig_t2_v, {}, {WASM_RTT_SUB(subtype_index, WASM_RTT_CANON(type_index)), kExprEnd}); const byte kStructWithRtt = tester.DefineFunction( &sig_q_v, {}, {WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_RTT_CANON(type_index)), kExprEnd}); const int kFieldIndex = 1; const int kStructIndexCode = 1; // Shifted in 'let' block. const int kRttIndexCode = 0; // Let-bound, hence first local. // This implements the following function: // var local_struct: type0; // let (local_rtt = rtt.sub(rtt.canon(type0), type1) in { // local_struct = new type1 with rtt 'local_rtt'; // return (ref.test local_struct local_rtt) + // ((ref.cast local_struct local_rtt)[field0]); // } // The expected return value is 1+42 = 43. const byte kRefCast = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LET_1_I( WASM_RTT_WITH_DEPTH(1, subtype_index), WASM_RTT_SUB(subtype_index, WASM_RTT_CANON(type_index)), WASM_LOCAL_SET(kStructIndexCode, WASM_STRUCT_NEW_WITH_RTT( subtype_index, WASM_I32V(11), WASM_I32V(42), WASM_LOCAL_GET(kRttIndexCode))), WASM_I32_ADD( WASM_REF_TEST(WASM_LOCAL_GET(kStructIndexCode), WASM_LOCAL_GET(kRttIndexCode)), WASM_STRUCT_GET(subtype_index, kFieldIndex, WASM_REF_CAST(WASM_LOCAL_GET(kStructIndexCode), WASM_LOCAL_GET(kRttIndexCode))))), kExprEnd}); tester.CompileModule(); Handle<Object> ref_result = tester.GetResultObject(kRttCanon).ToHandleChecked(); CHECK(ref_result->IsMap()); Handle<Map> map = Handle<Map>::cast(ref_result); CHECK(map->IsWasmStructMap()); CHECK_EQ(reinterpret_cast<Address>( tester.instance()->module()->struct_type(type_index)), map->wasm_type_info().foreign_address()); Handle<Object> subref_result = tester.GetResultObject(kRttSub).ToHandleChecked(); CHECK(subref_result->IsMap()); Handle<Map> submap = Handle<Map>::cast(subref_result); CHECK_EQ(reinterpret_cast<Address>( tester.instance()->module()->struct_type(subtype_index)), submap->wasm_type_info().foreign_address()); Handle<Object> subref_result_canonicalized = tester.GetResultObject(kRttSub).ToHandleChecked(); CHECK(subref_result.is_identical_to(subref_result_canonicalized)); Handle<Object> s = tester.GetResultObject(kStructWithRtt).ToHandleChecked(); CHECK(s->IsWasmStruct()); CHECK_EQ(Handle<WasmStruct>::cast(s)->map(), *map); tester.CheckResult(kRefCast, 43); } TEST(NoDepthRtt) { WasmGCTester tester; const byte type_index = tester.DefineStruct({F(wasm::kWasmI32, true)}); const byte subtype_index = tester.DefineStruct({F(wasm::kWasmI32, true), F(wasm::kWasmI32, true)}); const byte empty_struct_index = tester.DefineStruct({}); ValueType kRttSubtypeNoDepth = ValueType::Rtt(subtype_index); FunctionSig sig_t2_v_nd(1, 0, &kRttSubtypeNoDepth); const byte kRttSubtypeCanon = tester.DefineFunction( &sig_t2_v_nd, {}, {WASM_RTT_CANON(subtype_index), kExprEnd}); const byte kRttSubtypeSub = tester.DefineFunction( &sig_t2_v_nd, {}, {WASM_RTT_SUB(subtype_index, WASM_RTT_CANON(type_index)), kExprEnd}); const byte kTestCanon = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LOCAL_SET(0, WASM_STRUCT_NEW_WITH_RTT( subtype_index, WASM_I32V(11), WASM_I32V(42), WASM_RTT_CANON(subtype_index))), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_CALL_FUNCTION0(kRttSubtypeCanon)), kExprEnd}); const byte kTestSub = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LOCAL_SET( 0, WASM_STRUCT_NEW_WITH_RTT( subtype_index, WASM_I32V(11), WASM_I32V(42), WASM_RTT_SUB(subtype_index, WASM_RTT_CANON(type_index)))), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_CALL_FUNCTION0(kRttSubtypeSub)), kExprEnd}); const byte kTestSubVsEmpty = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LOCAL_SET(0, WASM_STRUCT_NEW_WITH_RTT( subtype_index, WASM_I32V(11), WASM_I32V(42), WASM_RTT_SUB(subtype_index, WASM_RTT_CANON(empty_struct_index)))), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_CALL_FUNCTION0(kRttSubtypeSub)), kExprEnd}); const byte kTestSubVsCanon = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LOCAL_SET(0, WASM_STRUCT_NEW_WITH_RTT( subtype_index, WASM_I32V(11), WASM_I32V(42), WASM_RTT_CANON(subtype_index))), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_CALL_FUNCTION0(kRttSubtypeSub)), kExprEnd}); const byte kTestCanonVsSub = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LOCAL_SET( 0, WASM_STRUCT_NEW_WITH_RTT( subtype_index, WASM_I32V(11), WASM_I32V(42), WASM_RTT_SUB(subtype_index, WASM_RTT_CANON(type_index)))), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_CALL_FUNCTION0(kRttSubtypeCanon)), kExprEnd}); const byte kTestSuperVsSub = tester.DefineFunction( tester.sigs.i_v(), {optref(type_index)}, {WASM_LOCAL_SET(0, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_RTT_CANON(type_index))), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_CALL_FUNCTION0(kRttSubtypeCanon)), kExprEnd}); tester.CompileModule(); tester.CheckResult(kTestCanon, 1); tester.CheckResult(kTestSub, 1); tester.CheckResult(kTestSubVsEmpty, 0); tester.CheckResult(kTestSubVsCanon, 0); tester.CheckResult(kTestCanonVsSub, 0); tester.CheckResult(kTestSuperVsSub, 0); } WASM_COMPILED_EXEC_TEST(ArrayNewMap) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineArray(kWasmI32, true); ValueType array_type = ValueType::Ref(type_index, kNonNullable); FunctionSig sig(1, 0, &array_type); const byte array_new_with_rtt = tester.DefineFunction( &sig, {}, {WASM_ARRAY_NEW_WITH_RTT(type_index, WASM_I32V(10), WASM_I32V(42), WASM_RTT_CANON(type_index)), kExprEnd}); ValueType rtt_type = ValueType::Rtt(type_index, 0); FunctionSig rtt_canon_sig(1, 0, &rtt_type); const byte kRttCanon = tester.DefineFunction( &rtt_canon_sig, {}, {WASM_RTT_CANON(type_index), kExprEnd}); tester.CompileModule(); Handle<Object> map = tester.GetResultObject(kRttCanon).ToHandleChecked(); Handle<Object> result = tester.GetResultObject(array_new_with_rtt).ToHandleChecked(); CHECK(result->IsWasmArray()); CHECK_EQ(Handle<WasmArray>::cast(result)->map(), *map); } WASM_COMPILED_EXEC_TEST(FunctionRefs) { WasmGCTester tester(execution_tier); const byte func_index = tester.DefineFunction(tester.sigs.i_v(), {}, {WASM_I32V(42), kExprEnd}); const byte sig_index = 0; const byte other_sig_index = tester.DefineSignature(tester.sigs.d_d()); // This is just so func_index counts as "declared". tester.AddGlobal(ValueType::Ref(sig_index, kNullable), false, WasmInitExpr::RefFuncConst(func_index)); ValueType func_type = ValueType::Ref(sig_index, kNullable); FunctionSig sig_func(1, 0, &func_type); ValueType rtt0 = ValueType::Rtt(sig_index, 0); FunctionSig sig_rtt0(1, 0, &rtt0); const byte rtt_canon = tester.DefineFunction( &sig_rtt0, {}, {WASM_RTT_CANON(sig_index), kExprEnd}); const byte cast = tester.DefineFunction( &sig_func, {kWasmFuncRef}, {WASM_LOCAL_SET(0, WASM_REF_FUNC(func_index)), WASM_REF_CAST(WASM_LOCAL_GET(0), WASM_RTT_CANON(sig_index)), kExprEnd}); const byte cast_reference = tester.DefineFunction( &sig_func, {}, {WASM_REF_FUNC(sig_index), kExprEnd}); const byte test = tester.DefineFunction( tester.sigs.i_v(), {kWasmFuncRef}, {WASM_LOCAL_SET(0, WASM_REF_FUNC(func_index)), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_RTT_CANON(sig_index)), kExprEnd}); const byte test_fail_1 = tester.DefineFunction( tester.sigs.i_v(), {kWasmFuncRef}, {WASM_LOCAL_SET(0, WASM_REF_FUNC(func_index)), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_RTT_CANON(other_sig_index)), kExprEnd}); const byte test_fail_2 = tester.DefineFunction( tester.sigs.i_v(), {kWasmFuncRef}, {WASM_LOCAL_SET(0, WASM_REF_FUNC(func_index)), WASM_REF_TEST(WASM_LOCAL_GET(0), WASM_RTT_SUB(sig_index, WASM_RTT_CANON(sig_index))), kExprEnd}); tester.CompileModule(); Handle<Object> result_canon = tester.GetResultObject(rtt_canon).ToHandleChecked(); CHECK(result_canon->IsMap()); Handle<Map> map_canon = Handle<Map>::cast(result_canon); CHECK(map_canon->IsJSFunctionMap()); Handle<Object> result_cast = tester.GetResultObject(cast).ToHandleChecked(); CHECK(result_cast->IsJSFunction()); Handle<JSFunction> cast_function = Handle<JSFunction>::cast(result_cast); Handle<Object> result_cast_reference = tester.GetResultObject(cast_reference).ToHandleChecked(); CHECK(result_cast_reference->IsJSFunction()); Handle<JSFunction> cast_function_reference = Handle<JSFunction>::cast(result_cast_reference); CHECK_EQ(cast_function->code().raw_instruction_start(), cast_function_reference->code().raw_instruction_start()); tester.CheckResult(test, 1); tester.CheckResult(test_fail_1, 0); tester.CheckResult(test_fail_2, 0); } WASM_COMPILED_EXEC_TEST(CallRef) { WasmGCTester tester(execution_tier); byte callee = tester.DefineFunction( tester.sigs.i_ii(), {}, {WASM_I32_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)), kExprEnd}); byte caller = tester.DefineFunction( tester.sigs.i_i(), {}, {WASM_CALL_REF(WASM_REF_FUNC(callee), WASM_I32V(42), WASM_LOCAL_GET(0)), kExprEnd}); // This is just so func_index counts as "declared". tester.AddGlobal(ValueType::Ref(0, kNullable), false, WasmInitExpr::RefFuncConst(callee)); tester.CompileModule(); tester.CheckResult(caller, 47, 5); } WASM_COMPILED_EXEC_TEST(RefTestCastNull) { WasmGCTester tester(execution_tier); byte type_index = tester.DefineStruct({F(wasm::kWasmI32, true)}); const byte kRefTestNull = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_REF_TEST(WASM_REF_NULL(type_index), WASM_RTT_CANON(type_index)), kExprEnd}); const byte kRefCastNull = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_REF_IS_NULL(WASM_REF_CAST(WASM_REF_NULL(type_index), WASM_RTT_CANON(type_index))), kExprEnd}); tester.CompileModule(); tester.CheckResult(kRefTestNull, 0); tester.CheckResult(kRefCastNull, 1); } WASM_COMPILED_EXEC_TEST(AbstractTypeChecks) { WasmGCTester tester(execution_tier); byte array_index = tester.DefineArray(kWasmI32, true); byte function_index = tester.DefineFunction(tester.sigs.v_v(), {}, {kExprEnd}); byte sig_index = 1; // This is just so func_index counts as "declared". tester.AddGlobal(ValueType::Ref(sig_index, kNullable), false, WasmInitExpr::RefFuncConst(function_index)); byte kDataCheckNull = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_REF_IS_DATA(WASM_REF_NULL(kAnyRefCode)), kExprEnd}); byte kFuncCheckNull = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_REF_IS_FUNC(WASM_REF_NULL(kAnyRefCode)), kExprEnd}); byte kI31CheckNull = tester.DefineFunction( tester.sigs.i_v(), {}, {WASM_REF_IS_I31(WASM_REF_NULL(kAnyRefCode)), kExprEnd}); byte kDataCastNull = tester.DefineFunction(tester.sigs.i_v(), {}, {WASM_REF_AS_DATA(WASM_REF_NULL(kAnyRefCode)), WASM_DROP, WASM_I32V(1), kExprEnd}); byte kFuncCastNull = tester.DefineFunction(tester.sigs.i_v(), {}, {WASM_REF_AS_FUNC(WASM_REF_NULL(kAnyRefCode)), WASM_DROP, WASM_I32V(1), kExprEnd}); byte kI31CastNull = tester.DefineFunction(tester.sigs.i_v(), {}, {WASM_REF_AS_I31(WASM_REF_NULL(kAnyRefCode)), WASM_DROP, WASM_I32V(1), kExprEnd}); #define TYPE_CHECK(type, value) \ tester.DefineFunction(tester.sigs.i_v(), {kWasmAnyRef}, \ {WASM_LOCAL_SET(0, WASM_SEQ(value)), \ WASM_REF_IS_##type(WASM_LOCAL_GET(0)), kExprEnd}) byte kDataCheckSuccess = TYPE_CHECK(DATA, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); byte kDataCheckFailure = TYPE_CHECK(DATA, WASM_I31_NEW(WASM_I32V(42))); byte kFuncCheckSuccess = TYPE_CHECK(FUNC, WASM_REF_FUNC(function_index)); byte kFuncCheckFailure = TYPE_CHECK(FUNC, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); byte kI31CheckSuccess = TYPE_CHECK(I31, WASM_I31_NEW(WASM_I32V(42))); byte kI31CheckFailure = TYPE_CHECK(I31, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); #undef TYPE_CHECK #define TYPE_CAST(type, value) \ tester.DefineFunction(tester.sigs.i_v(), {kWasmAnyRef}, \ {WASM_LOCAL_SET(0, WASM_SEQ(value)), \ WASM_REF_AS_##type(WASM_LOCAL_GET(0)), WASM_DROP, \ WASM_I32V(1), kExprEnd}) byte kDataCastSuccess = TYPE_CAST(DATA, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); byte kDataCastFailure = TYPE_CAST(DATA, WASM_I31_NEW(WASM_I32V(42))); byte kFuncCastSuccess = TYPE_CAST(FUNC, WASM_REF_FUNC(function_index)); byte kFuncCastFailure = TYPE_CAST(FUNC, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); byte kI31CastSuccess = TYPE_CAST(I31, WASM_I31_NEW(WASM_I32V(42))); byte kI31CastFailure = TYPE_CAST(I31, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); #undef TYPE_CAST // If the branch is not taken, we return 0. If it is taken, then the respective // type check should succeed, and we return 1. #define BR_ON(TYPE, type, value) \ tester.DefineFunction( \ tester.sigs.i_v(), {kWasmAnyRef}, \ {WASM_LOCAL_SET(0, WASM_SEQ(value)), \ WASM_REF_IS_##TYPE(WASM_BLOCK_R( \ kWasm##type##Ref, WASM_BR_ON_##TYPE(0, WASM_LOCAL_GET(0)), \ WASM_RETURN(WASM_I32V(0)))), \ kExprEnd}) byte kBrOnDataTaken = BR_ON(DATA, Data, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); byte kBrOnDataNotTaken = BR_ON(DATA, Data, WASM_REF_FUNC(function_index)); byte kBrOnFuncTaken = BR_ON(FUNC, Func, WASM_REF_FUNC(function_index)); byte kBrOnFuncNotTaken = BR_ON(FUNC, Func, WASM_I31_NEW(WASM_I32V(42))); byte kBrOnI31Taken = BR_ON(I31, I31, WASM_I31_NEW(WASM_I32V(42))); byte kBrOnI31NotTaken = BR_ON(I31, I31, WASM_ARRAY_NEW_DEFAULT(array_index, WASM_I32V(10), WASM_RTT_CANON(array_index))); #undef BR_ON tester.CompileModule(); tester.CheckResult(kDataCheckNull, 0); tester.CheckHasThrown(kDataCastNull); tester.CheckResult(kDataCheckSuccess, 1); tester.CheckResult(kDataCheckFailure, 0); tester.CheckResult(kDataCastSuccess, 1); tester.CheckHasThrown(kDataCastFailure); tester.CheckResult(kBrOnDataTaken, 1); tester.CheckResult(kBrOnDataNotTaken, 0); tester.CheckResult(kFuncCheckNull, 0); tester.CheckHasThrown(kFuncCastNull); tester.CheckResult(kFuncCheckSuccess, 1); tester.CheckResult(kFuncCheckFailure, 0); tester.CheckResult(kFuncCastSuccess, 1); tester.CheckHasThrown(kFuncCastFailure); tester.CheckResult(kBrOnFuncTaken, 1); tester.CheckResult(kBrOnFuncNotTaken, 0); tester.CheckResult(kI31CheckNull, 0); tester.CheckHasThrown(kI31CastNull); tester.CheckResult(kI31CheckSuccess, 1); tester.CheckResult(kI31CheckFailure, 0); tester.CheckResult(kI31CastSuccess, 1); tester.CheckHasThrown(kI31CastFailure); tester.CheckResult(kBrOnI31Taken, 1); tester.CheckResult(kBrOnI31NotTaken, 0); } WASM_COMPILED_EXEC_TEST(BasicI31) { WasmGCTester tester(execution_tier); const byte kSigned = tester.DefineFunction( tester.sigs.i_i(), {}, {WASM_I31_GET_S(WASM_I31_NEW(WASM_LOCAL_GET(0))), kExprEnd}); const byte kUnsigned = tester.DefineFunction( tester.sigs.i_i(), {}, {WASM_I31_GET_U(WASM_I31_NEW(WASM_LOCAL_GET(0))), kExprEnd}); tester.CompileModule(); tester.CheckResult(kSigned, 123, 123); tester.CheckResult(kUnsigned, 123, 123); // Truncation: tester.CheckResult(kSigned, 0x1234, static_cast<int32_t>(0x80001234)); tester.CheckResult(kUnsigned, 0x1234, static_cast<int32_t>(0x80001234)); // Sign/zero extension: tester.CheckResult(kSigned, -1, 0x7FFFFFFF); tester.CheckResult(kUnsigned, 0x7FFFFFFF, 0x7FFFFFFF); } // This flushed out a few bugs, so it serves as a regression test. It can also // be modified (made to run longer) to measure performance of casts. WASM_COMPILED_EXEC_TEST(CastsBenchmark) { WasmGCTester tester(execution_tier); const byte SuperType = tester.DefineStruct({F(wasm::kWasmI32, true)}); const byte SubType = tester.DefineStruct({F(wasm::kWasmI32, true), F(wasm::kWasmI32, true)}); ValueType kDataRefNull = ValueType::Ref(HeapType::kData, kNullable); const byte ListType = tester.DefineArray(kDataRefNull, true); const byte List = tester.AddGlobal(ValueType::Ref(ListType, kNullable), true, WasmInitExpr::RefNullConst( static_cast<HeapType::Representation>(ListType))); const byte RttSuper = tester.AddGlobal( ValueType::Rtt(SuperType, 0), false, WasmInitExpr::RttCanon(static_cast<HeapType::Representation>(SuperType))); const byte RttSub = tester.AddGlobal( ValueType::Rtt(SubType, 1), false, WasmInitExpr::RttSub(static_cast<HeapType::Representation>(SubType), WasmInitExpr::GlobalGet(RttSuper))); const byte RttList = tester.AddGlobal( ValueType::Rtt(ListType, 0), false, WasmInitExpr::RttCanon(static_cast<HeapType::Representation>(ListType))); const uint32_t kListLength = 1024; const uint32_t i = 0; const byte Prepare = tester.DefineFunction( tester.sigs.i_v(), {wasm::kWasmI32}, {// List = new eqref[kListLength]; WASM_GLOBAL_SET(List, WASM_ARRAY_NEW_DEFAULT(ListType, WASM_I32V(kListLength), WASM_GLOBAL_GET(RttList))), // for (int i = 0; i < kListLength; ) { // List[i] = new Super(i); // i++; // List[i] = new Sub(i, 0); // i++; // } WASM_LOCAL_SET(i, WASM_I32V_1(0)), WASM_LOOP( WASM_ARRAY_SET(ListType, WASM_GLOBAL_GET(List), WASM_LOCAL_GET(i), WASM_STRUCT_NEW_WITH_RTT(SuperType, WASM_LOCAL_GET(i), WASM_GLOBAL_GET(RttSuper))), WASM_LOCAL_SET(i, WASM_I32_ADD(WASM_LOCAL_GET(i), WASM_I32V_1(1))), WASM_ARRAY_SET(ListType, WASM_GLOBAL_GET(List), WASM_LOCAL_GET(i), WASM_STRUCT_NEW_WITH_RTT(SubType, WASM_LOCAL_GET(i), WASM_I32V_1(0), WASM_GLOBAL_GET(RttSub))), WASM_LOCAL_SET(i, WASM_I32_ADD(WASM_LOCAL_GET(i), WASM_I32V_1(1))), WASM_BR_IF(0, WASM_I32_NE(WASM_LOCAL_GET(i), WASM_I32V(kListLength)))), // return 42; // Dummy value, due to test framework. WASM_I32V_1(42), kExprEnd}); const uint32_t sum = 1; // Index of the local. const uint32_t list = 2; const uint32_t kLoops = 2; const uint32_t kIterations = kLoops * kListLength; const byte Main = tester.DefineFunction( tester.sigs.i_v(), { wasm::kWasmI32, wasm::kWasmI32, ValueType::Ref(ListType, kNullable), }, {WASM_LOCAL_SET(list, WASM_GLOBAL_GET(List)), // sum = 0; WASM_LOCAL_SET(sum, WASM_I32V_1(0)), // for (int i = 0; i < kIterations; i++) { // sum += ref.cast<super>(List[i & kListLength]).x // } WASM_LOCAL_SET(i, WASM_I32V_1(0)), WASM_LOOP( WASM_LOCAL_SET( sum, WASM_I32_ADD( WASM_LOCAL_GET(sum), WASM_STRUCT_GET( SuperType, 0, WASM_REF_CAST( WASM_ARRAY_GET( ListType, WASM_LOCAL_GET(list), WASM_I32_AND(WASM_LOCAL_GET(i), WASM_I32V(kListLength - 1))), WASM_GLOBAL_GET(RttSuper))))), WASM_LOCAL_SET(i, WASM_I32_ADD(WASM_LOCAL_GET(i), WASM_I32V_1(1))), WASM_BR_IF(0, WASM_I32_LTS(WASM_LOCAL_GET(i), WASM_I32V(kIterations)))), // return sum; WASM_LOCAL_GET(sum), kExprEnd}); tester.CompileModule(); tester.CheckResult(Prepare, 42); // Time this section to get a benchmark for subtyping checks. // Note: if you bump kIterations or kListLength, you may have to take i32 // overflow into account. tester.CheckResult(Main, (kListLength * (kListLength - 1) / 2) * kLoops); } WASM_COMPILED_EXEC_TEST(GlobalInitReferencingGlobal) { WasmGCTester tester(execution_tier); const byte from = tester.AddGlobal(kWasmI32, false, WasmInitExpr(42)); const byte to = tester.AddGlobal(kWasmI32, false, WasmInitExpr::GlobalGet(from)); const byte func = tester.DefineFunction(tester.sigs.i_v(), {}, {WASM_GLOBAL_GET(to), kExprEnd}); tester.CompileModule(); tester.CheckResult(func, 42); } WASM_COMPILED_EXEC_TEST(IndirectNullSetManually) { WasmGCTester tester(execution_tier); byte sig_index = tester.DefineSignature(tester.sigs.i_i()); tester.DefineTable(ValueType::Ref(sig_index, kNullable), 1, 1); byte func_index = tester.DefineFunction( tester.sigs.i_i(), {}, {WASM_TABLE_SET(0, WASM_I32V(0), WASM_REF_NULL(sig_index)), WASM_CALL_INDIRECT(sig_index, WASM_I32V(0), WASM_LOCAL_GET(0)), kExprEnd}); tester.CompileModule(); tester.CheckHasThrown(func_index, 42); } WASM_COMPILED_EXEC_TEST(JsAccess) { WasmGCTester tester(execution_tier); const byte type_index = tester.DefineStruct({F(wasm::kWasmI32, true)}); ValueType kRefType = ref(type_index); ValueType kSupertypeToI[] = {kWasmI32, kWasmDataRef}; FunctionSig sig_t_v(1, 0, &kRefType); FunctionSig sig_super_v(1, 0, &kWasmDataRef); FunctionSig sig_i_super(1, 1, kSupertypeToI); tester.DefineExportedFunction( "disallowed", &sig_t_v, {WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_RTT_CANON(type_index)), kExprEnd}); // Same code, different signature. tester.DefineExportedFunction( "producer", &sig_super_v, {WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42), WASM_RTT_CANON(type_index)), kExprEnd}); tester.DefineExportedFunction( "consumer", &sig_i_super, {WASM_STRUCT_GET( type_index, 0, WASM_REF_CAST(WASM_LOCAL_GET(0), WASM_RTT_CANON(type_index))), kExprEnd}); tester.CompileModule(); Isolate* isolate = tester.isolate(); TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); MaybeHandle<Object> maybe_result = tester.CallExportedFunction("disallowed", 0, nullptr); CHECK(maybe_result.is_null()); CHECK(try_catch.HasCaught()); try_catch.Reset(); isolate->clear_pending_exception(); maybe_result = tester.CallExportedFunction("producer", 0, nullptr); if (maybe_result.is_null()) { FATAL("Calling 'producer' failed: %s", *v8::String::Utf8Value(reinterpret_cast<v8::Isolate*>(isolate), try_catch.Message()->Get())); } { Handle<Object> args[] = {maybe_result.ToHandleChecked()}; maybe_result = tester.CallExportedFunction("consumer", 1, args); } if (maybe_result.is_null()) { FATAL("Calling 'consumer' failed: %s", *v8::String::Utf8Value(reinterpret_cast<v8::Isolate*>(isolate), try_catch.Message()->Get())); } Handle<Object> result = maybe_result.ToHandleChecked(); CHECK(result->IsSmi()); CHECK_EQ(42, Smi::cast(*result).value()); // Calling {consumer} with any other object (e.g. the Smi we just got as // {result}) should trap. { Handle<Object> args[] = {result}; maybe_result = tester.CallExportedFunction("consumer", 1, args); } CHECK(maybe_result.is_null()); CHECK(try_catch.HasCaught()); try_catch.Reset(); isolate->clear_pending_exception(); } } // namespace test_gc } // namespace wasm } // namespace internal } // namespace v8
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
d57904638dc4f1a6774a3a638859285963823c6e
5470741500daf8ff820bf1fa30498e2984a3d403
/cykTable.h
533087803f00fa15e959876119089bddf7c01156
[]
no_license
alanarteagav/cykCpp
0443400e1f8a6b20f87e8ec6e0c78eb41712e4ee
d5a86a5eb10f0c634dffede664b796db6c108f62
refs/heads/master
2020-05-14T22:23:09.083493
2019-04-25T13:12:57
2019-04-25T13:12:57
181,978,081
0
0
null
null
null
null
UTF-8
C++
false
false
2,159
h
#include <iterator> #include <map> #include <unordered_set> #include <string> #include <vector> using namespace std; // Clase tabla CYK, permite abstraer la tabla de posibles derivaciones para la // ejecución del algoritmo CYK. class CYKTable { private: // La tabla CYK, implementada como un vector multidimensional, cuyos // elementos son conjuntos sin orden. vector< vector<unordered_set <string> > > table; public: // Constructor de la tabla CYK. Recibe una cadena a partir de la cual se // inicializa la tabla con conjuntos vacíos. CYKTable (string input){ vector< vector<unordered_set <string> > > newTable(input.length()); for (int i = 0; i < input.length(); i++) { vector<unordered_set <string> > step(i+1); newTable[i] = step; } table = newTable; } // Función que determina si una cadena figura en el conjunto subyaciente a // cierta entrada de la tabla. bool isInEntry (string str, int i, int j){ unordered_set <string> stringSet = table[i-1][j]; if (stringSet.find(str) != stringSet.end()) return true; else return false; } // Función que añade una cadena figura al conjunto subyaciente a // cierta entrada de la tabla. void addToEntry (string str, int i, int j){ table[i-1][j].insert(str); } // Función que reegresa la representación en cadena de la tabla CYK. string toString(){ string str; unordered_set<string>::iterator it; for (auto vec : table){ str += "["; for(auto stringSet : vec){ if (stringSet.empty()) { str += " Ø , "; } else { str += "["; for (it = stringSet.begin(); it != stringSet.end(); ++it) str += *it + ", "; str.pop_back(); str.pop_back(); str += "], "; } } str.pop_back(); str.pop_back(); str += "]\n"; } return str; } };
[ "alanarteagav@ciencias.unam.mx" ]
alanarteagav@ciencias.unam.mx
996d44be35818f3c5929dec76c16ef08a46470ac
1a381efd10255ccd353e10ff7bf53106812cf422
/CurrentViewer/DBHandler/agDBFunction.cpp
3a88686b936680f7276d5c1af377ccd6222bcdf8
[]
no_license
hankkuu/CurrentViewer
0e8367e0b13606ab1df6fd034434506e64fbbcb9
c54c229c23ec686e8bec55f17a33da0a70267a1a
refs/heads/master
2022-07-04T03:26:01.194108
2020-05-15T01:12:21
2020-05-15T01:12:21
264,060,647
0
0
null
null
null
null
UHC
C++
false
false
24,095
cpp
#include "StdAfx.h" #include "agDBFunction.h" #include <qhostinfo.h> #include <QNetworkInterface.h> #include <QhostInfo> #include "Cgzip.h" #include "DBHandler/qDBAccssor.h" agDBFunction* agDBFunction::m_pInstance = 0; agDBFunction* agDBFunction::Instance() { if ( m_pInstance == 0 ) { m_pInstance = new agDBFunction; std::atexit(&ExitInstance); } return m_pInstance; } void agDBFunction::ExitInstance() { if ( m_pInstance ) { delete m_pInstance; m_pInstance = 0; } } agDBFunction::agDBFunction(QObject *parent) : QObject(parent) { qDbAccssor->connectDB(); } agDBFunction::~agDBFunction() { } bool agDBFunction::setEnbox() { bool bRet = false; QString strMyComName = QHostInfo::localHostName(); if( strMyComName.isNull() ) return bRet; int nCount = 0; nCount = qDbAccssor->GetServerCount(); QString officeCode = qDbAccssor->getServerName(0); QString officeName = qDbAccssor->getOfficeName(officeCode); QString strQuery; strQuery.sprintf("SELECT enbox_number FROM enbox_info where computer_name = '%s'", strMyComName.toStdString().c_str() ); int nEnboxNum = 0; QSqlDatabase db; if( qDbAccssor->getDBInstatnce(DAS, officeCode, db) == true ) // QSqlDatabase의객체를가져오는함수( 사업소코드와DB 타입으로가져옴) { if( db.isOpen() ) { QSqlQuery query(db); QString strErr; if( qDbAccssor->getCommand(strQuery , query , strErr) != true ) // 쿼리 날려서 해당결과를 QSqlQuery 객체에담아옴. { // strErr 표시 //GlobalLog->writelog(strErr.toLocal8Bit().data()); return bRet; } while(query.next()) // 결과확인 { nEnboxNum = query.value(0).toInt(); } setEnboxData( nEnboxNum ); bRet = true; } } return bRet; } void agDBFunction::setEnboxData( int nEnboxNum ) { m_enboxData.push_back(nEnboxNum); } QVector<int> agDBFunction::getEnboxData() { return m_enboxData; } bool agDBFunction::LoadDataSubsAndCbName() { bool bRet = false; int nCount = 0; nCount = qDbAccssor->GetServerCount(); for(int i = 0 ; i < nCount ; i++) { QString officeCode = qDbAccssor->getServerName(i); QString officeName = qDbAccssor->getOfficeName(officeCode); QString strQuery; strQuery.sprintf("select subs_name, dl_name, cb_id from mmi_subs_info order by subs_name, dl_name asc"); QSqlDatabase db; if( qDbAccssor->getDBInstatnce(DAS, officeCode, db) == true ) // QSqlDatabase의객체를가져오는함수( 사업소코드와DB 타입으로가져옴) { if( db.isOpen() ) { QSqlQuery query(db); QString strErr; if( qDbAccssor->getCommand(strQuery , query , strErr) != true ) // 쿼리 날려서 해당결과를 QSqlQuery 객체에담아옴. { // strErr 표시 //GlobalLog->writelog(strErr.toLocal8Bit().data()); return bRet; } DLInfo Info; QVector<DLInfo>* vtDlName; TypeSubStationMap SubStationMap; while(query.next()) { QString strSubStationName = query.value(0).toString(); QString strDLName = query.value(1).toString(); int nCbId = query.value(2).toInt(); TypeSubStationMap::iterator iter = SubStationMap.find(strSubStationName); if( iter != SubStationMap.end() ) { Info.nCBId = nCbId; Info.strDLName = strDLName; vtDlName->push_back(Info); } else { Info.nCBId = nCbId; Info.strDLName = strDLName; vtDlName = new QVector<DLInfo>; // 프로그램 종료시 메모리 해제 해줘야 함 vtDlName->push_back(Info); SubStationMap.insert(strSubStationName, vtDlName); } } m_ServerMap.insertMulti( officeCode, SubStationMap ); bool bRet = true; } } } return bRet; } TypeServerMap agDBFunction::GetServerMap() { return m_ServerMap; } void agDBFunction::cleanServerData() { TypeServerMap cleanServer = GetServerMap(); QMapIterator<QString, TypeSubStationMap> serverItr(cleanServer); while( serverItr.hasNext() ) { serverItr.next(); TypeSubStationMap cleanSubstation = serverItr.value(); QMapIterator<QString, TypeDLName*> subItr(cleanSubstation); while( subItr.hasNext() ) { subItr.next(); TypeDLName* cleanDL = subItr.value(); if( !cleanDL->isEmpty() ) { delete cleanDL; cleanDL = NULL; } } } if( !cleanServer.isEmpty() ) m_ServerMap.clear(); } bool agDBFunction::CreateOLD(QString strOffice, int nCBId) { bool bRet = false; QString officeName = qDbAccssor->getOfficeName(strOffice); QString strQuery; strQuery.sprintf("select Top (1) XMLTable.AlarmTime, XMLTable.xml, XmlOutSize, XmlInSize, CBData.subs_name, CBData.dl_name, CBData.cb_id \ from Enterprise_OLDXML XMLTable, \ ( \ select Tree.subs_name, Tree.dl_name, Tree.dl_id, Tree.cb_id \ from mmi_subs_info Tree \ inner join dl DL \ on Tree.dl_id = DL.dl_id \ and Tree.cb_id = DL.cb_id \ ) CBData \ where CBData.cb_id = %d \ and old_type = 0 \ and XMLTable.dl_id = CBData.dl_id \ order by alarmTime desc", nCBId); QSqlDatabase db; if( qDbAccssor->getDBInstatnce(DAS, strOffice, db) == true ) // QSqlDatabase의객체를가져오는함수( 사업소코드와DB 타입으로가져옴) { if( db.isOpen() ) { QSqlQuery query(db); QString strErr; if( qDbAccssor->getCommand(strQuery , query , strErr) != true ) // 쿼리 날려서 해당결과를 QSqlQuery 객체에담아옴. { // strErr 표시 //GlobalLog->writelog(strErr.toLocal8Bit().data()); return bRet; } while(query.next()) { QString strAlarmTime = query.value(0).toString(); QByteArray strXml = query.value(1).toByteArray(); int nXMLOutSize = query.value(2).toInt(); int nXMLInSize = query.value(3).toInt(); QString strSubST = query.value(4).toString(); QString strDLName = query.value(5).toString(); int nCBId = query.value(6).toInt(); PBYTE pData = reinterpret_cast<PBYTE>(strXml.data()); std::string strData(pData , pData + nXMLOutSize); Cgzip zip; std::wstring strXmlData = zip.DCompress(nXMLInSize , nXMLOutSize , strData).c_str(); setOLDCreateTime( strAlarmTime ); SetXMLDLInfo(strOffice, nCBId, strXmlData); } bRet = true; } } return bRet; } void agDBFunction::setOLDCreateTime(QString strAlarmTime ) // 단선도 화면에 현재 계통 시간을 찍어두려고 했는데... 미구현될 듯 { m_strOLDCreateTime = strAlarmTime; } QString agDBFunction::getOLDCreateTime( ) { return m_strOLDCreateTime; } QString agDBFunction::GetXMLDLInfo() { return m_XMLDLInfo; } void agDBFunction::SetXMLDLInfo(QString strOffice, int nCBId, std::wstring strDLInfo) { QString strDLXmlData; strDLXmlData = QString::fromStdWString(strDLInfo); TypeDLXmlData DLInfoMap; // 후에 XML 이력 관리를 해야할 수도 있으므로 일단 놔둔다(2차 개발) TypeServerDLInfoMap ServerDLInfoMap; TypeServerDLInfoMap::iterator ServerDLIter = ServerDLInfoMap.find(strOffice); if( ServerDLIter != ServerDLInfoMap.end() ) // 현재는 이쪽이랑은 볼일 없음 { TypeDLXmlData::iterator XmlIter = DLInfoMap.find(nCBId); if( XmlIter != DLInfoMap.end() ) { m_XMLDLInfo = (*XmlIter); } else { DLInfoMap.insert(nCBId, strDLXmlData); ServerDLInfoMap.insertMulti(strOffice, DLInfoMap); } } else { DLInfoMap.insert(nCBId, strDLXmlData); ServerDLInfoMap.insertMulti(strOffice, DLInfoMap); m_XMLDLInfo = strDLXmlData; } } bool agDBFunction::CreateTotalCurrent(QString strOffice, int nCBId) { bool bIsEmptyLine = false; QString LineDataQuery = makeSecQuery(); if( LineDataQuery.isEmpty() ) bIsEmptyLine = true; QString (LineDataQuery.toLocal8Bit()); QList<int> lineDataList = GetChartLineData(); int nMainLineSize = lineDataList.count(); QString strCurrentData = getCurrentTime(); QString sTable = makeDBTableQuery(strCurrentData, strCurrentData, HOUR); bool bRet = false; QString officeName = qDbAccssor->getOfficeName(strOffice); QString strQuery; strQuery.sprintf("SELECT top(%d) [sec_id] \ ,[avg_current_a] \ ,[avg_current_b] \ ,[avg_current_c] \ ,[datetime] \ ,[treacherousData] \ ,[msg] \ FROM [%s] \ where sec_id in (%s) \ order by [datetime] desc", nMainLineSize, sTable.toStdString().c_str(), LineDataQuery.toStdString().c_str() ); QSqlDatabase db; if( qDbAccssor->getDBInstatnce(DAS_LOG, strOffice, db) == true ) // QSqlDatabase의객체를가져오는함수( 사업소코드와DB 타입으로가져옴) { if( db.isOpen() ) { QSqlQuery query(db); QString strErr; if( qDbAccssor->getCommand(strQuery , query , strErr) != true ) // 쿼리 날려서 해당결과를 QSqlQuery 객체에담아옴. { // strErr 표시 //GlobalLog->writelog(strErr.toLocal8Bit().data()); return bRet; } if( nMainLineSize == 0 ) { QMessageBox msg; msg.setText( QString::fromLocal8Bit("CB만 존재하거나 선로정보를 가져오지 못했습니다.")); msg.exec(); return bRet; } ChartData stChart; TypeChartDataMap ChartMap; QList<int> noQueryLineId; while(query.next()) { int nSec_id = query.value(0).toInt(); float fAvg_Current_a = query.value(1).toFloat(); float fAvg_Current_b = query.value(2).toFloat(); float fAvg_Current_c = query.value(3).toFloat(); QString sDateTime = query.value(4).toString(); bool bUnreliable = query.value(5).toBool(); QString sMsg = query.value(6).toString(); QListIterator<int> checkLineList(lineDataList); while( checkLineList.hasNext() ) { if( checkLineList.findNext(nSec_id) ) { stChart.nSecId = nSec_id; stChart.fAvg_Current_a = fAvg_Current_a; stChart.fAvg_Current_b = fAvg_Current_b; stChart.fAvg_Current_c = fAvg_Current_c; ChartMap.insert(stChart.nSecId, stChart); } } } QListIterator<int> checkQueryLine(lineDataList); // 쿼리 data가 없는 경우 while ( checkQueryLine.hasNext() ) { int nCheckLine = checkQueryLine.next(); QMap<int, ChartData>::iterator checkRemoveLine = ChartMap.find(nCheckLine); while (checkRemoveLine == ChartMap.end()) { stChart.nSecId = nCheckLine; stChart.fAvg_Current_a = 0.0; stChart.fAvg_Current_b = 0.0; stChart.fAvg_Current_c = 0.0; ChartMap.insert(stChart.nSecId, stChart ); noQueryLineId.append(nCheckLine); checkRemoveLine++; } } setNoQueryLineList(noQueryLineId); SetChartSortLineData(ChartMap); bRet = true; } } return bRet; } void agDBFunction::SetChartLineData(QList<int> LineIdList) { m_LineIdList = LineIdList; } QList<int> agDBFunction::GetChartLineData() { return m_LineIdList; } void agDBFunction::setNoQueryLineList(QList<int> LineIdList) { m_lstNoQueryLindID = LineIdList; } QList<int> agDBFunction::getNoQueryLineList() { return m_lstNoQueryLindID; } bool agDBFunction::makeTimeChart(QString strOffice, QString fromDate, QString toDate, DateType dType) { m_ChartMap.clear(); bool bIsEmptyLine = false; QString LineDataQuery = makeSecQuery(); if( LineDataQuery.isEmpty() ) bIsEmptyLine = true; QString (LineDataQuery.toLocal8Bit()); QString sTable = makeDBTableQuery(fromDate, toDate, dType); bool bRet = false; QString officeName = qDbAccssor->getOfficeName(strOffice); QString strQuery; if( dType == MONTH || dType == DAY ) { strQuery = QString("SELECT sum([avg_current_a]), sum([avg_current_b]), sum([avg_current_c]), sumDate " "FROM (" "SELECT [avg_current_a], [avg_current_b], [avg_current_c], convert(char(10), [datetime], 23) as \"sumDate\" " "FROM [%1] " "WHERE [datetime] > '%2' " "AND [datetime] < '%3' " "AND sec_id in ( %4 )" " ) a " "GROUP BY sumDate " "ORDER BY sumDate ") .arg(sTable) //테이블명 .arg(fromDate) // 검색시작시간 .arg(toDate) // 종료시간 .arg(LineDataQuery); // 라인ID } else if( dType == HOUR ) { strQuery = QString("SELECT SUM([avg_current_a]), SUM([avg_current_b]), SUM([avg_current_c]), [datetime] " "FROM [%1] " "WHERE [datetime] > '%2' " "AND [datetime] < '%3' " "AND sec_id in ( %4 )" "GROUP BY datetime " "ORDER BY [datetime] ") .arg(sTable) //테이블명 .arg(fromDate) // 검색시작시간 .arg(toDate) // 종료시간 .arg(LineDataQuery); // 라인ID } // QString sSql = QString("SELECT [sec_id] " // ", [avg_current_a] " // ", [datetime] " // ", [avg_current_b] " // ", [avg_current_c] " // ", [treacherousData] " // ", [msg] " // "FROM [daslogv2].[dbo].[%1] " // "where convert(varchar, [datetime], 112) > '%2' " // " and convert(varchar, [datetime], 112) > '%3' " // " and sec_id = %4 " // "order by [datetime] ") // .arg(sTable) //테이블명 // .arg(fromDate + "00") // .arg(toDate + "99") // .arg(LineDataQuery); QSqlDatabase db; if( qDbAccssor->getDBInstatnce(DAS_LOG, strOffice, db) == true ) // QSqlDatabase의객체를가져오는함수( 사업소코드와DB 타입으로가져옴) { if( db.isOpen() ) { QSqlQuery query(db); QString strErr; if( qDbAccssor->getCommand(strQuery , query , strErr) != true ) // 쿼리 날려서 해당결과를 QSqlQuery 객체에담아옴. { // strErr 표시 //GlobalLog->writelog(strErr.toLocal8Bit().data()); return bRet; } if( bIsEmptyLine == true ) { QMessageBox msg; msg.setText( QString::fromLocal8Bit("선로선택이 되지 않았습니다.")); msg.exec(); return bRet; } // if(!query.isActive() ) // { // QMessageBox::warning(NULL , tr("Database Error") , query.lastError().text(), QMessageBox::NoButton); // } ChartData stChart; TypeChartDataMap chartCurrentY; int nMaxCurrent_a = 0; int nMaxCurrent_b = 0; int nMaxCurrent_c = 0; int nTimeCount = 0; while(query.next()) { // Month 일때 // Day 일때 if( dType == MONTH || dType == DAY) { //int nSecId = query.value(0).toInt(); float fAvg_Current_a = query.value(0).toFloat(); float fAvg_Current_b = query.value(1).toFloat(); float fAvg_Current_c = query.value(2).toFloat(); QString sDateTime = query.value(3).toString(); stChart.nSecId = nTimeCount; stChart.fAvg_Current_a = fAvg_Current_a; stChart.fAvg_Current_b = fAvg_Current_b; stChart.fAvg_Current_c = fAvg_Current_c; stChart.sDatetime = sDateTime; chartCurrentY.insert(nTimeCount, stChart); nTimeCount++; } else if( dType == HOUR) // Hour 일때 { float fAvg_Current_a = query.value(0).toFloat(); float fAvg_Current_b = query.value(1).toFloat(); float fAvg_Current_c = query.value(2).toFloat(); QString sDateTime = query.value(3).toString(); stChart.nSecId = nTimeCount; stChart.fAvg_Current_a = fAvg_Current_a; stChart.fAvg_Current_b = fAvg_Current_b; stChart.fAvg_Current_c = fAvg_Current_c; stChart.sDatetime = sDateTime; chartCurrentY.insert(nTimeCount, stChart); nTimeCount++; } } if( query.size() == 0 ) { QMap<int, QString> nXCount = getXCount(); for(int i = 0 ; i < nXCount.count() ; i++) { stChart.nSecId = nTimeCount; stChart.fAvg_Current_a = 0; stChart.fAvg_Current_b = 0; stChart.fAvg_Current_c = 0; stChart.sDatetime = nXCount.value(i); chartCurrentY.insert(nTimeCount, stChart); nTimeCount++; } } SetChartSortLineData( chartCurrentY ); // X 축이 되는 시간 정보는 따로 저정한다 nTimeCount = 0; QMap<int, QString> chartTimeX; int nDateCount = chartCurrentY.count(); if( nDateCount > 0 ) { QMapIterator<int, ChartData> timeItr(chartCurrentY); while (timeItr.hasNext()) { timeItr.next(); chartTimeX.insert(nTimeCount, timeItr.value().sDatetime); nTimeCount++; } } SetChartTimeXaxis( chartTimeX ); bRet = true; } } return bRet; } bool agDBFunction::makeCBTimeChart(QString strOffice, int nCBId, QString fromDate, QString toDate, DateType dType) { m_ChartMap.clear(); QString sTable = makeCBDBTableQuery(fromDate, toDate, dType); bool bRet = false; QString officeName = qDbAccssor->getOfficeName(strOffice); QString strQuery; // CB의 값을 추가로 보려면 시간 설정 및 선로 or CB로 선택해서 할 수 있게 해야 한다 월간/일간 미구현 if( dType == MONTH ) // 월간은 일간31일을 평균한 것을 UNION 이나 해서 붙여야 함 간단한것은 테이블을 추가 { // strQuery = QString("SELECT sum([avg_current_a]), sum([avg_current_b]), sum([avg_current_c]), sumDate " // "FROM (" // "SELECT [avg_current_a], [avg_current_b], [avg_current_c], convert(char(10), [datetime], 23) as \"sumDate\" " // "FROM [%1] " // "WHERE [datetime] > '%2' " // "AND [datetime] < '%3' " // "AND sec_id in ( %4 )" // " ) a " // "GROUP BY sumDate " // "ORDER BY sumDate ") // .arg(sTable) //테이블명 // .arg(fromDate) // 검색시작시간 // .arg(toDate) // 종료시간 // .arg(LineDataQuery); // 라인ID } else if( dType == HOUR || dType == DAY) { strQuery = QString("SELECT [cb_id], [current_a], [current_b], [current_c], [update_time] " "FROM [%1] " "WHERE [update_time] > '%2' " "AND [update_time] < '%3' " "AND cb_id in ( %4 )" "ORDER BY [update_time] ") .arg(sTable) //테이블명 .arg(fromDate) // 검색시작시간 .arg(toDate) // 종료시간 .arg(QString::number(nCBId)); // 라인ID } // QString sSql = QString("SELECT [sec_id] " // ", [avg_current_a] " // ", [datetime] " // ", [avg_current_b] " // ", [avg_current_c] " // ", [treacherousData] " // ", [msg] " // "FROM [daslogv2].[dbo].[%1] " // "where convert(varchar, [datetime], 112) > '%2' " // " and convert(varchar, [datetime], 112) > '%3' " // " and sec_id = %4 " // "order by [datetime] ") // .arg(sTable) //테이블명 // .arg(fromDate + "00") // .arg(toDate + "99") // .arg(LineDataQuery); QSqlDatabase db; if( qDbAccssor->getDBInstatnce(DAS_LOG, strOffice, db) == true ) // QSqlDatabase의객체를가져오는함수( 사업소코드와DB 타입으로가져옴) { if( db.isOpen() ) { QSqlQuery query(db); QString strErr; if( qDbAccssor->getCommand(strQuery , query , strErr) != true ) // 쿼리 날려서 해당결과를 QSqlQuery 객체에담아옴. { // strErr 표시 //GlobalLog->writelog(strErr.toLocal8Bit().data()); return bRet; } //if(!query.isActive() ) //{ // QMessageBox::warning(NULL , tr("Database Error") , query.lastError().text(),QMessageBox::NoButton); //} ChartData stChart; TypeChartDataMap chartCurrentY; int nTimeCount = 0; while(query.next()) { // Month 일때 // Day 일때 // 월단은 일단 보류 if( dType == MONTH ) { // int nCBId = query.value(0).toInt(); // float fCurrent_a = query.value(1).toFloat(); // float fCurrent_b = query.value(2).toFloat(); // float fCurrent_c = query.value(3).toFloat(); // QString sDateTime = query.value(4).toString(); // // stChart.nSecId = nCBId; // stChart.fAvg_Current_a = fCurrent_a; // stChart.fAvg_Current_b = fCurrent_b; // stChart.fAvg_Current_c = fCurrent_c; // stChart.sDatetime = sDateTime; // // chartCurrentY.insertMulti(nTimeCount, stChart); // nTimeCount++; } else if( dType == HOUR || dType == DAY ) // Hour 일때 { int nCBId = query.value(0).toInt(); float fCurrent_a = query.value(1).toFloat(); float fCurrent_b = query.value(2).toFloat(); float fCurrent_c = query.value(3).toFloat(); QString sDateTime = query.value(4).toString(); stChart.nSecId = nCBId; stChart.fAvg_Current_a = fCurrent_a; stChart.fAvg_Current_b = fCurrent_b; stChart.fAvg_Current_c = fCurrent_c; stChart.sDatetime = sDateTime; chartCurrentY.insert(nTimeCount, stChart); nTimeCount++; } } if( query.size() == 0 ) // 쿼리 결과가 없으면 그냥 0으로 표시하자.... { int nXCount = 0; stChart.nSecId = 0; stChart.fAvg_Current_a = 0; stChart.fAvg_Current_b = 0; stChart.fAvg_Current_c = 0; stChart.sDatetime = QString::fromLocal8Bit(""); chartCurrentY.insert(nXCount, stChart); } SetChartSortLineData( chartCurrentY ); // .. 시발 이렇게 처리하기 싫은데... 일단 화면나오자... // X 축이 되는 시간 정보는 따로 저정한다 // 쿼리 결과 값이랑 갯수맞추려고... 이렇게 함 그냥 함.. 막 함 nTimeCount = 0; QMap<int, QString> chartTimeX; int nDateCount = chartCurrentY.count(); if( nDateCount > 0 ) { QMapIterator<int, ChartData> timeItr(chartCurrentY); while (timeItr.hasNext()) { timeItr.next(); chartTimeX.insert(nTimeCount, timeItr.value().sDatetime); nTimeCount++; } } SetChartTimeXaxis( chartTimeX ); bRet = true; } } return bRet; } void agDBFunction::setXCount(QMap<int, QString> nXCount) { m_nXCount = nXCount; } QMap<int, QString> agDBFunction::getXCount() { return m_nXCount; } void agDBFunction::SetChartSortLineData(TypeChartDataMap chartData) { m_ChartMap.clear(); m_ChartMap = chartData; } TypeChartDataMap agDBFunction::GetChartSortLineData() { return m_ChartMap; } void agDBFunction::SetChartTimeXaxis(QMap<int, QString> chartXMap ) { m_ChartTime.clear(); m_ChartTime = chartXMap; } QMap<int, QString> agDBFunction::GetChartTimeXaxis() { return m_ChartTime; } QString agDBFunction::makeSecQuery() { QString LineDataQuery; QList<int> lineDataList = GetChartLineData(); QList<int>::iterator lineItr = lineDataList.begin(); while( lineItr != lineDataList.end() ) { QString LineData = QString::number((*lineItr)); LineDataQuery.append(LineData); if( (*lineItr) != lineDataList.back() ) { LineDataQuery.append(','); } lineItr++; } return LineDataQuery; } QString agDBFunction::makeDBTableQuery(QString fromDate, QString toDate, DateType dType) { QString sTable; QString sYear = fromDate.mid(0, 4); QString sMonth = fromDate.mid(5,2); if( dType == MONTH ) { sTable = "MonthLoadData"; } else if( dType == DAY ) { sTable = "DayLoadData" + sYear; } else if( dType == HOUR ) { QString sDayType; if( sMonth == "01" || sMonth == "02" || sMonth == "03" ) sDayType = "0103"; else if( sMonth == "04" || sMonth == "05" || sMonth == "06" ) sDayType = "0406"; else if( sMonth == "07" || sMonth == "08" || sMonth == "09" ) sDayType = "0709"; else if( sMonth == "10" || sMonth == "11" || sMonth == "12" ) sDayType = "1012"; else return NULL; sTable = "HourLoadData" + sYear + sDayType; } return sTable; } QString agDBFunction::makeCBDBTableQuery(QString fromDate, QString toDate, DateType dType) { QString sTable; QString sYear = fromDate.mid(0, 4); QString sMonth = fromDate.mid(5,2); if( dType == MONTH || dType == DAY ) { sTable = "CbDayLoadData" + sYear; } else if( dType == HOUR ) { sTable = "CbHourLoadData" + sYear; } return sTable; } QString agDBFunction::getCurrentTime() { //기본 시간 차트 생성 - 현재 시간을 기준으로 24시간 차트 출력 QString dDate = QDate::currentDate().toString("yyyy-MM-dd"); QString dHour = QTime::currentTime().toString("hh-mm-ss"); // 2020-05-15 임시로 보여주기 위한 데이터 만들기 KHK QString temp = "2016-01-03"; QString dCurrentTime = temp + "" + dHour; //dDate + "" +dHour; return dCurrentTime; }
[ "hankkuu@gmail.com" ]
hankkuu@gmail.com
1354cc340be0cce4fbf6be34284d9feac68e545b
e53fdc3415ea64b52535a0257d9b8d7e0fcebd06
/src/test/coins_tests.cpp
b4e8044120f27aa2c147cee7a1b358d2e6380352
[ "MIT" ]
permissive
TheGCCcoin/global-cryptocurrency
033db8e0d51bdb6381005437797fab172597fde4
53f499031fa7d5af7b7328fa4779b83b853c61bb
refs/heads/master
2020-03-20T21:58:17.419438
2018-07-06T08:57:57
2018-07-06T08:57:57
137,771,637
0
0
null
null
null
null
UTF-8
C++
false
false
13,163
cpp
// Copyright (c) 2014-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coins.h" #include "random.h" #include "uint256.h" #include "test/test_TheGCCcoin.h" #include "main.h" #include "consensus/validation.h" #include <vector> #include <map> #include <boost/test/unit_test.hpp> namespace { class CCoinsViewTest : public CCoinsView { uint256 hashBestBlock_; std::map<uint256, CCoins> map_; public: bool GetCoins(const uint256& txid, CCoins& coins) const { std::map<uint256, CCoins>::const_iterator it = map_.find(txid); if (it == map_.end()) { return false; } coins = it->second; if (coins.IsPruned() && insecure_rand() % 2 == 0) { // Randomly return false in case of an empty entry. return false; } return true; } bool HaveCoins(const uint256& txid) const { CCoins coins; return GetCoins(txid, coins); } uint256 GetBestBlock() const { return hashBestBlock_; } bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) { for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) { if (it->second.flags & CCoinsCacheEntry::DIRTY) { // Same optimization used in CCoinsViewDB is to only write dirty entries. map_[it->first] = it->second.coins; if (it->second.coins.IsPruned() && insecure_rand() % 3 == 0) { // Randomly delete empty entries on write. map_.erase(it->first); } } mapCoins.erase(it++); } if (!hashBlock.IsNull()) hashBestBlock_ = hashBlock; return true; } bool GetStats(CCoinsStats& stats) const { return false; } }; class CCoinsViewCacheTest : public CCoinsViewCache { public: CCoinsViewCacheTest(CCoinsView* base) : CCoinsViewCache(base) {} void SelfTest() const { // Manually recompute the dynamic usage of the whole data, and compare it. size_t ret = memusage::DynamicUsage(cacheCoins); for (CCoinsMap::iterator it = cacheCoins.begin(); it != cacheCoins.end(); it++) { ret += it->second.coins.DynamicMemoryUsage(); } BOOST_CHECK_EQUAL(DynamicMemoryUsage(), ret); } }; } BOOST_FIXTURE_TEST_SUITE(coins_tests, BasicTestingSetup) static const unsigned int NUM_SIMULATION_ITERATIONS = 40000; // This is a large randomized insert/remove simulation test on a variable-size // stack of caches on top of CCoinsViewTest. // // It will randomly create/update/delete CCoins entries to a tip of caches, with // txids picked from a limited list of random 256-bit hashes. Occasionally, a // new tip is added to the stack of caches, or the tip is flushed and removed. // // During the process, booleans are kept to make sure that the randomized // operation hits all branches. BOOST_AUTO_TEST_CASE(coins_cache_simulation_test) { // Various coverage trackers. bool removed_all_caches = false; bool reached_4_caches = false; bool added_an_entry = false; bool removed_an_entry = false; bool updated_an_entry = false; bool found_an_entry = false; bool missed_an_entry = false; // A simple map to track what we expect the cache stack to represent. std::map<uint256, CCoins> result; // The cache stack. CCoinsViewTest base; // A CCoinsViewTest at the bottom. std::vector<CCoinsViewCacheTest*> stack; // A stack of CCoinsViewCaches on top. stack.push_back(new CCoinsViewCacheTest(&base)); // Start with one cache. // Use a limited set of random transaction ids, so we do test overwriting entries. std::vector<uint256> txids; txids.resize(NUM_SIMULATION_ITERATIONS / 8); for (unsigned int i = 0; i < txids.size(); i++) { txids[i] = GetRandHash(); } for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) { // Do a random modification. { uint256 txid = txids[insecure_rand() % txids.size()]; // txid we're going to modify in this iteration. CCoins& coins = result[txid]; CCoinsModifier entry = stack.back()->ModifyCoins(txid); BOOST_CHECK(coins == *entry); if (insecure_rand() % 5 == 0 || coins.IsPruned()) { if (coins.IsPruned()) { added_an_entry = true; } else { updated_an_entry = true; } coins.nVersion = insecure_rand(); coins.vout.resize(1); coins.vout[0].nValue = insecure_rand(); *entry = coins; } else { coins.Clear(); entry->Clear(); removed_an_entry = true; } } // Once every 1000 iterations and at the end, verify the full cache. if (insecure_rand() % 1000 == 1 || i == NUM_SIMULATION_ITERATIONS - 1) { for (std::map<uint256, CCoins>::iterator it = result.begin(); it != result.end(); it++) { const CCoins* coins = stack.back()->AccessCoins(it->first); if (coins) { BOOST_CHECK(*coins == it->second); found_an_entry = true; } else { BOOST_CHECK(it->second.IsPruned()); missed_an_entry = true; } } BOOST_FOREACH(const CCoinsViewCacheTest *test, stack) { test->SelfTest(); } } if (insecure_rand() % 100 == 0) { // Every 100 iterations, flush an intermediate cache if (stack.size() > 1 && insecure_rand() % 2 == 0) { unsigned int flushIndex = insecure_rand() % (stack.size() - 1); stack[flushIndex]->Flush(); } } if (insecure_rand() % 100 == 0) { // Every 100 iterations, change the cache stack. if (stack.size() > 0 && insecure_rand() % 2 == 0) { //Remove the top cache stack.back()->Flush(); delete stack.back(); stack.pop_back(); } if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) { //Add a new cache CCoinsView* tip = &base; if (stack.size() > 0) { tip = stack.back(); } else { removed_all_caches = true; } stack.push_back(new CCoinsViewCacheTest(tip)); if (stack.size() == 4) { reached_4_caches = true; } } } } // Clean up the stack. while (stack.size() > 0) { delete stack.back(); stack.pop_back(); } // Verify coverage. BOOST_CHECK(removed_all_caches); BOOST_CHECK(reached_4_caches); BOOST_CHECK(added_an_entry); BOOST_CHECK(removed_an_entry); BOOST_CHECK(updated_an_entry); BOOST_CHECK(found_an_entry); BOOST_CHECK(missed_an_entry); } // This test is similar to the previous test // except the emphasis is on testing the functionality of UpdateCoins // random txs are created and UpdateCoins is used to update the cache stack // In particular it is tested that spending a duplicate coinbase tx // has the expected effect (the other duplicate is overwitten at all cache levels) BOOST_AUTO_TEST_CASE(updatecoins_simulation_test) { bool spent_a_duplicate_coinbase = false; // A simple map to track what we expect the cache stack to represent. std::map<uint256, CCoins> result; // The cache stack. CCoinsViewTest base; // A CCoinsViewTest at the bottom. std::vector<CCoinsViewCacheTest*> stack; // A stack of CCoinsViewCaches on top. stack.push_back(new CCoinsViewCacheTest(&base)); // Start with one cache. // Track the txids we've used and whether they have been spent or not std::map<uint256, CAmount> coinbaseids; std::set<uint256> alltxids; std::set<uint256> duplicateids; for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) { { CMutableTransaction tx; tx.vin.resize(1); tx.vout.resize(1); tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate unsigned int height = insecure_rand(); // 1/10 times create a coinbase if (insecure_rand() % 10 == 0 || coinbaseids.size() < 10) { // 1/100 times create a duplicate coinbase if (insecure_rand() % 10 == 0 && coinbaseids.size()) { std::map<uint256, CAmount>::iterator coinbaseIt = coinbaseids.lower_bound(GetRandHash()); if (coinbaseIt == coinbaseids.end()) { coinbaseIt = coinbaseids.begin(); } //Use same random value to have same hash and be a true duplicate tx.vout[0].nValue = coinbaseIt->second; assert(tx.GetHash() == coinbaseIt->first); duplicateids.insert(coinbaseIt->first); } else { coinbaseids[tx.GetHash()] = tx.vout[0].nValue; } assert(CTransaction(tx).IsCoinBase()); } // 9/10 times create a regular tx else { uint256 prevouthash; // equally likely to spend coinbase or non coinbase std::set<uint256>::iterator txIt = alltxids.lower_bound(GetRandHash()); if (txIt == alltxids.end()) { txIt = alltxids.begin(); } prevouthash = *txIt; // Construct the tx to spend the coins of prevouthash tx.vin[0].prevout.hash = prevouthash; tx.vin[0].prevout.n = 0; // Update the expected result of prevouthash to know these coins are spent CCoins& oldcoins = result[prevouthash]; oldcoins.Clear(); // It is of particular importance here that once we spend a coinbase tx hash // it is no longer available to be duplicated (or spent again) // BIP 34 in conjunction with enforcing BIP 30 (at least until BIP 34 was active) // results in the fact that no coinbases were duplicated after they were already spent alltxids.erase(prevouthash); coinbaseids.erase(prevouthash); // The test is designed to ensure spending a duplicate coinbase will work properly // if that ever happens and not resurrect the previously overwritten coinbase if (duplicateids.count(prevouthash)) spent_a_duplicate_coinbase = true; assert(!CTransaction(tx).IsCoinBase()); } // Track this tx to possibly spend later alltxids.insert(tx.GetHash()); // Update the expected result to know about the new output coins CCoins &coins = result[tx.GetHash()]; coins.FromTx(tx, height); CValidationState dummy; UpdateCoins(tx, dummy, *(stack.back()), height); } // Once every 1000 iterations and at the end, verify the full cache. if (insecure_rand() % 1000 == 1 || i == NUM_SIMULATION_ITERATIONS - 1) { for (std::map<uint256, CCoins>::iterator it = result.begin(); it != result.end(); it++) { const CCoins* coins = stack.back()->AccessCoins(it->first); if (coins) { BOOST_CHECK(*coins == it->second); } else { BOOST_CHECK(it->second.IsPruned()); } } } if (insecure_rand() % 100 == 0) { // Every 100 iterations, flush an intermediate cache if (stack.size() > 1 && insecure_rand() % 2 == 0) { unsigned int flushIndex = insecure_rand() % (stack.size() - 1); stack[flushIndex]->Flush(); } } if (insecure_rand() % 100 == 0) { // Every 100 iterations, change the cache stack. if (stack.size() > 0 && insecure_rand() % 2 == 0) { stack.back()->Flush(); delete stack.back(); stack.pop_back(); } if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) { CCoinsView* tip = &base; if (stack.size() > 0) { tip = stack.back(); } stack.push_back(new CCoinsViewCacheTest(tip)); } } } // Clean up the stack. while (stack.size() > 0) { delete stack.back(); stack.pop_back(); } // Verify coverage. BOOST_CHECK(spent_a_duplicate_coinbase); } BOOST_AUTO_TEST_SUITE_END()
[ "neo-crypt@neo-crypt.ai" ]
neo-crypt@neo-crypt.ai
74a6b52806a4000daef82f631df43149fb4a2e7b
1b3ea745b0afc8d9786e1ecba14bbf0747d2f309
/Shell/main.cpp
2dc62b0702869adabe3cd4342620280de12b2b44
[ "BSD-2-Clause" ]
permissive
InspectorDidi/serenity
09f2b8001dddf91e94df12f71f45976d2fa38541
eb77e680ed615e9daf5b165359b4a45541b4e6f3
refs/heads/master
2020-08-22T08:36:08.949554
2019-10-20T10:30:25
2019-10-20T10:55:55
216,357,640
2
0
BSD-2-Clause
2019-10-20T12:23:04
2019-10-20T12:23:04
null
UTF-8
C++
false
false
25,904
cpp
#include "GlobalState.h" #include "LineEditor.h" #include "Parser.h" #include <AK/FileSystemPath.h> #include <AK/StringBuilder.h> #include <LibCore/CDirIterator.h> #include <LibCore/CElapsedTimer.h> #include <LibCore/CFile.h> #include <errno.h> #include <fcntl.h> #include <pwd.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/utsname.h> #include <sys/wait.h> #include <termios.h> #include <unistd.h> #define SH_DEBUG GlobalState g; static LineEditor editor; static int run_command(const String&); static String prompt() { if (g.uid == 0) return "# "; StringBuilder builder; builder.appendf("\033]0;%s@%s:%s\007", g.username.characters(), g.hostname, g.cwd.characters()); builder.appendf("\033[31;1m%s\033[0m@\033[37;1m%s\033[0m:\033[32;1m%s\033[0m$> ", g.username.characters(), g.hostname, g.cwd.characters()); return builder.to_string(); } static int sh_pwd(int, char**) { printf("%s\n", g.cwd.characters()); return 0; } static int sh_exit(int, char**) { printf("Good-bye!\n"); exit(0); return 0; } static int sh_export(int argc, char** argv) { if (argc == 1) { for (int i = 0; environ[i]; ++i) puts(environ[i]); return 0; } auto parts = String(argv[1]).split('='); if (parts.size() != 2) { fprintf(stderr, "usage: export variable=value\n"); return 1; } return setenv(parts[0].characters(), parts[1].characters(), 1); } static int sh_unset(int argc, char** argv) { if (argc != 2) { fprintf(stderr, "usage: unset variable\n"); return 1; } unsetenv(argv[1]); return 0; } static int sh_cd(int argc, char** argv) { char pathbuf[PATH_MAX]; if (argc == 1) { strcpy(pathbuf, g.home.characters()); } else { if (strcmp(argv[1], "-") == 0) { char* oldpwd = getenv("OLDPWD"); if (oldpwd == nullptr) return 1; size_t len = strlen(oldpwd); ASSERT(len + 1 <= PATH_MAX); memcpy(pathbuf, oldpwd, len + 1); } else if (argv[1][0] == '/') { memcpy(pathbuf, argv[1], strlen(argv[1]) + 1); } else { sprintf(pathbuf, "%s/%s", g.cwd.characters(), argv[1]); } } FileSystemPath canonical_path(pathbuf); if (!canonical_path.is_valid()) { printf("FileSystemPath failed to canonicalize '%s'\n", pathbuf); return 1; } const char* path = canonical_path.string().characters(); struct stat st; int rc = stat(path, &st); if (rc < 0) { printf("stat(%s) failed: %s\n", path, strerror(errno)); return 1; } if (!S_ISDIR(st.st_mode)) { printf("Not a directory: %s\n", path); return 1; } rc = chdir(path); if (rc < 0) { printf("chdir(%s) failed: %s\n", path, strerror(errno)); return 1; } setenv("OLDPWD", g.cwd.characters(), 1); g.cwd = canonical_path.string(); setenv("PWD", g.cwd.characters(), 1); return 0; } static int sh_history(int, char**) { for (int i = 0; i < editor.history().size(); ++i) { printf("%6d %s\n", i, editor.history()[i].characters()); } return 0; } static int sh_time(int argc, char** argv) { if (argc == 1) { printf("usage: time <command>\n"); return 0; } StringBuilder builder; for (int i = 1; i < argc; ++i) { builder.append(argv[i]); if (i != argc - 1) builder.append(' '); } CElapsedTimer timer; timer.start(); int exit_code = run_command(builder.to_string()); printf("Time: %d ms\n", timer.elapsed()); return exit_code; } static int sh_umask(int argc, char** argv) { if (argc == 1) { mode_t old_mask = umask(0); printf("%#o\n", old_mask); umask(old_mask); return 0; } if (argc == 2) { unsigned mask; int matches = sscanf(argv[1], "%o", &mask); if (matches == 1) { umask(mask); return 0; } } printf("usage: umask <octal-mask>\n"); return 0; } static int sh_popd(int argc, char** argv) { if (g.directory_stack.size() <= 1) { fprintf(stderr, "Shell: popd: directory stack empty\n"); return 1; } bool should_switch = true; String path = g.directory_stack.take_last(); // When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. if (argc == 1) { int rc = chdir(path.characters()); if (rc < 0) { fprintf(stderr, "chdir(%s) failed: %s", path.characters(), strerror(errno)); return 1; } g.cwd = path; return 0; } for (int i = 1; i < argc; i++) { const char* arg = argv[i]; if (!strcmp(arg, "-n")) { should_switch = false; } } FileSystemPath canonical_path(path.characters()); if (!canonical_path.is_valid()) { fprintf(stderr, "FileSystemPath failed to canonicalize '%s'\n", path.characters()); return 1; } const char* real_path = canonical_path.string().characters(); struct stat st; int rc = stat(real_path, &st); if (rc < 0) { fprintf(stderr, "stat(%s) failed: %s\n", real_path, strerror(errno)); return 1; } if (!S_ISDIR(st.st_mode)) { fprintf(stderr, "Not a directory: %s\n", real_path); return 1; } if (should_switch) { int rc = chdir(real_path); if (rc < 0) { fprintf(stderr, "chdir(%s) failed: %s\n", real_path, strerror(errno)); return 1; } g.cwd = canonical_path.string(); } return 0; } static int sh_pushd(int argc, char** argv) { StringBuilder path_builder; bool should_switch = true; // From the BASH reference manual: https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html // With no arguments, pushd exchanges the top two directories and makes the new top the current directory. if (argc == 1) { if (g.directory_stack.size() < 2) { fprintf(stderr, "pushd: no other directory\n"); return 1; } String dir1 = g.directory_stack.take_first(); String dir2 = g.directory_stack.take_first(); g.directory_stack.insert(0, dir2); g.directory_stack.insert(1, dir1); int rc = chdir(dir2.characters()); if (rc < 0) { fprintf(stderr, "chdir(%s) failed: %s", dir2.characters(), strerror(errno)); return 1; } g.cwd = dir2; return 0; } // Let's assume the user's typed in 'pushd <dir>' if (argc == 2) { g.directory_stack.append(g.cwd.characters()); if (argv[1][0] == '/') { path_builder.append(argv[1]); } else { path_builder.appendf("%s/%s", g.cwd.characters(), argv[1]); } } else if (argc == 3) { g.directory_stack.append(g.cwd.characters()); for (int i = 1; i < argc; i++) { const char* arg = argv[i]; if (arg[0] != '-') { if (arg[0] == '/') { path_builder.append(arg); } else path_builder.appendf("%s/%s", g.cwd.characters(), arg); } if (!strcmp(arg, "-n")) should_switch = false; } } FileSystemPath canonical_path(path_builder.to_string()); if (!canonical_path.is_valid()) { fprintf(stderr, "FileSystemPath failed to canonicalize '%s'\n", path_builder.to_string().characters()); return 1; } const char* real_path = canonical_path.string().characters(); struct stat st; int rc = stat(real_path, &st); if (rc < 0) { fprintf(stderr, "stat(%s) failed: %s\n", real_path, strerror(errno)); return 1; } if (!S_ISDIR(st.st_mode)) { fprintf(stderr, "Not a directory: %s\n", real_path); return 1; } if (should_switch) { int rc = chdir(real_path); if (rc < 0) { fprintf(stderr, "chdir(%s) failed: %s\n", real_path, strerror(errno)); return 1; } g.cwd = canonical_path.string(); } return 0; } static int sh_dirs(int argc, char** argv) { // The first directory in the stack is ALWAYS the current directory g.directory_stack.at(0) = g.cwd.characters(); if (argc == 1) { for (String dir : g.directory_stack) printf("%s ", dir.characters()); printf("\n"); return 0; } bool printed = false; for (int i = 0; i < argc; i++) { const char* arg = argv[i]; if (!strcmp(arg, "-c")) { for (int i = 1; i < g.directory_stack.size(); i++) g.directory_stack.remove(i); printed = true; continue; } if (!strcmp(arg, "-p") && !printed) { for (auto& directory : g.directory_stack) printf("%s\n", directory.characters()); printed = true; continue; } if (!strcmp(arg, "-v") && !printed) { int idx = 0; for (auto& directory : g.directory_stack) { printf("%d %s\n", idx++, directory.characters()); } printed = true; continue; } } return 0; } static bool handle_builtin(int argc, char** argv, int& retval) { if (argc == 0) return false; if (!strcmp(argv[0], "cd")) { retval = sh_cd(argc, argv); return true; } if (!strcmp(argv[0], "pwd")) { retval = sh_pwd(argc, argv); return true; } if (!strcmp(argv[0], "exit")) { retval = sh_exit(argc, argv); return true; } if (!strcmp(argv[0], "export")) { retval = sh_export(argc, argv); return true; } if (!strcmp(argv[0], "unset")) { retval = sh_unset(argc, argv); return true; } if (!strcmp(argv[0], "history")) { retval = sh_history(argc, argv); return true; } if (!strcmp(argv[0], "umask")) { retval = sh_umask(argc, argv); return true; } if (!strcmp(argv[0], "dirs")) { retval = sh_dirs(argc, argv); return true; } if (!strcmp(argv[0], "pushd")) { retval = sh_pushd(argc, argv); return true; } if (!strcmp(argv[0], "popd")) { retval = sh_popd(argc, argv); return true; } if (!strcmp(argv[0], "time")) { retval = sh_time(argc, argv); return true; } return false; } class FileDescriptionCollector { public: FileDescriptionCollector() {} ~FileDescriptionCollector() { collect(); } void collect() { for (auto fd : m_fds) close(fd); m_fds.clear(); } void add(int fd) { m_fds.append(fd); } private: Vector<int, 32> m_fds; }; struct CommandTimer { CommandTimer() { timer.start(); } ~CommandTimer() { dbgprintf("sh: command finished in %d ms\n", timer.elapsed()); } CElapsedTimer timer; }; static bool is_glob(const StringView& s) { for (int i = 0; i < s.length(); i++) { char c = s.characters_without_null_termination()[i]; if (c == '*' || c == '?') return true; } return false; } static Vector<StringView> split_path(const StringView& path) { Vector<StringView> parts; ssize_t substart = 0; for (ssize_t i = 0; i < path.length(); i++) { char ch = path.characters_without_null_termination()[i]; if (ch != '/') continue; ssize_t sublen = i - substart; if (sublen != 0) parts.append(path.substring_view(substart, sublen)); parts.append(path.substring_view(i, 1)); substart = i + 1; } ssize_t taillen = path.length() - substart; if (taillen != 0) parts.append(path.substring_view(substart, taillen)); return parts; } static Vector<String> expand_globs(const StringView& path, const StringView& base) { auto parts = split_path(path); StringBuilder builder; builder.append(base); Vector<String> res; for (int i = 0; i < parts.size(); ++i) { auto& part = parts[i]; if (!is_glob(part)) { builder.append(part); continue; } // Found a glob. String new_base = builder.to_string(); StringView new_base_v = new_base; if (new_base_v.is_empty()) new_base_v = "."; CDirIterator di(new_base_v, CDirIterator::NoFlags); if (di.has_error()) { return res; } while (di.has_next()) { String name = di.next_path(); // Dotfiles have to be explicitly requested if (name[0] == '.' && part[0] != '.') continue; // And even if they are, skip . and .. if (name == "." || name == "..") continue; if (name.matches(part, String::CaseSensitivity::CaseSensitive)) { StringBuilder nested_base; nested_base.append(new_base); nested_base.append(name); StringView remaining_path = path.substring_view_starting_after_substring(part); Vector<String> nested_res = expand_globs(remaining_path, nested_base.to_string()); for (auto& s : nested_res) res.append(s); } } return res; } // Found no globs. String new_path = builder.to_string(); if (access(new_path.characters(), F_OK) == 0) res.append(new_path); return res; } static Vector<String> expand_parameters(const StringView& param) { bool is_variable = param.length() > 1 && param[0] == '$'; if (!is_variable) return { param }; String variable_name = String(param.substring_view(1, param.length() - 1)); if (variable_name == "?") return { String::number(g.last_return_code) }; else if (variable_name == "$") return { String::number(getpid()) }; char* env_value = getenv(variable_name.characters()); if (env_value == nullptr) return { "" }; Vector<String> res; String str_env_value = String(env_value); const auto& split_text = str_env_value.split_view(' '); for (auto& part : split_text) res.append(part); return res; } static Vector<String> process_arguments(const Vector<String>& args) { Vector<String> argv_string; for (auto& arg : args) { // This will return the text passed in if it wasn't a variable // This lets us just loop over its values auto expanded_parameters = expand_parameters(arg); for (auto& exp_arg : expanded_parameters) { auto expanded_globs = expand_globs(exp_arg, ""); for (auto& path : expanded_globs) argv_string.append(path); if (expanded_globs.is_empty()) argv_string.append(exp_arg); } } return argv_string; } static int run_command(const String& cmd) { if (cmd.is_empty()) return 0; if (cmd.starts_with("#")) return 0; auto commands = Parser(cmd).parse(); #ifdef SH_DEBUG for (auto& command : commands) { for (int i = 0; i < command.subcommands.size(); ++i) { for (int j = 0; j < i; ++j) dbgprintf(" "); for (auto& arg : command.subcommands[i].args) { dbgprintf("<%s> ", arg.characters()); } dbgprintf("\n"); for (auto& redirecton : command.subcommands[i].redirections) { for (int j = 0; j < i; ++j) dbgprintf(" "); dbgprintf(" "); switch (redirecton.type) { case Redirection::Pipe: dbgprintf("Pipe\n"); break; case Redirection::FileRead: dbgprintf("fd:%d = FileRead: %s\n", redirecton.fd, redirecton.path.characters()); break; case Redirection::FileWrite: dbgprintf("fd:%d = FileWrite: %s\n", redirecton.fd, redirecton.path.characters()); break; case Redirection::FileWriteAppend: dbgprintf("fd:%d = FileWriteAppend: %s\n", redirecton.fd, redirecton.path.characters()); break; default: break; } } } dbgprintf("\n"); } #endif struct termios trm; tcgetattr(0, &trm); tcsetattr(0, TCSANOW, &g.default_termios); struct SpawnedProcess { String name; pid_t pid; }; int return_value = 0; for (auto& command : commands) { if (command.subcommands.is_empty()) continue; FileDescriptionCollector fds; for (int i = 0; i < command.subcommands.size(); ++i) { auto& subcommand = command.subcommands[i]; for (auto& redirection : subcommand.redirections) { switch (redirection.type) { case Redirection::Pipe: { int pipefd[2]; int rc = pipe(pipefd); if (rc < 0) { perror("pipe"); return 1; } subcommand.rewirings.append({ STDOUT_FILENO, pipefd[1] }); auto& next_command = command.subcommands[i + 1]; next_command.rewirings.append({ STDIN_FILENO, pipefd[0] }); fds.add(pipefd[0]); fds.add(pipefd[1]); break; } case Redirection::FileWriteAppend: { int fd = open(redirection.path.characters(), O_WRONLY | O_CREAT | O_APPEND, 0666); if (fd < 0) { perror("open"); return 1; } subcommand.rewirings.append({ redirection.fd, fd }); fds.add(fd); break; } case Redirection::FileWrite: { int fd = open(redirection.path.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) { perror("open"); return 1; } subcommand.rewirings.append({ redirection.fd, fd }); fds.add(fd); break; } case Redirection::FileRead: { int fd = open(redirection.path.characters(), O_RDONLY); if (fd < 0) { perror("open"); return 1; } subcommand.rewirings.append({ redirection.fd, fd }); fds.add(fd); break; } } } } Vector<SpawnedProcess> children; CommandTimer timer; for (int i = 0; i < command.subcommands.size(); ++i) { auto& subcommand = command.subcommands[i]; Vector<String> argv_string = process_arguments(subcommand.args); Vector<const char*> argv; argv.ensure_capacity(argv_string.size()); for (const auto& s : argv_string) { argv.append(s.characters()); } argv.append(nullptr); #ifdef SH_DEBUG for (auto& arg : argv) { dbgprintf("<%s> ", arg); } dbgprintf("\n"); #endif int retval = 0; if (handle_builtin(argv.size() - 1, const_cast<char**>(argv.data()), retval)) return retval; pid_t child = fork(); if (!child) { setpgid(0, 0); tcsetpgrp(0, getpid()); for (auto& rewiring : subcommand.rewirings) { #ifdef SH_DEBUG dbgprintf("in %s<%d>, dup2(%d, %d)\n", argv[0], getpid(), rewiring.rewire_fd, rewiring.fd); #endif int rc = dup2(rewiring.rewire_fd, rewiring.fd); if (rc < 0) { perror("dup2"); return 1; } } fds.collect(); int rc = execvp(argv[0], const_cast<char* const*>(argv.data())); if (rc < 0) { if (errno == ENOENT) fprintf(stderr, "%s: Command not found.\n", argv[0]); else fprintf(stderr, "execvp(%s): %s\n", argv[0], strerror(errno)); exit(1); } ASSERT_NOT_REACHED(); } children.append({ argv[0], child }); } #ifdef SH_DEBUG dbgprintf("Closing fds in shell process:\n"); #endif fds.collect(); #ifdef SH_DEBUG dbgprintf("Now we gotta wait on children:\n"); for (auto& child : children) dbgprintf(" %d\n", child); #endif int wstatus = 0; for (int i = 0; i < children.size(); ++i) { auto& child = children[i]; do { int rc = waitpid(child.pid, &wstatus, WEXITED | WSTOPPED); if (rc < 0 && errno != EINTR) { if (errno != ECHILD) perror("waitpid"); break; } if (WIFEXITED(wstatus)) { if (WEXITSTATUS(wstatus) != 0) dbg() << "Shell: " << child.name << ":" << child.pid << " exited with status " << WEXITSTATUS(wstatus); if (i == 0) return_value = WEXITSTATUS(wstatus); } else if (WIFSTOPPED(wstatus)) { printf("Shell: %s(%d) stopped.\n", child.name.characters(), child.pid); } else { if (WIFSIGNALED(wstatus)) { printf("Shell: %s(%d) exited due to signal '%s'\n", child.name.characters(), child.pid, strsignal(WTERMSIG(wstatus))); } else { printf("Shell: %s(%d) exited abnormally\n", child.name.characters(), child.pid); } } } while (errno == EINTR); } } g.last_return_code = return_value; // FIXME: Should I really have to tcsetpgrp() after my child has exited? // Is the terminal controlling pgrp really still the PGID of the dead process? tcsetpgrp(0, getpid()); tcsetattr(0, TCSANOW, &trm); return return_value; } static String get_history_path() { StringBuilder builder; builder.append(g.home); builder.append("/.history"); return builder.to_string(); } void load_history() { auto history_file = CFile::construct(get_history_path()); if (!history_file->open(CIODevice::ReadOnly)) return; while (history_file->can_read_line()) { auto b = history_file->read_line(1024); // skip the newline and terminating bytes editor.add_to_history(String(reinterpret_cast<const char*>(b.data()), b.size() - 2)); } } void save_history() { auto history_file = CFile::construct(get_history_path()); if (!history_file->open(CIODevice::WriteOnly)) return; for (const auto& line : editor.history()) { history_file->write(line); history_file->write("\n"); } } int main(int argc, char** argv) { g.uid = getuid(); g.sid = setsid(); tcsetpgrp(0, getpgrp()); tcgetattr(0, &g.default_termios); g.termios = g.default_termios; // Because we use our own line discipline which includes echoing, // we disable ICANON and ECHO. g.termios.c_lflag &= ~(ECHO | ICANON); tcsetattr(0, TCSANOW, &g.termios); signal(SIGINT, [](int) { g.was_interrupted = true; }); signal(SIGHUP, [](int) { save_history(); }); signal(SIGWINCH, [](int) { g.was_resized = true; }); int rc = gethostname(g.hostname, sizeof(g.hostname)); if (rc < 0) perror("gethostname"); rc = ttyname_r(0, g.ttyname, sizeof(g.ttyname)); if (rc < 0) perror("ttyname_r"); { auto* pw = getpwuid(getuid()); if (pw) { g.username = pw->pw_name; g.home = pw->pw_dir; setenv("HOME", pw->pw_dir, 1); } endpwent(); } if (argc > 2 && !strcmp(argv[1], "-c")) { dbgprintf("sh -c '%s'\n", argv[2]); run_command(argv[2]); return 0; } if (argc == 2 && argv[1][0] != '-') { auto file = CFile::construct(argv[1]); if (!file->open(CIODevice::ReadOnly)) { fprintf(stderr, "Failed to open %s: %s\n", file->filename().characters(), file->error_string()); return 1; } for (;;) { auto line = file->read_line(4096); if (line.is_null()) break; run_command(String::copy(line, Chomp)); } return 0; } { auto* cwd = getcwd(nullptr, 0); g.cwd = cwd; setenv("PWD", cwd, 1); free(cwd); } g.directory_stack.append(g.cwd); load_history(); atexit(save_history); for (;;) { auto line = editor.get_line(prompt()); if (line.is_empty()) continue; run_command(line); editor.add_to_history(line); } return 0; }
[ "awesomekling@gmail.com" ]
awesomekling@gmail.com
a3666bd68ba022d1bd1de367734bed46adf20c06
e4b30523ceefcf5d054ddfbc077be403e4cd88e0
/depend/include/vr/memory_leak.h
91f9a41dcaef4dbe5c088fa31019d975ecac82e3
[ "MIT" ]
permissive
potato3d/grid
409a2fd18fedb514b72cf7257111a39cb5ba08cd
bb9b0dc7ef65abe05c5b6f9b4d107588d062cb56
refs/heads/main
2023-03-03T05:25:56.312949
2021-02-13T13:18:42
2021-02-13T13:18:42
338,573,256
3
0
null
null
null
null
UTF-8
C++
false
false
2,137
h
#ifndef _VR_MEMORYLEAK_H_ #define _VR_MEMORYLEAK_H_ /*! Memory Leak Test Class @brief Used to test for memory leak problems. Use the macro VR_BEGIN_MEMORY_LEAK_TEST to initialize a memory leak test and the macro VR_END_MEMORY_LEAK_TEST to finalize it. If a memory leak occur, then it will report the memory usage and trigger a failure using cppunit. Follows a sample of how to detect memory leak integrated with cppunit: #include <cppunit/extensions/HelperMacros.h> #include <tdgnIO/Reader.h> #include "memory_leak.h" class MemoryLeakTests : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( MemoryLeakTests ); CPPUNIT_TEST( test1MemoryLeak ); CPPUNIT_TEST_SUITE_END(); public: void test1MemoryLeak() { BEGIN_MEMORY_LEAK_TEST; malloc(10); END_MEMORY_LEAK_TEST; } }; CPPUNIT_TEST_SUITE_REGISTRATION( MemoryLeakTests ); */ #if defined(_MSC_VER) #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #ifndef _DEBUG #define VR_BEGIN_MEMORY_LEAK_TEST #else #define VR_BEGIN_MEMORY_LEAK_TEST \ _CrtMemState __initialState; \ _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); \ _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); \ _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); \ _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT ); \ /*_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );*/ \ /*_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );*/ \ _CrtMemCheckpoint( &__initialState ); { \ #endif #ifdef _DEBUG #define VR_END_MEMORY_LEAK_TEST \ } \ _CrtMemState __finalState, __diffState; \ _CrtMemCheckpoint( &__finalState ); \ int __hasMemoryLeak = _CrtMemDifference( &__diffState, &__initialState, &__finalState ); \ if ( __hasMemoryLeak ) \ _CrtMemDumpStatistics( &__diffState ); \ CPPUNIT_ASSERT( __hasMemoryLeak == 0 ); #else #define VR_END_MEMORY_LEAK_TEST #endif #else #endif // Platform definition #endif // _VR_MEMORYLEAK_H_
[ "" ]
ef8e793d33112032271f0b84baa26c68bebea3bb
2788efdd87aee3c0b58520b38f59c3489e468d4e
/TankMundial/Codigo_Final/MundialTank/ganadorj1.cpp
93ff602bba8af5699d6e4feb4a9b994280a7bcd9
[]
no_license
pipeflorez55/Proyecto-final
d928b0b70ee2e40633e7fe3cd9ae98c5cd23d94b
7b77b30030a947741c7c43590cf2c95691d543c1
refs/heads/master
2022-12-17T10:30:59.455625
2020-08-03T16:33:05
2020-08-03T16:33:05
275,460,537
0
0
null
2020-07-19T22:13:25
2020-06-27T22:05:10
Makefile
UTF-8
C++
false
false
487
cpp
#include "ganadorj1.h" #include "ui_ganadorj1.h" #include "menu.h" GanadorJ1::GanadorJ1(QWidget *parent) : QDialog(parent), ui(new Ui::GanadorJ1) { ui->setupUi(this); ui->label->setPixmap(QPixmap(":/GanadorJ1.png"));//se pinta el label con la imagen que se desee } GanadorJ1::~GanadorJ1() { delete ui; } void GanadorJ1::on_menu_clicked()//se cierra ui se abre ui de menu { delete ui; this->hide(); Menu menu; menu.setModal(true); menu.exec(); }
[ "62771586+AFRF99@users.noreply.github.com" ]
62771586+AFRF99@users.noreply.github.com
da77e25331e0b204912d78f5f60103787ea9a54d
c32ee8ade268240a8064e9b8efdbebfbaa46ddfa
/Libraries/m2sdk/C_Train.h
e011c98c8f4544fcb55f0f8faabdbeeac6028c29
[]
no_license
hopk1nz/maf2mp
6f65bd4f8114fdeb42f9407a4d158ad97f8d1789
814cab57dc713d9ff791dfb2a2abeb6af0e2f5a8
refs/heads/master
2021-03-12T23:56:24.336057
2015-08-22T13:53:10
2015-08-22T13:53:10
41,209,355
19
21
null
2015-08-31T05:28:13
2015-08-22T13:56:04
C++
UTF-8
C++
false
false
3,156
h
// auto-generated file (rttidump-exporter by h0pk1nz) #pragma once #include <C_ActorVehicle.h> #include <fsm/C_StateMachine_TPL_FFD6BF12.h> /** C_Train (VTable=0x01E99B60) */ class C_Train : public C_ActorVehicle, public fsm::C_StateMachine_TPL_FFD6BF12 { public: virtual void vfn_0001_3849729E() = 0; virtual void vfn_0002_3849729E() = 0; virtual void vfn_0003_3849729E() = 0; virtual void vfn_0004_3849729E() = 0; virtual void vfn_0005_3849729E() = 0; virtual void vfn_0006_3849729E() = 0; virtual void vfn_0007_3849729E() = 0; virtual void vfn_0008_3849729E() = 0; virtual void vfn_0009_3849729E() = 0; virtual void vfn_0010_3849729E() = 0; virtual void vfn_0011_3849729E() = 0; virtual void vfn_0012_3849729E() = 0; virtual void vfn_0013_3849729E() = 0; virtual void vfn_0014_3849729E() = 0; virtual void vfn_0015_3849729E() = 0; virtual void vfn_0016_3849729E() = 0; virtual void vfn_0017_3849729E() = 0; virtual void vfn_0018_3849729E() = 0; virtual void vfn_0019_3849729E() = 0; virtual void vfn_0020_3849729E() = 0; virtual void vfn_0021_3849729E() = 0; virtual void vfn_0022_3849729E() = 0; virtual void vfn_0023_3849729E() = 0; virtual void vfn_0024_3849729E() = 0; virtual void vfn_0025_3849729E() = 0; virtual void vfn_0026_3849729E() = 0; virtual void vfn_0027_3849729E() = 0; virtual void vfn_0028_3849729E() = 0; virtual void vfn_0029_3849729E() = 0; virtual void vfn_0030_3849729E() = 0; virtual void vfn_0031_3849729E() = 0; virtual void vfn_0032_3849729E() = 0; virtual void vfn_0033_3849729E() = 0; virtual void vfn_0034_3849729E() = 0; virtual void vfn_0035_3849729E() = 0; virtual void vfn_0036_3849729E() = 0; virtual void vfn_0037_3849729E() = 0; virtual void vfn_0038_3849729E() = 0; virtual void vfn_0039_3849729E() = 0; virtual void vfn_0040_3849729E() = 0; virtual void vfn_0041_3849729E() = 0; virtual void vfn_0042_3849729E() = 0; virtual void vfn_0043_3849729E() = 0; virtual void vfn_0044_3849729E() = 0; virtual void vfn_0045_3849729E() = 0; virtual void vfn_0046_3849729E() = 0; virtual void vfn_0047_3849729E() = 0; virtual void vfn_0048_3849729E() = 0; virtual void vfn_0049_3849729E() = 0; virtual void vfn_0050_3849729E() = 0; virtual void vfn_0051_3849729E() = 0; virtual void vfn_0052_3849729E() = 0; virtual void vfn_0053_3849729E() = 0; virtual void vfn_0054_3849729E() = 0; virtual void vfn_0055_3849729E() = 0; virtual void vfn_0056_3849729E() = 0; virtual void vfn_0057_3849729E() = 0; virtual void vfn_0058_3849729E() = 0; virtual void vfn_0059_3849729E() = 0; virtual void vfn_0060_3849729E() = 0; virtual void vfn_0061_3849729E() = 0; virtual void vfn_0062_3849729E() = 0; virtual void vfn_0063_3849729E() = 0; virtual void vfn_0064_3849729E() = 0; virtual void vfn_0065_3849729E() = 0; virtual void vfn_0066_3849729E() = 0; virtual void vfn_0067_3849729E() = 0; virtual void vfn_0068_3849729E() = 0; virtual void vfn_0069_3849729E() = 0; virtual void vfn_0070_3849729E() = 0; virtual void vfn_0071_3849729E() = 0; virtual void vfn_0072_3849729E() = 0; virtual void vfn_0073_3849729E() = 0; virtual void vfn_0074_3849729E() = 0; };
[ "hopk1nz@gmail.com" ]
hopk1nz@gmail.com
935c3826cc964326d4b9694df1eea0e31e25dd5e
e0a0d45181c1d0b0f0aa3d4dd977fc7bec4d21bb
/estimation/calibration/camera_model.cc
e8b2703539429a32e4fd67ff4f16fb3edc4de06e
[ "MIT" ]
permissive
jpanikulam/experiments
71004ff701f4552c932eb6958a0bcd3de76ee383
be36319a89f8baee54d7fa7618b885edb7025478
refs/heads/master
2021-01-12T01:35:15.817397
2020-01-24T00:59:12
2020-01-24T00:59:17
78,386,199
1
1
MIT
2018-12-29T00:54:28
2017-01-09T02:24:16
C++
UTF-8
C++
false
false
1,714
cc
#include "estimation/calibration/camera_model.hh" namespace estimation { CameraModel::CameraModel(const ProjMat& K) : K_(K) { K_inv_ = Eigen::PartialPivLU<ProjMat>(K_); }; CameraModel::CameraModel(const ProjectionCoefficients& projection_coefficients) { K_.setZero(); K_(0, 0) = projection_coefficients.fx; K_(1, 1) = projection_coefficients.fy; K_(0, 2) = projection_coefficients.cx; K_(1, 2) = projection_coefficients.cy; K_(2, 2) = 1.0; K_inv_ = Eigen::PartialPivLU<ProjMat>(K_); } // @param camera_point: Point in the camera frame (3d) // @returns The point projected into image space jcc::Vec2 CameraModel::project(const jcc::Vec3& camera_point) const { const jcc::Vec3 projected_h = K_ * camera_point; const jcc::Vec2 projected = projected_h.head<2>() / projected_h(2); return projected; } // Fire that little guy right back through the image plane! // // @param image_point: Point in the image frame (2d) // @returns ray passing through the image point, originating at the center of projection geometry::Ray CameraModel::unproject(const jcc::Vec2& image_point) const { const Eigen::PartialPivLU<ProjMat>& K_inv = get_k_inv(); const jcc::Vec3 image_point_h = jcc::Vec3(image_point.x(), image_point.y(), 1.0); const jcc::Vec3 soln = K_inv.solve(image_point_h); const jcc::Vec3 unprojected = soln; const geometry::Ray unprojected_ray{.origin = jcc::Vec3::Zero(), .direction = unprojected.normalized()}; return unprojected_ray; } const CameraModel::ProjMat& CameraModel::get_k() const { return K_; } const Eigen::PartialPivLU<CameraModel::ProjMat>& CameraModel::get_k_inv() const { return K_inv_; } } // namespace estimation
[ "jpanikul@gmail.com" ]
jpanikul@gmail.com
029dcb7eb4395f238caf9d09b141883e3f9b88ae
83bc275206b311e29903ca2a2cc31ab1722eb09a
/sta-src/Astro-Core/orbitalTOcartesian.h
372e054cc4b93549d37136f8eae082a3cd4b4b4d
[ "LicenseRef-scancode-unknown-license-reference", "IJG" ]
permissive
Dwarf-Planet-Project/SpaceDesignTool
34428a587c29a9bb7034cc585b223c21aea17d3a
85b6905c3ef4b0fa43b41506cd18f0e2c513a701
refs/heads/master
2023-01-20T06:40:43.689896
2023-01-11T21:51:25
2023-01-11T21:51:25
25,429,887
6
3
null
null
null
null
UTF-8
C++
false
false
1,437
h
/* This program is free software; you can redistribute it and/or modify it under the terms of the European Union Public Licence - EUPL v.1.1 as published by the European Commission. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the European Union Public Licence - EUPL v.1.1 for more details. You should have received a copy of the European Union Public Licence - EUPL v.1.1 along with this program. Further information about the European Union Public Licence - EUPL v.1.1 can also be found on the world wide web at http://ec.europa.eu/idabc/eupl */ /* ------ Copyright (C) 2010 STA Steering Board (space.trajectory.analysis AT gmail.com) ---- */ // //------------------ Author: Guillermo Ortega ------------------- //------------------ Affiliation: European Space Agency (ESA) ------------------- //----------------------------------------------------------------------------------- #ifndef _ASTROCORE_ORBITAL_TO_CARTESIAN_H_ #define _ASTROCORE_ORBITAL_TO_CARTESIAN_H_ #include "statevector.h" using namespace sta; sta::StateVector orbitalTOcartesian(double mu, double a, double ec, double i, double w0, double o0, double m0); sta::StateVector orbitalTOcartesian(double mu, KeplerianElements elements); #endif // _ASTROCORE_ORBITAL_TO_CARTESIAN_H_
[ "stamaster@0f720082-229d-4b06-8c75-e5250cb1739c" ]
stamaster@0f720082-229d-4b06-8c75-e5250cb1739c
25f664f6cf4fc0f8514f4d4f912b61fca12528e5
3993a1bd022ad64fbcb8020a4b0faf2f16ad105c
/Chapt_01/09_stringRotation/09_stringRotation/main.cpp
59b7d8abb2f92d225bed52b375f0b9e087af3385
[]
no_license
carakitty/CtCI6th
20a0eb9ea1179a8d34bdba089e3c0e0239666716
8c60ab10f634d2dcb2a766972a210e65ed578a1c
refs/heads/master
2020-03-28T21:08:23.688965
2018-09-22T13:08:09
2018-09-22T13:08:09
149,126,544
0
0
null
null
null
null
UTF-8
C++
false
false
1,312
cpp
// // main.cpp // 09_stringRotation // Given two strings s1 and s2, check if s2 is rotation of s1 using only one call to function isSubstring. // // Created by carakitty on 9/22/18. // Copyright © 2018 carakitty. All rights reserved. // #include <iostream> using namespace std; // check if s2 is the substring of s1 // can also use the lib function in <string>, see githubompressedString_1(str) bool isSubstring(string s1, string s2) { int l1 = int (s1.length()); int l2 = int (s2.length()); if (l2 > l1) return false; int i = 0, j = 0; while (i < l1 && j < l2) { if (s1[i] != s2[j]) { if (j == 0) i++; j = 0; } else { i++; j++; if (j == l2) return true; } } return false; } // check if s2 is the rotation of s1 bool isRotation(string s1, string s2) { if (s1.length() == 0 || s1.length() != s2.length()) return false; return isSubstring(s1+s1, s2); } int main() { string s = "appleapple", sub = "pleap"; cout << "Is " << sub << " substring of " << s << "? " << boolalpha << isSubstring(s, sub) << endl; string s1 = "apple", s2 = "leapp"; cout << "Is " << s2 << " rotation of " << s1 << "? " << boolalpha << isRotation(s1, s2) << endl; return 0; }
[ "MengchaoJiang@Hongxings-MacBook-Pro.local" ]
MengchaoJiang@Hongxings-MacBook-Pro.local
9c0476ff9d27d05f19fbc753f088811b631cb625
8a41901322dcd4bda0e359153c0832189bb00720
/impl/utils.cxx
6141d33dd1011acb5a8816beddcfb8c7aa9652a0
[ "MIT" ]
permissive
PaulDodd/ArgParse
26063bf7c78246f6da1b18199208312ffafae483
b67e0c87e10827fd92845bd0b60221d5063cf033
refs/heads/master
2021-01-17T10:32:07.683999
2016-06-07T09:32:52
2016-06-07T09:32:52
21,761,607
0
0
null
null
null
null
UTF-8
C++
false
false
8,067
cxx
#include "utils.h" #include "CommandLine.h" #include "Stopwatch.h" #include "Numerical2.h" using namespace std; using namespace utils; class quadratic { double m_a, m_b, m_c; public: quadratic(double a, double b, double c) : m_a(a), m_b(b), m_c(c){} double operator()(const double& x) const { return m_a*x * x + m_b*x + m_c; } }; class quadratic2d { double m_a, m_b, m_c; public: quadratic2d(double a, double b, double c) : m_a(a), m_b(b), m_c(c){} double operator()(const vector<double>& x) const { return m_a*x[0] * x[1] + m_b*x[0] + m_c; } }; class CTestSubCommand : public CCommandBase { public: CTestSubCommand() : CCommandBase("sub"), m_Path("-path", "", true), m_Number("-n", 0, 10, false), m_bFlag("-flag") { SetDescription ("This is a test sub-command"); m_Path.SetUsage ("Path to a file"); m_Number.SetUsage ("Integer between 0 and 10"); m_bFlag.SetUsage ("Boolean example"); m_Parser.AddArg(m_Path); m_Parser.AddArg(m_Number); m_Parser.AddArg(m_bFlag); } ~CTestSubCommand(){} int ExecuteMain() { cout<< "Executing command " << m_Name << endl; if(m_Path.IsInitialized()) cout << "Path : "<< m_Path.Value() << endl; if(m_Number.IsInitialized()) cout << "Number : "<< m_Number.Value() << endl; if(m_bFlag.IsInitialized()) cout << "Flag : "<< (m_bFlag.Value() ? "true" : "false") << endl; return CMD_LINE_NO_ERROR; } private: // Arguments CCommandLineArgString m_Path; CCommandLineArgNum<size_t> m_Number; CCommandLineArgBool m_bFlag; }; class CTestCommand : public CCommandBase { public: CTestCommand() : CCommandBase("test") { SetDescription("Command for all tests."); AddCommand(m_SubCommand); } ~CTestCommand() {} int ExecuteMain() { return CMD_LINE_PRINT_HELP; // this command is a no-op } private: // sub-commands CTestSubCommand m_SubCommand; }; class TestProgram : public CProgramBase { public: TestProgram(const string& name, int argc, const char * argv[]) : CProgramBase(name, argc, argv) { SetDescription("This program demonstrates argparse"); AddCommand(m_TestCommand); } ~TestProgram() {} private: CTestCommand m_TestCommand; }; #define ALPHABET "01ABCDEFGHIJKLMNOPQRSTUVWXYZ" int main(int argc, const char * argv[]) { set<int> intset; vector<size_t> v; vector<double> vf, vf2; vector< vector<double> > vff; vf2.push_back(1.0); vf2.push_back(1.0); vff.push_back(vf2); for(size_t i = 0; i < 10; i++) v.push_back(i); vf.push_back(1.00000000001); vf.push_back(0.99999999999); bool equal = 3 == 3; cout << "hello world!" << equal << endl; cout << boolalpha << "5 in vec = " << IsInVec<size_t, equal_to<size_t> >(v, size_t(5)) << endl; float_is_equal<double> f; float_vec_is_equal<double> ff; cout << boolalpha << "1.0 in vecF = " << IsInVec<double, float_is_equal<double> >(vf, double(1.0)) << endl; cout << boolalpha << "vf in vff = " << IsInVec<vector<double>, float_vec_is_equal<double> >(vff, vf) << endl; cout << "abs(-6 % 4)=" << -5%4 << endl; cout << "int(-6) % size_t(4)=" << int(-6)%size_t(4) << endl; for(int i = 0; i < 10; i++){ cout << "d(0, "<< i <<") = " << mod_dist(0, i, 4) << endl; } for(int i = 0; i < 10; i++){ cout << "d(0, "<< i <<") = " << mod_dist(0, i, 7) << endl; } string alpha(ALPHABET), str1 = "AAABBB", str2 = "BAAABB", str3 = "AABBBA", str4 = "ABABBA"; for(size_t i = 0; i < alpha.length(); i++) { cout << alpha[i]<< " = " <<int(alpha[i]) << endl; } circular_string_equal_to eq; cout << str1 << " == " << str2 << " : " << boolalpha << eq(str1, str2, str1.length()) << endl; cout << str1 << " == " << str3 << " : " << boolalpha << eq(str1, str3, str1.length()) << endl; cout << str2 << " == " << str3 << " : " << boolalpha << eq(str2, str3, str2.length()) << endl; cout << str1 << " == " << str4 << " : " << boolalpha << eq(str1, str4, str4.length()) << endl; cout << str2 << " == " << str4 << " : " << boolalpha << eq(str2, str4, str4.length()) << endl; cout << str3 << " == " << str4 << " : " << boolalpha << eq(str3, str4, str4.length()) << endl; cout << "10 = "<< NumberToString(10, 4, '0') << endl; cout << "acos(1) = "<< acos(1)<< endl; cout << "acos(-1) = "<< acos(-1.0000000001)<< endl; std::mt19937_64 generator; cout<< "****************************************************************************************************************************************************"<<endl; cout << generator<< endl<< endl << endl; // rng_util::seed_generator(generator); cout<< "****************************************************************************************************************************************************"<<endl; // cout << generator<< endl<< endl << endl; // cout << "after RNG = " << generator << endl; std::uniform_real_distribution<double> u01(0,1); std::uniform_real_distribution<double> u81(0.8,1); auto rnd = std::bind(u01, generator); auto rnd2 = std::bind(u81, generator); for(size_t i = 0; i < 10; i++) cout << "rnd "<< rnd() << ", "<< rnd2() << endl; maximum(vector<size_t>()); auto func = [](float i, float j)->float{ return i*i + j - 1; }; // quadratic quad(1.0, 0.0, -1.0); // Derivative< double, quadratic > D; // auto dx = std::bind(D, quad, std::placeholders::_1); // double eval = dx(1.0); Function<quadratic> func1(&quad); Function<decltype(func)> func2(&func); quadratic2d quad2d(1.0, 0.0, -1.0); vector<double> x = {0.5, 0.5}; Function<quadratic2d> func3(&quad2d); cout << "func1 = " << func1(0.0) << " func2 = " << func2(2, 3) << " func3 = " << func3(x) <<endl; Derivative<double> Ddouble(0.01); Derivative<float> Dfloat(0.01); auto dfdx = std::bind(Ddouble, func1, 0, std::placeholders::_1); auto dgdx = std::bind(Dfloat, func2, 0, std::placeholders::_1, std::placeholders::_2); auto dgdy = std::bind(Dfloat, func2, 1, std::placeholders::_1, std::placeholders::_2); auto dhdx = std::bind(Ddouble, func3, 0, std::placeholders::_1); cout << "dfdx @ 1.0 = " << dfdx(1.0) << " dgdx @ (2, 3) = " << dgdx(2.0f, 3.0f)<< " dgdy @ (2, 3) = " << dgdy(2.0f, 3.0f) <<endl; cout << "dhdx @ (0.5, 0.5) = " << dhdx(x) << endl; // Partition Test: vector<size_t> p1 = {0, 1, 1, 2}, p2 = {0, 1, 2, 2}, pbar; pbar = math_util::PartitionUnion(p1, p2); for(auto p : pbar) { cout << p << ", "; } cout << endl; vector< vector<size_t> > v_access_check(5, vector<size_t>(5)); for(size_t i = 0; i < 5; i++) for(size_t j = 0; j < 5; j++) v_access_check[i][j] = i*5 + j; access< vector< vector<size_t> >, size_t > accessor; cout << "v[3][3] = " << accessor(v_access_check, size_t(3), size_t(3)) << endl; // accessor(v_access_check, size_t(3), size_t(3)) = 1; cout << "v[3][3] = " << accessor(v_access_check, size_t(3), size_t(3)) << endl; vector<size_t> comb(3, 0); comb[1] = 1; comb[2] = 2; for(size_t i = 0; i < comb.size(); i++) cout << comb[i] << " "; cout << endl; while(math_util::next_combination(comb.rbegin(), comb.rend(), 5)) { for(size_t i = 0; i < comb.size(); i++) cout << comb[i] << " "; cout << endl; } return TestProgram(argv[0], argc, argv).Main(); }
[ "pdodd@umich.edu" ]
pdodd@umich.edu
42634f2a1b16f7d7105800dde7b20140077a0965
c75fe06cdae4ca3e91f5794dbb21ab6a96406776
/UNIMRawDataReader/M2RMidasRootEvent.h
afc05439ddd4aa67b1aa236a81a41f079f73474f
[]
no_license
dellaquilamaster/UNIMapper
20012783df7b9bde41961ccf0de2cecae88ec678
c980a2ed15dbb856a8175268bec3d0bd3b2a00ec
refs/heads/master
2021-06-23T16:22:27.408141
2021-06-15T07:59:50
2021-06-15T07:59:50
211,689,953
0
0
null
null
null
null
UTF-8
C++
false
false
365
h
#ifndef M2RMIDASROOTEVENT_H #define M2RMIDASROOTEVENT_H #include <stdlib.h> #include <TROOT.h> #include <UNIMShared.h> class M2RMidasRootEvent { public : M2RMidasRootEvent(); virtual ~M2RMidasRootEvent(); Int_t fmulti; Short_t * fgid; //[fmulti] Short_t * fch; //[fmulti] Short_t * fampl; //[fmulti] ClassDef(M2RMidasRootEvent,1); }; #endif
[ "daniele@ddellaq.zef.irb.hr" ]
daniele@ddellaq.zef.irb.hr
ab0dba230f430040fa74918ed86ea6ee7b13ee6a
faf52f759ea38fdfeb9e4a06327bdb677fe53931
/repos_2_bzzzuka_Minimizator/include/Math.h
76f0b506ef239b036d12faf71a6a966628514c85
[]
no_license
Redrum34/mix
010866ba0f5c105b49da17ec897f054d59a6e8ca
ed538d7bcfe8c955dd34d1643760e11e869fee13
refs/heads/master
2020-09-01T21:31:13.084997
2019-11-01T20:43:59
2019-11-01T20:43:59
null
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
3,047
h
#pragma once #include <iostream> #include <iomanip> #include <vector> #include <cmath> #include <cassert> //#include <nrtypes.h> // Объявление типов: typedef long double ld; typedef std::vector<ld> Vector; typedef std::vector<double> Vector1; typedef std::vector<Vector> Matrix; typedef ld(*Function)(const Vector & x); /* template<class T> inline const T SIGN(const T &a, const T &b) { return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a); } /* template<class T> inline void SWAP(T &a, T &b) { T dum = a; a = b; b = dum; } /* template<class T> inline const T MAX(const T &a, const T &b) { return b > a ? (b) : (a); } template<class T> inline const T SQR(const T a) { return a * a; } */ typedef std::pair<Vector, int>(*Method)(Function, Vector, int); //typedef std::pair<Vector, int> powell(int *a, DP func(Vec_I_DP &x), int NDIM, int n); // Точность сравнения вещественных чисел: const ld COMPARE_EPS = 0.0000000000000001L; // Математические константы (M_E, M_PI, M_PI_2) в файле реализации // Операторы вывода в поток: std::ostream& operator<<(std::ostream& os, const Vector& v); std::ostream& operator<<(std::ostream& os, const Matrix& m); // Операция умножения вектора на число и различные ее вариации: Vector& operator*=(Vector& v, const ld value); Vector operator*(const ld value, Vector v); Vector operator*(Vector v, const ld value); // Унарный минус для вектора: Vector operator-(Vector v); // Сложение и вычитание векторов: Vector& operator+=(Vector & v1, const Vector& v2); Vector& operator-=(Vector & v1, const Vector& v2); Vector operator+(Vector v1, const Vector& v2); Vector operator-(Vector v1, const Vector& v2); // Скалярное произведение векторов: ld dot(const Vector& v1, const Vector& v2); // Норма вектора: ld norm(const Vector& v); /* template<class T> inline const T MAX(const T &a, const T &b) { return b > a ? (b) : (a); } */ ld MAX(const ld &a, const ld &b); void SWAP(ld &a, ld &b); ld SIGN(const ld &a, const ld &b); ld SQR(const ld a); // Умножение матрицы на вектор: Vector operator*(const Matrix& m, const Vector& v); // Проверка равенства вектора нулю bool is_zero(const Vector& v); // Базисный вектор в пространстве R^n: // на i-ом месте 1, на всех остальных нули Vector id_vect(int size, int i); // Явное взятие градиента от функции: Vector grad(Function f, const Vector& point, const ld h = 1e-4); // Явное вычисление матрицы Гессе (слишком затратно, годится только для проверки результатов) // в точке x с шагом h и погрешностью O(h) Matrix hess(Function f, const Vector& x, const ld h = 1e-4);
[ "Urmud@yandex.ru" ]
Urmud@yandex.ru
c7a3603b8c05eeed0360950193ee815a9b753913
83386ddda3403abcce3458e7bfd63d5d0169a2ae
/visual_phase_2d.cpp
c41633a6f953d3a2b7d6c6ad2d859766ee580ccb
[]
no_license
hoangt/Fourier-Transform-Library
50d62af5fd24acaf4aaa7e1c6364a74d9c6f08fb
0543cf501a7ca64a3ca1c0171dfe9b1ace24446c
refs/heads/master
2021-01-20T00:23:30.594083
2016-09-18T21:56:36
2016-09-18T21:56:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,040
cpp
// Software: Discrete Fourier Transform 1D (for real and complex signals) // Author: Hy Truong Son // Position: PhD Student // Institution: Department of Computer Science, The University of Chicago // Email: sonpascal93@gmail.com, hytruongson@uchicago.edu // Website: http://people.inf.elte.hu/hytruongson/ // Copyright 2016 (c) Hy Truong Son. All rights reserved. #include <iostream> #include <fstream> #include <sstream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <vector> #include <set> #include <iterator> #include <algorithm> #include <ctime> #include "mex.h" using namespace std; int M, N; double **Re; double **Im; double **Phase; void vector2matrix(double *input, int nRows, int nCols, double **output) { for (int i = 0; i < nRows; ++i) { for (int j = 0; j < nCols; ++j) { output[i][j] = input[j * nRows + i]; } } } void matrix2vector(double **input, int nRows, int nCols, double *output) { for (int i = 0; i < nRows; ++i) { for (int j = 0; j < nCols; ++j) { output[j * nRows + i] = input[i][j]; } } } void mexFunction(int nOutputs, mxArray *output_pointers[], int nInputs, const mxArray *input_pointers[]) { if (nInputs != 2) { std::cerr << "Exactly 2 input parameters!" << std::endl; return; } if (nOutputs != 1) { std::cerr << "Exactly 1 output parameters!" << std::endl; return; } if ((mxGetM(input_pointers[0]) != mxGetM(input_pointers[1])) || (mxGetN(input_pointers[0]) != mxGetN(input_pointers[1]))) { std::cerr << "The size of the real part and the imaginary part must be the same!" << std::endl; return; } int M = mxGetM(input_pointers[0]); int N = mxGetN(input_pointers[0]); Re = new double* [M]; Im = new double* [N]; Phase = new double* [M]; for (int row = 0; row < M; ++row) { Re[row] = new double [N]; Im[row] = new double [N]; Phase[row] = new double [N]; } vector2matrix(mxGetPr(input_pointers[0]), M, N, Re); vector2matrix(mxGetPr(input_pointers[1]), M, N, Im); // Computation of the phase and move the basis to the center of the image double max_value = 0.0; for (int row = 0; row < M; ++row) { for (int column = 0; column < N; ++column) { int next_row = (row + M / 2) % M; int next_column = (column + N / 2) % N; Phase[next_row][next_column] = atan2(Im[row][column], Re[row][column]); max_value = max(max_value, Phase[next_row][next_column]); } } // Scaling to [0..255] double scale = 255.0 / (1 + log(max_value)); for (int row = 0; row < M; ++row) { for (int column = 0; column < N; ++column) { Phase[row][column] = scale * log(1 + Phase[row][column]); } } output_pointers[0] = mxCreateDoubleMatrix(M, N, mxREAL); matrix2vector(Phase, M, N, mxGetPr(output_pointers[0])); }
[ "sonpascal93@gmail.com" ]
sonpascal93@gmail.com
ba88010d4a9dfdb4721cbb4000673a7bc1376e33
969814c5773a3889f026ea31b21c6904d0dbe195
/Classes/DocumentContainer.cpp
6c65c419af0497358beef5dfc3343f3296a81157
[]
no_license
starloft3/Newsroom
b92067392ea109ed503ca37e74f452b74accec7c
91a10a52adc0521f38756675a9426de739e7802b
refs/heads/master
2021-01-25T05:11:15.190516
2014-10-15T04:24:28
2014-10-15T04:24:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,195
cpp
#include "Document.h" #include "DocumentContainer.h" USING_NS_CC; DocumentContainer::DocumentContainer() : mActiveDocument( NULL ), mDocumentSprite( NULL ), mIsDraggingDocument( false ) { } DocumentContainer::~DocumentContainer() { mDocumentSprite = NULL; if ( mActiveDocument != NULL ) { delete mActiveDocument; } } bool DocumentContainer::IsInteractable() { return ( mActiveDocument != NULL ); } void DocumentContainer::SpawnNewDocument() { mActiveDocument = new Document(); } void DocumentContainer::WarpToSpawnPoint() { CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); mDocumentSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); } Document* DocumentContainer::GetDocument() { return mActiveDocument; } CCSprite* DocumentContainer::GetSprite() { return mDocumentSprite; } void DocumentContainer::SetSprite(CCSprite* sprite) { mDocumentSprite = sprite; } bool DocumentContainer::GetIsBeingDragged() { return mIsDraggingDocument; } void DocumentContainer::SetIsBeingDragged(bool isBeingDragged) { mIsDraggingDocument = isBeingDragged; }
[ "atbrown21@gmail.com" ]
atbrown21@gmail.com
f11ec71327c82973133bdd5412cd3e53351fdf43
3de27b096822e78b3c826a76460b51dd2fb8d95b
/src/wallet.cpp
c5ce58802ee68922b55769b3e81c7ccfaa653912
[ "MIT" ]
permissive
scryptchain/scryptchain-core
dc6843904c9da237016e53f55d72cd478d73b04c
04cec7a79b0a2eb50095ef02ab00ab497bf7b7b2
refs/heads/master
2020-04-12T03:43:05.869832
2018-12-18T11:16:40
2018-12-18T11:16:40
162,274,891
0
0
null
null
null
null
UTF-8
C++
false
false
83,858
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2014 The ScryptChain developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "txdb.h" #include "wallet.h" #include "walletdb.h" #include "crypter.h" #include "ui_interface.h" #include "base58.h" #include "kernel.h" #include "coincontrol.h" #include <boost/algorithm/string/replace.hpp> using namespace std; extern unsigned int nStakeMaxAge; unsigned int nStakeSplitAge = 1 * 1 * 60 * 60; int64_t nStakeCombineThreshold = 1000 * COIN; ////////////////////////////////////////////////////////////////////////////// // // mapWallet // struct CompareValueOnly { bool operator()(const pair<int64_t, pair<const CWalletTx*, unsigned int> >& t1, const pair<int64_t, pair<const CWalletTx*, unsigned int> >& t2) const { return t1.first < t2.first; } }; CPubKey CWallet::GenerateNewKey() { bool fCompressed = CanSupportFeature(FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets RandAddSeedPerfmon(); CKey key; key.MakeNewKey(fCompressed); // Compressed public keys were introduced in version 0.6.0 if (fCompressed) SetMinVersion(FEATURE_COMPRPUBKEY); CPubKey pubkey = key.GetPubKey(); // Create new metadata int64_t nCreationTime = GetTime(); mapKeyMetadata[pubkey.GetID()] = CKeyMetadata(nCreationTime); if (!nTimeFirstKey || nCreationTime < nTimeFirstKey) nTimeFirstKey = nCreationTime; if (!AddKey(key)) throw std::runtime_error("CWallet::GenerateNewKey() : AddKey failed"); return key.GetPubKey(); } bool CWallet::AddKey(const CKey& key) { CPubKey pubkey = key.GetPubKey(); if (!CCryptoKeyStore::AddKey(key)) return false; if (!fFileBacked) return true; if (!IsCrypted()) return CWalletDB(strWalletFile).WriteKey(pubkey, key.GetPrivKey(), mapKeyMetadata[pubkey.GetID()]); return true; } bool CWallet::AddCryptedKey(const CPubKey &vchPubKey, const vector<unsigned char> &vchCryptedSecret) { if (!CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret)) return false; if (!fFileBacked) return true; { LOCK(cs_wallet); if (pwalletdbEncryption) return pwalletdbEncryption->WriteCryptedKey(vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); else return CWalletDB(strWalletFile).WriteCryptedKey(vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); } return false; } bool CWallet::LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &meta) { if (meta.nCreateTime && (!nTimeFirstKey || meta.nCreateTime < nTimeFirstKey)) nTimeFirstKey = meta.nCreateTime; mapKeyMetadata[pubkey.GetID()] = meta; return true; } bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); } bool CWallet::AddCScript(const CScript& redeemScript) { if (!CCryptoKeyStore::AddCScript(redeemScript)) return false; if (!fFileBacked) return true; return CWalletDB(strWalletFile).WriteCScript(Hash160(redeemScript), redeemScript); } // optional setting to unlock wallet for staking only // serves to disable the trivial sendmoney when OS account compromised // provides no real security bool fWalletUnlockStakingOnly = false; bool CWallet::Unlock(const SecureString& strWalletPassphrase) { if (!IsLocked()) return false; CCrypter crypter; CKeyingMaterial vMasterKey; { LOCK(cs_wallet); BOOST_FOREACH(const MasterKeyMap::value_type& pMasterKey, mapMasterKeys) { if(!crypter.SetKeyFromPassphrase(strWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) return false; if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, vMasterKey)) return false; if (CCryptoKeyStore::Unlock(vMasterKey)) return true; } } return false; } bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase) { bool fWasLocked = IsLocked(); { LOCK(cs_wallet); Lock(); CCrypter crypter; CKeyingMaterial vMasterKey; BOOST_FOREACH(MasterKeyMap::value_type& pMasterKey, mapMasterKeys) { if(!crypter.SetKeyFromPassphrase(strOldWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) return false; if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, vMasterKey)) return false; if (CCryptoKeyStore::Unlock(vMasterKey)) { int64_t nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod); pMasterKey.second.nDeriveIterations = pMasterKey.second.nDeriveIterations * (100 / ((double)(GetTimeMillis() - nStartTime))); nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod); pMasterKey.second.nDeriveIterations = (pMasterKey.second.nDeriveIterations + pMasterKey.second.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime))) / 2; if (pMasterKey.second.nDeriveIterations < 25000) pMasterKey.second.nDeriveIterations = 25000; printf("Wallet passphrase changed to an nDeriveIterations of %i\n", pMasterKey.second.nDeriveIterations); if (!crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) return false; if (!crypter.Encrypt(vMasterKey, pMasterKey.second.vchCryptedKey)) return false; CWalletDB(strWalletFile).WriteMasterKey(pMasterKey.first, pMasterKey.second); if (fWasLocked) Lock(); return true; } } } return false; } void CWallet::SetBestChain(const CBlockLocator& loc) { CWalletDB walletdb(strWalletFile); walletdb.WriteBestBlock(loc); } // This class implements an addrIncoming entry that causes pre-0.4 // clients to crash on startup if reading a private-key-encrypted wallet. class CCorruptAddress { public: IMPLEMENT_SERIALIZE ( if (nType & SER_DISK) READWRITE(nVersion); ) }; bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn, bool fExplicit) { if (nWalletVersion >= nVersion) return true; // when doing an explicit upgrade, if we pass the max version permitted, upgrade all the way if (fExplicit && nVersion > nWalletMaxVersion) nVersion = FEATURE_LATEST; nWalletVersion = nVersion; if (nVersion > nWalletMaxVersion) nWalletMaxVersion = nVersion; if (fFileBacked) { CWalletDB* pwalletdb = pwalletdbIn ? pwalletdbIn : new CWalletDB(strWalletFile); if (nWalletVersion >= 40000) { // Versions prior to 0.4.0 did not support the "minversion" record. // Use a CCorruptAddress to make them crash instead. CCorruptAddress corruptAddress; pwalletdb->WriteSetting("addrIncoming", corruptAddress); } if (nWalletVersion > 40000) pwalletdb->WriteMinVersion(nWalletVersion); if (!pwalletdbIn) delete pwalletdb; } return true; } bool CWallet::SetMaxVersion(int nVersion) { // cannot downgrade below current version if (nWalletVersion > nVersion) return false; nWalletMaxVersion = nVersion; return true; } bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) { if (IsCrypted()) return false; CKeyingMaterial vMasterKey; RandAddSeedPerfmon(); vMasterKey.resize(WALLET_CRYPTO_KEY_SIZE); RAND_bytes(&vMasterKey[0], WALLET_CRYPTO_KEY_SIZE); CMasterKey kMasterKey(nDerivationMethodIndex); RandAddSeedPerfmon(); kMasterKey.vchSalt.resize(WALLET_CRYPTO_SALT_SIZE); RAND_bytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE); CCrypter crypter; int64_t nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, 25000, kMasterKey.nDerivationMethod); kMasterKey.nDeriveIterations = 2500000 / ((double)(GetTimeMillis() - nStartTime)); nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, kMasterKey.nDeriveIterations, kMasterKey.nDerivationMethod); kMasterKey.nDeriveIterations = (kMasterKey.nDeriveIterations + kMasterKey.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime))) / 2; if (kMasterKey.nDeriveIterations < 25000) kMasterKey.nDeriveIterations = 25000; printf("Encrypting Wallet with an nDeriveIterations of %i\n", kMasterKey.nDeriveIterations); if (!crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, kMasterKey.nDeriveIterations, kMasterKey.nDerivationMethod)) return false; if (!crypter.Encrypt(vMasterKey, kMasterKey.vchCryptedKey)) return false; { LOCK(cs_wallet); mapMasterKeys[++nMasterKeyMaxID] = kMasterKey; if (fFileBacked) { pwalletdbEncryption = new CWalletDB(strWalletFile); if (!pwalletdbEncryption->TxnBegin()) return false; pwalletdbEncryption->WriteMasterKey(nMasterKeyMaxID, kMasterKey); } if (!EncryptKeys(vMasterKey)) { if (fFileBacked) pwalletdbEncryption->TxnAbort(); exit(1); //We now probably have half of our keys encrypted in memory, and half not...die and let the user reload their unencrypted wallet. } // Encryption was introduced in version 0.4.0 SetMinVersion(FEATURE_WALLETCRYPT, pwalletdbEncryption, true); if (fFileBacked) { if (!pwalletdbEncryption->TxnCommit()) exit(1); //We now have keys encrypted in memory, but no on disk...die to avoid confusion and let the user reload their unencrypted wallet. delete pwalletdbEncryption; pwalletdbEncryption = NULL; } Lock(); Unlock(strWalletPassphrase); NewKeyPool(); Lock(); // Need to completely rewrite the wallet file; if we don't, bdb might keep // bits of the unencrypted private key in slack space in the database file. CDB::Rewrite(strWalletFile); } NotifyStatusChanged(this); return true; } int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb) { int64_t nRet = nOrderPosNext++; if (pwalletdb) { pwalletdb->WriteOrderPosNext(nOrderPosNext); } else { CWalletDB(strWalletFile).WriteOrderPosNext(nOrderPosNext); } return nRet; } CWallet::TxItems CWallet::OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount) { CWalletDB walletdb(strWalletFile); // First: get all CWalletTx and CAccountingEntry into a sorted-by-order multimap. TxItems txOrdered; // Note: maintaining indices in the database of (account,time) --> txid and (account, time) --> acentry // would make this much faster for applications that do this a lot. for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { CWalletTx* wtx = &((*it).second); txOrdered.insert(make_pair(wtx->nOrderPos, TxPair(wtx, (CAccountingEntry*)0))); } acentries.clear(); walletdb.ListAccountCreditDebit(strAccount, acentries); BOOST_FOREACH(CAccountingEntry& entry, acentries) { txOrdered.insert(make_pair(entry.nOrderPos, TxPair((CWalletTx*)0, &entry))); } return txOrdered; } void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock) { // Anytime a signature is successfully verified, it's proof the outpoint is spent. // Update the wallet spent flag if it doesn't know due to wallet.dat being // restored from backup or the user making copies of wallet.dat. { LOCK(cs_wallet); BOOST_FOREACH(const CTxIn& txin, tx.vin) { map<uint256, CWalletTx>::iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { CWalletTx& wtx = (*mi).second; if (txin.prevout.n >= wtx.vout.size()) printf("WalletUpdateSpent: bad wtx %s\n", wtx.GetHash().ToString().c_str()); else if (!wtx.IsSpent(txin.prevout.n) && IsMine(wtx.vout[txin.prevout.n])) { printf("WalletUpdateSpent found spent coin %s SPTC %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str()); wtx.MarkSpent(txin.prevout.n); wtx.WriteToDisk(); NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED); } } } if (fBlock) { uint256 hash = tx.GetHash(); map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash); CWalletTx& wtx = (*mi).second; BOOST_FOREACH(const CTxOut& txout, tx.vout) { if (IsMine(txout)) { wtx.MarkUnspent(&txout - &tx.vout[0]); wtx.WriteToDisk(); NotifyTransactionChanged(this, hash, CT_UPDATED); } } } } } void CWallet::MarkDirty() { { LOCK(cs_wallet); BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet) item.second.MarkDirty(); } } bool CWallet::AddToWallet(const CWalletTx& wtxIn) { uint256 hash = wtxIn.GetHash(); { LOCK(cs_wallet); // Inserts only if not already there, returns tx inserted or tx found pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn)); CWalletTx& wtx = (*ret.first).second; wtx.BindWallet(this); bool fInsertedNew = ret.second; if (fInsertedNew) { wtx.nTimeReceived = GetAdjustedTime(); wtx.nOrderPos = IncOrderPosNext(); wtx.nTimeSmart = wtx.nTimeReceived; if (wtxIn.hashBlock != 0) { if (mapBlockIndex.count(wtxIn.hashBlock)) { unsigned int latestNow = wtx.nTimeReceived; unsigned int latestEntry = 0; { // Tolerate times up to the last timestamp in the wallet not more than 5 minutes into the future int64_t latestTolerated = latestNow + 300; std::list<CAccountingEntry> acentries; TxItems txOrdered = OrderedTxItems(acentries); for (TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { CWalletTx *const pwtx = (*it).second.first; if (pwtx == &wtx) continue; CAccountingEntry *const pacentry = (*it).second.second; int64_t nSmartTime; if (pwtx) { nSmartTime = pwtx->nTimeSmart; if (!nSmartTime) nSmartTime = pwtx->nTimeReceived; } else nSmartTime = pacentry->nTime; if (nSmartTime <= latestTolerated) { latestEntry = nSmartTime; if (nSmartTime > latestNow) latestNow = nSmartTime; break; } } } unsigned int& blocktime = mapBlockIndex[wtxIn.hashBlock]->nTime; wtx.nTimeSmart = std::max(latestEntry, std::min(blocktime, latestNow)); } else printf("AddToWallet() : found %s in block %s not in index\n", wtxIn.GetHash().ToString().substr(0,10).c_str(), wtxIn.hashBlock.ToString().c_str()); } } bool fUpdated = false; if (!fInsertedNew) { // Merge if (wtxIn.hashBlock != 0 && wtxIn.hashBlock != wtx.hashBlock) { wtx.hashBlock = wtxIn.hashBlock; fUpdated = true; } if (wtxIn.nIndex != -1 && (wtxIn.vMerkleBranch != wtx.vMerkleBranch || wtxIn.nIndex != wtx.nIndex)) { wtx.vMerkleBranch = wtxIn.vMerkleBranch; wtx.nIndex = wtxIn.nIndex; fUpdated = true; } if (wtxIn.fFromMe && wtxIn.fFromMe != wtx.fFromMe) { wtx.fFromMe = wtxIn.fFromMe; fUpdated = true; } fUpdated |= wtx.UpdateSpent(wtxIn.vfSpent); } //// debug print printf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString().substr(0,10).c_str(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); // Write to disk if (fInsertedNew || fUpdated) if (!wtx.WriteToDisk()) return false; #ifndef QT_GUI // If default receiving address gets used, replace it with a new one CScript scriptDefaultKey; scriptDefaultKey.SetDestination(vchDefaultKey.GetID()); BOOST_FOREACH(const CTxOut& txout, wtx.vout) { if (txout.scriptPubKey == scriptDefaultKey) { CPubKey newDefaultKey; if (GetKeyFromPool(newDefaultKey, false)) { SetDefaultKey(newDefaultKey); SetAddressBookName(vchDefaultKey.GetID(), ""); } } } #endif // since AddToWallet is called directly for self-originating transactions, check for consumption of own coins WalletUpdateSpent(wtx, (wtxIn.hashBlock != 0)); // Notify UI of new or updated transaction NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED); // notify an external script when a wallet transaction comes in or is updated std::string strCmd = GetArg("-walletnotify", ""); if ( !strCmd.empty()) { boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex()); boost::thread t(runCommand, strCmd); // thread runs free } } return true; } // Add a transaction to the wallet, or update it. // pblock is optional, but should be provided if the transaction is known to be in a block. // If fUpdate is true, existing transactions will be updated. bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate, bool fFindBlock) { uint256 hash = tx.GetHash(); { LOCK(cs_wallet); bool fExisted = mapWallet.count(hash); if (fExisted && !fUpdate) return false; if (fExisted || IsMine(tx) || IsFromMe(tx)) { CWalletTx wtx(this,tx); // Get merkle branch if transaction was found in a block if (pblock) wtx.SetMerkleBranch(pblock); return AddToWallet(wtx); } else WalletUpdateSpent(tx); } return false; } bool CWallet::EraseFromWallet(uint256 hash) { if (!fFileBacked) return false; { LOCK(cs_wallet); if (mapWallet.erase(hash)) CWalletDB(strWalletFile).EraseTx(hash); } return true; } bool CWallet::IsMine(const CTxIn &txin) const { { LOCK(cs_wallet); map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { const CWalletTx& prev = (*mi).second; if (txin.prevout.n < prev.vout.size()) if (IsMine(prev.vout[txin.prevout.n])) return true; } } return false; } int64_t CWallet::GetDebit(const CTxIn &txin) const { { LOCK(cs_wallet); map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { const CWalletTx& prev = (*mi).second; if (txin.prevout.n < prev.vout.size()) if (IsMine(prev.vout[txin.prevout.n])) return prev.vout[txin.prevout.n].nValue; } } return 0; } bool CWallet::IsChange(const CTxOut& txout) const { CTxDestination address; // TODO: fix handling of 'change' outputs. The assumption is that any // payment to a TX_PUBKEYHASH that is mine but isn't in the address book // is change. That assumption is likely to break when we implement multisignature // wallets that return change back into a multi-signature-protected address; // a better way of identifying which outputs are 'the send' and which are // 'the change' will need to be implemented (maybe extend CWalletTx to remember // which output, if any, was change). if (ExtractDestination(txout.scriptPubKey, address) && ::IsMine(*this, address)) { LOCK(cs_wallet); if (!mapAddressBook.count(address)) return true; } return false; } int64_t CWalletTx::GetTxTime() const { int64_t n = nTimeSmart; return n ? n : nTimeReceived; } int CWalletTx::GetRequestCount() const { // Returns -1 if it wasn't being tracked int nRequests = -1; { LOCK(pwallet->cs_wallet); if (IsCoinBase() || IsCoinStake()) { // Generated block if (hashBlock != 0) { map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); if (mi != pwallet->mapRequestCount.end()) nRequests = (*mi).second; } } else { // Did anyone request this transaction? map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(GetHash()); if (mi != pwallet->mapRequestCount.end()) { nRequests = (*mi).second; // How about the block it's in? if (nRequests == 0 && hashBlock != 0) { map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); if (mi != pwallet->mapRequestCount.end()) nRequests = (*mi).second; else nRequests = 1; // If it's in someone else's block it must have got out } } } } return nRequests; } void CWalletTx::GetAmounts(list<pair<CTxDestination, int64_t> >& listReceived, list<pair<CTxDestination, int64_t> >& listSent, int64_t& nFee, string& strSentAccount) const { nFee = 0; listReceived.clear(); listSent.clear(); strSentAccount = strFromAccount; // Compute fee: int64_t nDebit = GetDebit(); if (nDebit > 0) // debit>0 means we signed/sent this transaction { int64_t nValueOut = GetValueOut(); nFee = nDebit - nValueOut; } // Sent/received. BOOST_FOREACH(const CTxOut& txout, vout) { // Skip special stake out if (txout.scriptPubKey.empty()) continue; bool fIsMine; // Only need to handle txouts if AT LEAST one of these is true: // 1) they debit from us (sent) // 2) the output is to us (received) if (nDebit > 0) { // Don't report 'change' txouts if (pwallet->IsChange(txout)) continue; fIsMine = pwallet->IsMine(txout); } else if (!(fIsMine = pwallet->IsMine(txout))) continue; // In either case, we need to get the destination address CTxDestination address; if (!ExtractDestination(txout.scriptPubKey, address)) { printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n", this->GetHash().ToString().c_str()); address = CNoDestination(); } // If we are debited by the transaction, add the output as a "sent" entry if (nDebit > 0) listSent.push_back(make_pair(address, txout.nValue)); // If we are receiving the output, add it as a "received" entry if (fIsMine) listReceived.push_back(make_pair(address, txout.nValue)); } } void CWalletTx::GetAccountAmounts(const string& strAccount, int64_t& nReceived, int64_t& nSent, int64_t& nFee) const { nReceived = nSent = nFee = 0; int64_t allFee; string strSentAccount; list<pair<CTxDestination, int64_t> > listReceived; list<pair<CTxDestination, int64_t> > listSent; GetAmounts(listReceived, listSent, allFee, strSentAccount); if (strAccount == strSentAccount) { BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64_t)& s, listSent) nSent += s.second; nFee = allFee; } { LOCK(pwallet->cs_wallet); BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64_t)& r, listReceived) { if (pwallet->mapAddressBook.count(r.first)) { map<CTxDestination, string>::const_iterator mi = pwallet->mapAddressBook.find(r.first); if (mi != pwallet->mapAddressBook.end() && (*mi).second == strAccount) nReceived += r.second; } else if (strAccount.empty()) { nReceived += r.second; } } } } void CWalletTx::AddSupportingTransactions(CTxDB& txdb) { vtxPrev.clear(); const int COPY_DEPTH = 3; if (SetMerkleBranch() < COPY_DEPTH) { vector<uint256> vWorkQueue; BOOST_FOREACH(const CTxIn& txin, vin) vWorkQueue.push_back(txin.prevout.hash); // This critsect is OK because txdb is already open { LOCK(pwallet->cs_wallet); map<uint256, const CMerkleTx*> mapWalletPrev; set<uint256> setAlreadyDone; for (unsigned int i = 0; i < vWorkQueue.size(); i++) { uint256 hash = vWorkQueue[i]; if (setAlreadyDone.count(hash)) continue; setAlreadyDone.insert(hash); CMerkleTx tx; map<uint256, CWalletTx>::const_iterator mi = pwallet->mapWallet.find(hash); if (mi != pwallet->mapWallet.end()) { tx = (*mi).second; BOOST_FOREACH(const CMerkleTx& txWalletPrev, (*mi).second.vtxPrev) mapWalletPrev[txWalletPrev.GetHash()] = &txWalletPrev; } else if (mapWalletPrev.count(hash)) { tx = *mapWalletPrev[hash]; } else if (!fClient && txdb.ReadDiskTx(hash, tx)) { ; } else { printf("ERROR: AddSupportingTransactions() : unsupported transaction\n"); continue; } int nDepth = tx.SetMerkleBranch(); vtxPrev.push_back(tx); if (nDepth < COPY_DEPTH) { BOOST_FOREACH(const CTxIn& txin, tx.vin) vWorkQueue.push_back(txin.prevout.hash); } } } } reverse(vtxPrev.begin(), vtxPrev.end()); } bool CWalletTx::WriteToDisk() { return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this); } // Scan the block chain (starting in pindexStart) for transactions // from or to us. If fUpdate is true, found transactions that already // exist in the wallet will be updated. int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) { int ret = 0; CBlockIndex* pindex = pindexStart; { LOCK(cs_wallet); while (pindex) { // no need to read and scan block, if block was created before // our wallet birthday (as adjusted for block time variability) if (nTimeFirstKey && (pindex->nTime < (nTimeFirstKey - 7200))) { pindex = pindex->pnext; continue; } CBlock block; block.ReadFromDisk(pindex, true); BOOST_FOREACH(CTransaction& tx, block.vtx) { if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) ret++; } pindex = pindex->pnext; } } return ret; } int CWallet::ScanForWalletTransaction(const uint256& hashTx) { CTransaction tx; tx.ReadFromDisk(COutPoint(hashTx, 0)); if (AddToWalletIfInvolvingMe(tx, NULL, true, true)) return 1; return 0; } void CWallet::ReacceptWalletTransactions() { CTxDB txdb("r"); bool fRepeat = true; while (fRepeat) { LOCK(cs_wallet); fRepeat = false; vector<CDiskTxPos> vMissingTx; BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet) { CWalletTx& wtx = item.second; if ((wtx.IsCoinBase() && wtx.IsSpent(0)) || (wtx.IsCoinStake() && wtx.IsSpent(1))) continue; CTxIndex txindex; bool fUpdated = false; if (txdb.ReadTxIndex(wtx.GetHash(), txindex)) { // Update fSpent if a tx got spent somewhere else by a copy of wallet.dat if (txindex.vSpent.size() != wtx.vout.size()) { printf("ERROR: ReacceptWalletTransactions() : txindex.vSpent.size() %"PRIszu" != wtx.vout.size() %"PRIszu"\n", txindex.vSpent.size(), wtx.vout.size()); continue; } for (unsigned int i = 0; i < txindex.vSpent.size(); i++) { if (wtx.IsSpent(i)) continue; if (!txindex.vSpent[i].IsNull() && IsMine(wtx.vout[i])) { wtx.MarkSpent(i); fUpdated = true; vMissingTx.push_back(txindex.vSpent[i]); } } if (fUpdated) { printf("ReacceptWalletTransactions found spent coin %s SPTC %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str()); wtx.MarkDirty(); wtx.WriteToDisk(); } } else { // Re-accept any txes of ours that aren't already in a block if (!(wtx.IsCoinBase() || wtx.IsCoinStake())) wtx.AcceptWalletTransaction(txdb); } } if (!vMissingTx.empty()) { // TODO: optimize this to scan just part of the block chain? if (ScanForWalletTransactions(pindexGenesisBlock)) fRepeat = true; // Found missing transactions: re-do re-accept. } } } void CWalletTx::RelayWalletTransaction(CTxDB& txdb) { BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) { if (!(tx.IsCoinBase() || tx.IsCoinStake())) { uint256 hash = tx.GetHash(); if (!txdb.ContainsTx(hash)) RelayTransaction((CTransaction)tx, hash); } } if (!(IsCoinBase() || IsCoinStake())) { uint256 hash = GetHash(); if (!txdb.ContainsTx(hash)) { printf("Relaying wtx %s\n", hash.ToString().substr(0,10).c_str()); RelayTransaction((CTransaction)*this, hash); } } } void CWalletTx::RelayWalletTransaction() { CTxDB txdb("r"); RelayWalletTransaction(txdb); } void CWallet::ResendWalletTransactions(bool fForce) { if (!fForce) { // Do this infrequently and randomly to avoid giving away // that these are our transactions. static int64_t nNextTime; if (GetTime() < nNextTime) return; bool fFirst = (nNextTime == 0); nNextTime = GetTime() + GetRand(30 * 60); if (fFirst) return; // Only do it if there's been a new block since last time static int64_t nLastTime; if (nTimeBestReceived < nLastTime) return; nLastTime = GetTime(); } // Rebroadcast any of our txes that aren't in a block yet printf("ResendWalletTransactions()\n"); CTxDB txdb("r"); { LOCK(cs_wallet); // Sort them in chronological order multimap<unsigned int, CWalletTx*> mapSorted; BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet) { CWalletTx& wtx = item.second; // Don't rebroadcast until it's had plenty of time that // it should have gotten in already by now. if (fForce || nTimeBestReceived - (int64_t)wtx.nTimeReceived > 5 * 60) mapSorted.insert(make_pair(wtx.nTimeReceived, &wtx)); } BOOST_FOREACH(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted) { CWalletTx& wtx = *item.second; if (wtx.CheckTransaction()) wtx.RelayWalletTransaction(txdb); else printf("ResendWalletTransactions() : CheckTransaction failed for transaction %s\n", wtx.GetHash().ToString().c_str()); } } } ////////////////////////////////////////////////////////////////////////////// // // Actions // int64_t CWallet::GetBalance() const { int64_t nTotal = 0; { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (pcoin->IsTrusted()) nTotal += pcoin->GetAvailableCredit(); } } return nTotal; } int64_t CWallet::GetUnconfirmedBalance() const { int64_t nTotal = 0; { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (!pcoin->IsFinal() || !pcoin->IsTrusted()) nTotal += pcoin->GetAvailableCredit(); } } return nTotal; } int64_t CWallet::GetImmatureBalance() const { int64_t nTotal = 0; { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx& pcoin = (*it).second; if (pcoin.IsCoinBase() && pcoin.GetBlocksToMaturity() > 0 && pcoin.IsInMainChain()) nTotal += GetCredit(pcoin); } } return nTotal; } // populate vCoins with vector of spendable COutputs void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl) const { vCoins.clear(); { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (!pcoin->IsFinal()) continue; if (fOnlyConfirmed && !pcoin->IsTrusted()) continue; if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0) continue; if(pcoin->IsCoinStake() && pcoin->GetBlocksToMaturity() > 0) continue; int nDepth = pcoin->GetDepthInMainChain(); if (nDepth < 0) continue; for (unsigned int i = 0; i < pcoin->vout.size(); i++) if (!(pcoin->IsSpent(i)) && IsMine(pcoin->vout[i]) && pcoin->vout[i].nValue >= nMinimumInputValue && (!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i))) vCoins.push_back(COutput(pcoin, i, nDepth)); } } } void CWallet::AvailableCoinsMinConf(vector<COutput>& vCoins, int nConf) const { vCoins.clear(); { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (!pcoin->IsFinal()) continue; if(pcoin->GetDepthInMainChain() < nConf) continue; for (unsigned int i = 0; i < pcoin->vout.size(); i++) if (!(pcoin->IsSpent(i)) && IsMine(pcoin->vout[i]) && pcoin->vout[i].nValue >= nMinimumInputValue) vCoins.push_back(COutput(pcoin, i, pcoin->GetDepthInMainChain())); } } } static void ApproximateBestSubset(vector<pair<int64_t, pair<const CWalletTx*,unsigned int> > >vValue, int64_t nTotalLower, int64_t nTargetValue, vector<char>& vfBest, int64_t& nBest, int iterations = 1000) { vector<char> vfIncluded; vfBest.assign(vValue.size(), true); nBest = nTotalLower; for (int nRep = 0; nRep < iterations && nBest != nTargetValue; nRep++) { vfIncluded.assign(vValue.size(), false); int64_t nTotal = 0; bool fReachedTarget = false; for (int nPass = 0; nPass < 2 && !fReachedTarget; nPass++) { for (unsigned int i = 0; i < vValue.size(); i++) { if (nPass == 0 ? rand() % 2 : !vfIncluded[i]) { nTotal += vValue[i].first; vfIncluded[i] = true; if (nTotal >= nTargetValue) { fReachedTarget = true; if (nTotal < nBest) { nBest = nTotal; vfBest = vfIncluded; } nTotal -= vValue[i].first; vfIncluded[i] = false; } } } } } } // ScryptChain: total coins staked (non-spendable until maturity) int64_t CWallet::GetStake() const { int64_t nTotal = 0; LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (pcoin->IsCoinStake() && pcoin->GetBlocksToMaturity() > 0 && pcoin->GetDepthInMainChain() > 0) nTotal += CWallet::GetCredit(*pcoin); } return nTotal; } int64_t CWallet::GetNewMint() const { int64_t nTotal = 0; LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0 && pcoin->GetDepthInMainChain() > 0) nTotal += CWallet::GetCredit(*pcoin); } return nTotal; } bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, unsigned int nSpendTime, int nConfMine, int nConfTheirs, vector<COutput> vCoins, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const { setCoinsRet.clear(); nValueRet = 0; // List of values less than target pair<int64_t, pair<const CWalletTx*,unsigned int> > coinLowestLarger; coinLowestLarger.first = std::numeric_limits<int64_t>::max(); coinLowestLarger.second.first = NULL; vector<pair<int64_t, pair<const CWalletTx*,unsigned int> > > vValue; int64_t nTotalLower = 0; random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt); BOOST_FOREACH(COutput output, vCoins) { const CWalletTx *pcoin = output.tx; if (output.nDepth < (pcoin->IsFromMe() ? nConfMine : nConfTheirs)) continue; int i = output.i; // Follow the timestamp rules if (pcoin->nTime > nSpendTime) continue; int64_t n = pcoin->vout[i].nValue; pair<int64_t,pair<const CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin, i)); if (n == nTargetValue) { setCoinsRet.insert(coin.second); nValueRet += coin.first; return true; } else if (n < nTargetValue + CENT) { vValue.push_back(coin); nTotalLower += n; } else if (n < coinLowestLarger.first) { coinLowestLarger = coin; } } if (nTotalLower == nTargetValue) { for (unsigned int i = 0; i < vValue.size(); ++i) { setCoinsRet.insert(vValue[i].second); nValueRet += vValue[i].first; } return true; } if (nTotalLower < nTargetValue) { if (coinLowestLarger.second.first == NULL) return false; setCoinsRet.insert(coinLowestLarger.second); nValueRet += coinLowestLarger.first; return true; } // Solve subset sum by stochastic approximation sort(vValue.rbegin(), vValue.rend(), CompareValueOnly()); vector<char> vfBest; int64_t nBest; ApproximateBestSubset(vValue, nTotalLower, nTargetValue, vfBest, nBest, 1000); if (nBest != nTargetValue && nTotalLower >= nTargetValue + CENT) ApproximateBestSubset(vValue, nTotalLower, nTargetValue + CENT, vfBest, nBest, 1000); // If we have a bigger coin and (either the stochastic approximation didn't find a good solution, // or the next bigger coin is closer), return the bigger coin if (coinLowestLarger.second.first && ((nBest != nTargetValue && nBest < nTargetValue + CENT) || coinLowestLarger.first <= nBest)) { setCoinsRet.insert(coinLowestLarger.second); nValueRet += coinLowestLarger.first; } else { for (unsigned int i = 0; i < vValue.size(); i++) if (vfBest[i]) { setCoinsRet.insert(vValue[i].second); nValueRet += vValue[i].first; } if (fDebug && GetBoolArg("-printpriority")) { //// debug print printf("SelectCoins() best subset: "); for (unsigned int i = 0; i < vValue.size(); i++) if (vfBest[i]) printf("%s ", FormatMoney(vValue[i].first).c_str()); printf("total %s\n", FormatMoney(nBest).c_str()); } } return true; } bool CWallet::SelectCoins(int64_t nTargetValue, unsigned int nSpendTime, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet, const CCoinControl* coinControl) const { vector<COutput> vCoins; AvailableCoins(vCoins, true, coinControl); // coin control -> return all selected outputs (we want all selected to go into the transaction for sure) if (coinControl && coinControl->HasSelected()) { BOOST_FOREACH(const COutput& out, vCoins) { nValueRet += out.tx->vout[out.i].nValue; setCoinsRet.insert(make_pair(out.tx, out.i)); } return (nValueRet >= nTargetValue); } return (SelectCoinsMinConf(nTargetValue, nSpendTime, 1, 6, vCoins, setCoinsRet, nValueRet) || SelectCoinsMinConf(nTargetValue, nSpendTime, 1, 1, vCoins, setCoinsRet, nValueRet) || SelectCoinsMinConf(nTargetValue, nSpendTime, 0, 1, vCoins, setCoinsRet, nValueRet)); } // Select some coins without random shuffle or best subset approximation bool CWallet::SelectCoinsSimple(int64_t nTargetValue, unsigned int nSpendTime, int nMinConf, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const { vector<COutput> vCoins; AvailableCoinsMinConf(vCoins, nMinConf); setCoinsRet.clear(); nValueRet = 0; BOOST_FOREACH(COutput output, vCoins) { const CWalletTx *pcoin = output.tx; int i = output.i; // Stop if we've chosen enough inputs if (nValueRet >= nTargetValue) break; // Follow the timestamp rules if (pcoin->nTime > nSpendTime) continue; int64_t n = pcoin->vout[i].nValue; pair<int64_t,pair<const CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin, i)); if (n >= nTargetValue) { // If input value is greater or equal to target then simply insert // it into the current subset and exit setCoinsRet.insert(coin.second); nValueRet += coin.first; break; } else if (n < nTargetValue + CENT) { setCoinsRet.insert(coin.second); nValueRet += coin.first; } } return true; } bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64_t& nFeeRet, const CCoinControl* coinControl) { int64_t nValue = 0; BOOST_FOREACH (const PAIRTYPE(CScript, int64_t)& s, vecSend) { if (nValue < 0) return false; nValue += s.second; } if (vecSend.empty() || nValue < 0) return false; wtxNew.BindWallet(this); { LOCK2(cs_main, cs_wallet); // txdb must be opened before the mapWallet lock CTxDB txdb("r"); { nFeeRet = nTransactionFee; while (true) { wtxNew.vin.clear(); wtxNew.vout.clear(); wtxNew.fFromMe = true; int64_t nTotalValue = nValue + nFeeRet; double dPriority = 0; // vouts to the payees BOOST_FOREACH (const PAIRTYPE(CScript, int64_t)& s, vecSend) wtxNew.vout.push_back(CTxOut(s.second, s.first)); // Choose coins to use set<pair<const CWalletTx*,unsigned int> > setCoins; int64_t nValueIn = 0; if (!SelectCoins(nTotalValue, wtxNew.nTime, setCoins, nValueIn, coinControl)) return false; BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { int64_t nCredit = pcoin.first->vout[pcoin.second].nValue; dPriority += (double)nCredit * pcoin.first->GetDepthInMainChain(); } int64_t nChange = nValueIn - nValue - nFeeRet; // if sub-cent change is required, the fee must be raised to at least MIN_TX_FEE // or until nChange becomes zero // NOTE: this depends on the exact behaviour of GetMinFee if (nFeeRet < MIN_TX_FEE && nChange > 0 && nChange < CENT) { int64_t nMoveToFee = min(nChange, MIN_TX_FEE - nFeeRet); nChange -= nMoveToFee; nFeeRet += nMoveToFee; } if (nChange > 0) { // Fill a vout to ourself // TODO: pass in scriptChange instead of reservekey so // change transaction isn't always pay-to-bitcoin-address CScript scriptChange; // coin control: send change to custom address if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange)) scriptChange.SetDestination(coinControl->destChange); // no coin control: send change to newly generated address else { // Note: We use a new key here to keep it from being obvious which side is the change. // The drawback is that by not reusing a previous key, the change may be lost if a // backup is restored, if the backup doesn't have the new private key for the change. // If we reused the old key, it would be possible to add code to look for and // rediscover unknown transactions that were written with keys of ours to recover // post-backup change. // Reserve a new key pair from key pool CPubKey vchPubKey = reservekey.GetReservedKey(); scriptChange.SetDestination(vchPubKey.GetID()); } // Insert change txn at random position: vector<CTxOut>::iterator position = wtxNew.vout.begin()+GetRandInt(wtxNew.vout.size()); wtxNew.vout.insert(position, CTxOut(nChange, scriptChange)); } else reservekey.ReturnKey(); // Fill vin BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins) wtxNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second)); // Sign int nIn = 0; BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins) if (!SignSignature(*this, *coin.first, wtxNew, nIn++)) return false; // Limit size unsigned int nBytes = ::GetSerializeSize(*(CTransaction*)&wtxNew, SER_NETWORK, PROTOCOL_VERSION); if (nBytes >= MAX_BLOCK_SIZE_GEN/5) return false; dPriority /= nBytes; // Check that enough fee is included int64_t nPayFee = nTransactionFee * (1 + (int64_t)nBytes / 1000); int64_t nMinFee = wtxNew.GetMinFee(1, GMF_SEND, nBytes); if (nFeeRet < max(nPayFee, nMinFee)) { nFeeRet = max(nPayFee, nMinFee); continue; } // Fill vtxPrev by copying from previous transactions vtxPrev wtxNew.AddSupportingTransactions(txdb); wtxNew.fTimeReceivedIsTxTime = true; break; } } } return true; } bool CWallet::CreateTransaction(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64_t& nFeeRet, const CCoinControl* coinControl) { vector< pair<CScript, int64_t> > vecSend; vecSend.push_back(make_pair(scriptPubKey, nValue)); return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, coinControl); } // NovaCoin: get current stake weight bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64_t& nMinWeight, uint64_t& nMaxWeight, uint64_t& nWeight) { // Choose coins to use int64_t nBalance = GetBalance(); if (nBalance <= nReserveBalance) return false; vector<const CWalletTx*> vwtxPrev; set<pair<const CWalletTx*,unsigned int> > setCoins; int64_t nValueIn = 0; if (!SelectCoinsSimple(nBalance - nReserveBalance, GetTime(), nCoinbaseMaturity + 10, setCoins, nValueIn)) return false; if (setCoins.empty()) return false; CTxDB txdb("r"); BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { CTxIndex txindex; { LOCK2(cs_main, cs_wallet); if (!txdb.ReadTxIndex(pcoin.first->GetHash(), txindex)) continue; } int64_t nTimeWeight = GetWeight((int64_t)pcoin.first->nTime, (int64_t)GetTime()); CBigNum bnCoinDayWeight = CBigNum(pcoin.first->vout[pcoin.second].nValue) * nTimeWeight / COIN / (24 * 60 * 60); // Weight is greater than zero if (nTimeWeight > 0) { nWeight += bnCoinDayWeight.getuint64(); } // Weight is greater than zero, but the maximum value isn't reached yet if (nTimeWeight > 0 && nTimeWeight < nStakeMaxAge) { nMinWeight += bnCoinDayWeight.getuint64(); } // Maximum weight was reached if (nTimeWeight == nStakeMaxAge) { nMaxWeight += bnCoinDayWeight.getuint64(); } } return true; } bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64_t nSearchInterval, int64_t nFees, CTransaction& txNew, CKey& key) { CBlockIndex* pindexPrev = pindexBest; CBigNum bnTargetPerCoinDay; bnTargetPerCoinDay.SetCompact(nBits); txNew.vin.clear(); txNew.vout.clear(); // Mark coin stake transaction CScript scriptEmpty; scriptEmpty.clear(); txNew.vout.push_back(CTxOut(0, scriptEmpty)); // Choose coins to use int64_t nBalance = GetBalance(); if (nBalance <= nReserveBalance) return false; vector<const CWalletTx*> vwtxPrev; set<pair<const CWalletTx*,unsigned int> > setCoins; int64_t nValueIn = 0; // Select coins with suitable depth if (!SelectCoinsSimple(nBalance - nReserveBalance, txNew.nTime, nCoinbaseMaturity + 10, setCoins, nValueIn)) return false; if (setCoins.empty()) return false; int64_t nCredit = 0; CScript scriptPubKeyKernel; CTxDB txdb("r"); BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { CTxIndex txindex; { LOCK2(cs_main, cs_wallet); if (!txdb.ReadTxIndex(pcoin.first->GetHash(), txindex)) continue; } // Read block header CBlock block; { LOCK2(cs_main, cs_wallet); if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false)) continue; } static int nMaxStakeSearchInterval = 60; if (block.GetBlockTime() + nStakeMinAge > txNew.nTime - nMaxStakeSearchInterval) continue; // only count coins meeting min age requirement bool fKernelFound = false; for (unsigned int n=0; n<min(nSearchInterval,(int64_t)nMaxStakeSearchInterval) && !fKernelFound && !fShutdown && pindexPrev == pindexBest; n++) { // Search backward in time from the given txNew timestamp // Search nSearchInterval seconds back up to nMaxStakeSearchInterval uint256 hashProofOfStake = 0, targetProofOfStake = 0; COutPoint prevoutStake = COutPoint(pcoin.first->GetHash(), pcoin.second); if (CheckStakeKernelHash(nBits, block, txindex.pos.nTxPos - txindex.pos.nBlockPos, *pcoin.first, prevoutStake, txNew.nTime - n, hashProofOfStake, targetProofOfStake)) { // Found a kernel if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : kernel found\n"); vector<valtype> vSolutions; txnouttype whichType; CScript scriptPubKeyOut; scriptPubKeyKernel = pcoin.first->vout[pcoin.second].scriptPubKey; if (!Solver(scriptPubKeyKernel, whichType, vSolutions)) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : failed to parse kernel\n"); break; } if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : parsed kernel type=%d\n", whichType); if (whichType != TX_PUBKEY && whichType != TX_PUBKEYHASH) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : no support for kernel type=%d\n", whichType); break; // only support pay to public key and pay to address } if (whichType == TX_PUBKEYHASH) // pay to address type { // convert to pay to public key type if (!keystore.GetKey(uint160(vSolutions[0]), key)) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : failed to get key for kernel type=%d\n", whichType); break; // unable to find corresponding public key } scriptPubKeyOut << key.GetPubKey() << OP_CHECKSIG; } if (whichType == TX_PUBKEY) { valtype& vchPubKey = vSolutions[0]; if (!keystore.GetKey(Hash160(vchPubKey), key)) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : failed to get key for kernel type=%d\n", whichType); break; // unable to find corresponding public key } if (key.GetPubKey() != vchPubKey) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : invalid key for kernel type=%d\n", whichType); break; // keys mismatch } scriptPubKeyOut = scriptPubKeyKernel; } txNew.nTime -= n; txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second)); nCredit += pcoin.first->vout[pcoin.second].nValue; vwtxPrev.push_back(pcoin.first); txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); if (GetWeight(block.GetBlockTime(), (int64_t)txNew.nTime) < nStakeSplitAge) txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); //split stake if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : added kernel type=%d\n", whichType); fKernelFound = true; break; } } if (fKernelFound || fShutdown) break; // if kernel is found stop searching } if (nCredit == 0 || nCredit > nBalance - nReserveBalance) return false; BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { // Attempt to add more inputs // Only add coins of the same key/address as kernel if (txNew.vout.size() == 2 && ((pcoin.first->vout[pcoin.second].scriptPubKey == scriptPubKeyKernel || pcoin.first->vout[pcoin.second].scriptPubKey == txNew.vout[1].scriptPubKey)) && pcoin.first->GetHash() != txNew.vin[0].prevout.hash) { int64_t nTimeWeight = GetWeight((int64_t)pcoin.first->nTime, (int64_t)txNew.nTime); // Stop adding more inputs if already too many inputs if (txNew.vin.size() >= 100) break; // Stop adding more inputs if value is already pretty significant if (nCredit >= nStakeCombineThreshold) break; // Stop adding inputs if reached reserve limit if (nCredit + pcoin.first->vout[pcoin.second].nValue > nBalance - nReserveBalance) break; // Do not add additional significant input if (pcoin.first->vout[pcoin.second].nValue >= nStakeCombineThreshold) continue; // Do not add input that is still too young if (nTimeWeight < nStakeMinAge) continue; txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second)); nCredit += pcoin.first->vout[pcoin.second].nValue; vwtxPrev.push_back(pcoin.first); } } // Calculate coin age reward { uint64_t nCoinAge; CTxDB txdb("r"); if (!txNew.GetCoinAge(txdb, nCoinAge)) return error("CreateCoinStake : failed to calculate coin age"); int64_t nReward = GetProofOfStakeReward(nCoinAge, nFees); if (nReward <= 0) return false; nCredit += nReward; } // Set output amount if (txNew.vout.size() == 3) { txNew.vout[1].nValue = (nCredit / 2 / CENT) * CENT; txNew.vout[2].nValue = nCredit - txNew.vout[1].nValue; } else txNew.vout[1].nValue = nCredit; // Sign int nIn = 0; BOOST_FOREACH(const CWalletTx* pcoin, vwtxPrev) { if (!SignSignature(*this, *pcoin, txNew, nIn++)) return error("CreateCoinStake : failed to sign coinstake"); } // Limit size unsigned int nBytes = ::GetSerializeSize(txNew, SER_NETWORK, PROTOCOL_VERSION); if (nBytes >= MAX_BLOCK_SIZE_GEN/5) return error("CreateCoinStake : exceeded coinstake size limit"); // Successfully generated coinstake return true; } // Call after CreateTransaction unless you want to abort bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) { { LOCK2(cs_main, cs_wallet); printf("CommitTransaction:\n%s", wtxNew.ToString().c_str()); { // This is only to keep the database open to defeat the auto-flush for the // duration of this scope. This is the only place where this optimization // maybe makes sense; please don't do it anywhere else. CWalletDB* pwalletdb = fFileBacked ? new CWalletDB(strWalletFile,"r") : NULL; // Take key pair from key pool so it won't be used again reservekey.KeepKey(); // Add tx to wallet, because if it has change it's also ours, // otherwise just for transaction history. AddToWallet(wtxNew); // Mark old coins as spent set<CWalletTx*> setCoins; BOOST_FOREACH(const CTxIn& txin, wtxNew.vin) { CWalletTx &coin = mapWallet[txin.prevout.hash]; coin.BindWallet(this); coin.MarkSpent(txin.prevout.n); coin.WriteToDisk(); NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED); } if (fFileBacked) delete pwalletdb; } // Track how many getdata requests our transaction gets mapRequestCount[wtxNew.GetHash()] = 0; // Broadcast if (!wtxNew.AcceptToMemoryPool()) { // This must not fail. The transaction has already been signed and recorded. printf("CommitTransaction() : Error: Transaction not valid\n"); return false; } wtxNew.RelayWalletTransaction(); } return true; } string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee) { CReserveKey reservekey(this); int64_t nFeeRequired; if (IsLocked()) { string strError = _("Error: Wallet locked, unable to create transaction "); printf("SendMoney() : %s", strError.c_str()); return strError; } if (fWalletUnlockStakingOnly) { string strError = _("Error: Wallet unlocked for staking only, unable to create transaction."); printf("SendMoney() : %s", strError.c_str()); return strError; } if (!CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired)) { string strError; if (nValue + nFeeRequired > GetBalance()) strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds "), FormatMoney(nFeeRequired).c_str()); else strError = _("Error: Transaction creation failed "); printf("SendMoney() : %s", strError.c_str()); return strError; } if (fAskFee && !uiInterface.ThreadSafeAskFee(nFeeRequired, _("Sending..."))) return "ABORTED"; if (!CommitTransaction(wtxNew, reservekey)) return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); return ""; } string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee) { // Check amount if (nValue <= 0) return _("Invalid amount"); if (nValue + nTransactionFee > GetBalance()) return _("Insufficient funds"); // Parse Bitcoin address CScript scriptPubKey; scriptPubKey.SetDestination(address); return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee); } DBErrors CWallet::LoadWallet(bool& fFirstRunRet) { if (!fFileBacked) return DB_LOAD_OK; fFirstRunRet = false; DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); if (nLoadWalletRet == DB_NEED_REWRITE) { if (CDB::Rewrite(strWalletFile, "\x04pool")) { setKeyPool.clear(); // Note: can't top-up keypool here, because wallet is locked. // User will be prompted to unlock wallet the next operation // the requires a new key. } } if (nLoadWalletRet != DB_LOAD_OK) return nLoadWalletRet; fFirstRunRet = !vchDefaultKey.IsValid(); NewThread(ThreadFlushWalletDB, &strWalletFile); return DB_LOAD_OK; } bool CWallet::SetAddressBookName(const CTxDestination& address, const string& strName) { std::map<CTxDestination, std::string>::iterator mi = mapAddressBook.find(address); mapAddressBook[address] = strName; NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED); if (!fFileBacked) return false; return CWalletDB(strWalletFile).WriteName(CBitcoinAddress(address).ToString(), strName); } bool CWallet::DelAddressBookName(const CTxDestination& address) { mapAddressBook.erase(address); NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED); if (!fFileBacked) return false; return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString()); } void CWallet::PrintWallet(const CBlock& block) { { LOCK(cs_wallet); if (block.IsProofOfWork() && mapWallet.count(block.vtx[0].GetHash())) { CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()]; printf(" mine: %d %d %"PRId64"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); } if (block.IsProofOfStake() && mapWallet.count(block.vtx[1].GetHash())) { CWalletTx& wtx = mapWallet[block.vtx[1].GetHash()]; printf(" stake: %d %d %"PRId64"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); } } printf("\n"); } bool CWallet::GetTransaction(const uint256 &hashTx, CWalletTx& wtx) { { LOCK(cs_wallet); map<uint256, CWalletTx>::iterator mi = mapWallet.find(hashTx); if (mi != mapWallet.end()) { wtx = (*mi).second; return true; } } return false; } bool CWallet::SetDefaultKey(const CPubKey &vchPubKey) { if (fFileBacked) { if (!CWalletDB(strWalletFile).WriteDefaultKey(vchPubKey)) return false; } vchDefaultKey = vchPubKey; return true; } bool GetWalletFile(CWallet* pwallet, string &strWalletFileOut) { if (!pwallet->fFileBacked) return false; strWalletFileOut = pwallet->strWalletFile; return true; } // // Mark old keypool keys as used, // and generate all new keys // bool CWallet::NewKeyPool() { { LOCK(cs_wallet); CWalletDB walletdb(strWalletFile); BOOST_FOREACH(int64_t nIndex, setKeyPool) walletdb.ErasePool(nIndex); setKeyPool.clear(); if (IsLocked()) return false; int64_t nKeys = max(GetArg("-keypool", 100), (int64_t)0); for (int i = 0; i < nKeys; i++) { int64_t nIndex = i+1; walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey())); setKeyPool.insert(nIndex); } printf("CWallet::NewKeyPool wrote %"PRId64" new keys\n", nKeys); } return true; } bool CWallet::TopUpKeyPool(unsigned int nSize) { { LOCK(cs_wallet); if (IsLocked()) return false; CWalletDB walletdb(strWalletFile); // Top up key pool unsigned int nTargetSize; if (nSize > 0) nTargetSize = nSize; else nTargetSize = max(GetArg("-keypool", 100), (int64_t)0); while (setKeyPool.size() < (nTargetSize + 1)) { int64_t nEnd = 1; if (!setKeyPool.empty()) nEnd = *(--setKeyPool.end()) + 1; if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey()))) throw runtime_error("TopUpKeyPool() : writing generated key failed"); setKeyPool.insert(nEnd); printf("keypool added key %"PRId64", size=%"PRIszu"\n", nEnd, setKeyPool.size()); } } return true; } void CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool) { nIndex = -1; keypool.vchPubKey = CPubKey(); { LOCK(cs_wallet); if (!IsLocked()) TopUpKeyPool(); // Get the oldest key if(setKeyPool.empty()) return; CWalletDB walletdb(strWalletFile); nIndex = *(setKeyPool.begin()); setKeyPool.erase(setKeyPool.begin()); if (!walletdb.ReadPool(nIndex, keypool)) throw runtime_error("ReserveKeyFromKeyPool() : read failed"); if (!HaveKey(keypool.vchPubKey.GetID())) throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); assert(keypool.vchPubKey.IsValid()); if (fDebug && GetBoolArg("-printkeypool")) printf("keypool reserve %"PRId64"\n", nIndex); } } int64_t CWallet::AddReserveKey(const CKeyPool& keypool) { { LOCK2(cs_main, cs_wallet); CWalletDB walletdb(strWalletFile); int64_t nIndex = 1 + *(--setKeyPool.end()); if (!walletdb.WritePool(nIndex, keypool)) throw runtime_error("AddReserveKey() : writing added key failed"); setKeyPool.insert(nIndex); return nIndex; } return -1; } void CWallet::KeepKey(int64_t nIndex) { // Remove from key pool if (fFileBacked) { CWalletDB walletdb(strWalletFile); walletdb.ErasePool(nIndex); } if(fDebug) printf("keypool keep %"PRId64"\n", nIndex); } void CWallet::ReturnKey(int64_t nIndex) { // Return to key pool { LOCK(cs_wallet); setKeyPool.insert(nIndex); } if(fDebug) printf("keypool return %"PRId64"\n", nIndex); } bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) { int64_t nIndex = 0; CKeyPool keypool; { LOCK(cs_wallet); ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex == -1) { if (fAllowReuse && vchDefaultKey.IsValid()) { result = vchDefaultKey; return true; } if (IsLocked()) return false; result = GenerateNewKey(); return true; } KeepKey(nIndex); result = keypool.vchPubKey; } return true; } int64_t CWallet::GetOldestKeyPoolTime() { int64_t nIndex = 0; CKeyPool keypool; ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex == -1) return GetTime(); ReturnKey(nIndex); return keypool.nTime; } std::map<CTxDestination, int64_t> CWallet::GetAddressBalances() { map<CTxDestination, int64_t> balances; { LOCK(cs_wallet); BOOST_FOREACH(PAIRTYPE(uint256, CWalletTx) walletEntry, mapWallet) { CWalletTx *pcoin = &walletEntry.second; if (!pcoin->IsFinal() || !pcoin->IsTrusted()) continue; if ((pcoin->IsCoinBase() || pcoin->IsCoinStake()) && pcoin->GetBlocksToMaturity() > 0) continue; int nDepth = pcoin->GetDepthInMainChain(); if (nDepth < (pcoin->IsFromMe() ? 0 : 1)) continue; for (unsigned int i = 0; i < pcoin->vout.size(); i++) { CTxDestination addr; if (!IsMine(pcoin->vout[i])) continue; if(!ExtractDestination(pcoin->vout[i].scriptPubKey, addr)) continue; int64_t n = pcoin->IsSpent(i) ? 0 : pcoin->vout[i].nValue; if (!balances.count(addr)) balances[addr] = 0; balances[addr] += n; } } } return balances; } set< set<CTxDestination> > CWallet::GetAddressGroupings() { set< set<CTxDestination> > groupings; set<CTxDestination> grouping; BOOST_FOREACH(PAIRTYPE(uint256, CWalletTx) walletEntry, mapWallet) { CWalletTx *pcoin = &walletEntry.second; if (pcoin->vin.size() > 0 && IsMine(pcoin->vin[0])) { // group all input addresses with each other BOOST_FOREACH(CTxIn txin, pcoin->vin) { CTxDestination address; if(!ExtractDestination(mapWallet[txin.prevout.hash].vout[txin.prevout.n].scriptPubKey, address)) continue; grouping.insert(address); } // group change with input addresses BOOST_FOREACH(CTxOut txout, pcoin->vout) if (IsChange(txout)) { CWalletTx tx = mapWallet[pcoin->vin[0].prevout.hash]; CTxDestination txoutAddr; if(!ExtractDestination(txout.scriptPubKey, txoutAddr)) continue; grouping.insert(txoutAddr); } groupings.insert(grouping); grouping.clear(); } // group lone addrs by themselves for (unsigned int i = 0; i < pcoin->vout.size(); i++) if (IsMine(pcoin->vout[i])) { CTxDestination address; if(!ExtractDestination(pcoin->vout[i].scriptPubKey, address)) continue; grouping.insert(address); groupings.insert(grouping); grouping.clear(); } } set< set<CTxDestination>* > uniqueGroupings; // a set of pointers to groups of addresses map< CTxDestination, set<CTxDestination>* > setmap; // map addresses to the unique group containing it BOOST_FOREACH(set<CTxDestination> grouping, groupings) { // make a set of all the groups hit by this new group set< set<CTxDestination>* > hits; map< CTxDestination, set<CTxDestination>* >::iterator it; BOOST_FOREACH(CTxDestination address, grouping) if ((it = setmap.find(address)) != setmap.end()) hits.insert((*it).second); // merge all hit groups into a new single group and delete old groups set<CTxDestination>* merged = new set<CTxDestination>(grouping); BOOST_FOREACH(set<CTxDestination>* hit, hits) { merged->insert(hit->begin(), hit->end()); uniqueGroupings.erase(hit); delete hit; } uniqueGroupings.insert(merged); // update setmap BOOST_FOREACH(CTxDestination element, *merged) setmap[element] = merged; } set< set<CTxDestination> > ret; BOOST_FOREACH(set<CTxDestination>* uniqueGrouping, uniqueGroupings) { ret.insert(*uniqueGrouping); delete uniqueGrouping; } return ret; } // ScryptChain: check 'spent' consistency between wallet and txindex // ScryptChain: fix wallet spent state according to txindex void CWallet::FixSpentCoins(int& nMismatchFound, int64_t& nBalanceInQuestion, bool fCheckOnly) { nMismatchFound = 0; nBalanceInQuestion = 0; LOCK(cs_wallet); vector<CWalletTx*> vCoins; vCoins.reserve(mapWallet.size()); for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) vCoins.push_back(&(*it).second); CTxDB txdb("r"); BOOST_FOREACH(CWalletTx* pcoin, vCoins) { // Find the corresponding transaction index CTxIndex txindex; if (!txdb.ReadTxIndex(pcoin->GetHash(), txindex)) continue; for (unsigned int n=0; n < pcoin->vout.size(); n++) { if (IsMine(pcoin->vout[n]) && pcoin->IsSpent(n) && (txindex.vSpent.size() <= n || txindex.vSpent[n].IsNull())) { printf("FixSpentCoins found lost coin %s SPTC %s[%d], %s\n", FormatMoney(pcoin->vout[n].nValue).c_str(), pcoin->GetHash().ToString().c_str(), n, fCheckOnly? "repair not attempted" : "repairing"); nMismatchFound++; nBalanceInQuestion += pcoin->vout[n].nValue; if (!fCheckOnly) { pcoin->MarkUnspent(n); pcoin->WriteToDisk(); } } else if (IsMine(pcoin->vout[n]) && !pcoin->IsSpent(n) && (txindex.vSpent.size() > n && !txindex.vSpent[n].IsNull())) { printf("FixSpentCoins found spent coin %s SPTC %s[%d], %s\n", FormatMoney(pcoin->vout[n].nValue).c_str(), pcoin->GetHash().ToString().c_str(), n, fCheckOnly? "repair not attempted" : "repairing"); nMismatchFound++; nBalanceInQuestion += pcoin->vout[n].nValue; if (!fCheckOnly) { pcoin->MarkSpent(n); pcoin->WriteToDisk(); } } } } } // ScryptChain: disable transaction (only for coinstake) void CWallet::DisableTransaction(const CTransaction &tx) { if (!tx.IsCoinStake() || !IsFromMe(tx)) return; // only disconnecting coinstake requires marking input unspent LOCK(cs_wallet); BOOST_FOREACH(const CTxIn& txin, tx.vin) { map<uint256, CWalletTx>::iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { CWalletTx& prev = (*mi).second; if (txin.prevout.n < prev.vout.size() && IsMine(prev.vout[txin.prevout.n])) { prev.MarkUnspent(txin.prevout.n); prev.WriteToDisk(); } } } } CPubKey CReserveKey::GetReservedKey() { if (nIndex == -1) { CKeyPool keypool; pwallet->ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex != -1) vchPubKey = keypool.vchPubKey; else { printf("CReserveKey::GetReservedKey(): Warning: Using default key instead of a new key, top up your keypool!"); vchPubKey = pwallet->vchDefaultKey; } } assert(vchPubKey.IsValid()); return vchPubKey; } void CReserveKey::KeepKey() { if (nIndex != -1) pwallet->KeepKey(nIndex); nIndex = -1; vchPubKey = CPubKey(); } void CReserveKey::ReturnKey() { if (nIndex != -1) pwallet->ReturnKey(nIndex); nIndex = -1; vchPubKey = CPubKey(); } void CWallet::GetAllReserveKeys(set<CKeyID>& setAddress) const { setAddress.clear(); CWalletDB walletdb(strWalletFile); LOCK2(cs_main, cs_wallet); BOOST_FOREACH(const int64_t& id, setKeyPool) { CKeyPool keypool; if (!walletdb.ReadPool(id, keypool)) throw runtime_error("GetAllReserveKeyHashes() : read failed"); assert(keypool.vchPubKey.IsValid()); CKeyID keyID = keypool.vchPubKey.GetID(); if (!HaveKey(keyID)) throw runtime_error("GetAllReserveKeyHashes() : unknown key in key pool"); setAddress.insert(keyID); } } void CWallet::UpdatedTransaction(const uint256 &hashTx) { { LOCK(cs_wallet); // Only notify UI if this transaction is in this wallet map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(hashTx); if (mi != mapWallet.end()) NotifyTransactionChanged(this, hashTx, CT_UPDATED); } } void CWallet::GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth) const { mapKeyBirth.clear(); // get birth times for keys with metadata for (std::map<CKeyID, CKeyMetadata>::const_iterator it = mapKeyMetadata.begin(); it != mapKeyMetadata.end(); it++) if (it->second.nCreateTime) mapKeyBirth[it->first] = it->second.nCreateTime; // map in which we'll infer heights of other keys CBlockIndex *pindexMax = FindBlockByHeight(std::max(0, nBestHeight - 144)); // the tip can be reorganised; use a 144-block safety margin std::map<CKeyID, CBlockIndex*> mapKeyFirstBlock; std::set<CKeyID> setKeys; GetKeys(setKeys); BOOST_FOREACH(const CKeyID &keyid, setKeys) { if (mapKeyBirth.count(keyid) == 0) mapKeyFirstBlock[keyid] = pindexMax; } setKeys.clear(); // if there are no such keys, we're done if (mapKeyFirstBlock.empty()) return; // find first block that affects those keys, if there are any left std::vector<CKeyID> vAffected; for (std::map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); it++) { // iterate over all wallet transactions... const CWalletTx &wtx = (*it).second; std::map<uint256, CBlockIndex*>::const_iterator blit = mapBlockIndex.find(wtx.hashBlock); if (blit != mapBlockIndex.end() && blit->second->IsInMainChain()) { // ... which are already in a block int nHeight = blit->second->nHeight; BOOST_FOREACH(const CTxOut &txout, wtx.vout) { // iterate over all their outputs ::ExtractAffectedKeys(*this, txout.scriptPubKey, vAffected); BOOST_FOREACH(const CKeyID &keyid, vAffected) { // ... and all their affected keys std::map<CKeyID, CBlockIndex*>::iterator rit = mapKeyFirstBlock.find(keyid); if (rit != mapKeyFirstBlock.end() && nHeight < rit->second->nHeight) rit->second = blit->second; } vAffected.clear(); } } } // Extract block timestamps for those keys for (std::map<CKeyID, CBlockIndex*>::const_iterator it = mapKeyFirstBlock.begin(); it != mapKeyFirstBlock.end(); it++) mapKeyBirth[it->first] = it->second->nTime - 7200; // block times can be 2h off }
[ "scryptchain@gmail.com" ]
scryptchain@gmail.com
24b7ad64e91a18c38a241fcd9f3a14543a30c29c
d87cb7bbc5077e1c3312522eefdd49fb2dfcf418
/include/tachyon.memory/VirtualZone.h
77af79ac5e59cc26d3ade0ecdd651117ebe58651
[]
no_license
mduft/tachyon2
d7bbe6e79b43d14bda2de7be7af4699aad83de69
8a026bc3d7c1f115d78a7df0ad57fe921f105080
refs/heads/master
2020-03-26T07:16:37.742863
2011-01-04T15:51:15
2011-01-04T15:51:15
1,191,227
1
1
null
null
null
null
UTF-8
C++
false
false
555
h
/* Copyright (c) 2010 by Markus Duft <mduft@gentoo.org> * This file is part of the 'tachyon' operating system. */ #pragma once #include <tachyon.platform/architecture.h> class VirtualZone { friend class VirtualZoneManager; uintptr_t start; uintptr_t end; bool use; void init(uintptr_t s, uintptr_t e) { start = s; end = e; } void destroy() { start = 0; end = 0; } public: uintptr_t getStart() { return start; } uintptr_t getEnd() { return end; } bool used() { return use; } void used(bool u) { use = u; } };
[ "mduft@gentoo.org" ]
mduft@gentoo.org
c1b1d15ebd0f184c8b81e63585734c37598c887e
2e312ea3d2ef8f711ed21834d7a2f4353c542373
/NidhoggEngine/SourceCode/imgui_impl_opengl3.cpp
53e0d34285b301c802620d4f95349b7ef1f6519c
[ "MIT" ]
permissive
Ap011y0n/Nidhogg-Engine
cdb13fdb3294b05155ae7f871366892609e8acf3
9cda1807d8ee3f9cc2662723c8f817c0b3539194
refs/heads/master
2023-02-16T15:47:40.600547
2021-01-10T11:46:03
2021-01-10T11:46:03
299,346,819
0
1
null
null
null
null
UTF-8
C++
false
false
34,568
cpp
// dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline // - Desktop GL: 2.x 3.x 4.x // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0) // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) // Implemented features: // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID! // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. // [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. // 2020-09-17: OpenGL: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 context which have the defines set by a loader. // 2020-07-10: OpenGL: Added support for glad2 OpenGL loader. // 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX. // 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix. // 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset. // 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader. // 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader. // 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders. // 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility. // 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call. // 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag. // 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state. // 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop. // 2019-03-15: OpenGL: Added a GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early. // 2019-03-03: OpenGL: Fix support for ES 2.0 (WebGL 1.0). // 2019-02-20: OpenGL: Fix for OSX not supporting OpenGL 4.5, we don't try to read GL_CLIP_ORIGIN even if defined by the headers/loader. // 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display. // 2019-02-01: OpenGL: Using GLSL 410 shaders for any version over 410 (e.g. 430, 450). // 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window. // 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT) / GL_CLIP_ORIGIN. // 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used. // 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES". // 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation. // 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link. // 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples. // 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle. // 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state. // 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a NULL pointer. // 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150". // 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context. // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself. // 2018-01-07: OpenGL: Changed GLSL shader version from 330 to 150. // 2017-09-01: OpenGL: Save and restore current bound sampler. Save and restore current polygon mode. // 2017-05-01: OpenGL: Fixed save and restore of current blend func state. // 2017-05-01: OpenGL: Fixed save and restore of current GL_ACTIVE_TEXTURE. // 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle. // 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752) //---------------------------------------- // OpenGL GLSL GLSL // version version string //---------------------------------------- // 2.0 110 "#version 110" // 2.1 120 "#version 120" // 3.0 130 "#version 130" // 3.1 140 "#version 140" // 3.2 150 "#version 150" // 3.3 330 "#version 330 core" // 4.0 400 "#version 400 core" // 4.1 410 "#version 410 core" // 4.2 420 "#version 410 core" // 4.3 430 "#version 430 core" // ES 2.0 100 "#version 100" = WebGL 1.0 // ES 3.0 300 "#version 300 es" = WebGL 2.0 //---------------------------------------- #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif #include "imgui.h" #include "imgui_impl_opengl3.h" #include <stdio.h> #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier #include <stddef.h> // intptr_t #else #include <stdint.h> // intptr_t #endif // GL includes #if defined(IMGUI_IMPL_OPENGL_ES2) #include <GLES2/gl2.h> #elif defined(IMGUI_IMPL_OPENGL_ES3) #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) #include <OpenGLES/ES3/gl.h> // Use GL ES 3 #else #include <GLES3/gl3.h> // Use GL ES 3 #endif #else // About Desktop OpenGL function loaders: // Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers. // Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad). // You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own. #if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) #include "GL/gl3w.h" // Needs to be initialized with gl3wInit() in user's code #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) #include "glew/include/glew.h" // Needs to be initialized with glewInit() in user's code. #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) #include <glad/glad.h> // Needs to be initialized with gladLoadGL() in user's code. #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD2) #include <glad/gl.h> // Needs to be initialized with gladLoadGL(...) or gladLoaderLoadGL() in user's code. #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) #ifndef GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors. #endif #include <glbinding/Binding.h> // Needs to be initialized with glbinding::Binding::initialize() in user's code. #include <glbinding/gl/gl.h> using namespace gl; #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) #ifndef GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors. #endif #include <glbinding/glbinding.h>// Needs to be initialized with glbinding::initialize() in user's code. #include <glbinding/gl/gl.h> using namespace gl; #else #include IMGUI_IMPL_OPENGL_LOADER_CUSTOM #endif #endif // Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have. #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_2) #define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET #endif // Desktop GL 3.3+ has glBindSampler() #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_3) #define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER #endif // OpenGL Data static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries (e.g. 320 for GL 3.2) static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings. static GLuint g_FontTexture = 0; static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0; static GLint g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; // Uniforms location static GLuint g_AttribLocationVtxPos = 0, g_AttribLocationVtxUV = 0, g_AttribLocationVtxColor = 0; // Vertex attributes location static unsigned int g_VboHandle = 0, g_ElementsHandle = 0; // Forward Declarations static void ImGui_ImplOpenGL3_InitPlatformInterface(); static void ImGui_ImplOpenGL3_ShutdownPlatformInterface(); // Functions bool ImGui_ImplOpenGL3_Init(const char* glsl_version) { // Query for GL version (e.g. 320 for GL 3.2) #if !defined(IMGUI_IMPL_OPENGL_ES2) GLint major, minor; glGetIntegerv(GL_MAJOR_VERSION, &major); glGetIntegerv(GL_MINOR_VERSION, &minor); g_GlVersion = (GLuint)(major * 100 + minor * 10); #else g_GlVersion = 200; // GLES 2 #endif // Setup back-end capabilities flags ImGuiIO& io = ImGui::GetIO(); io.BackendRendererName = "imgui_impl_opengl3"; #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET if (g_GlVersion >= 320) io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes. #endif io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional) // Store GLSL version string so we can refer to it later in case we recreate shaders. // Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure. #if defined(IMGUI_IMPL_OPENGL_ES2) if (glsl_version == NULL) glsl_version = "#version 100"; #elif defined(IMGUI_IMPL_OPENGL_ES3) if (glsl_version == NULL) glsl_version = "#version 300 es"; #elif defined(__APPLE__) if (glsl_version == NULL) glsl_version = "#version 150"; #else if (glsl_version == NULL) glsl_version = "#version 130"; #endif IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString)); strcpy(g_GlslVersionString, glsl_version); strcat(g_GlslVersionString, "\n"); // Debugging construct to make it easily visible in the IDE and debugger which GL loader has been selected. // The code actually never uses the 'gl_loader' variable! It is only here so you can read it! // If auto-detection fails or doesn't select the same GL loader file as used by your application, // you are likely to get a crash below. // You can explicitly select a loader by using '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line. const char* gl_loader = "Unknown"; IM_UNUSED(gl_loader); #if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) gl_loader = "GL3W"; #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) gl_loader = "GLEW"; #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) gl_loader = "GLAD"; #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD2) gl_loader = "GLAD2"; #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) gl_loader = "glbinding2"; #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) gl_loader = "glbinding3"; #elif defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) gl_loader = "custom"; #else gl_loader = "none"; #endif // Make an arbitrary GL call (we don't actually need the result) // IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by this code. // Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above. GLint current_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture); if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) ImGui_ImplOpenGL3_InitPlatformInterface(); return true; } void ImGui_ImplOpenGL3_Shutdown() { ImGui_ImplOpenGL3_ShutdownPlatformInterface(); ImGui_ImplOpenGL3_DestroyDeviceObjects(); } void ImGui_ImplOpenGL3_NewFrame() { if (!g_ShaderHandle) ImGui_ImplOpenGL3_CreateDeviceObjects(); } static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object) { // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glEnable(GL_SCISSOR_TEST); #ifdef GL_POLYGON_MODE glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); #endif // Support for GL 4.5 rarely used glClipControl(GL_UPPER_LEFT) bool clip_origin_lower_left = true; #if defined(GL_CLIP_ORIGIN) && !defined(__APPLE__) GLenum current_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)&current_clip_origin); if (current_clip_origin == GL_UPPER_LEFT) clip_origin_lower_left = false; #endif // Setup viewport, orthographic projection matrix // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps. glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height); float L = draw_data->DisplayPos.x; float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x; float T = draw_data->DisplayPos.y; float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y; if (!clip_origin_lower_left) { float tmp = T; T = B; B = tmp; } // Swap top and bottom if origin is upper left const float ortho_projection[4][4] = { { 2.0f/(R-L), 0.0f, 0.0f, 0.0f }, { 0.0f, 2.0f/(T-B), 0.0f, 0.0f }, { 0.0f, 0.0f, -1.0f, 0.0f }, { (R+L)/(L-R), (T+B)/(B-T), 0.0f, 1.0f }, }; glUseProgram(g_ShaderHandle); glUniform1i(g_AttribLocationTex, 0); glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]); #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER if (g_GlVersion >= 330) glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise. #endif (void)vertex_array_object; #ifndef IMGUI_IMPL_OPENGL_ES2 glBindVertexArray(vertex_array_object); #endif // Bind vertex/index buffers and setup attributes for ImDrawVert glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle); glEnableVertexAttribArray(g_AttribLocationVtxPos); glEnableVertexAttribArray(g_AttribLocationVtxUV); glEnableVertexAttribArray(g_AttribLocationVtxColor); glVertexAttribPointer(g_AttribLocationVtxPos, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos)); glVertexAttribPointer(g_AttribLocationVtxUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv)); glVertexAttribPointer(g_AttribLocationVtxColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col)); } // OpenGL3 Render function. // (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop) // Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so. void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data) { // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates) int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x); int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y); if (fb_width <= 0 || fb_height <= 0) return; // Backup GL state GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture); glActiveTexture(GL_TEXTURE0); GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program); GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture); #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER GLuint last_sampler; if (g_GlVersion >= 330) { glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler); } else { last_sampler = 0; } #endif GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer); #ifndef IMGUI_IMPL_OPENGL_ES2 GLuint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object); #endif #ifdef GL_POLYGON_MODE GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode); #endif GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport); GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box); GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb); GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb); GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha); GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha); GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb); GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha); GLboolean last_enable_blend = glIsEnabled(GL_BLEND); GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE); GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST); GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST); // Setup desired GL state // Recreate the VAO every time (this is to easily allow multiple GL contexts to be rendered to. VAO are not shared among GL contexts) // The renderer would actually work without any VAO bound, but then our VertexAttrib calls would overwrite the default one currently bound. GLuint vertex_array_object = 0; #ifndef IMGUI_IMPL_OPENGL_ES2 glGenVertexArrays(1, &vertex_array_object); #endif ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object); // Will project scissor/clipping rectangles into framebuffer space ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2) // Render command lists for (int n = 0; n < draw_data->CmdListsCount; n++) { const ImDrawList* cmd_list = draw_data->CmdLists[n]; // Upload vertex/index buffers glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW); for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) { const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; if (pcmd->UserCallback != NULL) { // User callback, registered via ImDrawList::AddCallback() // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.) if (pcmd->UserCallback == ImDrawCallback_ResetRenderState) ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object); else pcmd->UserCallback(cmd_list, pcmd); } else { // Project scissor/clipping rectangles into framebuffer space ImVec4 clip_rect; clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x; clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y; clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x; clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y; if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f) { // Apply scissor/clipping rectangle glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y)); // Bind texture, Draw glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId); #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET if (g_GlVersion >= 320) glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset); else #endif glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx))); } } } } // Destroy the temporary VAO #ifndef IMGUI_IMPL_OPENGL_ES2 glDeleteVertexArrays(1, &vertex_array_object); #endif // Restore modified GL state glUseProgram(last_program); glBindTexture(GL_TEXTURE_2D, last_texture); #ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER if (g_GlVersion >= 330) glBindSampler(0, last_sampler); #endif glActiveTexture(last_active_texture); #ifndef IMGUI_IMPL_OPENGL_ES2 glBindVertexArray(last_vertex_array_object); #endif glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha); glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha); if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND); if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE); if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST); #ifdef GL_POLYGON_MODE glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]); #endif glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]); glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]); } bool ImGui_ImplOpenGL3_CreateFontsTexture() { // Build texture atlas ImGuiIO& io = ImGui::GetIO(); unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory. // Upload texture to graphics system GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); glGenTextures(1, &g_FontTexture); glBindTexture(GL_TEXTURE_2D, g_FontTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); #endif glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // Store our identifier io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture; // Restore state glBindTexture(GL_TEXTURE_2D, last_texture); return true; } void ImGui_ImplOpenGL3_DestroyFontsTexture() { if (g_FontTexture) { ImGuiIO& io = ImGui::GetIO(); glDeleteTextures(1, &g_FontTexture); io.Fonts->TexID = 0; g_FontTexture = 0; } } // If you get an error please report on github. You may try different GL context version or GLSL version. See GL<>GLSL version table at the top of this file. static bool CheckShader(GLuint handle, const char* desc) { GLint status = 0, log_length = 0; glGetShaderiv(handle, GL_COMPILE_STATUS, &status); glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length); if ((GLboolean)status == GL_FALSE) fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc); if (log_length > 1) { ImVector<char> buf; buf.resize((int)(log_length + 1)); glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin()); fprintf(stderr, "%s\n", buf.begin()); } return (GLboolean)status == GL_TRUE; } // If you get an error please report on GitHub. You may try different GL context version or GLSL version. static bool CheckProgram(GLuint handle, const char* desc) { GLint status = 0, log_length = 0; glGetProgramiv(handle, GL_LINK_STATUS, &status); glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length); if ((GLboolean)status == GL_FALSE) fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')\n", desc, g_GlslVersionString); if (log_length > 1) { ImVector<char> buf; buf.resize((int)(log_length + 1)); glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin()); fprintf(stderr, "%s\n", buf.begin()); } return (GLboolean)status == GL_TRUE; } bool ImGui_ImplOpenGL3_CreateDeviceObjects() { // Backup GL state GLint last_texture, last_array_buffer; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture); glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer); #ifndef IMGUI_IMPL_OPENGL_ES2 GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array); #endif // Parse GLSL version string int glsl_version = 130; sscanf(g_GlslVersionString, "#version %d", &glsl_version); const GLchar* vertex_shader_glsl_120 = "uniform mat4 ProjMtx;\n" "attribute vec2 Position;\n" "attribute vec2 UV;\n" "attribute vec4 Color;\n" "varying vec2 Frag_UV;\n" "varying vec4 Frag_Color;\n" "void main()\n" "{\n" " Frag_UV = UV;\n" " Frag_Color = Color;\n" " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" "}\n"; const GLchar* vertex_shader_glsl_130 = "uniform mat4 ProjMtx;\n" "in vec2 Position;\n" "in vec2 UV;\n" "in vec4 Color;\n" "out vec2 Frag_UV;\n" "out vec4 Frag_Color;\n" "void main()\n" "{\n" " Frag_UV = UV;\n" " Frag_Color = Color;\n" " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" "}\n"; const GLchar* vertex_shader_glsl_300_es = "precision mediump float;\n" "layout (location = 0) in vec2 Position;\n" "layout (location = 1) in vec2 UV;\n" "layout (location = 2) in vec4 Color;\n" "uniform mat4 ProjMtx;\n" "out vec2 Frag_UV;\n" "out vec4 Frag_Color;\n" "void main()\n" "{\n" " Frag_UV = UV;\n" " Frag_Color = Color;\n" " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" "}\n"; const GLchar* vertex_shader_glsl_410_core = "layout (location = 0) in vec2 Position;\n" "layout (location = 1) in vec2 UV;\n" "layout (location = 2) in vec4 Color;\n" "uniform mat4 ProjMtx;\n" "out vec2 Frag_UV;\n" "out vec4 Frag_Color;\n" "void main()\n" "{\n" " Frag_UV = UV;\n" " Frag_Color = Color;\n" " gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" "}\n"; const GLchar* fragment_shader_glsl_120 = "#ifdef GL_ES\n" " precision mediump float;\n" "#endif\n" "uniform sampler2D Texture;\n" "varying vec2 Frag_UV;\n" "varying vec4 Frag_Color;\n" "void main()\n" "{\n" " gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n" "}\n"; const GLchar* fragment_shader_glsl_130 = "uniform sampler2D Texture;\n" "in vec2 Frag_UV;\n" "in vec4 Frag_Color;\n" "out vec4 Out_Color;\n" "void main()\n" "{\n" " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" "}\n"; const GLchar* fragment_shader_glsl_300_es = "precision mediump float;\n" "uniform sampler2D Texture;\n" "in vec2 Frag_UV;\n" "in vec4 Frag_Color;\n" "layout (location = 0) out vec4 Out_Color;\n" "void main()\n" "{\n" " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" "}\n"; const GLchar* fragment_shader_glsl_410_core = "in vec2 Frag_UV;\n" "in vec4 Frag_Color;\n" "uniform sampler2D Texture;\n" "layout (location = 0) out vec4 Out_Color;\n" "void main()\n" "{\n" " Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" "}\n"; // Select shaders matching our GLSL versions const GLchar* vertex_shader = NULL; const GLchar* fragment_shader = NULL; if (glsl_version < 130) { vertex_shader = vertex_shader_glsl_120; fragment_shader = fragment_shader_glsl_120; } else if (glsl_version >= 410) { vertex_shader = vertex_shader_glsl_410_core; fragment_shader = fragment_shader_glsl_410_core; } else if (glsl_version == 300) { vertex_shader = vertex_shader_glsl_300_es; fragment_shader = fragment_shader_glsl_300_es; } else { vertex_shader = vertex_shader_glsl_130; fragment_shader = fragment_shader_glsl_130; } // Create shaders const GLchar* vertex_shader_with_version[2] = { g_GlslVersionString, vertex_shader }; g_VertHandle = glCreateShader(GL_VERTEX_SHADER); glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL); glCompileShader(g_VertHandle); CheckShader(g_VertHandle, "vertex shader"); const GLchar* fragment_shader_with_version[2] = { g_GlslVersionString, fragment_shader }; g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(g_FragHandle, 2, fragment_shader_with_version, NULL); glCompileShader(g_FragHandle); CheckShader(g_FragHandle, "fragment shader"); g_ShaderHandle = glCreateProgram(); glAttachShader(g_ShaderHandle, g_VertHandle); glAttachShader(g_ShaderHandle, g_FragHandle); glLinkProgram(g_ShaderHandle); CheckProgram(g_ShaderHandle, "shader program"); g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture"); g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx"); g_AttribLocationVtxPos = (GLuint)glGetAttribLocation(g_ShaderHandle, "Position"); g_AttribLocationVtxUV = (GLuint)glGetAttribLocation(g_ShaderHandle, "UV"); g_AttribLocationVtxColor = (GLuint)glGetAttribLocation(g_ShaderHandle, "Color"); // Create buffers glGenBuffers(1, &g_VboHandle); glGenBuffers(1, &g_ElementsHandle); ImGui_ImplOpenGL3_CreateFontsTexture(); // Restore modified GL state glBindTexture(GL_TEXTURE_2D, last_texture); glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer); #ifndef IMGUI_IMPL_OPENGL_ES2 glBindVertexArray(last_vertex_array); #endif return true; } void ImGui_ImplOpenGL3_DestroyDeviceObjects() { if (g_VboHandle) { glDeleteBuffers(1, &g_VboHandle); g_VboHandle = 0; } if (g_ElementsHandle) { glDeleteBuffers(1, &g_ElementsHandle); g_ElementsHandle = 0; } if (g_ShaderHandle && g_VertHandle) { glDetachShader(g_ShaderHandle, g_VertHandle); } if (g_ShaderHandle && g_FragHandle) { glDetachShader(g_ShaderHandle, g_FragHandle); } if (g_VertHandle) { glDeleteShader(g_VertHandle); g_VertHandle = 0; } if (g_FragHandle) { glDeleteShader(g_FragHandle); g_FragHandle = 0; } if (g_ShaderHandle) { glDeleteProgram(g_ShaderHandle); g_ShaderHandle = 0; } ImGui_ImplOpenGL3_DestroyFontsTexture(); } //-------------------------------------------------------------------------------------------------------- // MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT // This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously. // If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first.. //-------------------------------------------------------------------------------------------------------- static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport, void*) { if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear)) { ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); glClear(GL_COLOR_BUFFER_BIT); } ImGui_ImplOpenGL3_RenderDrawData(viewport->DrawData); } static void ImGui_ImplOpenGL3_InitPlatformInterface() { ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO(); platform_io.Renderer_RenderWindow = ImGui_ImplOpenGL3_RenderWindow; } static void ImGui_ImplOpenGL3_ShutdownPlatformInterface() { ImGui::DestroyPlatformWindows(); }
[ "47557365+Ap011y0n@users.noreply.github.com" ]
47557365+Ap011y0n@users.noreply.github.com
1516efbd4823d598542e5255aef4f85e2f33f08e
7939409cc41c7e355bf7a7ecff2b1ee80d89f40b
/DB1-2/main.cpp
4c6cfe85c3003a18711f0942aadb8ae196eb9e01
[]
no_license
onecan2009/hellogit
aca6d4fa919cac370365eb80ef13e6ed434c2808
e8d18a4b7b7b98de7640110c3f25717896fbd199
refs/heads/master
2021-01-12T02:05:11.154709
2018-03-30T15:36:58
2018-03-30T15:36:58
78,465,417
0
0
null
null
null
null
UTF-8
C++
false
false
349
cpp
#include <QCoreApplication> #include <QtSql> #include <iostream> using namespace std; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); qDebug() << "Available drivers:"; QStringList drivers = QSqlDatabase::drivers(); foreach(QString driver, drivers) qDebug() << "\t" << driver; return a.exec(); }
[ "oc1788@163.com" ]
oc1788@163.com
dbf55e73b07c298ef9c0c60aa93335c66cacaf86
70da9a649e73fa7a9146a478e773091ea00b4c5d
/Header/Cheat Functions/CheatFunctions.h
4ac3a7c08d99cc7bec23e6a65ae7de169b7937c1
[ "MIT", "curl", "BSL-1.0", "BSD-2-Clause" ]
permissive
ChristofferRysholt/GrandTheftAutoV-Cheat
3d48c8b6df847732c667bd0db0d4df0082751b01
0b4eaa29aaabc17d080e3ff50afd35e671bd16f9
refs/heads/master
2023-06-19T13:21:40.539874
2021-07-18T22:40:59
2021-07-18T22:40:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,540
h
#pragma once namespace Cheat { namespace CheatFunctions { extern bool NewerCheatVersionAvailable; extern std::string NewCheatVersionString; extern bool LoadConfigThreadFunctionCompleted; extern std::vector <std::string> LoadedOptionsVector; const std::string ReturnConfigFilePath(); const std::string ReturnMainLogFilePath(); const std::string ReturnChatLogFilePath(); void LoadConfig(); bool IsOptionRegisteredAsLoaded(std::string OptionName); template<typename T> void LoadConfigOption(std::string OptionName, T& ReturnedVariable) { if (!CheatFunctions::IsOptionRegisteredAsLoaded(OptionName)) { std::string TypeName = typeid(ReturnedVariable).name(); if (TypeName == "bool") { std::string ConfigFileValue = GetOptionValueFromConfig(OptionName); if (ConfigFileValue != "NOT_FOUND") { ReturnedVariable = CheatFunctions::StringToBool(CheatFunctions::GetOptionValueFromConfig(OptionName)); Cheat::LogFunctions::DebugMessage("Loaded savable option (Boolean) '" + OptionName + "'"); } LoadedOptionsVector.push_back(OptionName); } else if (TypeName == "int") { std::string ConfigFileValue = GetOptionValueFromConfig(OptionName); if (ConfigFileValue != "NOT_FOUND") { ReturnedVariable = CheatFunctions::StringToInt(CheatFunctions::GetOptionValueFromConfig(OptionName)); Cheat::LogFunctions::DebugMessage("Loaded savable option (Integer) '" + OptionName + "'"); } LoadedOptionsVector.push_back(OptionName); } else if (TypeName == "float") { std::string ConfigFileValue = GetOptionValueFromConfig(OptionName); if (ConfigFileValue != "NOT_FOUND") { ReturnedVariable = std::stof(CheatFunctions::GetOptionValueFromConfig(OptionName)); Cheat::LogFunctions::DebugMessage("Loaded savable option (Float) '" + OptionName + "'"); } LoadedOptionsVector.push_back(OptionName); } } } std::string ReturnCheatModuleDirectoryPath(); void SaveOption(std::string OptionName, std::string OptionValue, bool IsSavable); std::string GetOptionValueFromConfig(std::string OptionName); bool FileOrDirectoryExists(std::string Path); void CreateNewDirectory(std::string Path); std::string GetLastErrorAsString(); void LoopedFunctions(); bool IsGameWindowFocussed(); bool StringIsInteger(const std::string& s); bool IsIntegerInRange(unsigned low, unsigned high, unsigned x); std::string TextureFilePath(); int WaitForAndReturnPressedKey(); char* StringToChar(std::string string); std::string VirtualKeyCodeToString(UCHAR virtualKey); void CreateConsole(); int ReturnNumberOfDigitsInValue(double Number); void IniFileWriteString(std::string string, std::string FilePath, std::string Section, std::string Key); std::string IniFileReturnKeyValueAsString(std::string FilePath, std::string Section, std::string Key); void WriteBoolToIni(bool b00l, std::string file, std::string app, std::string key); std::string ReturnDateTimeFormatAsString(const char* DateTimeFormat); bool StringToBool(std::string String); bool IsKeyCurrentlyPressed(int vKey, bool PressedOnce = false); void WriteToFile(std::string FilePath, std::string text, std::ios_base::openmode FileOpenMode); Json::Value ReturnOnlineJsonCppDataObject(std::string URL); std::string ReturnLatestCheatBuildNumber(); void CheckCheatUpdate(); std::string RemoveCharactersFromStringAndReturn(std::string String, char* CharactersToRemove); int StringToInt(std::string String); } }
[ "hatchespls@protonmail.com" ]
hatchespls@protonmail.com
9968122bf5586098fa3cddec25cac09044f95244
86868e998a6ead4b5a915a5dfef1b0b14a24c373
/Intro_to_algorithm_14_days/cpp_version/day5/main.cpp
e661293aa8d100f2455e6db2166a9a3aeb55ebba
[]
no_license
Kevin-ZhangClutchit/Leetcode_pratice
058dbb2b45beb39a024c3945a9b102de3fab46e2
b0bbf908523b4fbf178828f4984f527c88e5ea11
refs/heads/main
2023-08-21T17:51:40.342878
2021-09-13T07:13:00
2021-09-13T07:13:00
394,865,587
0
0
null
null
null
null
UTF-8
C++
false
false
1,527
cpp
#include <iostream> #include <vector> using namespace std; struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : val(x), next(nullptr) {} ListNode(int x, ListNode *next) : val(x), next(next) {} }; //#876 Middle of the Linked List ListNode* middleNode(ListNode* head) { if (head== nullptr){return head;} else{ ListNode* fast=head; ListNode* slow=head; while (fast!= nullptr&&fast->next!= nullptr){ slow=slow->next; fast=fast->next->next; } return slow; } } //#19 Remove Nth Node From End of List ListNode* removeNthFromEnd(ListNode* head, int n) { if (head== nullptr){return head;} else if (head->next== nullptr){return nullptr;} else{ ListNode* slow_pre= nullptr; ListNode* slow=head; ListNode* fast=head; while (n){ fast=fast->next; n--; } while (fast!= nullptr){ slow_pre=slow; slow=slow->next; fast=fast->next; } if (slow_pre!= nullptr){ slow_pre->next=slow->next; delete slow; }else{ head=head->next; delete slow; } return head; } } int main() { ListNode* l2=new ListNode(2, nullptr); ListNode* l1=new ListNode(1,l2); ListNode* answer=removeNthFromEnd(l1,2); std::cout << "Hello, World!" << std::endl; return 0; }
[ "kevin.zhang@sjtu.edu.cn" ]
kevin.zhang@sjtu.edu.cn
418e51591cac3fa7069391306f13b2598bb86681
6584a3675663415fe0ed62c604e5fd383ac46e09
/Contest/AUG long 2019/1.cpp
44e6cd85a107fd2375135e3e16661a4e031d3505
[]
no_license
lsiddiqsunny/Days-with-programming
753e1569a5a389fa05f39742d691707496557f1b
b9d8ce24065d775a8ce2be981d177b69dc4fede5
refs/heads/master
2021-06-25T02:49:50.931406
2021-01-23T12:14:23
2021-01-23T12:14:23
184,076,547
0
0
null
null
null
null
UTF-8
C++
false
false
407
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int test; cin>>test; while(test--){ int n; cin>>n; long long a[n],b[n]; long long c[n]; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ cin>>b[i]; } for(int i=0;i<n;i++){ c[i]=max(0LL,a[i]*20LL-b[i]*10LL); } cout<<*max_element(c,c+n)<<endl; } }
[ "lsiddiqsunny@DESKTOP-VGRAGF8.localdomain" ]
lsiddiqsunny@DESKTOP-VGRAGF8.localdomain
cd3acb593eb5de5e9a768438fa2d4d5492fecf69
c4eb80b22473b11d83691a0cbe983362cedc4d7a
/problems/URI/ad-hoc/c++/1437/1437.cpp
11dd3df30679fbbfc27ee45703013d03d84709ba
[]
no_license
NicolasFrancaX/coding4fun
ef0510eae0fb5d3ab05dabddcde603dd7075737f
122f178270d00fcb4ad9f24308f8b5e321b1a7cc
refs/heads/master
2021-05-04T10:18:34.159457
2019-08-23T17:12:05
2019-08-23T17:12:05
53,812,576
3
1
null
null
null
null
UTF-8
C++
false
false
875
cpp
#include <iostream> #include <map> #include <string> using namespace std; int main() { int N; string ops; int state; /* Controle */ map<int, int> esquerda; map<int, int> direita; map<int, char> localizacao; esquerda[0] = 1; esquerda[1] = 2; esquerda[2] = 3; esquerda[3] = 0; direita[0] = 3; direita[1] = 0; direita[2] = 1; direita[3] = 2; localizacao[0] = 'N'; localizacao[1] = 'O'; localizacao[2] = 'S'; localizacao[3] = 'L'; while (cin >> N && N) { state = 0; cin >> ops; for (auto s = ops.begin(); s != ops.end(); s++) { if (*s == 'D') { state = direita[state]; } else if (*s == 'E') { state = esquerda[state]; } } cout << localizacao[state] << endl; } return 0; }
[ "nicolasfranca9@gmail.com" ]
nicolasfranca9@gmail.com
31720e87f1dee35ffd89698768c6fbcdb86cea89
ccb16158018038889be01180c7c9893116819628
/server/src/push_server/push_session_handler.h
ddfec15917b0c2f19853c34deda91261cbb82570
[ "Apache-2.0" ]
permissive
teamtalk-remix/teamtalk-ng
94f6b0b0858751d80607f60ab6586a798b852b30
6c7634eb2e8f8e3dff0166188b340c145bf8c4fc
refs/heads/master
2021-06-28T05:03:05.523011
2020-12-13T10:15:36
2020-12-13T10:15:36
196,715,352
2
3
Apache-2.0
2020-12-13T10:15:38
2019-07-13T11:45:16
PHP
UTF-8
C++
false
false
936
h
// // push_session_handler.h // my_push_server // // Created by luoning on 14-11-11. // Copyright (c) 2014年 luoning. All rights reserved. // #ifndef __my_push_server__push_session_handler__ #define __my_push_server__push_session_handler__ #include <stdio.h> #include "socket/base_handler.hpp" #include "pdu_msg.h" class CPushSessionHandler : public CBaseHandler { public: CPushSessionHandler() { m_NotificationID = 0; } virtual ~CPushSessionHandler() {}; virtual void OnException(uint32_t nsockid, int32_t nErrorCode); virtual void OnClose(uint32_t nsockid); virtual void OnRecvData(const char* szBuf, int32_t nBufSize); private: void _HandlePushMsg(const char* szBuf, int32_t nBufSize); void _HandleHeartBeat(const char* szBuf, int32_t nBufSize); private: uint64_t m_NotificationID; CPduMsg m_Msg; }; #endif /* defined(__my_push_server__push_session_handler__) */
[ "vfreex@gmail.com" ]
vfreex@gmail.com
8b95b64a8d4a7406cf95558aac2c14250c31e970
2c1e7d0b5740549bd4b21f140f28d884093f6378
/OP_CW.cpp
f9f8d218b550021066e5f274bf8c4e0ff442f0ca
[]
no_license
FreeLike76/OP_CW
00277919cb7a0a7c70a59cd667b1844a379057ff
2a0c597b7f462951ebc480a80177aebc9bd18401
refs/heads/master
2022-09-20T11:40:24.424189
2020-05-30T12:10:20
2020-05-30T12:10:20
266,052,144
0
0
null
null
null
null
UTF-8
C++
false
false
10,020
cpp
#include <iostream> #include <cmath> #include <vector> #include <fstream> #define _PATH "input.txt" using namespace std; class LinEquasSys { double** Acoef; double* Bcoef; double* Result; int size; void clearABR() { if (Acoef != nullptr) { for (int i = 0; i < size; i++) { delete[] Acoef[i]; } delete[] Acoef; } if (Bcoef != nullptr) { delete[] Bcoef; } if (Result != nullptr) { delete[] Result; } size = 0; } void Jacobi(double diff) { if (Result == nullptr) Result = new double[size]; for (int i = 0; i < size; i++) { Result[i] = Bcoef[i]; } double* tempX = new double[size]; double norm; do { for (int i = 0; i < size; i++) { tempX[i] = Bcoef[i]; for (int j = 0; j < size; j++) { if (i != j) tempX[i] -= Acoef[i][j] * Result[j]; } tempX[i] /= Acoef[i][i]; } norm = fabs(Result[0] - tempX[0]); for (int i = 0; i < size; i++) { if (fabs(Result[i] - tempX[i]) > norm) norm = fabs(Result[i] - tempX[i]); Result[i] = tempX[i]; } } while (norm > diff); delete[] tempX; } void G_Z(double diff) { if(Result==nullptr) Result = new double[size]; for (int i = 0; i < size; i++) { Result[i] = Bcoef[i]; } double* tempX = new double[size]; double norm; do { for (int i = 0; i < size; i++) { tempX[i] = Bcoef[i]; for (int j = 0; j < size; j++) { if (i != j) tempX[i] -= Acoef[i][j] * tempX[j]; // As we go we use the new parameters } tempX[i] /= Acoef[i][i]; } norm = fabs(Result[0] - tempX[0]); for (int i = 0; i < size; i++) { if (fabs(Result[i] - tempX[i]) > norm) norm = fabs(Result[i] - tempX[i]); Result[i] = tempX[i]; } } while (norm > diff); delete[] tempX; } void conj_grad(double diff) { if (Result == nullptr) Result = new double[size]; //Result== Xk (original) double* Zk = new double[size]; double* Rk = new double[size]; double* Sz = new double[size]; double Spr, Spr1, Spz, alpha, beta, mf; int i, j, kl = 1; double max_iter = 100000; /* Вычисляем сумму квадратов элементов вектора F*/ for (mf = 0, i = 0; i < size; i++) { mf += Bcoef[i] * Bcoef[i]; } /* Задаем начальное приближение корней. В Result хранятся значения корней * к-й итерации. */ for (i = 0; i < size; i++) { Result[i] = 0.2; } /* Задаем начальное значение r0 и z0. */ for (i = 0; i < size; i++) { for (Sz[i] = 0, j = 0; j < size; j++) Sz[i] += Acoef[i][j] * Result[j]; Rk[i] = Bcoef[i] - Sz[i]; Zk[i] = Rk[i]; } int Iteration = 0; do { Iteration++; /* Вычисляем числитель и знаменатель для коэффициента * alpha = (rk-1,rk-1)/(Azk-1,zk-1) */ Spz = 0; Spr = 0; for (i = 0; i < size; i++) { for (Sz[i] = 0, j = 0; j < size; j++) { Sz[i] += Acoef[i][j] * Zk[j]; } Spz += Sz[i] * Zk[i]; Spr += Rk[i] * Rk[i]; } alpha = Spr / Spz; /* alpha */ /* Вычисляем вектор решения: xk = xk-1+ alpha * zk-1, вектор невязки: rk = rk-1 - alpha * A * zk-1 и числитель для beta равный (rk,rk) */ Spr1 = 0; for (i = 0; i < size; i++) { Result[i] += alpha * Zk[i]; Rk[i] -= alpha * Sz[i]; Spr1 += Rk[i] * Rk[i]; } kl++; /* Вычисляем beta */ beta = Spr1 / Spr; /* Вычисляем вектор спуска: zk = rk+ beta * zk-1 */ for (i = 0; i < size; i++) Zk[i] = Rk[i] + beta * Zk[i]; } /* Проверяем условие выхода из итерационного цикла */ while (Spr1 / mf > diff* diff&& Iteration < max_iter); delete[] Zk; delete[] Rk; delete[] Sz; } bool zeroIJ() { for (int i = 0; i < size; i++) { if (Acoef[i][i] == 0) return true; } return false; } void zeroFix() { for (int iter = 0; iter < size; iter++) //Run through matrix { if (Acoef[iter][iter] == 0) //If there is 0 on [i][i] { for (int i = 0; i < size; i++) //Look for another row { if (Acoef[i][iter] != 0) //That does not have zero on required position { for (int j = 0; j < size; j++) //Add it's coef to initial row { Acoef[iter][j] += Acoef[i][j]; } Bcoef[iter] += Bcoef[i]; //And the ...=B(i) break; //End } } } } } void getMatrixWithoutRowAndCol(double** matrix, int _size, int row, int col, double** newMatrix) { int offsetRow = 0; //Смещение индекса строки в матрице int offsetCol = 0; //Смещение индекса столбца в матрице for (int i = 0; i < _size - 1; i++) { //Пропустить row-ую строку if (i == row) { offsetRow = 1; //Как только встретили строку, которую надо пропустить, делаем смещение для исходной матрицы } offsetCol = 0; //Обнулить смещение столбца for (int j = 0; j < _size - 1; j++) { //Пропустить col-ый столбец if (j == col) { offsetCol = 1; //Встретили нужный столбец, проускаем его смещением } newMatrix[i][j] = matrix[i + offsetRow][j + offsetCol]; } } } double matrixDet(double** matrix, int _size) { double det = 0; int degree = 1; // (-1)^(1+j) из формулы определителя //Условие выхода из рекурсии if (_size == 1) { return matrix[0][0]; } //Условие выхода из рекурсии else if (_size == 2) { return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]; } else { //Матрица без строки и столбца double** newMatrix = new double* [_size - 1]; for (int i = 0; i < _size - 1; i++) { newMatrix[i] = new double[_size - 1]; } //Раскладываем по 0-ой строке, цикл бежит по столбцам for (int j = 0; j < _size; j++) { //Удалить из матрицы i-ю строку и j-ый столбец //Результат в newMatrix getMatrixWithoutRowAndCol(matrix, _size, 0, j, newMatrix); //Рекурсивный вызов //По формуле: сумма по j, (-1)^(1+j) * matrix[0][j] * minor_j (это и есть сумма из формулы) //где minor_j - дополнительный минор элемента matrix[0][j] // (напомню, что минор это определитель матрицы без 0-ой строки и j-го столбца) det = det + (degree * matrix[0][j] * matrixDet(newMatrix, _size - 1)); //"Накручиваем" степень множителя degree = -degree; } //Чистим память на каждом шаге рекурсии(важно!) for (int i = 0; i < _size - 1; i++) { delete[] newMatrix[i]; } delete[] newMatrix; } return det; } public: LinEquasSys() { Acoef = nullptr; Bcoef = nullptr; Result = nullptr; size = 0; } ~LinEquasSys() { clearABR(); } void setEquasion(double** A,double* B, int cur_size) { clearABR(); size = cur_size; // New A and B coef Acoef = new double* [size]; Bcoef = new double[size]; // Applying new data for (int i = 0; i < size; i++) { Acoef[i] = new double[size]; Bcoef[i] = B[i]; for (int j = 0; j < size; j++) { Acoef[i][j] = A[i][j]; } } } void doMath(int method,double accuracy=0.001) { switch (method) { case 1: Jacobi(accuracy); break; case 2: G_Z(accuracy); break; case 3: conj_grad(accuracy); break; default: //WRONG break; } } vector<double> getvectorResult() { vector<double> get; if(Result!=nullptr) { for (int i = 0; i < size; i++) { get.push_back(Result[i]); } return get; } else { cout << "Error! Results are unavalible, because no calculations has been done!" << endl; get.push_back(0); return get; } } void CheckFixDiagonals() { if (zeroIJ()) zeroFix(); } double getDet() { return matrixDet(Acoef, size); } bool is_semetrical() { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (Acoef[i][j] != Acoef[j][i]) return false; } } return true; } bool is_positive() { for (int i = 1; i <= size; i++) { if (matrixDet(Acoef, i) <= 0) return false; } return true; } void coutAB() { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { cout << Acoef[i][j] << '\t'; } cout << "= " << Bcoef[i]<<endl; } } void coutRes() { for (int i = 0; i < size; i++) { cout << Result[i] << endl; } } bool readLESff(string path) { ifstream input(path); if (!input.is_open()) return false; else { //Reading size int _size; input >> _size; //Creating A and B double** A = new double* [_size]; for (int i = 0; i < _size; i++) { A[i] = new double[_size]; } double* B = new double[_size]; //Reading A and B for (int i = 0; i < _size; i++) { for (int j = 0; j < _size; j++) { input >> A[i][j]; } input >> B[i]; } this->setEquasion(A, B, _size); input.close(); for (int i = 0; i < _size; i++) { delete[] A[i]; } delete[] A; delete[] B; return true; } } bool dominDiag() { int row; for (int i = 0; i < size; i++) { row = 0; for (int j = 0; j < size; j++) { if (i != j) row += fabs(Acoef[i][j]); } if (fabs(Acoef[i][i]) < row) return false; } return true; } }; int main() { string path = "input.txt"; LinEquasSys test; test.readLESff(path); cout<<test.dominDiag(); }
[ "dimahunter17@gmail.com" ]
dimahunter17@gmail.com
dbe46c900c5cf5aac8de1354c6f72c12be4f09ac
7589fb3b3f380974b0ca217f9b756911c1cc4e0d
/ouzel/input/GamepadDevice.cpp
7add17bd154074484fe0858ec2c7e3e28bb1d47b
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
VitoTringolo/ouzel
2af2c373c9aa56eff9c8ee7954acc905a2a8fe90
df20fbb4687f8a8fd3b0d5c1b83d26271f8c7c3a
refs/heads/master
2020-04-21T02:09:36.750445
2019-02-05T00:55:56
2019-02-05T00:55:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,453
cpp
// Copyright 2015-2018 Elviss Strazdins. All rights reserved. #include "GamepadDevice.hpp" #include "InputSystem.hpp" namespace ouzel { namespace input { GamepadDevice::GamepadDevice(InputSystem& initInputSystem, uint32_t initId): InputDevice(initInputSystem, initId, Controller::Type::GAMEPAD) { InputSystem::Event deviceConnectEvent; deviceConnectEvent.type = InputSystem::Event::Type::DEVICE_CONNECT; deviceConnectEvent.deviceId = id; deviceConnectEvent.deviceType = type; inputSystem.sendEvent(deviceConnectEvent); } GamepadDevice::~GamepadDevice() { InputSystem::Event deviceDisconnectEvent; deviceDisconnectEvent.type = InputSystem::Event::Type::DEVICE_DISCONNECT; deviceDisconnectEvent.deviceId = id; deviceDisconnectEvent.deviceType = type; inputSystem.sendEvent(deviceDisconnectEvent); } std::future<bool> GamepadDevice::handleButtonValueChange(Gamepad::Button button, bool pressed, float value) { InputSystem::Event event(InputSystem::Event::Type::GAMEPAD_BUTTON_CHANGE); event.deviceId = id; event.gamepadButton = button; event.pressed = pressed; event.value = value; return inputSystem.sendEvent(event); } } // namespace input } // namespace ouzel
[ "elviss@elviss.lv" ]
elviss@elviss.lv
548934d480a596602558f089e273c9f8053fe0ff
d187965ac0f9fa305b612e0d2896b2330ca1688c
/math/pre_ntt.cpp
6c5010cb95865ba0aff9732c0c7361a2dafd8bdb
[]
no_license
LoppA/RepGod
13446d7ea2615ce965f3d107a4d37171f70bafe6
52b6ad1b93323e9f3ecd0512cb851edccf315a24
refs/heads/master
2023-08-07T23:56:04.685175
2023-07-30T13:26:52
2023-07-30T13:26:52
65,022,806
12
5
null
null
null
null
UTF-8
C++
false
false
1,825
cpp
#include <bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back #define mk make_pair #define fi first #define se second typedef long long ll; typedef pair<int, int> ii; const int INF = 0x3f3f3f3f; const double PI = acos(-1.0); const int N = 1e5 + 5; ll mod, n, c; int vis[N]; vector<int> v; void crivo() { for(int i = 2; i < N; i++) if(!vis[i]) for(int j = i + i; j < N; j += i) vis[j] = 1; } int pot(ll x, ll y, int mod) { int ret = 1; ll a = x; while(y > 0) { if(y&1) ret = (a * ret)%mod; a = (a * a)%mod; y>>=1; } return ret; } void find_nth_root(int mod) { crivo(); int n = mod - 1; int m = sqrt(n) + 2; for(int i = 2; i < m; i++) if(!vis[i] and n%i == 0) v.pb(n/i); // find if i**k != 1 for 1 <= k < mod - 1 = 2**k * c // just need to try (mod - 1)/prime_is_(mod-1) because of cicles for(int i = 2; i < mod; i++) { bool f = true; for(auto d : v) if(pot(i, d, mod) == 1) f = false; if(f) { // if i is (mod - 1)th root, i**c is (2**k)th root // now we can use i**c as root of ntt for polynomial of size 2**k (order 2**k - 1) cout << "r: " << i << endl; cout << "root = r**c: " << pot(i, c, mod) << endl; cout << "root_1 = r**-c: " << pot(i, (c*(mod - 2))%(mod-1), mod) << endl; return; } } } void find_pw(int n) { int pw = 1; int k = 0; while(pw < n) { pw <<= 1; k++; } c = (mod - 1)/pw; cout << "pw: " << pw << " root_pw: 1<<" << k << endl; cout << "(mod-1)%pw: " << (mod-1)%pw << " (mod-1)/pw = c: " << c << endl; // mod must be of form mod = 2**k * c + 1 assert((mod-1)%pw == 0); } int main (void) { ios_base::sync_with_stdio(false); cout << "mod: "; cin >> mod; cout << "\nn: "; cin >> n; cout << "mod: " << mod << endl; find_pw(2*n); find_nth_root(mod); return 0; }
[ "xLopacheco@gmail.com" ]
xLopacheco@gmail.com
30d628757b8676d1ff3da42b778f4616b0a00b75
98b1e51f55fe389379b0db00365402359309186a
/homework_6/problem_2/10x10/0.738/phi
4b13ae183cd70be29e9d425cd74696fd6abe4e9f
[]
no_license
taddyb/597-009
f14c0e75a03ae2fd741905c4c0bc92440d10adda
5f67e7d3910e3ec115fb3f3dc89a21dcc9a1b927
refs/heads/main
2023-01-23T08:14:47.028429
2020-12-03T13:24:27
2020-12-03T13:24:27
311,713,551
1
0
null
null
null
null
UTF-8
C++
false
false
2,690
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class surfaceScalarField; location "0.738"; object phi; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 3 -1 0 0 0 0]; internalField nonuniform List<scalar> 180 ( 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 ) ; boundaryField { left { type calculated; value nonuniform List<scalar> 10(-0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002); } right { type calculated; value nonuniform List<scalar> 10(0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002); } up { type calculated; value nonuniform List<scalar> 10(0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002); } down { type calculated; value nonuniform List<scalar> 10(-0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002); } frontAndBack { type empty; value nonuniform List<scalar> 0(); } } // ************************************************************************* //
[ "tbindas@pop-os.localdomain" ]
tbindas@pop-os.localdomain
69f655767923396cbb27bd6dc5e66ec08489e5e7
046e35e3e674ce9aaacf17bc7d5fa675dc5bbd26
/src/CTrackRobot.cpp
a5069b110213a3440acea8e866e9994e4c92b985
[]
no_license
cqzhoujg/track_robot
1f7925dc8ebfb0a75ee80de3e9ebed51269c904b
0cdfd682df45596e6e717ef5774b9ddbb7513faf
refs/heads/master
2022-11-24T13:43:11.081622
2020-07-23T09:27:33
2020-07-23T09:27:33
281,900,544
1
0
null
null
null
null
UTF-8
C++
false
false
95,549
cpp
/************************************************* Copyright: wootion Author: ZhouJinGang Date: 2019-2-25 Description: CTrackRobot **************************************************/ #include "CTrackRobot.h" double actual_tire_diameter; double forward_diameter; double back_diameter; CTrackRobot::CTrackRobot(): m_nDirection(FORWARD), m_nJoyCtrlTimeoutMSec(300), m_nBatteryPower(0), m_nBatteryStatus(0), m_nBatteryVoltage(0), m_nSdoCheckCount(0), m_nLightStatus(0), m_nControlMode(IDLE), m_nRobotOriginPulseOne(0), m_nRobotOriginPulseTwo(0), m_bMotorRunning(false), m_bIsMotorInit(false), m_bIsMotorPause(false), m_bIsInitializing(false), m_bCheckAlarmData(false), m_bGetAxesData(false), m_bForwardRelocation(true), m_bCheckSdo(true), m_bIsEStopButtonPressed(true), m_bIsUpdateOrigin(false), m_bPubPosData(true), m_bManagerUpdateOrigin(true), m_bSingleMove(false), m_dDistance(0), m_dOdom(0), m_dCurrentSpeed(0), m_dTargetSpeedTemp(0), m_dPitchAngle(0.0), m_nMotorOneTemp(0), m_nMotorTwoTemp(0), m_sMotorOneStatus("normal"), m_sMotorTwoStatus("normal") { ros::NodeHandle PublicNodeHandle; ros::NodeHandle PrivateNodeHandle("~"); PrivateNodeHandle.param("can_speed", m_nCanSpeed, 500000); PrivateNodeHandle.param("print_can", m_nPrintCanRTX, 0); PrivateNodeHandle.param("use_imu_odom", m_nUseImuOdom, 0); PrivateNodeHandle.param("sport_mode", m_sMode, std::string("PP")); PrivateNodeHandle.param("motor_speed", m_dTargetSpeed, 0.0); PrivateNodeHandle.param("pv_a", m_dPvAcceleration, 0.2); PrivateNodeHandle.param("target_dis", m_dTargetDis, 10.0); PrivateNodeHandle.param("scan_title", m_dScanTitle, 20.0); PrivateNodeHandle.param("timer_cycle", m_dTimerCycle, 10.0); PrivateNodeHandle.param("print_level", m_sPrintLevel, std::string("debug")); PrivateNodeHandle.param("imu_size", m_nImuBufSize, 2); //added by btrmg for adjust mileage 2020.01.07 PrivateNodeHandle.param("forward_diameter",forward_diameter,143.175); PrivateNodeHandle.param("back_diameter",back_diameter,143.175); //added end PrivateNodeHandle.param("record_laser", m_nRecordLaser, 1); PrivateNodeHandle.param("first_filter_radius", m_d1stFilterRadius, 0.1); PrivateNodeHandle.param("first_filter_num", m_n1stFilterNum, 30); PrivateNodeHandle.param("second_filter_radius", m_d2ndFilterRadius, 0.01); PrivateNodeHandle.param("second_filter_num", m_n2ndFilterNum, 3); PrivateNodeHandle.param("adjust_limit", m_dAdjustLimit, 2.0); PublicNodeHandle.param("sub_move_cmd_topic", m_sSubManagerCmdTopic, std::string("train_move_cmd")); PublicNodeHandle.param("sub_joy_topic", m_sSubJoyTopic, std::string("train_joy")); PublicNodeHandle.param("sub_scan_topic", m_sSubScanTopic, std::string("scan")); PublicNodeHandle.param("sub_scan_topic", m_sSubImuTopic, std::string("imu0")); PublicNodeHandle.param("robot_odom", m_sSubOdomTopic, std::string("odom")); PublicNodeHandle.param("pub_pos_topic", m_sPubPositionTopic, std::string("train_robot_position")); PublicNodeHandle.param("pub_task_status_topic", m_sPubStatusTopic, std::string("train_task_status")); PublicNodeHandle.param("pub_move_ack_topic", m_sMoveAckTopic, std::string("train_move_ack")); PublicNodeHandle.param("track_odom", m_sPubOdomTopic, std::string("robot_odom")); PublicNodeHandle.param("pub_heart_beat_topic", m_sHeartBeatTopic, std::string("train_motor_heart_beat")); // Se the logging level manually to Debug, Info, Warn, Error ros::console::levels::Level printLevel = ros::console::levels::Info; if(m_sPrintLevel == "debug") printLevel = ros::console::levels::Debug; else if(m_sPrintLevel == "warn") printLevel = ros::console::levels::Warn; else if(m_sPrintLevel == "error") printLevel = ros::console::levels::Error; ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, printLevel); ROS_INFO("usb can parameters:"); ROS_INFO("[ros param] can_speed:%d", m_nCanSpeed); ROS_INFO("[ros param] print_can_flag:%d", m_nPrintCanRTX); ROS_INFO("[ros param] use_imu_odom:%d", m_nUseImuOdom); ROS_INFO("----------------------------------"); ROS_INFO("motor control parameters:"); ROS_INFO("[ros param] sport_mode:%s", m_sMode.c_str()); ROS_INFO("[ros param] motor_speed:%f", m_dTargetSpeed); ROS_INFO("[ros param] pv_a:%f", m_dPvAcceleration); ROS_INFO("[ros param] target_dis:%f", m_dTargetDis); ROS_INFO("[ros param] scan_title:%f", m_dScanTitle); ROS_INFO("[ros param] timer_cycle:%.1f", m_dTimerCycle); ROS_INFO("[ros param] print_level:%s", m_sPrintLevel.c_str()); ROS_INFO("[ros param] imu_size:%d", m_nImuBufSize); //added by btrmg for adjust mileage 2020.01.07 ROS_INFO("[ros param] forward_diameter:%f", forward_diameter); ROS_INFO("[ros param] back_diameter:%f", back_diameter); //added end ROS_INFO("[ros param] record_laser:%d", m_nRecordLaser); ROS_INFO("[ros param] first_filter_radius:%f", m_d1stFilterRadius); ROS_INFO("[ros param] first_filter_num:%d", m_n1stFilterNum); ROS_INFO("[ros param] second_filter_radius:%f", m_d2ndFilterRadius); ROS_INFO("[ros param] second_filter_num:%d", m_n2ndFilterNum); ROS_INFO("----------------------------------"); ROS_INFO("ros topics:"); ROS_INFO("[ros param] sub_manager_cmd_topic:%s", m_sSubManagerCmdTopic.c_str()); ROS_INFO("[ros param] sub_joy_topic:%s", m_sSubJoyTopic.c_str()); ROS_INFO("[ros param] sub_scan_topic:%s", m_sSubScanTopic.c_str()); ROS_INFO("[ros param] sub_imu_topic:%s", m_sSubImuTopic.c_str()); ROS_INFO("[ros param] pub_stat_topic:%s", m_sPubPositionTopic.c_str()); ROS_INFO("[ros param] pub_status_topic:%s", m_sPubStatusTopic.c_str()); ROS_INFO("[ros param] pub_manager_status_topic:%s", m_sMoveAckTopic.c_str()); ROS_INFO("[ros param] pub_heart_beat_topic:%s", m_sHeartBeatTopic.c_str()); ROS_INFO("----------------------------------"); if(m_sMode == "PP" && 1 != m_nUseImuOdom) { m_nMode = PP; } else { m_nMode = PV; } actual_tire_diameter = forward_diameter; m_dInitialAngle = 180.0-m_dScanTitle-(90.0-LASER_ANGLE_RANGE/2)-LASER_EXCISION_ANGLE; UsbCan.SetCanSpeed(m_nCanSpeed); if (!UsbCan.Init()) { ROS_ERROR("init usbcan failed"); exit(-1); } try { m_pCANReceiveThread = new std::thread(std::bind(&CTrackRobot::CANReceiveThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc CAN receive thread failed, %s", exception.what()); exit(-1); } #if USE_CAN2_RT try { m_pCAN2ReceiveThread = new std::thread(std::bind(&CTrackRobot::CAN2ReceiveThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc CAN2 receive thread failed, %s", exception.what()); exit(-1); } #endif try { m_pCANManageThread = new std::thread(std::bind(&CTrackRobot::CANManageThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc CAN receive thread failed, %s", exception.what()); exit(-1); } try { m_pCANSendThread = new std::thread(std::bind(&CTrackRobot::CANSendThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc CAN Send thread failed, %s", exception.what()); exit(-1); } try { m_pPositionFilterThread = new std::thread(std::bind(&CTrackRobot::ManageScanDataThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc filter Thread failed, %s", exception.what()); exit(-1); } this_thread::sleep_for(std::chrono::milliseconds(500)); m_ImuSubscriber = PublicNodeHandle.subscribe<sensor_msgs::Imu>(m_sSubImuTopic, 10, boost::bind(&CTrackRobot::ImuCallBack, this, _1)); m_CmdManagerSubscriber = PublicNodeHandle.subscribe<custom_msgs::TrainRobotControl>(m_sSubManagerCmdTopic, 1, boost::bind( &CTrackRobot::CommandCallBack, this, _1)); if(1 == m_nUseImuOdom) { m_OdomSubscriber = PublicNodeHandle.subscribe<nav_msgs::Odometry>(m_sSubOdomTopic, 1, boost::bind(&CTrackRobot::OdomCallBack, this, _1)); } m_PositionPublisher = PublicNodeHandle.advertise<custom_msgs::TrainRobotPosition>(m_sPubPositionTopic, 10); m_StatusPublisher = PublicNodeHandle.advertise<custom_msgs::GeneralTopic>(m_sPubStatusTopic, 10); m_MoveAckPublisher = PublicNodeHandle.advertise<custom_msgs::TrainRobotControlAck>(m_sMoveAckTopic, 10); m_HeartBeatPublisher = PublicNodeHandle.advertise<custom_msgs::TrainRobotHeartBeat>(m_sHeartBeatTopic, 10); m_OdomPublisher = PublicNodeHandle.advertise<nav_msgs::Odometry>(m_sPubOdomTopic, 10); m_BatteryService = PublicNodeHandle.advertiseService("battery_status", &CTrackRobot::BatteryServiceFunc, this); m_CurrentPosService = PublicNodeHandle.advertiseService("current_position", &CTrackRobot::CurrentPosServiceFunc, this); m_DisplacementTimer = PublicNodeHandle.createTimer(ros::Duration(m_dTimerCycle/1000.0), boost::bind(&CTrackRobot::UpdateMotorInfoTimerFunc, this)); this_thread::sleep_for(std::chrono::milliseconds(500)); if(!m_bIsInitializing) { MotorServoInit(); } try { m_pHeartBeatThread = new std::thread(std::bind(&CTrackRobot::HeartBeatThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc heart beat Thread failed, %s", exception.what()); exit(-1); } try { m_pScanThread = new std::thread(std::bind(&CTrackRobot::ScanThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc scan Thread failed, %s", exception.what()); exit(-1); } try { m_pScanThread = new std::thread(std::bind(&CTrackRobot::MonitorStatusThreadFunc, this)); } catch (std::bad_alloc &exception) { ROS_ERROR("[CTrackRobot::CTrackRobot] malloc monitor Thread failed, %s", exception.what()); exit(-1); } } /************************************************* Function: CTrackRobot::CANReceiveThreadFunc Description: USBCAN设备数据接收线程功能函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CANReceiveThreadFunc() { unsigned int unRecvLen; CanFrame rec[2500]; int nRetryTimes = 0; while (ros::ok()) { try { // if((unRecvLen=UsbCan.Receive(rec, 2500, 0))>0) if((unRecvLen = VCI_Receive(VCI_USBCAN2, 0, 0, rec, 2500, 0)) > 0) { if(unRecvLen > 2500) { if(nRetryTimes < 3) { UsbCan.Reset(); std::this_thread::sleep_for(std::chrono::milliseconds(200)); ROS_WARN("[CANReceiveThreadFunc] recLen = %d",unRecvLen); nRetryTimes ++; continue; } else { UsbCan.Close(); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); exit(-1); } } nRetryTimes = 0; std::unique_lock<std::mutex> lock(m_CanRXMutex); for(int i=0; i<unRecvLen; i++) { if(rec[i].DataLen <=0 || rec[i].DataLen >8) continue; if(m_nPrintCanRTX) UsbCan.PrintCanFrame(&rec[i], __FUNCTION__); m_dCanRXDeque.push_back(rec[i]); } lock.unlock(); m_CanRXCondition.notify_one(); } } catch(...) { UsbCan.Reset(); ROS_ERROR("[CANReceiveThreadFunc] catch can receive func error"); } } } #if USE_CAN2_RT /************************************************* Function: CDeviceNetMaster::CAN2ReceiveThreadFunc Description: 用于记录总线上的交互报文数据 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CAN2ReceiveThreadFunc() { ROS_DEBUG("[CAN2ReceiveThreadFunc] running"); int i; ULL recLen; CanFrame rec[3000]; string sDataFileName = m_sDataFilePath; sDataFileName += "servo/"; sDataFileName += "ServoInit"; CFileRW ServoInitFileRw; time_t t = time(nullptr); char cTmp[64]; strftime( cTmp, sizeof(cTmp), "%Y%m%d-%H%M%S",localtime(&t)); sDataFileName += cTmp; sDataFileName += ".txt"; ServoInitFileRw.OpenFile(sDataFileName, std::string("a+")); ROS_DEBUG("[CreateNewRecordFile] open file:%s",sDataFileName.c_str()); while (ros::ok()) { if(!m_bIsMotorInit) { if((recLen=VCI_Receive(VCI_USBCAN2, 0, 1, rec, 3000, 100/*ms*/))>0) { for(i=0; i<recLen; i++) { if(rec[i].DataLen <=0 || rec[i].DataLen >8) continue; string sPrintStr; char buf[32]; timeval tv; char cTimeTmp[64]; gettimeofday(&tv, nullptr); strftime(cTimeTmp, sizeof(cTimeTmp)-1, "TimeStamp:%Y/%m/%d-%H:%M:%S", localtime(&tv.tv_sec)); sprintf(buf, "%s.%03d ", cTimeTmp, (int)(tv.tv_usec / 1000)); sPrintStr += buf; sprintf(buf,"ID:0x%08X ", rec[i].ID);//ID sPrintStr += buf; if(rec[i].ExternFlag==0) sprintf(buf, "Standard ");//帧格式:标准帧 if(rec[i].ExternFlag==1) sprintf(buf, "Extend ");//帧格式:扩展帧 sPrintStr += buf; if(rec[i].RemoteFlag==0) sprintf(buf, "Data ");//帧类型:数据帧 if(rec[i].RemoteFlag==1) sprintf(buf, "Remote ");//帧类型:远程帧 sPrintStr += buf; sprintf(buf, "Len:%d", rec[i].DataLen);//帧长度 sPrintStr += buf; sPrintStr += " data:0x"; //数据 for(int j = 0; j < rec[i].DataLen; j++) { sprintf(buf, " %02X", rec[i].Data[j]); sPrintStr += buf; } sPrintStr += "\n"; ServoInitFileRw.Output(sPrintStr); } } } else { ServoInitFileRw.CloseFile(); break; } } } #endif /************************************************* Function: CTrackRobot::CANManageThreadFunc Description: USBCAN设备数据处理线程功能函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CANManageThreadFunc() { ROS_INFO("[CANManageThreadFunc] start"); CanFrame canTemp; std::deque<CanFrame> vCanFrameDeque; unsigned long ulSize; int nMotorOnePrePulse = 0; int nMotorTwoPrePulse = 0; while(ros::ok()) { std::unique_lock<std::mutex> lock(m_CanRXMutex); while(m_dCanRXDeque.empty()) { m_CanRXCondition.wait(lock); } vCanFrameDeque.assign(m_dCanRXDeque.begin(), m_dCanRXDeque.end()); m_dCanRXDeque.clear(); lock.unlock(); ulSize = vCanFrameDeque.size(); for (int i = 0; i < ulSize; i++) { canTemp = vCanFrameDeque[i]; //PDO Motor INFO if(canTemp.u32Id == m_MotorOne.m_unPdoRxCobId) { timespec_get(&m_tMotorOneLastRespTime, TIME_UTC); m_MotorOne.UpdateMotorStatus(canTemp); m_CurrentMotorPos.nMotorOnePos = m_MotorOne.m_MotorStatus.nCurrentPos; m_dCurrentSpeed1 = m_MotorOne.m_MotorStatus.dActual_speed; m_bMotorRunning = (abs(m_dCurrentSpeed) > 0.001); if(m_dCurrentSpeed >= 0) { m_nRobotCurrentPulseOne += m_CurrentMotorPos.nMotorOnePos - nMotorOnePrePulse; } else { m_nRobotCurrentPulseOne += int((m_CurrentMotorPos.nMotorOnePos - nMotorOnePrePulse)*(back_diameter/forward_diameter)); } nMotorOnePrePulse = m_CurrentMotorPos.nMotorOnePos; } else if(canTemp.u32Id == m_MotorTwo.m_unPdoRxCobId) { timespec_get(&m_tMotorTwoLastRespTime, TIME_UTC); m_MotorTwo.UpdateMotorStatus(canTemp); m_CurrentMotorPos.nMotorTwoPos = m_MotorTwo.m_MotorStatus.nCurrentPos; m_dCurrentSpeed = (m_MotorTwo.m_MotorStatus.dActual_speed + m_dCurrentSpeed1)/2; m_bMotorRunning = (abs(m_dCurrentSpeed) > 0.001); //位置模式下设置,跟随电机速度设置 if(m_nMode == PP && !m_bSingleMove) { CanFrame SpeedCanData; SpeedCanData.ID = m_MotorOne.m_unPdoTxCobId; SpeedCanData.RemoteFlag = 0; SpeedCanData.ExternFlag = 0; SpeedCanData.SendType = 0; SpeedCanData.DataLen = 2; SpeedCanData.Data[0] = canTemp.Data[0]; SpeedCanData.Data[1] = canTemp.Data[1]; SendCanFrame(&SpeedCanData, 1); } if(1 != m_nUseImuOdom) { if(m_bMotorRunning) { CalcRobotMileage(); } } if(m_dCurrentSpeed >= 0) { m_nRobotCurrentPulseTwo += m_CurrentMotorPos.nMotorTwoPos - nMotorTwoPrePulse; } else { m_nRobotCurrentPulseTwo += int((m_CurrentMotorPos.nMotorTwoPos - nMotorTwoPrePulse)*(back_diameter/forward_diameter)); } nMotorTwoPrePulse = m_CurrentMotorPos.nMotorTwoPos; } //Motor Sdo Check else if(canTemp.u32Id == m_MotorOne.m_unSdoRxCobId || canTemp.u32Id == m_MotorTwo.m_unSdoRxCobId) { if(m_bCheckSdo) { std::unique_lock<std::mutex> Lock(m_SdoCheckMutex); if(UsbCan.CanFrameCmp(&m_SdoCheckBuf[m_nSdoCheckCount],&canTemp) != 0) { UsbCan.PrintCanFrame(&m_SdoCheckBuf[m_nSdoCheckCount],"SdoCheckBuf"); UsbCan.PrintCanFrame(&canTemp,"recvCanData"); m_bCheckSdo = false; } m_nSdoCheckCount++; } else if(canTemp.u32Id == m_MotorOne.m_unSdoRxCobId) { m_MotorOne.ManageSdoInfo(canTemp); m_sMotorOneStatus = m_MotorOne.m_MotorStatus.sErr; if(m_sMotorOneStatus != "normal" && m_bIsMotorInit) { ROS_ERROR("[CANManageThreadFunc] Motor1 servo error"); m_dTargetSpeed = 0; m_bIsMotorInit = false; if(GpioControl(G_LIGHT_OFF) == -1) ROS_ERROR("[MotorServoInit] turn off green light failed"); if(GpioControl(R_LIGHT_ON) == -1) ROS_ERROR("[MotorServoInit] turn on red light failed"); } } else if(canTemp.u32Id == m_MotorTwo.m_unSdoRxCobId) { m_MotorTwo.ManageSdoInfo(canTemp); m_sMotorTwoStatus = m_MotorTwo.m_MotorStatus.sErr; if(m_sMotorTwoStatus != "normal" && m_bIsMotorInit) { ROS_ERROR("[CANManageThreadFunc] Motor2 servo error"); m_dTargetSpeed = 0; m_bIsMotorInit = false; if(GpioControl(G_LIGHT_OFF) == -1) ROS_ERROR("[MotorServoInit] turn off green light failed"); if(GpioControl(R_LIGHT_ON) == -1) ROS_ERROR("[MotorServoInit] turn on red light failed"); } } } //字节1 电池电压(单位0.1V,400->40V);字节2 电池电压(单位0.1V,400->40V);字节3 电池电流(单位0.1A,200->20A);字节4 电池电流(单位0.1A,200->20A) //字节5 电量信息(SOC,0-100);字节6 电池温度(65表示25℃,负偏40);字节7 充电状态:1正在充电,0没有充电;字节8 电池组串数 else if(canTemp.u32Id == 0xBB) { m_nBatteryVoltage = canTemp.szData[0]; m_nBatteryVoltage <<= 8; m_nBatteryVoltage += canTemp.szData[1]; m_nBatteryCurrent = canTemp.szData[2]; m_nBatteryCurrent <<= 8; m_nBatteryCurrent += canTemp.szData[3]; m_nBatteryPower = canTemp.szData[4]; m_nBatteryTemp = canTemp.szData[5] - 40; m_nBatteryCharge = canTemp.szData[6]; } //#电池状态:bit0:欠压 bit1:过压 bit2:过流 bit3:低温 bit4:高温 bit5:充电中 bit6:放电中 bit7:充电fet损坏 else if(canTemp.u32Id == 0xBE) { uint8_t nBatteryStatus; nBatteryStatus = 0x00; nBatteryStatus |= (canTemp.szData[1] & 0xAA)? 0x01:0x00;//欠压 nBatteryStatus |= (canTemp.szData[1] & 0x55)? 0x02:0x00;//过压 nBatteryStatus |= (canTemp.szData[3] & 0x34)? 0x04:0x00;//过流 nBatteryStatus |= (canTemp.szData[4] & 0xAA)? 0x08:0x00; nBatteryStatus |= (canTemp.szData[5] & 0xAA)? 0x08:0x00;//低温 nBatteryStatus |= (canTemp.szData[4] & 0x55)? 0x10:0x00; nBatteryStatus |= (canTemp.szData[5] & 0x55)? 0x10:0x00;//高温 // nBatteryStatus |= (canTemp.szData[3] & 0x01)? 0x20:0x00;//充电状态 // nBatteryStatus |= (canTemp.szData[3] & 0x02)? 0x40:0x00;//放电状态 nBatteryStatus |= (canTemp.szData[7] & 0x02)? 0x80:0x00;//充电fet损坏 m_nBatteryStatus = nBatteryStatus; } } vCanFrameDeque.clear(); } } /************************************************* Function: CTrackRobot::CANSendThreadFunc Description: USBCAN设备数据发送线程功能函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CANSendThreadFunc() { ROS_INFO("[CANSendThreadFunc] start"); CanFrame canFrame; std::deque<CanFrame> CanSendDeque; unsigned long ulSize = 0; while (ros::ok()) { try { std::unique_lock<std::mutex> LockSendPack(m_CanTXMutex); if (m_dCanTXDeque.empty()) { m_CanTXCondition.wait(LockSendPack); } CanSendDeque.assign(m_dCanTXDeque.begin(), m_dCanTXDeque.end()); m_dCanTXDeque.clear(); LockSendPack.unlock(); ulSize = CanSendDeque.size(); if(ulSize > 100) { ROS_WARN("[CANSendThreadFunc] send buf size is: %ld.",ulSize); } for (int i = 0; i < ulSize; i++) { canFrame = CanSendDeque[i]; if(m_nPrintCanRTX) UsbCan.PrintCanFrame(&canFrame, __FUNCTION__); UsbCan.SendCan(&canFrame, 1); this_thread::sleep_for(std::chrono::milliseconds(1)); } } catch(...) { UsbCan.Reset(); ROS_ERROR("[CANSendThreadFunc] catch can send func error"); } } } /************************************************* Function: CTrackRobot::CheckTaskStatus Description: 检测任务是否完成 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CheckTaskStatus() { if(m_nControlMode != IDLE) { if(m_dDistance >= m_dTargetDis - AUTO_RUN_LOCATION_TRIM) { if(m_nMode == PV || m_bSingleMove) { ROS_INFO("[CheckTaskStatus] run Quick Stop"); QuickStop(); this_thread::sleep_for(std::chrono::milliseconds(200)); } if(WaitForMotionStop(5)) { PublishStatus(TASK_DONE); m_bPubPosData = false; } else PublishStatus(ERROR); m_bSingleMove = false; m_nControlMode = IDLE; ROS_DEBUG("[CheckTaskStatus] forward or backward m_dDistance=%lf",m_dDistance); } } } /************************************************* Function: CTrackRobot::UpdateMotorInfoTimerFunc Description: 状态监测TIMER Input: void Output: void Others: void **************************************************/ void CTrackRobot::UpdateMotorInfoTimerFunc() { if(1 == m_nUseImuOdom) { PublishOdom(); } if(!m_bIsMotorInit || m_bIsEStopButtonPressed) return; SendGetMotorInfoCmd(); } /************************************************* Function: CTrackRobot::UpdateMotorInfoTimerFunc Description: 状态监测TIMER Input: void Output: void Others: void **************************************************/ void CTrackRobot::MonitorStatusThreadFunc() { ROS_INFO("[MonitorStatusThreadFunc] start"); while (ros::ok()) { if(m_nControlMode == JOY) { CheckJoyStatus(); } else { CheckTaskStatus(); } CheckCanStatus(); CheckEStopStatus(); if(!m_bIsMotorInit || m_bIsEStopButtonPressed) {} else { //非位置信息的速度处理:匀加速 or 匀减速 if(m_nMode == PV || m_bSingleMove) AccelerationOrDeceleration(); } this_thread::sleep_for(std::chrono::milliseconds(20)); } ROS_INFO("[MonitorStatusThreadFunc] end"); } /************************************************* Function: CTrackRobot::AccelerationOrDeceleration Description: 匀加速 and 匀减速 Input: void Output: void Others: void **************************************************/ void CTrackRobot::AccelerationOrDeceleration() { if(m_nControlMode == TASK || m_nControlMode == ALARM) { std::unique_lock<std::mutex> Lock(m_CurrentSpeedMutex); double dEndSpeed = 0.05; if( !m_bIsMotorPause && (abs(m_dTargetSpeed) > dEndSpeed) && (m_dDistance >= (m_dTargetDis - m_dEndDis)) && m_nControlMode != JOY) { if(m_nDirection == FORWARD) { m_dTargetSpeed = m_dTargetSpeed > dEndSpeed ? dEndSpeed : m_dTargetSpeed; ROS_DEBUG("[AccelerationOrDeceleration] deceleration set speed:%f",m_dTargetSpeed); } else if(m_nDirection == BACKWARD) { m_dTargetSpeed = abs(m_dTargetSpeed) > dEndSpeed ? -dEndSpeed : m_dTargetSpeed; ROS_DEBUG("[AccelerationOrDeceleration] deceleration set speed:%f",m_dTargetSpeed); } } Lock.unlock(); } SetMotorSpeed(m_dTargetSpeed); } /************************************************* Function: CTrackRobot::CalcRobotMileage Description: 换算机器人运动里程 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CalcRobotMileage() { int nMotor_One_Displacement=0, nMotor_Two_Displacement=0; //32位数值溢出 if(m_nDirection == FORWARD) { if(m_nMode == PV || m_bSingleMove) { if(m_CurrentMotorPos.nMotorOnePos < m_DynamicOrigin.nMotorOnePos) { nMotor_One_Displacement = 0x7FFFFFFF - m_DynamicOrigin.nMotorOnePos; nMotor_One_Displacement += m_CurrentMotorPos.nMotorOnePos - 0x80000000 + 1; } else { nMotor_One_Displacement = m_CurrentMotorPos.nMotorOnePos-m_DynamicOrigin.nMotorOnePos; } } if(m_CurrentMotorPos.nMotorTwoPos < m_DynamicOrigin.nMotorTwoPos) { nMotor_Two_Displacement = 0x7FFFFFFF - m_DynamicOrigin.nMotorTwoPos; nMotor_Two_Displacement += m_CurrentMotorPos.nMotorTwoPos - 0x80000000 + 1; } else { nMotor_Two_Displacement = m_CurrentMotorPos.nMotorTwoPos-m_DynamicOrigin.nMotorTwoPos; } } else if(m_nDirection == BACKWARD) { if(m_nMode == PV || m_bSingleMove) { if(m_CurrentMotorPos.nMotorOnePos > m_DynamicOrigin.nMotorOnePos) { nMotor_One_Displacement = m_DynamicOrigin.nMotorOnePos - 0x80000000; nMotor_One_Displacement += 0x7FFFFFFF - m_CurrentMotorPos.nMotorOnePos + 1; } else { nMotor_One_Displacement = m_DynamicOrigin.nMotorOnePos-m_CurrentMotorPos.nMotorOnePos; } } if(m_CurrentMotorPos.nMotorTwoPos > m_DynamicOrigin.nMotorTwoPos) { nMotor_Two_Displacement = m_DynamicOrigin.nMotorTwoPos - 0x80000000; nMotor_Two_Displacement += 0x7FFFFFFF - m_CurrentMotorPos.nMotorTwoPos + 1; } else { nMotor_Two_Displacement = m_DynamicOrigin.nMotorTwoPos-m_CurrentMotorPos.nMotorTwoPos; } } if(m_nMode == PV || m_bSingleMove) { double dDistance = (nMotor_One_Displacement/(PULSES_OF_MOTOR_ONE_TURN*MOTOR_TRANSMISSION))*M_PI*actual_tire_diameter/1000; m_dDistance = ((nMotor_Two_Displacement/(PULSES_OF_MOTOR_ONE_TURN*MOTOR_TRANSMISSION))*M_PI*actual_tire_diameter/1000 + dDistance) / 2; } else if(m_nMode == PP) { m_dDistance = (nMotor_Two_Displacement/(PULSES_OF_MOTOR_ONE_TURN*MOTOR_TRANSMISSION))*M_PI*actual_tire_diameter/1000; } } /************************************************* Function: CTrackRobot::MotorServoInit Description: 电机伺服初始化函数 Input: void Output: void Others: void **************************************************/ int CTrackRobot::MotorServoInit() { ROS_DEBUG("[MotorServoInit] start."); m_bIsMotorInit = false; if(GpioControl(R_LIGHT_OFF) == -1) { ROS_ERROR("[MotorServoInit] turn off red light failed"); return -1; } if(GpioControl(G_LIGHT_OFF) == -1) { ROS_ERROR("[MotorServoInit] turn off green light failed"); return -1; } if(GpioControl(B_LIGHT_OFF) == -1) { ROS_ERROR("[MotorServoInit] turn off blue light failed"); return -1; } if(GpioControl(R_LIGHT_ON) == -1) { ROS_ERROR("[MotorServoInit] turn on red light failed"); return -1; } if(m_bIsEStopButtonPressed) { ROS_WARN("[MotorServoInit] motor init failed, the E-Stop button is pressed"); return -1; } m_bIsInitializing = true; if(RestartMotorServo() == -1) { ROS_ERROR("[MotorServoInit] start motor servo failed"); m_bIsInitializing = false; return -1; } this_thread::sleep_for(std::chrono::milliseconds(1000)); m_DynamicOrigin.nMotorOnePos = 0; m_DynamicOrigin.nMotorTwoPos = 0; m_tTimeOfLastJoyCmd.tv_sec = 0; m_tTimeOfLastJoyCmd.tv_nsec = 0; m_tMotorOneLastRespTime.tv_sec = 0; m_tMotorOneLastRespTime.tv_nsec = 0; m_tMotorTwoLastRespTime.tv_sec = 0; m_tMotorTwoLastRespTime.tv_nsec = 0; m_MotorOne.SetMotorId(1); m_MotorTwo.SetMotorId(2); m_MotorOne.SetMotorControlMode(PV); m_MotorTwo.SetMotorControlMode(m_nMode); int nCanDataLen = 40; int nCount = 0; bool bIsCheck = true; CanFrame initCanData[nCanDataLen]; CanFrame initCheckCanData[nCanDataLen]; memset(initCanData, 0, sizeof(CanFrame)*nCanDataLen); memset(initCheckCanData, 0, sizeof(CanFrame)*nCanDataLen); SendCanFrame(0, 1, 0x01);//0x01 启动节点 m_MotorOne.InitMotorCmdPack(initCanData); nCount = m_MotorOne.InitMotorCheckDataPack(initCheckCanData); if(SendCanFrame(initCanData, nCount, initCheckCanData, bIsCheck) == -1) { ROS_ERROR("[MotorServoInit] motor one init error"); m_bIsInitializing = false; return -1; } memset(initCanData, 0, sizeof(CanFrame)*nCanDataLen); memset(initCheckCanData, 0, sizeof(CanFrame)*nCanDataLen); m_MotorTwo.InitMotorCmdPack(initCanData); nCount = m_MotorTwo.InitMotorCheckDataPack(initCheckCanData); if(SendCanFrame(initCanData, nCount, initCheckCanData, bIsCheck) == -1) { ROS_ERROR("[MotorServoInit] motor two init error"); m_bIsInitializing = false; return -1; } if(SetRobotAcceleration(m_dPvAcceleration) == -1) { ROS_ERROR("[MotorServoInit] init set Acceleration error"); m_bIsInitializing = false; return -1; } if(SetRobotDeceleration(m_dPvAcceleration) == -1) { ROS_ERROR("[MotorServoInit] init set Deceleration error"); m_bIsInitializing = false; return -1; } if(GpioControl(R_LIGHT_OFF) == -1) { ROS_ERROR("[MotorServoInit] turn off red light failed"); m_bIsInitializing = false; return -1; } if(GpioControl(G_LIGHT_ON) == -1) { ROS_ERROR("[MotorServoInit] turn on green light failed"); m_bIsInitializing = false; return -1; } m_bIsMotorInit = true; m_bIsInitializing = false; PublishStatus(TASK_DONE); ROS_INFO("[MotorServoInit] motor init succeed"); this_thread::sleep_for(std::chrono::milliseconds(100)); UpdateOriginPosition(); return 1; } /************************************************* Function: CTrackRobot::SetMotorAcceleration Description: 设置电机伺服的加速度 A Input: float fVelocity 机器人运动减速度,单位 m/s^2 Output: void Others: void **************************************************/ int CTrackRobot::SetRobotAcceleration(double dAcceleration) { CanFrame AccelerationCanData[2]; CanFrame AccelerationCheckCanData[2]; memset(AccelerationCanData, 0, sizeof(CanFrame)*2); memset(AccelerationCheckCanData, 0, sizeof(CanFrame)*2); int nCount = 0; m_MotorOne.SetAccelerationCmdPack(AccelerationCanData, dAcceleration); nCount = m_MotorOne.SetAccelerationCheckDataPack(AccelerationCheckCanData); if(SendCanFrame(AccelerationCanData, nCount, AccelerationCheckCanData, true)== -1) { ROS_ERROR("[SetRobotAcceleration] set motor one Acceleration error"); return -1; } memset(AccelerationCanData, 0, sizeof(CanFrame)*2); memset(AccelerationCheckCanData, 0, sizeof(CanFrame)*2); m_MotorTwo.SetAccelerationCmdPack(AccelerationCanData, dAcceleration); nCount = m_MotorTwo.SetAccelerationCheckDataPack(AccelerationCheckCanData); if(SendCanFrame(AccelerationCanData, nCount, AccelerationCheckCanData, true)== -1) { ROS_ERROR("[SetRobotAcceleration] set motor two Acceleration error"); return -1; } return 1; } /************************************************* Function: CTrackRobot::SetMotorAcceleration Description: 设置电机伺服的加速度 A Input: float fVelocity 机器人运动减速度,单位 m/s^2 Output: void Others: void **************************************************/ int CTrackRobot::SetRobotDeceleration(double dDeceleration) { CanFrame DecelerationCanData[2]; CanFrame DecelerationCheckCanData[2]; memset(DecelerationCanData, 0, sizeof(CanFrame)*2); memset(DecelerationCheckCanData, 0, sizeof(CanFrame)*2); int nCount = 0; m_MotorOne.SetDecelerationCmdPack(DecelerationCanData, dDeceleration); nCount = m_MotorOne.SetDecelerationCheckDataPack(DecelerationCheckCanData); if(SendCanFrame(DecelerationCanData, nCount, DecelerationCheckCanData, true)== -1) { ROS_ERROR("[SetRobotDeceleration] set motor one Deceleration error"); return -1; } memset(DecelerationCanData, 0, sizeof(CanFrame)*2); memset(DecelerationCheckCanData, 0, sizeof(CanFrame)*2); m_MotorTwo.SetDecelerationCmdPack(DecelerationCanData, dDeceleration); nCount = m_MotorTwo.SetDecelerationCheckDataPack(DecelerationCheckCanData); if(SendCanFrame(DecelerationCanData, nCount, DecelerationCheckCanData, true)== -1) { ROS_ERROR("[SetRobotDeceleration] set motor two Deceleration error"); return -1; } return 1; } /************************************************* Function: CTrackRobot::ForwardMotion Description: 机器人向正方向运动 Input: void Output: void Others: void **************************************************/ void CTrackRobot::ForwardMotion() { m_nDirection = FORWARD; actual_tire_diameter = forward_diameter; if(m_nMode == PP && !m_bSingleMove) { SetNewPos(m_dTargetDis); } else { m_bCheckAlarmData = false; m_dTargetSpeed = m_dTargetSpeedTemp; //m_dEndDis需要判断 处理目标距离无法完成抵达目标速度的正常匀加速和匀减速 m_dEndDis = (m_dTargetSpeed*m_dTargetSpeed)/(2*m_dPvAcceleration) + END_DIS_AMEND; double dTargetDis = m_dTargetDis; if(dTargetDis <= 2*m_dEndDis - END_DIS_AMEND) { m_dEndDis = dTargetDis*END_DIS_MODIFICATION; } ROS_DEBUG("[ForwardMotion] m_dEndDis :%f",m_dEndDis); } } /************************************************* Function: CTrackRobot::BackwardMotion Description: 机器人向正方向反向运动 Input: void Output: void Others: void **************************************************/ void CTrackRobot::BackwardMotion() { m_nDirection = BACKWARD; actual_tire_diameter = back_diameter; if(m_nMode == PP && !m_bSingleMove) { SetNewPos(-m_dTargetDis); } else { m_bCheckAlarmData = false; m_dTargetSpeed = m_dTargetSpeedTemp; //m_dEndDis需要判断 处理目标距离无法完成抵达目标速度的正常匀加速和匀减速 m_dEndDis = (m_dTargetSpeed*m_dTargetSpeed)/(2*m_dPvAcceleration) + END_DIS_AMEND; double dTargetDis = m_dTargetDis; if(dTargetDis <= 2*m_dEndDis - END_DIS_AMEND) { m_dEndDis = dTargetDis*END_DIS_MODIFICATION; } ROS_DEBUG("[BackwardMotion] m_dEndDis :%f",m_dEndDis); } } /************************************************* Function: CTrackRobot::MotorSpeedUp Description: 电机运动加速 Input: void Output: void Others: void **************************************************/ void CTrackRobot::MotorSpeedUp() { std::unique_lock<std::mutex> Lock(m_CurrentSpeedMutex); if(m_nMode == PP) { m_dTargetSpeed += SPEED_INCREMENT; } else if(m_nMode == PV) { if(m_nDirection == FORWARD) { m_dTargetSpeed += SPEED_INCREMENT; } else { m_dTargetSpeed -= SPEED_INCREMENT; } } Lock.unlock(); } /************************************************* Function: CTrackRobot::MotorSpeedDown Description: 电机运动减速 Input: void Output: void Others: void **************************************************/ void CTrackRobot::MotorSpeedDown() { std::unique_lock<std::mutex> Lock(m_CurrentSpeedMutex); if(m_nMode == PP) { m_dTargetSpeed -= SPEED_INCREMENT; if(m_dTargetSpeed <= 0) m_dTargetSpeed = 0; } else if(m_nMode == PV) { if(m_nDirection == FORWARD) { m_dTargetSpeed -= SPEED_INCREMENT; if(m_dTargetSpeed <= 0) { m_dTargetSpeed = 0; } } else { m_dTargetSpeed -= SPEED_INCREMENT; if(m_dTargetSpeed >= 0) { m_dTargetSpeed = 0; } } } Lock.unlock(); } /************************************************* Function: CTrackRobot::SetMotorSpeed Description: 设置电机运动速度 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SetMotorSpeed(double dSpeed) { CanFrame SpeedCanData[2]; CanFrame *pCanData = SpeedCanData; int nCount = 0; if(m_nMode == PV || m_bSingleMove) { nCount += m_MotorOne.SetSpeedPdoCmdPack(pCanData, dSpeed); pCanData = SpeedCanData + nCount; } if(!m_bSingleMove) nCount += m_MotorTwo.SetSpeedPdoCmdPack(pCanData, dSpeed); SendCanFrame(SpeedCanData, nCount); } /************************************************* Function: CTrackRobot::SendCmdOfGetMotorTemp Description: 发送获取电机伺服温度报文 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SendCmdOfGetMotorTemp() { CanFrame CanData[2]; CanFrame *pCanData = CanData; int nCount = 0; nCount += m_MotorOne.GetMotorTempPack(pCanData); pCanData = CanData + nCount; nCount += m_MotorTwo.GetMotorTempPack(pCanData); SendCanFrame(CanData, nCount); } /************************************************* Function: CTrackRobot::SendCmdOfGetMotorErrorCode Description: 发送获取电机伺服温度报文 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SendCmdOfGetMotorErrorCode() { CanFrame CanData[2]; CanFrame *pCanData = CanData; int nCount = 0; nCount += m_MotorOne.GetErrorCodeCmdPack(pCanData); pCanData = CanData + nCount; nCount += m_MotorTwo.GetErrorCodeCmdPack(pCanData); SendCanFrame(CanData, nCount); } /************************************************* Function: CTrackRobot::SendHeartBeatCanFrame Description: 设置电机运动速度 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SendHeartBeatCanFrame() { SendCanFrame(MASTER_HEART_BEAT_ID, 0, 0); } /************************************************* Function: CTrackRobot::SetMotorSpeed Description: 设置电机运动速度 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SendCmdOfGetBatteryInfo() { SendCanFrame(0x16, 8, 0x16BB00000000007E); SendCanFrame(0x16, 8, 0x16BE00000000007E); } /************************************************* Function: CTrackRobot::SetNewPos Description: 位置模式下,设置电机的新的位置点 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SetNewPos(double dDistance) { CanFrame PosCanData[5]; CanFrame *pCanData = PosCanData; int nType = RELATIVE; int nCount = m_MotorTwo.SetNewPosCmdPack(pCanData, nType, dDistance); pCanData = PosCanData + nCount; m_MotorOne.SetSdoCanFrame(pCanData, SdoControlWords[ENABLE_OPERATION]); nCount ++; SendCanFrame(PosCanData, nCount); } /************************************************* Function: CTrackRobot::QuickStop Description: 电机运动停止,急停 Input: void Output: void Others: void **************************************************/ void CTrackRobot::QuickStop() { m_dTargetSpeed = 0; SetMotorSpeed(m_dTargetSpeed); CanFrame StopCanData[2]; CanFrame *pCanData = StopCanData; int nCount = 0; nCount += m_MotorOne.QuickStopCmdPack(pCanData); pCanData = StopCanData + nCount; nCount += m_MotorTwo.QuickStopCmdPack(pCanData); SendCanFrame(StopCanData, nCount); // ROS_DEBUG("[QuickStop] send quick stop cmd"); } /************************************************* Function: CTrackRobot::StopMotion Description: 电机运动停止,按照设置的匀减速,速度减至0 Input: void Output: void Others: void **************************************************/ void CTrackRobot::StopMotion(bool bJoy) { if(m_nMode == PV) { m_dTargetSpeed = 0; } else if(m_nMode == PP) { CanFrame StopCanData[2]; CanFrame *pCanData = StopCanData; int nCount = 0; nCount += m_MotorOne.StopCmdPack(pCanData); pCanData = StopCanData + nCount; nCount += m_MotorTwo.StopCmdPack(pCanData); SendCanFrame(StopCanData, nCount); } if(!bJoy) m_bIsMotorPause = true; } /************************************************* Function: CTrackRobot::MotorPowerOff Description: 电机伺服控制掉电 Input: void Output: void Others: void **************************************************/ void CTrackRobot::MotorPowerOff() { SendCanFrame(0x601, 8, 0x2B40600006000000);//断电 SendCanFrame(0x602, 8, 0x2B40600006000000); m_bMotorRunning = false; } /************************************************* Function: CTrackRobot::ClearWarn Description: 清除伺服警告 Input: void Output: void Others: void **************************************************/ void CTrackRobot::ClearWarn() { if(m_bIsMotorInit) { ROS_INFO("[ClearWarn]m_bIsMotorInit = %d, return.",m_bIsMotorInit); return; } int nSize = 2; CanFrame ClearCanData[nSize]; CanFrame ClearCanCheckData[nSize]; bool bIsCheck = true; memset(ClearCanData, 0, sizeof(CanFrame)*nSize); memset(ClearCanCheckData, 0, sizeof(CanFrame)*nSize); m_MotorOne.ClearWarnPack(ClearCanData); int nCount = m_MotorOne.ClearWarnCheckCmdPack(ClearCanCheckData); if(SendCanFrame(ClearCanData, nCount, ClearCanCheckData, bIsCheck) == -1) { ROS_ERROR("[ClearWarn] motor one clear warn error"); } memset(ClearCanData, 0, sizeof(CanFrame)*nSize); memset(ClearCanCheckData, 0, sizeof(CanFrame)*nSize); m_MotorTwo.ClearWarnPack(ClearCanData); nCount = m_MotorTwo.ClearWarnCheckCmdPack(ClearCanCheckData); if(SendCanFrame(ClearCanData, nCount, ClearCanCheckData, bIsCheck) == -1) { ROS_ERROR("[ClearWarn] motor two clear warn error"); } m_sMotorOneStatus = "normal"; m_sMotorTwoStatus = "normal"; } /************************************************* Function: CTrackRobot::SendGetMotorPosCmd Description: 获取电机的当前位置值,绝对位移 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SendGetMotorInfoCmd() { SendCanFrame(GET_MOTOR_INFO_PDO_ID, 0, 0); } /************************************************* Function: CTrackRobot::SendCanFrame Description: can数据发送函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::SendCanFrame(unsigned ID, unsigned char DataLen, ULL frameData) { CanFrame canFrame; UsbCan.SetCanFrame(&canFrame, ID, DataLen, frameData); std::unique_lock<std::mutex> LockSendCanFrame(m_CanTXMutex); m_dCanTXDeque.push_back(canFrame); m_CanTXCondition.notify_one(); } int CTrackRobot::SendCanFrame(CanFrame *sendCanData, int nCount, CanFrame *checkCanData, bool bIsCheck) { if(bIsCheck) { std::unique_lock<std::mutex> Lock(m_SdoCheckMutex); m_SdoCheckBuf = new CanFrame[nCount]; memcpy(m_SdoCheckBuf, checkCanData, sizeof(CanFrame)*nCount); Lock.unlock(); m_nSdoCheckCount = 0; m_bCheckSdo = true; } std::unique_lock<std::mutex> LockSendCanFrame(m_CanTXMutex); for(int i=0; i<nCount; i++) { m_dCanTXDeque.push_back(sendCanData[i]); } m_CanTXCondition.notify_one(); LockSendCanFrame.unlock(); if(bIsCheck) { timespec StartTime; timespec_get(&StartTime, TIME_UTC); while(m_nSdoCheckCount < nCount) { this_thread::sleep_for(std::chrono::milliseconds(10)); timespec CurrentTime; timespec_get(&CurrentTime, TIME_UTC); long pollInterval=((CurrentTime.tv_sec - StartTime.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - StartTime.tv_nsec)) / 1000000; if(pollInterval > (nCount * 20) || !m_bCheckSdo) { if(m_bCheckSdo) ROS_WARN("[SendCanFrame] receive data time out"); m_nSdoCheckCount = 0; m_bCheckSdo = false; return -1; } } std::unique_lock<std::mutex> Lock1(m_SdoCheckMutex); delete m_SdoCheckBuf; m_SdoCheckBuf = nullptr; Lock1.unlock(); m_nSdoCheckCount = 0; m_bCheckSdo = false; } return 1; } /************************************************* Function: CTrackRobot::PublishOdom Description: can帧数据打印函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::PublishOdom() { nav_msgs::Odometry OdomMsg; OdomMsg.header.stamp = ros::Time::now(); OdomMsg.header.frame_id = "odom"; if(m_bIsEStopButtonPressed) { m_dCurrentSpeed = 0; } OdomMsg.twist.twist.linear.x = m_dCurrentSpeed; OdomMsg.twist.covariance[0] = 1e-8; OdomMsg.twist.covariance[7] = 1e-8; OdomMsg.twist.covariance[14] = 1e-8; OdomMsg.twist.covariance[21] = 1e-8; OdomMsg.twist.covariance[28] = 1e-8; OdomMsg.twist.covariance[35] = 1e-8; m_OdomPublisher.publish(OdomMsg); } /************************************************* Function: CTrackRobot::PublishStatus Description: can帧数据打印函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::PublishStatus(int nStatus) { custom_msgs::GeneralTopic status; status.sender = "track_robot"; status.data = vsRobotStatus[nStatus]; status.header.stamp = ros::Time::now(); status.header.frame_id = "status"; m_StatusPublisher.publish(status); } /************************************************* Function: CTrackRobot::PublishStatus Description: can帧数据打印函数 Input: void Output: void Others: void **************************************************/ void CTrackRobot::PublishStatus(string &sStatus) { custom_msgs::GeneralTopic status; status.sender = "track_robot"; status.data = sStatus; status.header.stamp = ros::Time::now(); status.header.frame_id = "status"; m_StatusPublisher.publish(status); } /************************************************* Function: CTrackRobot::CommandCallBack Description: 后台控制回调函数 Input: const custom_msgs::TrainRobotControl::ConstPtr &Command, 后台控制消息 Output: void Others: void **************************************************/ void CTrackRobot::CommandCallBack(const custom_msgs::TrainRobotControl::ConstPtr &Command) { custom_msgs::TrainRobotControlAck Ack; Ack.trans_id = Command->trans_id; Ack.header.stamp = ros::Time::now(); Ack.header.frame_id = Command->cmd; Ack.sender = "track_robot"; Ack.ack = "succeed"; if(!m_bIsMotorInit) { ROS_WARN("[CommandCallBack] motor is not init."); Ack.ack = "failed"; Ack.data = "motor is not init"; } else if(m_bIsEStopButtonPressed) { ROS_WARN("[CommandCallBack] E-Stop button is pressed."); Ack.ack = "failed"; Ack.data = "E-Stop button is pressed"; } else if(Command->cmd == "joy_run") { if(m_bMotorRunning && m_nControlMode != JOY) { ROS_WARN("[CommandCallBack] busy, please wait for a moment"); } else { m_nControlMode = JOY; std::unique_lock<std::mutex> lock(m_JoyTimeOutCheckMutex); if(m_tTimeOfLastJoyCmd.tv_sec == 0 && m_tTimeOfLastJoyCmd.tv_nsec == 0) { m_dTargetSpeed = Command->speed; if(m_nMode == PP) { SetMotorSpeed(abs(m_dTargetSpeed)); if(Command->speed > 0) SetNewPos(2000.0); else SetNewPos(-2000.0); } m_nDirection = m_dTargetSpeed > 0 ? FORWARD : BACKWARD; } timespec_get(&m_tTimeOfLastJoyCmd, TIME_UTC); lock.unlock(); } return; } else if(Command->cmd == "run" || Command->cmd == "alarm_run") { m_bSingleMove = false; m_bPubPosData = false; if(m_bMotorRunning) { ROS_WARN("[CommandCallBack] robot is running, return."); Ack.ack = "failed"; Ack.data = "robot is running"; } else if(m_nControlMode != IDLE) { ROS_WARN("[CommandCallBack] control mode is not idle."); Ack.ack = "failed"; Ack.data = "busy"; } else if(Command->distance < 0.001) { Ack.data = "target dis is to small"; } else { if(Command->cmd == "run") { m_bPubPosData = (Command->move_type == UPDATE_ORIGIN_MOVE_PUB) || (Command->move_type == MOVE_PUB); this_thread::sleep_for(std::chrono::milliseconds(100));//确保先把激光数据打开 if(UPDATE_ORIGIN_MOVE_PUB == Command->move_type) { m_bManagerUpdateOrigin = (Command->move_type == 1); m_dRealDis = Command->real_distance; m_bForwardRelocation = (Command->speed > 0); } else if(SINGLE_MOVE == Command->move_type) { m_dTargetDis /= 2; m_bSingleMove = true; } } else { m_bPubPosData = (Command->move_type == MOVE_PUB); this_thread::sleep_for(std::chrono::milliseconds(100));//确保先把激光数据打开 } m_dDisTemp = 0xFFFFFFFFFFFFFFFF; if(Command->distance != m_dTargetDis) { ROS_INFO("[CommandCallBack] set distance :%f",Command->distance); m_dTargetDis = Command->distance; } UpdateOriginPosition(); ROS_INFO("[CommandCallBack] set speed :%f",Command->speed); m_dTargetSpeedTemp = Command->speed; m_bIsMotorPause = false; if(m_nMode == PP) { SetMotorSpeed(abs(m_dTargetSpeedTemp)); } if(m_dTargetSpeedTemp > 0) { ForwardMotion(); } else { BackwardMotion(); } m_nControlMode = Command->cmd == "run" ? TASK : ALARM; } } else if(Command->cmd == "stop") { StopMotion(); timespec CurrentTime, LastTime; long pollInterval; timespec_get(&LastTime, TIME_UTC); while(m_bMotorRunning) { timespec_get(&CurrentTime, TIME_UTC); pollInterval=(CurrentTime.tv_sec - LastTime.tv_sec) + (CurrentTime.tv_nsec - LastTime.tv_nsec)/1000000000; if(pollInterval > 15) { Ack.ack = "failed"; Ack.data = "timeout"; break; } this_thread::sleep_for(std::chrono::seconds(1)); } m_nControlMode = IDLE; } else if(Command->cmd == "update_origin") { if(Command->move_type == UPDATE_ORIGIN) { m_nRobotOriginPulseOne = m_nRobotCurrentPulseOne; m_nRobotOriginPulseTwo = m_nRobotCurrentPulseTwo; } else if(Command->move_type == UPDATE_ORIGIN_PLUS) { actual_tire_diameter = forward_diameter; m_nRobotOriginPulseOne = m_nRobotCurrentPulseOne + m_MotorTwo.TransMileToPulse(Command->distance); m_nRobotOriginPulseOne = m_nRobotCurrentPulseTwo + m_MotorTwo.TransMileToPulse(Command->distance); } else if(Command->move_type == UPDATE_ORIGIN_SUB) { actual_tire_diameter = forward_diameter; m_nRobotOriginPulseOne = m_nRobotCurrentPulseOne - m_MotorTwo.TransMileToPulse(Command->distance); m_nRobotOriginPulseTwo = m_nRobotCurrentPulseTwo - m_MotorTwo.TransMileToPulse(Command->distance); } } //added by btrmg for adjust mileage 2020.01.07 else if(Command->cmd =="adjust_mileage") { ROS_INFO("[CommandCallBack] adjust expected mileage:%d and actual mileage:%d",Command->expected_mileage,Command->actual_mileage); if(0 != Command->actual_mileage && 0 != Command->expected_mileage) { if(Command->expected_mileage < 1000) { Ack.data = "refused, the distance is less than 1000mm"; ROS_WARN("[CommandCallBack] adjust_mileage refused, the distance:%dmm is less than 1000mm", Command->expected_mileage); } else if(Command->speed > 0) { double dForwardDiameter = forward_diameter/Command->expected_mileage*Command->actual_mileage; if(abs(dForwardDiameter - forward_diameter) > m_dAdjustLimit) { ROS_WARN("[CommandCallBack] adjust_mileage over limit, forward_diameter:%f, dForwardDiameter:%f",forward_diameter,dForwardDiameter); Ack.data = "refused, over limit"; } else { forward_diameter = dForwardDiameter; string str_diameter; str_diameter = std::to_string(forward_diameter); updata_XML("forward_diameter",str_diameter); ROS_DEBUG("[CommandCallBack] adjusted forward diameter is:%f",forward_diameter); } } else if(Command->speed < 0) { double dBackDiameter = back_diameter/Command->expected_mileage*Command->actual_mileage; if(abs(dBackDiameter - back_diameter) > m_dAdjustLimit) { ROS_WARN("[CommandCallBack] adjust_mileage over limit, back_diameter:%f, dBackDiameter:%f",back_diameter,dBackDiameter); Ack.data = "refused, over limit"; } else { back_diameter = dBackDiameter; string str_diameter; str_diameter = std::to_string(back_diameter); updata_XML("back_diameter",str_diameter); ROS_DEBUG("[CommandCallBack] adjusted back diameter is :%f",back_diameter); } } } } //added end else { Ack.ack = "failed"; Ack.data = "unknown command"; ROS_INFO("[CommandCallBack] unknown command: %s",Command->cmd.c_str()); } m_MoveAckPublisher.publish(Ack); if((Command->cmd == "run" || Command->cmd == "alarm_run") && Command->distance < 0.001) { PublishStatus(TASK_DONE); } ROS_DEBUG("[CommandCallBack] cdm:%s, ack:%s, data:%s", Command->cmd.c_str(), Ack.ack.c_str(), Ack.data.c_str()); } /************************************************* Function: CTrackRobot::OdomCallBack Description: 滤波后的历程消息 Input: nav_msgs::Odometry::ConstPtr &OdomMsg , 滤波后的里程消息 Output: void Others: void **************************************************/ void CTrackRobot::OdomCallBack(const nav_msgs::Odometry::ConstPtr &OdomMsg) { m_dCurrentOdom = OdomMsg->pose.pose.position.x; m_dDistance = m_dCurrentOdom - m_dOdom; if(m_nDirection == BACKWARD) { m_dDistance = m_dOdom - m_dCurrentOdom; } if(m_bIsUpdateOrigin) { m_dOdom = m_dCurrentOdom; m_bIsUpdateOrigin = false; } } /************************************************* Function: CTrackRobot::BatteryServiceFunc Description: 电池状态查询服务端 Input: custom_msgs::BatteryStatus::Request &Req 请求 custom_msgs::BatteryStatus::Response &Resp 响应 Output: true or false Others: void **************************************************/ bool CTrackRobot::BatteryServiceFunc(custom_msgs::BatteryStatus::Request &Req, custom_msgs::BatteryStatus::Response &Resp) { Resp.response = Req.request + "_response"; SendCanFrame(0x16, 8, 0x16BB00000000007E); timespec StartTime; timespec_get(&StartTime, TIME_UTC); this_thread::sleep_for(std::chrono::milliseconds(20)); while(ros::ok()) { //此处加锁是规避多个client高并发请求时引入的数据混乱 std::unique_lock<std::mutex> lock(m_ButteryStatusMutex); int nButteryPower = m_nBatteryPower; lock.unlock(); if(nButteryPower) { Resp.data = "{"; Resp.data += "\"battery_power\":" + to_string(nButteryPower); Resp.data += "}"; std::unique_lock<std::mutex> locker(m_ButteryStatusMutex); m_nBatteryPower = 0; locker.unlock(); return true; } else { timespec CurrentTime; timespec_get(&CurrentTime, TIME_UTC); long pollInterval=((CurrentTime.tv_sec - StartTime.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - StartTime.tv_nsec)) / 1000000; if(pollInterval > 1000) { Resp.data = "timeout error!"; return true; } SendCanFrame(0x16, 8, 0x16BB00000000007E); this_thread::sleep_for(std::chrono::milliseconds(20)); } } } /************************************************* Function: CTrackRobot::CurrentPosServiceFunc Description: 获取当前位置信息 Input: custom_msgs::CurrentPosition::Request &Req 请求 custom_msgs::CurrentPosition::Response &Resp 响应 Output: true or false Others: void **************************************************/ bool CTrackRobot::CurrentPosServiceFunc(custom_msgs::CurrentPosition::Request &Req, custom_msgs::CurrentPosition::Response &Resp) { Resp.response = Req.request + "_response"; std::unique_lock<std::mutex> locker(m_CurrentPosScanBufMutex); if(!m_bGetAxesData && !m_dCurrentPosScanBuf.empty()) { m_dCurrentPosScanBuf.clear(); // ROS_DEBUG("[CurrentPosServiceFunc]m_dCurrentPosScanBuf.clear()"); } locker.unlock(); m_bGetAxesData = true; std::deque<sScanBuf> dScanBufTemp; timespec StartTime; timespec_get(&StartTime, TIME_UTC); this_thread::sleep_for(std::chrono::milliseconds(20)); while(ros::ok()) { dScanBufTemp.clear(); std::unique_lock<std::mutex> lock(m_CurrentPosScanBufMutex); dScanBufTemp.assign(m_dCurrentPosScanBuf.begin(), m_dCurrentPosScanBuf.end()); lock.unlock(); if(dScanBufTemp.size() >= CURRENT_DATA_TOTAL_NUM) { m_bGetAxesData = false; break; } else { timespec CurrentTime; timespec_get(&CurrentTime, TIME_UTC); long pollInterval=((CurrentTime.tv_sec - StartTime.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - StartTime.tv_nsec)) / 1000000; if(pollInterval > 1000) { ROS_ERROR("[CurrentPosServiceFunc] timeout error"); Resp.data = "timeout error!"; m_bGetAxesData = false; return true; } this_thread::sleep_for(std::chrono::milliseconds(20)); } } //二维数组数据 float fScanMatrix[CURRENT_DATA_TOTAL_NUM][LASER_MAX_DATA_LEN]={0}; sScanBuf SumRanges; memset(&SumRanges, 0 , sizeof(sScanBuf)); //将激光数据copy至二维数组当中 for(int row=0; row < CURRENT_DATA_TOTAL_NUM; row++) { sScanBuf sBufTemp = dScanBufTemp[row]; for(int column=0; column < LASER_MAX_DATA_LEN; column++) { fScanMatrix[row][column] = sBufTemp.fRanges[column]; } SumRanges.x = sBufTemp.x; } //剔除同一角度位置的有0出现的数据,将没有0出现的数据累计求和 for(int column=0; column<LASER_MAX_DATA_LEN; column++) { for(int row=0; row<CURRENT_DATA_TOTAL_NUM; row++) { if(fScanMatrix[row][column] == 0) { SumRanges.fRanges[column] = 0; break; } else { SumRanges.fRanges[column] += fScanMatrix[row][column]; } } } //求均值 for(int i=0; i<LASER_MAX_DATA_LEN; i++) { SumRanges.fRanges[i] = SumRanges.fRanges[i]/CURRENT_DATA_TOTAL_NUM; } SumRanges.ullRangeSize = LASER_MAX_DATA_LEN; sPositionData desPositionData = {0}; int nDataLen = 0; nDataLen = TransPosBufData(desPositionData, SumRanges, true); Resp.x = desPositionData.x; vector<float> filter_y; vector<float> filter_z; filter_y.resize((unsigned long)nDataLen); filter_z.resize((unsigned long)nDataLen); for(int i = 0; i < nDataLen; i++) { filter_y[i] = desPositionData.y[i]; filter_z[i] = desPositionData.z[i]; } FilterPoints(filter_y,filter_z,Resp.y,Resp.z); /* Resp.y.resize((unsigned long)nDataLen); Resp.z.resize((unsigned long)nDataLen); for(int i = 0; i < nDataLen; i++) { Resp.y[i] = desPositionData.y[i]; Resp.z[i] = desPositionData.z[i]; } */ Resp.data = "succeed"; return true; } /************************************************* Function: CTrackRobot::ImuCallBack Description: 激光节点消息回调函数,按照激光的回调频率对里程x做平均差值处理, 并把处理后的x及激光原始数据缓存到队列当中 Input: void Output: void Others: void **************************************************/ void CTrackRobot::ImuCallBack(const sensor_msgs::Imu::ConstPtr &ImuData) { double dRoll, dPitch, dYaw; tf::Matrix3x3(tf::Quaternion(ImuData->orientation.x, ImuData->orientation.y, ImuData->orientation.z, ImuData->orientation.w)).getRPY(dRoll, dPitch, dYaw); // ROS_INFO("[ImuCallBack] dRoll=%f, dPitch=%f, dYaw=%f",dRoll/M_PI*180, dPitch/M_PI*180, dYaw/M_PI*180); double dPitchAngle = 180*dPitch/M_PI; m_dImuPitchDeque.push_back(dPitchAngle); if(m_dImuPitchDeque.size() > m_nImuBufSize) m_dImuPitchDeque.pop_front(); dPitchAngle = 0.0; for(auto i : m_dImuPitchDeque) { dPitchAngle += i; } m_dPitchAngle = dPitchAngle / m_dImuPitchDeque.size(); m_dRealScanTitle = m_dScanTitle - m_dPitchAngle; m_dInitialAngle = 180.0-m_dRealScanTitle-(90.0-LASER_ANGLE_RANGE/2)-LASER_EXCISION_ANGLE; } /************************************************* Function: CTrackRobot::ScanCallBack Description: 激光节点消息回调函数,按照激光的回调频率对里程x做平均差值处理, 并把处理后的x及激光原始数据缓存到队列当中 Input: void Output: void Others: void **************************************************/ void CTrackRobot::ScanThreadFunc() { asr_sick_lms_400 lms_ = asr_sick_lms_400 ("192.168.1.100", 2111, 0); // Attempt to connect to the laser unit if (lms_.Connect () != 0) { ROS_ERROR("[ScanThreadFunc] Connecting to SICK LMS4000 on 192.168.1.100:2111 filed"); } ROS_INFO ("[ScanThreadFunc] Connecting to SICK LMS4000 on 192.168.1.100:2111 succeed"); // Stop the measurement process (in case it's running from another instance) lms_.StopMeasurement(); // Login to userlevel 4 if (lms_.SetUserLevel (4, "81BE23AA") != 0) { ROS_ERROR("[ScanThreadFunc] Unable to change user level to 'Service' using "); } else { ROS_INFO("[ScanThreadFunc]Set User Level to 'Service'"); } // Start Continous measurements lms_.StartMeasurement (true); lms_.sMNRUN (); lms_.LMDscandata (1); ROS_INFO("[ScanThreadFunc]start read measurement data"); while (ros::ok ()) { sensor_msgs::LaserScan scanData = lms_.ReadMeasurement(); //以下情况直接返回: // 前端没有获取当前数据 并且 ①机器人停止状态 ②机器人做返程运动并且不记录返程数据 ③机器人控制模式为手柄模式 ④ if(!m_bGetAxesData) { // if(!m_bMotorRunning || !m_bPubPosData) if(!m_bPubPosData) { if(!m_dScanSrcBufDeque.empty()) { std::unique_lock<std::mutex> lock(m_ScanSrcBufMutex); m_dScanSrcBufDeque.clear(); lock.unlock(); } // this_thread::sleep_for(std::chrono::milliseconds(10)); continue; } } // sensor_msgs::LaserScan scanData = lms_.LMDscandataOneTimes(); if (scanData.ranges.empty()) continue; double dDistance, d_x; ULL ullRangeSize = scanData.ranges.size(); sScanBuf ScanBuf; memset(&ScanBuf, 0 , sizeof(sScanBuf)); memcpy(&(ScanBuf.fRanges[0]), &(scanData.ranges[0]), sizeof(ScanBuf.fRanges[0])*ullRangeSize); dDistance = m_dDistance; ScanBuf.x = dDistance; ScanBuf.ullRangeSize = ullRangeSize; // ROS_INFO("[ScanThreadFunc] get scan data"); //前台获取当前位置数据的service用 if(m_bGetAxesData) { //按键获取当前位置信息(x y z) std::unique_lock<std::mutex> locker(m_CurrentPosScanBufMutex); m_dCurrentPosScanBuf.push_back(ScanBuf); if(m_dCurrentPosScanBuf.size() > CURRENT_DATA_TOTAL_NUM) { m_dCurrentPosScanBuf.pop_front(); } locker.unlock(); if(!m_bMotorRunning) continue; } m_dScanSrcBufDeque.push_back(ScanBuf); //涉及里程的平均插值,第一个位置数据单独处理(直接保存) if(m_dDisTemp == 0xFFFFFFFFFFFFFFFF) { std::unique_lock<std::mutex> lock(m_ScanManBufMutex); m_dScanManBufDeque.push_back(ScanBuf); lock.unlock(); m_ScanBufCondition.notify_one(); m_dScanSrcBufDeque.clear(); m_dDisTemp = dDistance; continue; } //对x做平均插值 if(abs(dDistance - m_dDisTemp) > 0.0001) { ULL ullRangeCount = m_dScanSrcBufDeque.size(); // ROS_DEBUG("dDistance=%f,m_dDisTemp=%f,ullRangeCount=%lld",dDistance,m_dDisTemp,ullRangeCount); std::unique_lock<std::mutex> lock(m_ScanManBufMutex); for(int i=0; i<ullRangeCount; i++) { sScanBuf ScanBufTemp = m_dScanSrcBufDeque[i]; if(ullRangeCount == 1) { d_x = dDistance; } else { d_x = m_dDisTemp + ((dDistance-m_dDisTemp)/ullRangeCount)*(i+1); } if(abs(d_x - m_dDisTemp) < 0.0001) continue; ScanBufTemp.x = d_x; // ROS_DEBUG("d_x=%f",d_x); m_dScanManBufDeque.push_back(ScanBufTemp); } lock.unlock(); m_dScanSrcBufDeque.clear(); m_ScanBufCondition.notify_one(); m_dDisTemp = dDistance; } } lms_.StopMeasurement (); } /************************************************* Function: CTrackRobot::ManageScanDataThreadFunc Description:数据过滤线程功能函数,保证两组数据中x的差值大于0.0001米 Input: void Output: void Others: void **************************************************/ void CTrackRobot::ManageScanDataThreadFunc() { unsigned long ulSize; std::deque<sScanBuf> sSCanBufDeque; while(ros::ok()) { std::unique_lock<std::mutex> lock(m_ScanManBufMutex); while(m_dScanManBufDeque.empty()) { m_ScanBufCondition.wait(lock); } sSCanBufDeque.assign(m_dScanManBufDeque.begin(), m_dScanManBufDeque.end()); m_dScanManBufDeque.clear(); lock.unlock(); if(!m_bMotorRunning) { sSCanBufDeque.clear(); continue; } ulSize = sSCanBufDeque.size(); double xTemp = 0; sPositionData positionData = {0}; int nDataLen = 0; for (int i = 0; i < ulSize; i++) { sScanBuf ScanBufTemp = sSCanBufDeque[i]; if(i == 0 || (abs(ScanBufTemp.x - xTemp) >= 0.0001)) { xTemp = ScanBufTemp.x; if(xTemp <= m_dTargetDis && xTemp >= 0) { nDataLen = TransPosBufData(positionData, ScanBufTemp); OutputPosData(positionData, nDataLen); } } } sSCanBufDeque.clear(); } } /************************************************* Function: CTrackRobot::ManagePosBufData Description:将激光原始数据转换成对应的侵限值y以及高度z Input: sPositionData &desPosData 存放处理后的数据, x y[] z[] sScanBuf srcBufData 激光原始buf数据 Output: int, y z 数据有效值的数据长度 Others: void **************************************************/ int CTrackRobot::TransPosBufData(sPositionData &desPosData, const sScanBuf &srcBufData, bool bAbsolute) { double d_y, d_z; int nValidSize = 0; //里程x值,侵限点定位情况为绝对定位,所以需要单独计算x值。 if(!bAbsolute && m_nControlMode != ALARM) { desPosData.x = srcBufData.x; if(m_nDirection == BACKWARD) { desPosData.x = m_dTargetDis - desPosData.x; } } else { double dDistance; int nRobotDisplacement; if(m_nMode == PP) { nRobotDisplacement = m_nRobotCurrentPulseTwo - m_nRobotOriginPulseTwo; } else { nRobotDisplacement = (m_nRobotCurrentPulseOne - m_nRobotOriginPulseOne)/2 + (m_nRobotCurrentPulseTwo - m_nRobotOriginPulseTwo)/2; } dDistance = (nRobotDisplacement/(PULSES_OF_MOTOR_ONE_TURN*MOTOR_TRANSMISSION))*M_PI*forward_diameter/1000; if(!m_bForwardRelocation) { // ROS_DEBUG("[TransPosBufData] m_dRealDis:%f, dDistance:%f", m_dRealDis, dDistance); dDistance = m_dRealDis + dDistance; } desPosData.x = dDistance; } double dInitialAngle = m_dInitialAngle, dPitchAngle = -m_dPitchAngle; double d_dy = HALF_OF_TRACK_DISTANCE - LASER_TRACK_POINT_DISTANCE*cos((LASER_TRACK_POINT_ANGLE - dPitchAngle)*M_PI/180); double d_dz = LASER_TRACK_POINT_DISTANCE*sin((LASER_TRACK_POINT_ANGLE - dPitchAngle)*M_PI/180); // ROS_DEBUG("[dInitialAngle]ddy=%f,ddz=%f",d_dy, d_dz); // ROS_INFO("[dInitialAngle]dInitialAngle=%f",dInitialAngle); for(int i=0; i< srcBufData.ullRangeSize; i++) { if(srcBufData.fRanges[i] < 0.1) continue; float fCalcRadian = (dInitialAngle-LASER_ANGLE_INCREMENT*i)*M_PI/180; d_y = srcBufData.fRanges[i]*sin(fCalcRadian); d_y += d_dy; d_z = srcBufData.fRanges[i]*cos(fCalcRadian); d_z += d_dz; if(d_z < 0.35 || d_y < LASER_TRACK_CENTER_DISTANCE + 0.5) continue; desPosData.y[nValidSize] = (float)d_y; desPosData.z[nValidSize] = (float)d_z; if(1 == m_nRecordLaser) { desPosData.laser_dis[nValidSize] = srcBufData.fRanges[i]; desPosData.laser_angle[nValidSize] = fCalcRadian; } nValidSize++; } return nValidSize; } /************************************************* Function: CTrackRobot::OutputPosData Description: 发布位置数据:x, y[], z[], 并保存至文件大当中 Input: sPositionData &desPosData , 位置数据结构体 int nDataLen, y z数组对应的有效数据的长度 int nWriteDataToFile , 是否将位置数据写入到文件当中 Output: void Others: void **************************************************/ void CTrackRobot::OutputPosData(sPositionData &desPosData, int nDataLen) { custom_msgs::TrainRobotPosition pos; pos.y.resize((unsigned long)nDataLen); pos.z.resize((unsigned long)nDataLen); if(1 == m_nRecordLaser) { pos.laser_dis.resize((unsigned long)nDataLen); pos.laser_angle.resize((unsigned long)nDataLen); } pos.x = desPosData.x; for(int i = 0; i < nDataLen; i++) { pos.y[i] = desPosData.y[i]; pos.z[i] = desPosData.z[i]; if(1 == m_nRecordLaser) { pos.laser_dis[i] = desPosData.laser_dis[i]; pos.laser_angle[i] = desPosData.laser_angle[i]; } } pos.trans_id = 0; pos.header.stamp = ros::Time::now(); pos.header.frame_id = "position"; m_PositionPublisher.publish(pos); } /************************************************* Function: CTrackRobot::UpdateOriginPosition Description:更新机器人原点位置值 Input: void Output: void Others: void **************************************************/ void CTrackRobot::UpdateOriginPosition() { //获取run指令下达时的位置值,并将其置为里程原点值 SendGetMotorInfoCmd(); this_thread::sleep_for(std::chrono::milliseconds(20)); m_DynamicOrigin.nMotorOnePos = m_CurrentMotorPos.nMotorOnePos; m_DynamicOrigin.nMotorTwoPos = m_CurrentMotorPos.nMotorTwoPos; if(m_bManagerUpdateOrigin) { m_bManagerUpdateOrigin = false; m_nRobotOriginPulseOne = m_nRobotCurrentPulseOne; m_nRobotOriginPulseTwo = m_nRobotCurrentPulseTwo; } m_dDistance = 0.0; m_bIsUpdateOrigin = true; ROS_DEBUG("[UpdateOriginPosition] m_DynamicOrigin.nMotorOnePos=%d,m_DynamicOrigin.nMotorTwoPos=%d",m_DynamicOrigin.nMotorOnePos,m_DynamicOrigin.nMotorTwoPos); } /************************************************* Function: CTrackRobot::WaitForMotionStop Description: 等待机器人运动停止 Input: int nTimeOutLen, 超时时长 Output: true or false Others: void **************************************************/ bool CTrackRobot::WaitForMotionStop(int nTimeOutLen) { timespec StartTime, CurrentTime; long pollInterval; timespec_get(&StartTime, TIME_UTC); while(m_bMotorRunning) { timespec_get(&CurrentTime, TIME_UTC); pollInterval=((CurrentTime.tv_sec - StartTime.tv_sec)\ + (CurrentTime.tv_nsec - StartTime.tv_nsec)) / 1000000000; if(pollInterval > nTimeOutLen) { ROS_ERROR("[WaitMotionDone] wait for done timeout error,pollInterval=%ld",pollInterval); return false; } this_thread::sleep_for(std::chrono::milliseconds(1000)); } return true; } /************************************************* Function: CTrackRobot::CheckJoyStatus Description:检测手柄消息是否发送结束,检测伺服是否上报报文,伺服重启后给伺服初始化 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CheckJoyStatus() { timespec CurrentTime; long pollInterval; //虚拟手柄控制超时检查 if(m_nControlMode == JOY) { std::unique_lock<std::mutex> lock(m_JoyTimeOutCheckMutex); if(m_tTimeOfLastJoyCmd.tv_sec != 0 && m_tTimeOfLastJoyCmd.tv_nsec != 0) { timespec_get(&CurrentTime, TIME_UTC); pollInterval=((CurrentTime.tv_sec - m_tTimeOfLastJoyCmd.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - m_tTimeOfLastJoyCmd.tv_nsec)) / 1000000; if(pollInterval > m_nJoyCtrlTimeoutMSec) { m_tTimeOfLastJoyCmd.tv_sec = 0; m_tTimeOfLastJoyCmd.tv_nsec = 0; ROS_DEBUG("[CheckJoyStatus] joy time out, pollInterval=%ld",pollInterval); if (abs(m_dTargetSpeed) <= 0.2) { QuickStop(); } else { StopMotion(true); } m_nControlMode = IDLE; } } lock.unlock(); } } /************************************************* Function: CTrackRobot::CheckCanStatus Description:检测手柄消息是否发送结束,检测伺服是否上报报文,伺服重启后给伺服初始化 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CheckCanStatus() { timespec CurrentTime; long pollInterval; //伺服报文反馈超时监测 if(m_bIsMotorInit) { if(m_tMotorOneLastRespTime.tv_sec != 0 && m_tMotorOneLastRespTime.tv_nsec != 0) { timespec_get(&CurrentTime, TIME_UTC); pollInterval=((CurrentTime.tv_sec - m_tMotorOneLastRespTime.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - m_tMotorOneLastRespTime.tv_nsec)) / 1000000; if(pollInterval > 2000) { m_tMotorOneLastRespTime.tv_sec = 0; m_tMotorOneLastRespTime.tv_nsec = 0; m_bMotorRunning = false; m_bIsMotorInit = false; StopMotion(); ROS_INFO("[CheckJoyStatus] motor one response timeout,pollInterval=%ld",pollInterval); m_sMotorOneStatus = "TimeOutErr"; } } if(m_tMotorTwoLastRespTime.tv_sec != 0 && m_tMotorTwoLastRespTime.tv_nsec != 0) { timespec_get(&CurrentTime, TIME_UTC); pollInterval=((CurrentTime.tv_sec - m_tMotorTwoLastRespTime.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - m_tMotorTwoLastRespTime.tv_nsec)) / 1000000; if(pollInterval > 2000) { m_tMotorTwoLastRespTime.tv_sec = 0; m_tMotorTwoLastRespTime.tv_nsec = 0; m_bMotorRunning = false; m_bIsMotorInit = false; StopMotion(); ROS_INFO("[CheckJoyStatus] motor two response timeout,pollInterval=%ld",pollInterval); m_sMotorTwoStatus = "TimeOutErr"; } } } } /************************************************* Function: CTrackRobot::CheckJoyStatus Description:检测手柄消息是否发送结束,检测伺服是否上报报文,伺服重启后给伺服初始化 Input: void Output: void Others: void **************************************************/ void CTrackRobot::CheckEStopStatus() { bool bEStopStatus = m_bIsEStopButtonPressed; //监测急停是否按下 m_bIsEStopButtonPressed = (GpioControl(GET_EMERGENCY_STOP_BUTTON_STATUS) == 0); //急停由按下切换至放开时进行电机伺服初始化 if(m_bIsEStopButtonPressed != bEStopStatus && bEStopStatus) { ROS_DEBUG("[CheckEStopStatus] E-Stop is up, call MotorServoInit() "); MotorServoInit(); } } /************************************************* Function: CTrackRobot::CheckStatusThreadFunc Description:检测手柄消息是否发送结束,检测伺服是否上报报文,伺服重启后给伺服初始化 Input: void Output: void Others: void **************************************************/ void CTrackRobot::HeartBeatThreadFunc() { ROS_INFO("[HeartBeatThreadFunc] start"); custom_msgs::TrainRobotHeartBeat heartBeatMsg; heartBeatMsg.sender = "track_robot"; heartBeatMsg.temperature.resize(3); while(ros::ok()) { SendCmdOfGetBatteryInfo(); if(m_bIsMotorInit) { SendCmdOfGetMotorErrorCode(); SendHeartBeatCanFrame(); } this_thread::sleep_for(std::chrono::milliseconds(20)); heartBeatMsg.status = 0x00; heartBeatMsg.status |= m_bIsEStopButtonPressed ? 0x01:0x00; heartBeatMsg.status |= m_nBatteryStatus != 0 ? 0x02:0x00; heartBeatMsg.status |= !m_bIsEStopButtonPressed && (m_sMotorOneStatus != "normal" || m_sMotorTwoStatus != "normal") ? 0x04:0x00; heartBeatMsg.status |= (m_nBatteryCharge == 1) ? 0x08:0x00; heartBeatMsg.velocity_x = m_dCurrentSpeed; double dDistance; int nRobotDisplacement; if(m_nMode == PP) { nRobotDisplacement = m_nRobotCurrentPulseTwo - m_nRobotOriginPulseTwo; } else { nRobotDisplacement = (m_nRobotCurrentPulseOne - m_nRobotOriginPulseOne)/2 + (m_nRobotCurrentPulseTwo - m_nRobotOriginPulseTwo)/2; } dDistance = (nRobotDisplacement/(PULSES_OF_MOTOR_ONE_TURN*MOTOR_TRANSMISSION))*M_PI*forward_diameter/1000; if(!m_bForwardRelocation) { dDistance = m_dRealDis + dDistance; } heartBeatMsg.position_x = dDistance; heartBeatMsg.light_status = m_nLightStatus; heartBeatMsg.battery_voltage = (m_nBatteryVoltage/10.0); heartBeatMsg.battery_quantity = m_nBatteryPower; heartBeatMsg.battery_status = m_nBatteryStatus; heartBeatMsg.motor_status = "normal"; if(m_sMotorOneStatus != "normal" && !m_bIsEStopButtonPressed) heartBeatMsg.motor_status = m_sMotorOneStatus; if(m_sMotorTwoStatus != "normal" && !m_bIsEStopButtonPressed) heartBeatMsg.motor_status += m_sMotorTwoStatus; heartBeatMsg.temperature[0] = m_nBatteryTemp; heartBeatMsg.temperature[1] = m_nMotorOneTemp; heartBeatMsg.temperature[2] = m_nMotorTwoTemp; heartBeatMsg.pitch_angle = m_dPitchAngle; heartBeatMsg.header.stamp = ros::Time::now(); m_HeartBeatPublisher.publish(heartBeatMsg); this_thread::sleep_for(std::chrono::milliseconds(980)); } } /************************************************* Function: CTrackRobot::RestartMotorServo Description:重启伺服驱动器 Input: void Output: int Others: void **************************************************/ int CTrackRobot::RestartMotorServo() { if(GpioControl(POWER_OFF) == -1) { ROS_ERROR("[RestartMotorServo] turn off power electric failed"); return -1; } this_thread::sleep_for(std::chrono::milliseconds(500)); if(GpioControl(LOGIC_OFF) == -1) { ROS_ERROR("[RestartMotorServo] turn off logic electric failed"); return -1; } this_thread::sleep_for(std::chrono::milliseconds(1000)); if(GpioControl(LOGIC_ON) == -1) { ROS_ERROR("[RestartMotorServo] turn on logic electric failed"); return -1; } this_thread::sleep_for(std::chrono::milliseconds(500)); if(GpioControl(POWER_ON) == -1) { ROS_ERROR("[RestartMotorServo] turn on power electric failed"); return -1; } m_sMotorOneStatus = "normal"; m_sMotorTwoStatus = "normal"; return 1; } /************************************************* Function: CTrackRobot::RestartMotorServo Description:重启伺服驱动器 Input: void Output: void Others: GPIO名称 GPIO功能定义 逻辑 输入DI: GPIO1_A0 急停按钮信号输入 急停复位-1;急停按下-0 GPIO1_D0 备用输入(24V) 输出DO: GPIO1_A1 驱动器逻辑供电 1-逻辑供电;0-逻辑断电 GPIO1_A3 灯带B输出 1-蓝色亮;0-蓝色熄灭 GPIO1_A4 灯带G输出 1-绿色亮;0-绿色熄灭 GPIO1_C6 灯带R输出 1-红色亮;0-红色熄灭 GPIO1_C7 驱动器动力供电 1-动力供电;0-动力断电 GPIO1_C2 备用输出(24V) **************************************************/ int CTrackRobot::GpioControl(int nCtrlWord) { CGpioControl GpioCtrl; string sDirection = "out"; int nGpioNum = 0; int nGpioValue = 0; if(nCtrlWord == GET_EMERGENCY_STOP_BUTTON_STATUS) { sDirection = "in"; nGpioNum = GPIO1_A0; GpioCtrl.SetPinAndDirection(nGpioNum, sDirection); return GpioCtrl.GetGpioValue(); } switch(nCtrlWord) { case LOGIC_ON: nGpioValue = HIGH; nGpioNum = GPIO1_A1; break; case LOGIC_OFF: nGpioValue = LOW; nGpioNum = GPIO1_A1; break; case R_LIGHT_ON: nGpioValue = HIGH; nGpioNum = GPIO1_C6; m_nLightStatus = 0; break; case R_LIGHT_OFF: nGpioValue = LOW; nGpioNum = GPIO1_C6; break; case G_LIGHT_ON: nGpioValue = HIGH; nGpioNum = GPIO1_A4; m_nLightStatus = 1; break; case G_LIGHT_OFF: nGpioValue = LOW; nGpioNum = GPIO1_A4; break; case B_LIGHT_ON: nGpioValue = HIGH; nGpioNum = GPIO1_A3; m_nLightStatus = 2; break; case B_LIGHT_OFF: nGpioValue = LOW; nGpioNum = GPIO1_A3; break; case POWER_ON: nGpioValue = HIGH; nGpioNum = GPIO1_C7; break; case POWER_OFF: nGpioValue = LOW; nGpioNum = GPIO1_C7; break; default: ROS_WARN("[GpioControl] ctrl word error"); return -1; } timespec StartTime; timespec_get(&StartTime, TIME_UTC); GpioCtrl.SetPinAndDirection(nGpioNum, sDirection); while(GpioCtrl.GetGpioValue() != nGpioValue) { GpioCtrl.SetGpioValue(HIGH); this_thread::sleep_for(std::chrono::milliseconds(10)); timespec CurrentTime; timespec_get(&CurrentTime, TIME_UTC); long pollInterval=((CurrentTime.tv_sec - StartTime.tv_sec) * 1000000000 \ + (CurrentTime.tv_nsec - StartTime.tv_nsec)) / 1000000; if(pollInterval > 100) { ROS_ERROR("[GpioControl] set value timeout error"); return -1; } } return 1; } CTrackRobot::~CTrackRobot() { ROS_DEBUG("[CTrackRobot][~CTrackRobot] begin..."); UsbCan.Close(); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); m_pCANReceiveThread->join(); #if USE_CAN2_RT m_pCAN2ReceiveThread->join(); #endif m_pCANManageThread->join(); m_pCANSendThread->join(); m_pControlThread->join(); m_pAutoRunThread->join(); m_pPositionFilterThread->join(); m_pCheckStatusThread->join(); m_pHeartBeatThread->join(); m_pScanThread->join(); delete m_pCANReceiveThread; #if USE_CAN2_RT delete m_pCAN2ReceiveThread; #endif delete m_pCANManageThread; delete m_pCANSendThread; delete m_pControlThread; delete m_pAutoRunThread; delete m_pPositionFilterThread; delete m_pCheckStatusThread; delete m_pHeartBeatThread; delete m_pScanThread; } /************************************************* Function: CTrackRobot::updata_XML Description:修改配置文件中的轮子直径 Input: path 配置文件名 updataposion,从外到更新节点的路径 attributes,更新元素 Output: 执行结果 **************************************************/ int CTrackRobot::updata_XML(string paramName, string paramValue) { XMLDocument doc; char buf[100]; getcwd(buf,100); strcat(buf,"/../catkin_ws/src/track_robot/launch/track_robot.launch"); const char* path_updata = buf; const char* paranName_updata = paramName.c_str(); const char* paramValue_updata = paramValue.c_str(); if (doc.LoadFile(path_updata)) { ROS_DEBUG("the launch file is:%s",buf); return 0; } XMLElement *current_root = doc.RootElement(); XMLElement *nodeName = current_root->FirstChildElement("node"); if(NULL==nodeName) return 0; XMLElement *paramNode = nodeName->FirstChildElement("param"); while (paramNode!=NULL) { string str = paramNode->Attribute("name"); if(str.compare(paranName_updata)==0) { paramNode->SetAttribute("value",paramValue_updata); break; } paramNode = paramNode->NextSiblingElement(); } doc.SaveFile(path_updata, false); return 1; } //added by btrmg for filter 2020.04.13 /*********************************************************** Function: CTrackRobot::FilterPoints Description: 根据输入直线的y,z值,输出过滤后的y,z数组 Input: y[] z[] Output: y[] z[] Others: void ************************************************************/ void CTrackRobot::FilterPoints(vector<float> in_y,vector<float > in_z,vector<double> &out_y,vector<double > &out_z) { pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); cloud->width = in_y.size(); cloud->height = 1; cloud->points.resize(cloud->width*cloud->height); string re_str; // int point_number = cloud->points.size(); // ROS_INFO("the point size is:%d",point_number); for (size_t i = 0; i < cloud->points.size(); i++) { cloud->points[i].x = 1.0; cloud->points[i].y = in_y[i]; cloud->points[i].z = in_z[i]; } pcl::PointCloud<pcl::PointXYZ>::Ptr FirstFilterCloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::RadiusOutlierRemoval<pcl::PointXYZ> radiusoutlier; //创建滤波器 radiusoutlier.setInputCloud(cloud); //设置输入点云 radiusoutlier.setRadiusSearch(m_d1stFilterRadius); //设置半径为5cm的范围内找临近点 radiusoutlier.setMinNeighborsInRadius(m_n1stFilterNum); //设置查询点的邻域点集数小于5的删除 radiusoutlier.filter(*FirstFilterCloud); // if(cloud_after_Radius->points.size() != cloud->points.size()) // { // int filtered_point = cloud->points.size()-cloud_after_Radius->points.size(); // ROS_INFO("filter %d points",filtered_point); // } pcl::PointCloud<pcl::PointXYZ>::Ptr SecondFilterCloud(new pcl::PointCloud<pcl::PointXYZ>); radiusoutlier.setInputCloud(FirstFilterCloud); //设置输入点云 radiusoutlier.setRadiusSearch(m_d2ndFilterRadius); //设置半径为1cm的范围内找临近点 radiusoutlier.setMinNeighborsInRadius(m_n2ndFilterNum); //设置查询点的邻域点集数小于3的删除 radiusoutlier.filter(*SecondFilterCloud); out_y.resize(SecondFilterCloud->points.size()); out_z.resize(SecondFilterCloud->points.size()); for(size_t k=0;k<SecondFilterCloud->points.size();k++) { out_y[k] = SecondFilterCloud->points[k].y; out_z[k] = SecondFilterCloud->points[k].z; } }
[ "zhoujingang.wootion_ltd@wootion.com" ]
zhoujingang.wootion_ltd@wootion.com
d3bfa3fd638a6406f9e8e0657c5ccb7bf1ed7ea1
e539d650bb16c248a342e2a8adf91dae8515173e
/Controller/MediaListBox.cpp
029118f7e58e4ef157d64f56e5ca53a029f56943
[]
no_license
progmalover/vc-mgcview
8a2671ebd8c35ed8ba4c6d0a6a2c6abb66ff3fbb
cf04e9b1b83cb36ed4a6386ae1b10097e29eae99
refs/heads/master
2021-04-29T04:27:26.134036
2017-01-04T08:38:42
2017-01-04T08:38:42
77,996,977
0
1
null
null
null
null
UTF-8
C++
false
false
20,216
cpp
// MediaListBox.cpp : implementation file // #include "stdafx.h" #include "Controller.h" #include "MediaListBox.h" #include <afxtagmanager.h> #include "PropertyLayer.h" #include "DesignerPage.h" // wParam - no used, lParam - no used UINT WM_ON_MEDIA_NUM_CHANGE = ::RegisterWindowMessage(_T("PROPERTY_MEDIA_NUM_CHANGE")); UINT WM_ON_MEDIA_ITEM_CHANGE = ::RegisterWindowMessage(_T("WM_ON_MEDIA_ITEM_CHANGE")); // CMediaListBox class CPrvPage :public CDesignerPage { friend class CMediaListBox; }; class CPrvPropertyLayer:public CPropertyLayer { friend class CMediaListBox; }; class CPrvLayoutDesignerCtrl :public CLayoutDesignerCtrl { friend class CMediaListBox; } ; CMediaListBox::CMediaListBox() { m_layerInfo.reset(); } CMediaListBox::~CMediaListBox() { m_layerInfo.reset(); } BEGIN_MESSAGE_MAP(CMediaListBox, CVSListBox) ON_MESSAGE(WM_MFC_INITCTRL, &CMediaListBox::OnInitControl) ON_NOTIFY(LVN_ITEMCHANGED, 1, &CMediaListBox::OnItemChanged) ON_NOTIFY(LVN_ENDLABELEDIT, 1, &CMediaListBox::OnEndLabelEdit) //ON_REGISTERED_MESSAGE(WM_DND_DROP, OnDrop) END_MESSAGE_MAP() // CMediaListBox message handlers void CMediaListBox::OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult) { ENSURE(pNMHDR != NULL); NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; ENSURE(pNMListView != NULL); pNMHDR->hwndFrom = this->m_hWnd; pNMHDR->idFrom = GetDlgCtrlID(); GetOwner()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)pNMHDR); *pResult = 0; UpdateButtons(); } LRESULT CMediaListBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class ASSERT_VALID(this); LRESULT lResult; switch (message) { case WM_NOTIFY: case WM_COMMAND: // send these messages to the owner if not handled if (OnWndMsg(message, wParam, lParam, &lResult)) return lResult; else { // try owner next lResult = GetOwner()->SendMessage(message, GetDlgCtrlID(), lParam); return lResult; } } // otherwise, just handle in default way return CVSListBox::WindowProc(message, wParam, lParam); } void CMediaListBox::SetContent(std::shared_ptr<LayerElement> layerInfo, int pos) { //m_pLayer = pLayer; m_layerInfo = layerInfo; vector<std::shared_ptr<MediaElement>> &mediaArray = layerInfo->GetMediaList(); vector<std::shared_ptr<MediaElement>>::iterator it; int p = 0; m_pWndList->DeleteAllItems(); for (it = mediaArray.begin();it != mediaArray.end(); it++) { CString mediaFile = (*it)->GetMediaFile(); CString mediaType = (*it)->GetMediaType(); if (mediaType.CompareNoCase(_T("S3WebBrowser")) != 0) { mediaFile = (*it)->GetMediaName(); } else { if (::PathFileExists(mediaFile)) { p = mediaFile.ReverseFind('\\'); if (p != -1) { mediaFile = mediaFile.Right(mediaFile.GetLength() - p - 1); } } } if (mediaType == szTypeName_Message) { p = mediaFile.ReverseFind('.'); if (p != -1) { mediaFile = mediaFile.Left(p); } } int Index = AddItem(mediaFile); SetItemData(Index, (DWORD_PTR )&(*it)); } if (pos >= 0 && pos < mediaArray.size()) { SelectItem(pos); } UpdateButtons(); #if 0 POSITION MediaPosition = pLayer->GetHeadPosition(); int p = 0; m_pWndList->DeleteAllItems(); for(int i = 0; i < pLayer->GetCount(); i++ ) { MEDIASETTING *pMedia = pLayer->GetAt(MediaPosition); CString str = pMedia->MediaFile; if (pMedia->MediaType.CompareNoCase(_T("S3WebBrowser")) != 0) { str = pMedia->MediaName; } else { if (::PathFileExists(str)) { p = str.ReverseFind('\\'); if (p != -1) { str = str.Right(str.GetLength() - p - 1); } } } if (pMedia->MediaType == szTypeName_Message) { p = str.ReverseFind('.'); if (p != -1) { str = str.Left(p); } } int Index = AddItem(str); SetItemData(Index, (DWORD_PTR )pMedia); pLayer->GetNext(MediaPosition); } if (pos >= 0 && pos < pLayer->GetCount()) { SelectItem(pos); } UpdateButtons(); /* if (m_pLayer->GetCount() > 0) { EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_DELETE_ID), TRUE); } */ #endif } void CMediaListBox::OnClickButton(int iButton) { ASSERT(m_layerInfo); if (m_layerInfo) { int pos = -1; UINT uiBtnID = GetButtonID(iButton); int iSelItem = GetSelItem(); if(uiBtnID == AFX_VSLISTBOX_BTN_NEW_ID) { std::shared_ptr<MediaElement> NewMediaEle; m_layerInfo->CreateMedia(NewMediaEle); NewMediaEle->SetMediaType(szTypeName_EmptyContent); NewMediaEle->SetMediaFile(szTypeName_EmptyContent); NewMediaEle->SetMediaName(szTypeName_EmptyContent); NewMediaEle->SetTextSetting(NULL); NewMediaEle->SetDesigner2(NULL); NewMediaEle->SetDesigner(NULL); NewMediaEle->SetBGColor(RGB(0,0,0)); if (iSelItem == -1) { m_layerInfo->AddTailMediaElement(NewMediaEle); //m_pLayer->AddTail(pMediaSetting); } else { //m_pLayer->InsertAfter(m_pLayer->FindIndex(iSelItem), pMediaSetting); m_layerInfo->InsertAfter(NewMediaEle, iSelItem); } pos = iSelItem + 1; GetOwner()->SendMessage(WM_ON_MEDIA_NUM_CHANGE, (WPARAM)ACTION_ADD, (LPARAM)&NewMediaEle); } else if (iSelItem >=0 && m_layerInfo->GetMediasCount() > iSelItem) { if (uiBtnID == AFX_VSLISTBOX_BTN_DELETE_ID) { std::shared_ptr<MediaElement> MediaEle = m_layerInfo->GetMediaElement(iSelItem); m_layerInfo->RemoveAt(iSelItem); GetOwner()->SendMessage(WM_ON_MEDIA_NUM_CHANGE, (WPARAM)MAKEWPARAM(ACTION_DEL,iSelItem), (LPARAM)&MediaEle); pos = iSelItem - 1; } else if (uiBtnID == AFX_VSLISTBOX_BTN_UP_ID) { GetOwner()->SendMessage(WM_ON_MEDIA_ITEM_CHANGE, ACTION_ITEM_MOVE_UP, 0); SwapLayer(iSelItem, iSelItem - 1); pos = iSelItem - 1; } else if (uiBtnID == AFX_VSLISTBOX_BTN_DOWN_ID) { GetOwner()->SendMessage(WM_ON_MEDIA_ITEM_CHANGE, ACTION_ITEM_MOVE_DOWN, 0); SwapLayer(iSelItem, iSelItem + 1); pos = iSelItem + 1; //GetOwner()->SendMessage(WM_ON_MEDIA_ITEM_CHANGE, 3, 0); } } UpdateButtons(); SetContent(m_layerInfo, pos); if (pos == -1) { LPARAM x; ((CPropertyLayer*)GetParent())->OnLvnItemchangedMediaList(NULL, &x); } } //CVSListBox::OnClickButton(iButton); } void CMediaListBox::UpdateButtons() { // enable/disable up/down button int i = GetSelItem(); EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_DELETE_ID), TRUE); EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_UP_ID), TRUE); EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_DOWN_ID), TRUE); EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_NEW_ID), TRUE); // nothing selected if (i == -1) { EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_DELETE_ID), FALSE); EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_UP_ID), FALSE); EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_DOWN_ID), FALSE); } // disable to move up if (i == 0) { EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_UP_ID), FALSE); } // disable to move down if (i == GetCount() - 1) { EnableButton(GetButtonNum(AFX_VSLISTBOX_BTN_DOWN_ID), FALSE); } } void CMediaListBox::SwapLayer(int pos1, int pos2) { ASSERT(pos1 != pos2 && m_layerInfo); m_layerInfo->SwapMedia(pos1, pos2); } BOOL CMediaListBox::EditItem(int iIndex) { #ifdef STARTER_EDITION std::shared_ptr<MediaElement> mediaEle = m_layerInfo->GetMediaElement(iIndex); CString mediaType = mediaEle->GetMediaType(); if (mediaType.CompareNoCase(_T("S3WebBrowser")) == 0) { return CVSListBox::EditItem(iIndex); } #endif return TRUE; } void CMediaListBox::OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult) { CVSListBox::OnEndLabelEdit(pNMHDR, pResult); *pResult = 0; int iIndex = GetSelItem(); if (m_layerInfo) { std::shared_ptr<MediaElement> mediaEle = m_layerInfo->GetMediaElement(iIndex); if(NULL != mediaEle) { CString mediaType = mediaEle->GetMediaType(); if (mediaType.CompareNoCase(_T("S3WebBrowser")) == 0) { mediaEle->SetMediaFile(GetItemText(iIndex)); CString mediaFile = mediaEle->GetMediaFile(); if(mediaFile.Find(_T(':')) == -1) { mediaFile = _T("http://") + mediaFile; mediaEle->SetMediaFile(mediaFile); } } } } UpdateButtons(); } LRESULT CMediaListBox::OnInitControl(WPARAM wParam, LPARAM lParam) { DWORD dwSize = (DWORD)wParam; BYTE* pbInitData = (BYTE*)lParam; CString strDst; CMFCControlContainer::UTF8ToString((LPSTR)pbInitData, strDst, dwSize); CTagManager tagManager(strDst); BOOL bBrowseButton = TRUE; if (CMFCControlContainer::ReadBoolProp(tagManager, PS_MFCVSListbox_BrowseButton, bBrowseButton)) { EnableBrowseButton(bBrowseButton); } UINT uiBtns = 0; BOOL bNewButton = FALSE; if (CMFCControlContainer::ReadBoolProp(tagManager, PS_MFCVSListbox_NewButton, bNewButton)) { if (bNewButton && GetButtonNum(AFX_VSLISTBOX_BTN_NEW_ID) == -1) { uiBtns |= AFX_VSLISTBOX_BTN_NEW; } } BOOL bRemoveButton = FALSE; if (CMFCControlContainer::ReadBoolProp(tagManager, PS_MFCVSListbox_RemoveButton, bRemoveButton)) { if (bRemoveButton && GetButtonNum(AFX_VSLISTBOX_BTN_DELETE_ID) == -1) { uiBtns |= AFX_VSLISTBOX_BTN_DELETE; } } BOOL bUpButton = FALSE; if (CMFCControlContainer::ReadBoolProp(tagManager, PS_MFCVSListbox_UpButton, bUpButton)) { if (bUpButton && GetButtonNum(AFX_VSLISTBOX_BTN_UP_ID) == -1) { uiBtns |= AFX_VSLISTBOX_BTN_UP; } } BOOL bDownButton = FALSE; if (CMFCControlContainer::ReadBoolProp(tagManager, PS_MFCVSListbox_DownButton, bDownButton)) { if (bDownButton && GetButtonNum(AFX_VSLISTBOX_BTN_DOWN_ID) == -1) { uiBtns |= AFX_VSLISTBOX_BTN_DOWN; } } if (uiBtns != 0) { MySetStandardButtons(uiBtns); } m_DragTarget.Register(this); m_BaseDragTarget.Register(this); return 0; } BOOL CMediaListBox::MySetStandardButtons(UINT uiBtns /*= AFX_VSLISTBOX_BTN_NEW | AFX_VSLISTBOX_BTN_DELETE | AFX_VSLISTBOX_BTN_UP | AFX_VSLISTBOX_BTN_DOWN*/) { if (GetSafeHwnd() == NULL) { ASSERT(FALSE); return FALSE; } CString strButton; if (uiBtns & AFX_VSLISTBOX_BTN_NEW) { strButton = Translate(_T("Insert Empty Content")); ENSURE(AddButton(afxGlobalData.Is32BitIcons() ? IDB_AFXBARRES_NEW32 : IDB_AFXBARRES_NEW, strButton, VK_INSERT,0,AFX_VSLISTBOX_BTN_NEW_ID)); } if (uiBtns & AFX_VSLISTBOX_BTN_DELETE) { // ENSURE(strButton.LoadString(IDS_AFXBARRES_DELETE)); strButton = Translate(_T("Delete")); ENSURE(AddButton(afxGlobalData.Is32BitIcons() ? IDB_AFXBARRES_DELETE32 : IDB_AFXBARRES_DELETE, strButton, VK_DELETE, 0, AFX_VSLISTBOX_BTN_DELETE_ID)); } if (uiBtns & AFX_VSLISTBOX_BTN_UP) { // ENSURE(strButton.LoadString(IDS_AFXBARRES_MOVEUP)); strButton = Translate(_T("Move to Top")); ENSURE(AddButton(afxGlobalData.Is32BitIcons() ? IDB_AFXBARRES_UP32 : IDB_AFXBARRES_UP, strButton, VK_UP, FALT, AFX_VSLISTBOX_BTN_UP_ID)); } if (uiBtns & AFX_VSLISTBOX_BTN_DOWN) { // ENSURE(strButton.LoadString(IDS_AFXBARRES_MOVEDN)); strButton = Translate(_T("Move to Bottom")); ENSURE(AddButton(afxGlobalData.Is32BitIcons() ? IDB_AFXBARRES_DOWN32 : IDB_AFXBARRES_DOWN, strButton, VK_DOWN, FALT, AFX_VSLISTBOX_BTN_DOWN_ID)); } m_uiStandardBtns |= uiBtns; return TRUE; } // Add DragDrop code here, by Xiangyang DROPEFFECT CMediaListBox::CanAccept(CString strId) { CString RefObjName; CPrvPropertyLayer *pOwner = (CPrvPropertyLayer *)GetOwner(); pOwner->m_pDrawObj->GetName(RefObjName); RefObjName.MakeUpper(); if( StringUtility::IsDigitalStr(strId.GetBuffer())) return DROPEFFECT_COPY; strId.MakeUpper(); if(strId == RefObjName) return DROPEFFECT_COPY; if(strId == _T("EMPTYCONTENT")) { return DROPEFFECT_COPY; } if(strId == _T("MESSAGE")) { if(RefObjName == _T("LAYER")) return DROPEFFECT_NONE; } return DROPEFFECT_NONE; } DROPEFFECT CMediaListBox::OnDragOver(COleDataObject* pDataObject, DWORD /*dwKeyState*/, CPoint /*point*/) { HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_UNICODETEXT); #ifdef _UNICODE CString strId =(LPWSTR) GlobalLock(hGlobal); #else CString strId = CW2A((LPWSTR)GlobalLock(hGlobal)); #endif GlobalUnlock(hGlobal); return CanAccept(strId); } // zxy 2011.8.19 #define DEFAULT_LENGHT 256 LRESULT CMediaListBox::OnAddDropedObject(CS3OleDropInfo *pDrop ,CString strId) { CPrvLayoutDesignerCtrl *pWnd = (CPrvLayoutDesignerCtrl*) SearchWndObj(AfxGetMainWnd(),RUNTIME_CLASS(CLayoutDesignerCtrl)); if(pWnd) { // temp solution ,issue is on hold. pWnd-> m_DragMediaFiles.clear(); //this code call main page function to add media,but has issue on layout z-order machin. POBJINFO pObjInfo = new OBJINFO(); pObjInfo->proType = LAYER; DWORD nWidth = DEFAULT_LENGHT, nHeight = DEFAULT_LENGHT; pObjInfo->proType = USER_DEFINED_PLUGIN; if (strId.CompareNoCase(szTypeName_Message) == 0) pObjInfo->proType = MESSAGE; else if (strId.CompareNoCase(szTypeName_EmptyContent) == 0) pObjInfo->proType = LAYER; CPrvPropertyLayer *pOwner = (CPrvPropertyLayer *)GetOwner(); FRect pos ; pOwner->m_pDrawObj->GetLogicPos(pos); CPoint pt(pos.left,pos.top); pWnd->LayoutToClient(pt); pt.x += 1; pt.y += 1; pWnd->OnAddObject( pObjInfo, pt,nWidth,nHeight); // GetOwner()->SendMessage(WM_ON_MEDIA_NUM_CHANGE, 0, 0); return S_OK; #if 0 MEDIASETTING *pNewMedia = new MEDIASETTING; int mediaID ; if (strId.CompareNoCase(szTypeName_Message) == 0) mediaID = MESSAGE; else if (strId.CompareNoCase(szTypeName_Layer) == 0) mediaID = LAYER; else mediaID = USER_DEFINED_PLUGIN; pNewMedia->MediaType = strId ;// DropMedias[0].GetName().c_str(); pNewMedia->MediaName = strId; pNewMedia->nMediaID = mediaID; if(mediaID == MESSAGE) { pNewMedia->MediaType = szTypeName_Text; pNewMedia->pTextSetting = new S3SIGNAGE_TEXT_SETTING; } else if(mediaID == USER_DEFINED_PLUGIN) { POBJINFO pObjInfo = new OBJINFO(); pObjInfo->proType = USER_DEFINED_PLUGIN; DWORD nWidth = DEFAULT_LENGHT, nHeight = DEFAULT_LENGHT; CPrvPropertyLayer *pOwner = (CPrvPropertyLayer *)GetOwner(); FRect pos ; pOwner->m_pDrawObj->GetLogicPos(pos); CPoint pt(pos.left,pos.top); pWnd->LayoutToClient(pt); pt.x += 1; pt.y += 1; pWnd->OnAddObject( pObjInfo, pt,nWidth,nHeight); if (pObjInfo) { delete pObjInfo; pObjInfo = NULL; } return S_OK; } CString objTypeName; // CPrvPropertyLayer *pOwner = (CPrvPropertyLayer *)GetOwner(); pOwner->m_pDrawObj->GetName(objTypeName); PROPERTY_TYPE propertyType; pOwner->m_pDrawObj->GetPropertyType( propertyType); objTypeName.MakeUpper(); m_pLayer->AddTail(pNewMedia); int nItem = this->AddItem(pNewMedia->MediaName); this->SetItemData(nItem,(DWORD_PTR)pNewMedia); #endif } return S_OK; } BOOL CMediaListBox::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint /*point*/) { //return OnDrop(WPARAM(pDataObject),LPARAM(dropEffect)); HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_UNICODETEXT); #ifdef _UNICODE CString strId =(LPWSTR) GlobalLock(hGlobal); #else CString strId = CW2A((LPWSTR)GlobalLock(hGlobal)); #endif GlobalUnlock(hGlobal); if(!StringUtility::IsDigitalStr(strId.GetBuffer())) return OnAddDropedObject((CS3OleDropInfo *)pDataObject,strId); int mediaID = StringUtility::stoi(strId.GetBuffer()); vector<int> Medias; Medias.push_back(mediaID); vector<Media> DropMedias; HRESULT hr = GetControllerInterface->GetMedias(Medias, DropMedias); if(!SUCCEEDED(hr) || DropMedias.empty()) return FALSE; //drag one file at once time. CString strFileName = DropMedias[0].GetName().c_str(); //continue to add file. std::shared_ptr<MediaElement> NewMediaEle; m_layerInfo->CreateMedia(NewMediaEle); NewMediaEle->SetMediaID(mediaID); NewMediaEle->SetMediaFile(DropMedias[0].GetMediaServerPath().c_str()); NewMediaEle->SetMediaName(DropMedias[0].GetName().c_str()); DWORD Duration = DropMedias[0].GetDuration() / 1000; if (0 == Duration) { Duration = 30; } NewMediaEle->SetDuration(Duration); CPrvPage *pPage = (CPrvPage *)GetRuntimePageCtrl(RUNTIME_CLASS(CDesignerPage)); CString szMediaType; pPage->QueryMediaType(NewMediaEle->GetMediaFile(),szMediaType); NewMediaEle->SetMediaType(szMediaType); //type filter here. CString objTypeName; CPrvPropertyLayer *pOwner = (CPrvPropertyLayer *)GetOwner(); pOwner->m_pDrawObj->GetName(objTypeName); PROPERTY_TYPE propertyType; pOwner->m_pDrawObj->GetPropertyType( propertyType); objTypeName.MakeUpper(); if(objTypeName != _T("LAYER") ||propertyType == AUDIO || (NewMediaEle->GetMediaType().CompareNoCase(_T("AUDIO")) == 0)) { if( objTypeName != NewMediaEle->GetMediaType()) { /*TRACE(_T(" %s, %s \n"),objTypeName, pNewMedia->MediaType);*/ #define Translate(x) x CString strPromt; if(NewMediaEle->GetMediaType().CompareNoCase(_T("MESSAGE")) == 0) { strPromt = Translate(_T("Only Message or EmptyContent can add to Message layer!")); } else if(NewMediaEle->GetMediaType().CompareNoCase(_T("USER_DEFINED_PLUGIN")) == 0) { strPromt = Translate(_T("Only same type component or EmptyContent can add to the layer!")); } else if(NewMediaEle->GetMediaType().CompareNoCase(_T("AUDIO")) == 0) { strPromt = Translate(_T("Only audio files can be added to audio layers!")); } #undef Translate MessageBox(Translate(strPromt), Translate(_T("Error:Media listbox")), MB_OK|MB_ICONERROR); return FALSE; } } m_layerInfo->AddTailMediaElement(NewMediaEle); int nItem = this->AddItem(NewMediaEle->GetMediaName()); this->SetItemData(nItem,(DWORD_PTR)&NewMediaEle); this->UpdateButtons(); GetOwner()->SendMessage(WM_ON_MEDIA_NUM_CHANGE, (LPARAM)ACTION_ADD, (WPARAM)&NewMediaEle); return TRUE; }
[ "zhangxiangyang@os-easy.com" ]
zhangxiangyang@os-easy.com
e25c36f1a7f9be5b9c364a3d4489ceaa2cdfe34a
3759d9d2666d26ddaeb6e07dec6fcb484a739d3a
/src/game_state/game_state.hpp
b856d4fe795fcbd7e5ec3c2738a4834c6a450bcc
[]
no_license
AbhiiDeshmukh/realms_shattered
b406f70d1140a58a1d0dce68cb529fde578f0c17
34684dda056e7b868a9722ced20582e397cd3c49
refs/heads/master
2022-12-24T16:27:46.577870
2020-10-01T14:27:17
2020-10-01T14:27:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,280
hpp
#ifndef _GAME_STATE_HPP_ #define _GAME_STATE_HPP_ #include <string> #include "../engine_systems/action_log.hpp" #include "../engine_systems/console.hpp" #include "../engine_systems/game_data.hpp" #include "../engine_systems/language.hpp" #include "../engine_systems/user_input.hpp" #include "../engine_systems/user_interface.hpp" enum class GameStateEnum { GAME_STATE_DEV_MENU, GAME_STATE_HELP, GAME_STATE_LOAD, GAME_STATE_MAIN_MENU, GAME_STATE_PLAYER_HUB, GAME_STATE_RIFT }; class GameState final { public: GameState( const std::string &game_title ); /* * Initialize all of the game systems that are needed to run the game. */ const bool initialize(); /* * Continues to process the current game state until the game ends. */ void run(); private: GameStateEnum m_game_state_current; std::string m_game_title; ActionLog m_action_log; Console m_console; GameData m_game_data; Language m_language; UserInput m_user_input; UserInterface m_user_interface; /* * The developer menu allows the player to use developer commands to do various things. Essentially a cheat menu used to assist in development. */ void game_state_dev_menu(); /* * A help menu that should display available commands and give general info on how to play the game. */ void game_state_help(); /* * Used to show the player a listing of all of the save files found, and allow the player to load one of them and continue their game. */ void game_state_load(); /* * Menu the game should load into after initialization. Basic options should include: New game, load game, help, settings, quit. */ void game_state_main_menu(); /* * The menu where that acts as the player's 'home'. Player is here between adventures, talking with npcs, etc. */ void game_state_player_hub(); /* * Here the player will explore generated rifts composed of rooms. */ void game_state_rift(); /* * Asks the player to specify x/y offsets and width/height of the console area the game prints to. * * Game has a minimum width/height required to ensure proper alignment of things on the screen. */ void print_dimensions_setup(); }; #endif // _GAME_STATE_HPP_
[ "joshua.t.bills86@gmail.com" ]
joshua.t.bills86@gmail.com
af6b3db39be23eb611c7a2570e24c0d8931c4f68
a35b30a7c345a988e15d376a4ff5c389a6e8b23a
/boost/numeric/ublas/operation/c_array.hpp
253f9541867c7fc1520162a97ec436f9532b6952
[]
no_license
huahang/thirdparty
55d4cc1c8a34eff1805ba90fcbe6b99eb59a7f0b
07a5d64111a55dda631b7e8d34878ca5e5de05ab
refs/heads/master
2021-01-15T14:29:26.968553
2014-02-06T07:35:22
2014-02-06T07:35:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
77
hpp
#include "thirdparty/boost_1_55_0/boost/numeric/ublas/operation/c_array.hpp"
[ "liuhuahang@xiaomi.com" ]
liuhuahang@xiaomi.com
92555e27da553d1ddfc4a4f45f4d81f69631a254
165be8367f5753b03fae11430b1c3ebf48aa834a
/tools/converter/source/optimizer/torchextra/TorchZeros.cpp
25535cf0c1e18d3f591f49a251aacf8a6345d1f2
[ "Apache-2.0" ]
permissive
alibaba/MNN
f21b31e3c62d9ba1070c2e4e931fd9220611307c
c442ff39ec9a6a99c28bddd465d8074a7b5c1cca
refs/heads/master
2023-09-01T18:26:42.533902
2023-08-22T11:16:44
2023-08-22T11:16:44
181,436,799
8,383
1,789
null
2023-09-07T02:01:43
2019-04-15T07:40:18
C++
UTF-8
C++
false
false
2,508
cpp
// // TorchZeros.cpp // MNNConverter // // Created by MNN on 2022/04/28. // Copyright © 2018, Alibaba Group Holding Limited // #include "MNN_generated.h" #include "TorchExtraManager.hpp" #include "logkit.h" namespace MNN { namespace Express { class TorchZerosTransform : public TorchExtraManager::Transform { public: virtual EXPRP onExecute(EXPRP expr) const override { auto inputs = expr->inputs(); auto op = expr->get(); auto opName = op->name()->str(); MNN_ASSERT(inputs.size() == 1); auto zeros = _Fill(inputs[0], _Const(0.)); zeros->setName(opName); return zeros->expr().first; } }; class TorchOnesTransform : public TorchExtraManager::Transform { public: virtual EXPRP onExecute(EXPRP expr) const override { auto inputs = expr->inputs(); auto op = expr->get(); auto opName = op->name()->str(); MNN_ASSERT(inputs.size() == 1); auto zeros = _Fill(inputs[0], _Const(1.)); zeros->setName(opName); return zeros->expr().first; } }; class TorchOnesLikeTransform : public TorchExtraManager::Transform { public: virtual EXPRP onExecute(EXPRP expr) const override { auto inputs = expr->inputs(); auto op = expr->get(); auto opName = op->name()->str(); MNN_ASSERT(inputs.size() == 1); auto zeros = _Fill(_Shape(inputs[0]), _Const(1.)); zeros->setName(opName); return zeros->expr().first; } }; class TorchFullLikeTransform : public TorchExtraManager::Transform { public: virtual EXPRP onExecute(EXPRP expr) const override { auto inputs = expr->inputs(); auto op = expr->get(); auto opName = op->name()->str(); MNN_ASSERT(inputs.size() == 2); auto full = _Fill(_Shape(inputs[0]), inputs[1]); full->setName(opName); return full->expr().first; } }; static auto gRegister = []() { TorchExtraManager::get()->insert("zeros", std::shared_ptr<TorchExtraManager::Transform>(new TorchZerosTransform)); TorchExtraManager::get()->insert("ones", std::shared_ptr<TorchExtraManager::Transform>(new TorchOnesTransform)); TorchExtraManager::get()->insert("ones_like", std::shared_ptr<TorchExtraManager::Transform>(new TorchOnesLikeTransform)); TorchExtraManager::get()->insert("full_like", std::shared_ptr<TorchExtraManager::Transform>(new TorchFullLikeTransform)); return true; }(); } // namespace Express } // namespace MNN
[ "xiaotang.jxt@alibaba-inc.com" ]
xiaotang.jxt@alibaba-inc.com
7e0f79eff8cbdca5d0d40378486f0428367221b7
575c78d3b7a2fe90f4f0624d963bd6111dfca309
/deps/libIGL/tests/include/igl/predicates/segment_segment_intersect.cpp
14f1bb83308e09e52bb4dcb63b98600297ee6d9e
[ "GPL-3.0-only", "MPL-2.0", "MIT" ]
permissive
g-gisbert/Inpainting-Holes-In-Folded-Fabric-Meshes
1898a35a848f9f16a99653c7c1e95ab0941755cd
ccce75215b742a1c971008c4f1a889bd85b6c74d
refs/heads/main
2023-08-19T08:49:47.829392
2023-08-18T13:55:11
2023-08-18T13:55:11
648,992,474
5
2
MIT
2023-07-21T15:34:49
2023-06-03T12:45:00
C++
UTF-8
C++
false
false
1,448
cpp
#include <test_common.h> #include <igl/predicates/segment_segment_intersect.h> #include <iomanip> TEST_CASE("segment_segment_intersect: robust", "[igl/predicates]") { // example 1: vanila intersecting case auto A1 = Eigen::RowVector2d(0, 128.5); auto B1 = Eigen::RowVector2d(-77.44,1.2); auto C1 = Eigen::RowVector2d(-83.2,2.8); auto D1 = Eigen::RowVector2d(-1.0,-1.0); bool check1 = igl::predicates::segment_segment_intersect(A1,B1,C1,D1); REQUIRE(check1 == true); // example 2: colinear overlapping auto A2 = Eigen::RowVector2d(1.0,5.0); auto B2 = Eigen::RowVector2d(1.0,9.0); auto C2 = Eigen::RowVector2d(1.0,8.0); auto D2 = Eigen::RowVector2d(1.0,12.0); bool check2 = igl::predicates::segment_segment_intersect(A2,B2,C2,D2); REQUIRE(check2 == true); // example 3: colinear touching endpoint auto A3 = Eigen::RowVector2d(0.0,0.0); auto B3 = Eigen::RowVector2d(1.5,1.5); auto C3 = Eigen::RowVector2d(1.5,1.5); auto D3 = Eigen::RowVector2d(2.0,2.0); bool check3 = igl::predicates::segment_segment_intersect(A3,B3,C3,D3); REQUIRE(check3 == true); // example 6: colinear not touching endpoint double eps = 1e-14; auto A4 = Eigen::RowVector2d(0.0,0.0); auto B4 = Eigen::RowVector2d(1.5,1.5); auto C4 = Eigen::RowVector2d(1.5+eps,1.5+eps); auto D4 = Eigen::RowVector2d(2.0,2.0); bool check4 = igl::predicates::segment_segment_intersect(A4,B4,C4,D4); REQUIRE(check4 == false); }
[ "gisbert.guillaume1997@gmail.com" ]
gisbert.guillaume1997@gmail.com
e17459b12f8c9eddacecc56330665392eb686742
055fd5ff44b971d2845a542554777a1ab66fc3d5
/c++/二叉树/BST的构建.cpp
cd216808d79ff70f69d9d0b1f215281ec242fc35
[]
no_license
Sun0121/sw-algorithms
ef7c993cacca2d98d298f5bb1d13b8cf74f7a5b4
8fb55193a8d5e1feda1e38774ec3f338f9359914
refs/heads/master
2021-05-12T14:17:08.066517
2018-05-24T09:32:32
2018-05-24T09:32:32
116,952,592
2
0
null
2018-01-10T12:05:33
2018-01-10T12:05:33
null
GB18030
C++
false
false
3,320
cpp
#include<iostream> #include <stack> using namespace std; int number = 0; /* 1、 通过链表的方式 */ /* 定义结点结构 */ class Node { public: int elem; Node *left, *right; Node(int elem, Node *left=NULL, Node *right=NULL) { this->elem = elem; this->left = left; this->right = right; } }; Node* insert1(Node* node,int temp) //通过迭代来构建BST,将根节点返回 { if(node == NULL) { return new Node(temp); } Node* p, *q; q = node; p = node; while(p != NULL) { q = p; //始终保证q是p的父亲,所以在建树的时候才能将结点串起来 if(temp < p->elem) { p = p->left; } else { p = p->right; } } if(temp<q->elem) { q->left = new Node(temp); } else { q->right = new Node(temp); } return node; } void insert2(Node* &node,int temp) //递归建树,指针引用 { if(node == NULL) { node = new Node(temp); return; } if(temp<node->elem) insert2(node->left,temp); else insert2(node->right,temp); } void traverse1(Node *node,int *result) //先序非递归遍历,将结果保存到数组result中 { if(node == NULL) return; stack<Node*> m_stack; m_stack.push(node); while(!m_stack.empty()) { Node* temp = m_stack.top(); m_stack.pop(); result[number++] = temp->elem; if(temp->right != NULL) m_stack.push(temp->right); if(temp->left != NULL) m_stack.push(temp->left); } } void traverse2(Node *node,int *result) //先序递归遍历,注意参数和返回值 { if(node == NULL) return; result[number++] = node->elem; traverse2(node->left,result); traverse2(node->right,result); } /* 通过数组的方式 */ void insert3(int *tree,int index,int elem) //index做参数是为了递归的时候能将左右儿子位置传过去 { if(tree[index] == 0) { tree[index] = elem; return; } if(elem<tree[index]) insert3(tree,2*index+1,elem); else insert3(tree,2*index+2,elem); } void insert4(int *tree,int elem) //迭代数组建树 { int index = 0; if(tree[index] == 0) { tree[index] = elem; return; } while(tree[index] != 0) { if(elem<tree[index]) index = 2*index + 1; else index = 2*index + 2; } tree[index] = elem; } void traverse3(int *tree,int index,int *result) //先序遍历 (递归) { if(tree[index] == 0) return; result[number++] = tree[index]; traverse3(tree,2*index+1,result); traverse3(tree,2*index+2,result); } void traverse4(int *tree,int *result) { int index = 0; if(tree[index] == 0) return; stack<int> m_stack; m_stack.push(index); while(!m_stack.empty()) { int temp = m_stack.top(); m_stack.pop(); result[number++] = tree[temp]; if(tree[2*temp+2] != 0) m_stack.push(2*temp+2); if(tree[2*temp+1] != 0) m_stack.push(2*temp+1); } } int main() { int n; //代表测试的个数 cin>>n; int temp,*tree; tree = new int[100000]; for(int i = 0;i<n;++ i) { tree[i] = 0; } for(int i = 0;i<n;++ i) { cin>>temp; insert3(tree,0,temp); } int *result; result = new int[n]; traverse4(tree,result); for(int i = 0;i<n;++ i) { cout<<result[i]<<" "; } }
[ "924166465@qq.com" ]
924166465@qq.com
0db3223f8073693344fb1327ac46041b1044243e
cc2afe5792145b3ca1e43d96b0e89e5f0768d6fa
/MergeSort.cpp
7d1960d94d7e6d2b33cb2359bc79e7d731a9facf
[]
no_license
MinYeolPark/Algorithm
c100be91c721d8c1cd372e362d03ceb211eda061
2e8a22cec5746449cd67c6e08781c2fc0a7d8ccf
refs/heads/main
2023-06-25T10:37:02.020953
2021-07-20T06:56:46
2021-07-20T06:56:46
374,054,006
0
0
null
null
null
null
UTF-8
C++
false
false
1,169
cpp
#include <iostream> #define max 6 void mergesort(int a[], int low, int high); void merge(int a[], int low, int mid, int high); void Print_a(int a[]); using namespace std; int main() { int a[max] = { 20,10,70,80,40,90 }; int i = 0; cout << "befor merge :"; Print_a(a); puts("\n"); mergesort(a, 0, max - 1); cout << "after merge :"; Print_a(a); puts("\n"); } void mergesort(int a[], int low, int high) { if (low < high) { int mid = (low + high) / 2; //left part sort mergesort(a, low, mid); //right part sort mergesort(a, mid+1, high); //merge(left,right) merge(a, low, mid, high); } else return; } void merge(int a[], int low, int mid, int high) { int b[1000]; int i = low; int j = mid + 1; int k = 0; while (i <= mid && j <= high) { if (a[i] <= a[j]) { b[k++] = a[i++]; } else { b[k++] = a[j++]; } } while (i <= mid) { b[k++] = a[i++]; } while (j <= high) { b[k++] = a[j++]; } //Adjust k value to end index; k--; while (k >= 0) { //Copy b(temp array) array to a(main) array a[low + k] = b[k]; k--; } } void Print_a(int a[]) { for (int i = 0; i < max; i++) { cout << a[i] << " "; } }
[ "pmy30813@gmail.com" ]
pmy30813@gmail.com
7ee2f53d87552145dba335f5d595edd96408330b
b447d0321463126767a4588358790061dedf8bb6
/arduino_code/bluefruitData/bluefruitData.ino
20a9cef2ee5e861e88ba53f87b6d5c44710c5f21
[]
no_license
rashidakamal/phoneLOC
93fb4d6369d38a20fc8db348efb8f25f1cdfcf3b
e19d8aff9a88e4c6b8af3bd54ec26e2994d549d6
refs/heads/master
2020-05-17T16:56:56.989082
2019-05-01T11:34:13
2019-05-01T11:34:13
183,834,312
0
0
null
null
null
null
UTF-8
C++
false
false
2,875
ino
#include <Arduino.h> #include <SPI.h> #include "Adafruit_BLE.h" #include "Adafruit_BluefruitLE_SPI.h" #include "Adafruit_BluefruitLE_UART.h" #include "BluefruitConfig.h" #if SOFTWARE_SERIAL_AVAILABLE #include <SoftwareSerial.h> #endif #define FACTORYRESET_ENABLE 1 #define MINIMUM_FIRMWARE_VERSION "0.6.6" #define MODE_LED_BEHAVIOUR "MODE" Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST); // A small helper void error(const __FlashStringHelper*err) { Serial.println(err); while (1); } uint8_t value = 7; void setup(void) { delay(500); Serial.begin(115200); Serial.println(F("Adafruit Bluefruit Command <-> Data Mode Example")); Serial.println(F("------------------------------------------------")); /* Initialise the module */ Serial.print(F("Initialising the Bluefruit LE module: ")); if ( !ble.begin(VERBOSE_MODE) ) { error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?")); } Serial.println( F("OK!") ); if ( FACTORYRESET_ENABLE ) { /* Perform a factory reset to make sure everything is in a known state */ Serial.println(F("Performing a factory reset: ")); if ( ! ble.factoryReset() ){ error(F("Couldn't factory reset")); } } /* Disable command echo from Bluefruit */ ble.echo(false); Serial.println("Requesting Bluefruit info:"); /* Print Bluefruit information */ ble.info(); Serial.println(F("Setting device name to 'Bluefruit LOC Phone': ")); if (! ble.sendCommandCheckOK(F("AT+GAPDEVNAME=Bluefruit LOC Phone")) ) { error(F("Could not set device name?")); } ble.verbose(false); // debug info is a little annoying after this point! /* Wait for connection */ while (! ble.isConnected()) { delay(500); } Serial.println(F("******************************")); // LED Activity command is only supported from 0.6.6 if ( ble.isVersionAtLeast(MINIMUM_FIRMWARE_VERSION) ) { // Change Mode LED Activity Serial.println(F("Change LED activity to " MODE_LED_BEHAVIOUR)); ble.sendCommandCheckOK("AT+HWModeLED=" MODE_LED_BEHAVIOUR); } // Set module to DATA mode Serial.println( F("Switching to DATA mode!") ); ble.setMode(BLUEFRUIT_MODE_DATA); Serial.println(F("******************************")); } void loop() { // I haven't really setup a // eventually, you'll want to do an analogRead, cast that value as // uint8_t and then ble.print(value). // Then app.js takes over from there. // Note you are not *really* setting up a properly structured custom GATT // service/characteristic structure; instead: naively broadcasting // data. ble.println(value); /* Check if command executed OK */ if ( !ble.waitForOK() ) { Serial.println(F("Failed to get response!")); } delay(5000); }
[ "rsk2161@columbia.edu" ]
rsk2161@columbia.edu
11e3f486e07ca8612e4fa1275ce1bb932fb7a224
21073d343d8c42bc00b3e942d5247facc18b1920
/1.2main.cpp
966ec0f9b286afb992607b034d83aa79b7bfb816
[]
no_license
v-borisov/Zhou-Project-1
adc8cc19b70f10fc81ac670b4431b34c84d3eae6
8454ed9f383b307c476485471fd511da39a5dcdf
refs/heads/master
2021-01-10T02:09:20.706261
2016-03-10T02:58:50
2016-03-10T02:58:50
53,549,394
0
0
null
null
null
null
UTF-8
C++
false
false
1,050
cpp
// 1.2 // Reverse Words is an easy practice problem. // Given a list of space separated words, // reverse the order of the words. #include <iostream> #include <stack> #include <sstream> #include <string> using namespace std; int main() { stack<string> words; string strraw; string ready; cout << "Please enter your sentence to be reversed: " << endl; getline(cin,strraw,'\n'); cout << endl << "Your words are:" << endl << strraw << endl; string cur; // reversing for (int i = 0; i < strraw.size(); i++) { if (strraw[i] != ' ') { cur = cur + strraw[i]; } else if (strraw[i] == ' ') { words.push(cur); cur.clear(); } } words.push(cur); //for last word without space cout << endl; // printing reversed cout << "Your reversed words are:" << endl; while( !(words.empty()) ) { cout << words.top() << " "; words.pop(); } cout << ready << endl << endl; }
[ "tktfowl@aol.com" ]
tktfowl@aol.com
db798a36bf2bc3857328c8a311334075cc0e576a
eec3f9ed803e408a1f81bdd93ca4eabcb7160631
/SubWidget/reshardware.cpp
17f199d0a82bbdd51a032837854c238e937cfdf7
[]
no_license
resilencelyn/QtDemo
720c46acbe7c00a22c775e57e3b6b97942364614
0f5e8c99fbcc90be942ee822d768c4664e24e318
refs/heads/master
2022-03-03T17:58:00.796364
2019-07-02T09:51:30
2019-07-02T09:51:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
44,941
cpp
#include "reshardware.h" #include "ui_reshardware.h" ResHardware::ResHardware(Model_UART *uart, QWidget *parent) : QDialog(parent), ui(new Ui::ResHardware) { ui->setupUi(this); this->setWindowFlags(this->windowFlags() | Qt::WindowMinMaxButtonsHint); //小屏显示 strDeal = new Model_String(); strDeal->MediaTransModel(0);//默认数据不转换 connect(strDeal,SIGNAL(UpdateScreenSignal(unsigned char)),this,SLOT(UpdateScreenSlot(unsigned char))); QPalette mainTextEditPalette;//设置小屏界面背景和字体颜色 mainTextEditPalette.setColor(QPalette::Text,QColor(90,232,248)); ui->mainTextEdit->setPalette(mainTextEditPalette); mainTextEditPalette.setColor(QPalette::Base,QColor(20,20,20)); ui->mainTextEdit->setPalette(mainTextEditPalette); //项目及按键 refreshitemName(WorkItem); //刷新项目名列表:从文件中获取项目信息 initkeyList(); //初始化点击按键列表 tableWidgetInit(); //初始化编辑列表框 getkeyControlNull(&copyTempKey); //初始化拷贝临时变量信息 //初始化当前项目的按键 if(ui->comboBox_itemName->currentText().isEmpty() == false) { readItemKeyInfo(ui->comboBox_itemName->currentText()); } //定义串口 keyUart = uart;//=new Model_UART; //any:由主函数定义 connect(keyUart,SIGNAL(RxFrameDat(char,uint8_t,char*)),this,SLOT(UartRxDealSlot(char,uint8_t,char*))); connect(keyUart,SIGNAL(UartRxAckResault(bool)),this,SLOT(UartRxAckResault(bool))); connect(keyUart,SIGNAL(UartError()),this,SLOT(UartErrorDeal())); connect(keyUart,SIGNAL(UartByteArrayBackStage(QByteArray,uartDir,bool)),this,SLOT(UartByteArraySlot(QByteArray,uartDir,bool))); //添加链接 connect(ui->comboBox_itemName,SIGNAL(activated(QString)),this,SLOT(itemNameSlot(QString))); connect(ui->comboBox_itemName,SIGNAL(currentTextChanged(QString)),this,SLOT(itemNameSlot(QString))); uartReadCANParamDeal(); } ResHardware::~ResHardware() { } /************************************************************* /函数功能:窗口关闭事件:主窗口调用是全局变量,未能及时释放,因此在关闭窗口处处理 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::closeEvent(QCloseEvent *event) { keyUart->Close();//关串口 delete strDeal; delete keyUart; delete ui; event->accept(); windowClose(); } /************************************************************* /函数功能:刷新项目名 /函数参数:项目名 /函数返回:无 *************************************************************/ void ResHardware::refreshitemName(QString currentText) { QStringList itemList; Model_XMLFile xmlRead; xmlRead.readKeyItemXML(&itemList); ui->comboBox_itemName->clear(); ui->comboBox_itemName->addItems(itemList); ui->comboBox_itemName->setCurrentText(currentText); } /************************************************************* /函数功能:初始化按键列表 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::initkeyList() { Model_XMLFile xmlRead; QList <keyControl> keysClickList; QStringList comboList; xmlRead.readKeyInfoXML(WorkItem,&keysClickList); if(keysClickList.isEmpty()==false) { for(int i=0;i<keysClickList.length();i++) { if(keysClickList.at(i).isUse) { comboList.append("KEY"+QString::number(i+1)+":"+keysClickList.at(i).name); //标记特殊按键处理字符串: if(keysClickList.at(i).type == HardACC) { AccKey = comboList.last(); } else if(keysClickList.at(i).type == HardBAT) { BatKey = comboList.last(); } } } } ui->comboBoxKeyList->clear(); ui->comboBoxKeyList->addItems(comboList); } /*---------------------------------------this is KeyEdit option-----------------------------------------*/ /************************************************************* /函数功能:编辑固定按键信息:ACC BAT CCD /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::fixedKeyEdit() { for(int i=0;i<fixedKeyNum;i++) { keyControl keyInfo; getkeyControlNull(&keyInfo); //填写具体信息 switch(i) { case 0: keyInfo.name = "ACC"; keyInfo.type = HardACC; keyInfo.isUse = true; break; case 1: keyInfo.name = "BAT"; keyInfo.type = HardBAT; keyInfo.isUse = true; break; case 2: keyInfo.name = "CCD"; keyInfo.type = HardCCD; keyInfo.isUse = true; break; } keyInfo.des = "name : "+keyInfo.name; keyInfo.des +="\ntype : "+getKeyType(keyInfo.type); //替换显示及列表信息 ui->tableWidget->item(i,colDes)->setText(keyInfo.des); //key:isEnable ui->tableWidget->item(i,colKey)->setCheckState(Qt::Checked); //按键信息添加到列表 keyList.replace(i,keyInfo); } } /************************************************************* /函数功能:按键资源初始化 /函数参数:按键信息 /函数返回:无 //keyName->setFlags(keyName->flags() & (~Qt::ItemIsEditable)); *************************************************************/ void ResHardware::tableWidgetInit() { keyList.clear(); for(int i=0;i<MaxKey;i++) { keyControl keyInfo; getkeyControlNull(&keyInfo); int row=ui->tableWidget->rowCount(); ui->tableWidget->setRowCount(row+1); //key:isUse QTableWidgetItem *keyName=new QTableWidgetItem("KEY"+QString::number(row+1)); if(keyInfo.isUse) keyName->setCheckState(Qt::Checked); else keyName->setCheckState(Qt::Unchecked); ui->tableWidget->setItem(row,colKey,keyName); //key :Description QTableWidgetItem *keyDes=new QTableWidgetItem(keyInfo.des); ui->tableWidget->setItem(row,colDes,keyDes); //key:Edit QPushButton *pBtn = new QPushButton(QIcon(":/test/edit.png"),"Edit"); pBtn->setFlat(true); if(row>=fixedKeyNum) connect(pBtn, SIGNAL(clicked()), this, SLOT(EditKeyClicked())); ui->tableWidget->setCellWidget(row,colEdit,pBtn); //key:Width ui->tableWidget->setColumnWidth(colKey,80); ui->tableWidget->setColumnWidth(colDes,280); //key:isEnable keyisUsetoEnable(row,keyInfo.isUse); //按键信息添加到列表 keyList.append(keyInfo); } //any:备注:放在添加项目完成时处理,不然在添加check时会进入 connect(ui->tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(on_cellChanged(int,int))); connect(ui->tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),ui->tableWidget,SLOT(resizeRowsToContents())); //设置固定按键信息 fixedKeyEdit(); } /************************************************************* /函数功能:按键是否使用,改变信息使用状态 /函数参数:num:设备序列号 isEn:true使能 false失能 /函数返回:无 *************************************************************/ void ResHardware::keyisUsetoEnable(int Num,bool isEn) { //key :Description if(isEn) ui->tableWidget->item(Num,colDes)->setTextColor(BLACK); else ui->tableWidget->item(Num,colDes)->setTextColor(GRAY); //key:Edit QPushButton *tempBtn=(QPushButton*)ui->tableWidget->cellWidget(Num,colEdit);//强制转化为QPushButton tempBtn->setEnabled(isEn); ui->tableWidget->setCellWidget(Num,colEdit,tempBtn); } /************************************************************* /函数功能:点击编辑信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::EditKeyClicked() { QPushButton * senderObj=qobject_cast<QPushButton *>(sender()); if(senderObj == 0) return; QModelIndex index =ui->tableWidget->indexAt(QPoint(senderObj->frameGeometry().x(),senderObj->frameGeometry().y())); keyControl theKey=keyList.at(index.row()); ResHardEdit *hardEdit=new ResHardEdit(&theKey); if(hardEdit->exec() == QDialog::Accepted) { theKey.des = "name : "+theKey.name; theKey.des +="\ntype : "+getKeyType(theKey.type); if((theKey.type == Can1_1)||(theKey.type == Can2_1)) theKey.des +="\nCANID : "+theKey.CANID+"\nCANDat : "+theKey.CANDat1; else if((theKey.type == Can1_2)||(theKey.type == Can2_2)) theKey.des +="\nCANID : "+theKey.CANID+"\nCANDatOn : "+theKey.CANDat1+"\nCANDatOff : "+theKey.CANDat2; //替换显示及列表信息 ui->tableWidget->item(index.row(),colDes)->setText(theKey.des); keyList.replace(index.row(),theKey); } delete hardEdit; } /************************************************************* /函数功能:table信息改变:主要处理选中任务 /函数参数:行列 /函数返回:无 /备注:在翻转信息时,若不进行过滤,表格中任何一项更改都将进入此函数,影响数据的处理 *************************************************************/ void ResHardware::on_cellChanged(int row, int column) { if(column == colKey) { keyControl theKey = keyList.at(row); if(ui->tableWidget->item (row,column)->checkState ()==Qt::Checked) { keyisUsetoEnable(row,true); theKey.isUse=true; } else if(ui->tableWidget->item (row,column)->checkState () == Qt::Unchecked) { keyisUsetoEnable(row,false); theKey.isUse=false; } keyList.replace(row,theKey); } } /************************************************************* /函数功能:读项目下的按键信息,并刷新显示 /函数参数:项目 /函数返回:无 *************************************************************/ void ResHardware::readItemKeyInfo(QString item) { Model_XMLFile xmlRead; keyList.clear(); //读xml文件填写 xmlRead.readKeyInfoXML(item,&keyList); if(keyList.isEmpty()==false) { int row=ui->tableWidget->rowCount(); for(int i=0;i<row;i++) { ui->tableWidget->item(i,colDes)->setText(keyList.at(i).des); if(keyList.at(i).isUse) ui->tableWidget->item (i,colKey)->setCheckState(Qt::Checked); else ui->tableWidget->item (i,colKey)->setCheckState(Qt::Unchecked); } } else cout << "文件中无此按键信息。"; } /************************************************************* /函数功能:切换项目编号,刷新项目列表:因此在需要的地方只需更改项目编号而已,无需再操心刷新问题 /函数参数:项目 /函数返回:无 *************************************************************/ void ResHardware::itemNameSlot(const QString &arg1) { readItemKeyInfo(arg1); itemNameChange(arg1); initkeyList(); } /************************************************************* /函数功能:重置列表 /函数参数:无 /函数返回:无 /备注:在删除项目时断开连接,避免重新添加时进行信号处理 *************************************************************/ void ResHardware::customContextMenuReset_clicked() { keyList.clear(); int row = ui->tableWidget->rowCount(); for(uint16_t i=row;i>0;i--) { ui->tableWidget->removeRow(i-1); } //ui->tableWidget->disconnect();//any:不使用全局取消链接操作,以免将其余链接无法使用(菜单链接) disconnect(ui->tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(on_cellChanged(int,int)));//删除时同时去掉连接,避免重新初始化时进入信号处理函数 disconnect(ui->tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),ui->tableWidget,SLOT(resizeRowsToContents())); tableWidgetInit(); } /************************************************************* /函数功能:保存按键信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::customContextMenuSave_clicked() { saveKeysInfoToXML(ui->comboBox_itemName->currentText()); } /************************************************************* /函数功能:保存按键信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::saveKeysInfoToXML(QString itemName) { bool ok; QString text = QInputDialog::getText(this, tr("保存"),tr("项目名:"), QLineEdit::Normal,itemName, &ok); if (ok && !text.isEmpty()) { Model_XMLFile xmlSave; QStringList keylist; itemName = text; bool isAppend=true; xmlSave.createKeyInfoXML(); if(xmlSave.hasItemKeyInfomation(itemName)) { if(QMessageBox::information(NULL, tr("提示"), tr("文件中该项目已存在,是否替换按键定义??"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::No) { return; } isAppend=false; } ui->label_Show->setText(tr("保存:保存按键信息到《KeyInfo.xml》 文件中. ")); for(int i=0;i<keyList.length();i++) { keyControl keyInfo = keyList.at(i); keylist.clear(); keylist << "KEY"+QString::number(i+1) << keyInfo.name << QString::number(keyInfo.isUse) << keyInfo.des << QString::number(keyInfo.type) << keyInfo.CANID << keyInfo.CANDat1 << keyInfo.CANDat2; xmlSave.appendKeyInfoXML(itemName,isAppend,keylist); } refreshitemName(itemName); initkeyList(); } } /************************************************************* /函数功能:复制按键信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::customContextMenuCopy_clicked() { //copyTempKey QTableWidgetItem * item = ui->tableWidget->currentItem(); if( item == NULL ) return; int curIndex = ui->tableWidget->row(item); copyTempKey = keyList.at(curIndex); } /************************************************************* /函数功能:粘贴按键信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::customContextMenuPaste_clicked() { QTableWidgetItem * item = ui->tableWidget->currentItem(); if( item == NULL ) return; int curIndex = ui->tableWidget->row(item); keyList.replace(curIndex,copyTempKey); //替换显示及列表信息 ui->tableWidget->item(curIndex,colDes)->setText(copyTempKey.des); //key:isEnable if(copyTempKey.isUse) ui->tableWidget->item (curIndex,colKey)->setCheckState(Qt::Checked); else ui->tableWidget->item (curIndex,colKey)->setCheckState(Qt::Unchecked); } /************************************************************* /函数功能:删除按键信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::customContextMenuDelete_clicked() { //copyTempKey QTableWidgetItem * item = ui->tableWidget->currentItem(); if( item == NULL ) return; int curIndex = ui->tableWidget->row(item); keyControl keyInfo; getkeyControlNull(&keyInfo); //替换显示及列表信息 ui->tableWidget->item(curIndex,colDes)->setText(keyInfo.des); //key:isEnable ui->tableWidget->item(curIndex,colKey)->setCheckState(Qt::Unchecked); keyList.replace(curIndex,keyInfo); } /************************************************************* /函数功能:tableWidget右键创建菜单栏 /函数参数:位置 /函数返回:wu *************************************************************/ void ResHardware::on_tableWidget_customContextMenuRequested(const QPoint &pos) { QTableWidgetItem * item = ui->tableWidget->currentItem(); if( item == NULL ) return; int curIndex = ui->tableWidget->row(item); Q_UNUSED(pos); QMenu *popMenu = new QMenu( this ); QAction *saveAct = new QAction(tr("保存到KeyInfo.xml"), this); QAction *downloadAct = new QAction(QIcon(":/Title/download.png"),tr("下载"), this); QAction *uploadAct = new QAction(QIcon(":/Title/upload.png"),tr("上传"), this); QAction *copyAct = new QAction(tr("复制")+" KEY"+toStr(curIndex+1), this); QAction *pasteAct = new QAction(tr("粘贴到")+" KEY"+toStr(curIndex+1), this); QAction *resetAct = new QAction(tr("重置列表"), this); QAction *deleteAct = new QAction(tr("删除")+" KEY"+toStr(curIndex+1), this); //添加到主菜单: if(userLogin.Permissions == Administrator) { popMenu->addAction(saveAct); popMenu->addAction(resetAct); popMenu->addAction(downloadAct); popMenu->addAction(uploadAct); popMenu->addSeparator(); popMenu->addAction(copyAct); popMenu->addAction(pasteAct); popMenu->addAction(deleteAct); if(keyList.at(curIndex).name.isEmpty()) { copyAct->setEnabled(false);//当前项无数据,无复制和删除操作 deleteAct->setEnabled(false); } if(copyTempKey.name.isEmpty()) pasteAct->setEnabled(false);//复制的临时数据为空,无粘贴操作 if(keyUart->isOpenCurrentUart()==false) { downloadAct->setEnabled(false);//串口未打开,无下载,上传操作 uploadAct->setEnabled(false); } } connect(saveAct,SIGNAL(triggered()),this,SLOT(customContextMenuSave_clicked())); connect(resetAct,SIGNAL(triggered()),this,SLOT(customContextMenuReset_clicked())); connect(uploadAct,SIGNAL(triggered()),this,SLOT(customContextMenuUpload_clicked())); connect(downloadAct,SIGNAL(triggered()),this,SLOT(customContextMenuDownload_clicked())); connect(copyAct,SIGNAL(triggered()),this,SLOT(customContextMenuCopy_clicked())); connect(pasteAct,SIGNAL(triggered()),this,SLOT(customContextMenuPaste_clicked())); connect(deleteAct,SIGNAL(triggered()),this,SLOT(customContextMenuDelete_clicked())); popMenu->exec( QCursor::pos() ); delete popMenu; } /*---------------------------------------this is UartDeal option-----------------------------------------*/ /************************************************************* /函数功能:串口接收处理函数 /函数参数: /函数返回:无 *************************************************************/ void ResHardware::UartRxDealSlot(char cmd,uint8_t dLen,char *dat) { switch(cmd) { case CMDItemRead: { QString item(dat); QStringList itemList; Model_XMLFile xmlRead; xmlRead.readKeyItemXML(&itemList); if(itemList.contains(item)) ui->comboBox_itemName->setCurrentText(item); if(QMessageBox::information(NULL, tr("提示"), tr("获取到项目:")+item+tr("\n是否继续获取按键信息??"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) { char read=0; keyUart->appendTxList(CMDUploadKey,&read,1,CMD_NEEDNACK); ui->label_Show->setText(tr("读取:按键信息")); g_ItemReadString = item; } ui->label_Show->setText(tr("项目:")+item); break; } case CMDUploadKey: { uint8_t keyIndex = dat[0]; if(keyIndex<MaxKey) { int index; keyControl keyDInfo; getkeyControlNull(&keyDInfo); for(index=1;index<dLen-1;index++) { if(dat[index]!='*') keyDInfo.name.append(dat[index]); else { index++; break; } } keyDInfo.isUse = dat[index++]; keyDInfo.type = (kType)dat[index++]; if(keyDInfo.isUse) { keyDInfo.des = "name : "+keyDInfo.name; keyDInfo.des +="\ntype : "+getKeyType(keyDInfo.type); } //any:处理延时任务,照成接收失误,换地方处理 if((keyDInfo.type == Can1_1)||(keyDInfo.type == Can1_2)||(keyDInfo.type == Can2_1)||(keyDInfo.type == Can2_2)) { keyDInfo.CANID=strDeal->hexToString((unsigned char *)&dat[index],4); index+=4; keyDInfo.CANDat1=strDeal->hexToString((unsigned char *)&dat[index],8); index+=8; keyDInfo.des +="\nCANID : "+keyDInfo.CANID+"\nCANDatOn : "+keyDInfo.CANDat1; if((keyDInfo.type==Can1_2)||(keyDInfo.type==Can2_2)) { keyDInfo.CANDat2=strDeal->hexToString((unsigned char *)&dat[index],8); keyDInfo.des +="\nCANDatOff : "+keyDInfo.CANDat2; } } keyList.replace(keyIndex,keyDInfo); ui->tableWidget->item(keyIndex,colDes)->setText(keyList.at(keyIndex).des); if(keyList.at(keyIndex).isUse) ui->tableWidget->item (keyIndex,colKey)->setCheckState(Qt::Checked); else ui->tableWidget->item (keyIndex,colKey)->setCheckState(Qt::Unchecked); //cout <<keyDInfo.name<<keyDInfo.isUse <<keyDInfo.type<<keyDInfo.CANID<<keyDInfo.CANDat1<<keyDInfo.CANDat2; //最后一帧按键时处理显示 if(keyIndex == (MaxKey-1)) { //初始化点击按键列表 initkeyList(); //保存 saveKeysInfoToXML(g_ItemReadString); } } break; } case CMDUploadBatVal: { unsigned int tempDat=0; for(int i=0;i<dLen;i++) { tempDat=((uint8_t)dat[i]<<(i*8))|tempDat;//低位在前,高位在后 } ui->lineEditShowVB->setText(toStr(tempDat/100.0)+"V"); break; } case CMD_MEDIA_INFO://媒体信息 { DispBufClear(); strDeal->MediaInfoAnalyze(dLen,dat,g_DisplayBuf);//,strDeal->Uni2UTF8_LittleEndian); break; } case CMD_MEDIA_INFO2://媒体信息2 { DispBufClear(); strDeal->MediaInfo2Analyze(dLen,dat,g_DisplayBuf);//,strDeal->Uni2UTF8_LittleEndian); break; } case CMD_LINK_STATUS://连接状态信息 { if(dat[0] == 0x01) { ui->linkStatusRadioButton->setText("设备已连接!"); ui->linkStatusRadioButton->setChecked(true); } else if(dat[0] == 0x00) { ui->linkStatusRadioButton->setText("设备未连接!"); ui->linkStatusRadioButton->setChecked(false); } break; } case CMDUploadCAN://CAN 参数 { //帧结构:Byte0:开/关 Byte1:CAN类型 Byte2~3:CAN波特率 if((dat[0]==1) ||(dat[0]==0))//避免其他数据结果乱入(从测试板内存中读取数据出错的情况,或初始情况) { if(dat[1] == CAN2CHANNEL) { if(dat[0]) { ui->checkBoxENCAN2->setChecked(true); ui->comboBoxCAN2Baud->setEnabled(false); ui->comboBoxCAN2Type->setEnabled(false); } else { ui->checkBoxENCAN2->setChecked(false); ui->comboBoxCAN2Baud->setEnabled(true); ui->comboBoxCAN2Type->setEnabled(true); } uint16_t baud = dat[2]<<8|dat[3]; ui->comboBoxCAN2Baud->setCurrentText( recovCANBaudDeal(baud)); } else { if(dat[1] == CAN1CHANNEL) { ui->comboBoxCAN1Type->setCurrentIndex(0); } else ui->comboBoxCAN1Type->setCurrentIndex(1); if(dat[0]) { ui->checkBoxENCAN1->setChecked(true); ui->comboBoxCAN1Baud->setEnabled(false); ui->comboBoxCAN1Type->setEnabled(false); } else { ui->checkBoxENCAN1->setChecked(false); ui->comboBoxCAN1Baud->setEnabled(true); ui->comboBoxCAN1Type->setEnabled(true); } uint16_t baud = dat[2]<<8|dat[3]; ui->comboBoxCAN1Baud->setCurrentText( recovCANBaudDeal(baud)); } } break; } case CMD_TIME_SYN: { QString timeStr; timeStr=QString("%1: %2").arg(strDeal->hexToString((unsigned char *)&dat[1],1)).arg(strDeal->hexToString((unsigned char *)&dat[2],1)); ui->lcdNumber_TimeDisplay->display(timeStr); break; } default:break; } } /************************************************************* /函数功能:接收串口响应处理槽函数 /函数参数:ack:响应结果 /函数返回:无 *************************************************************/ void ResHardware::UartRxAckResault(bool ack) { if(!ack) { cout<<("串口响应失败,请检查!"); ui->label_Show->setText(tr("传输失败!")); } } /************************************************************* /函数功能:串口错误处理:串口断开,响应失败 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::UartErrorDeal() { QMessageBox::warning(NULL, tr("提示"), tr("串口错误,请检查串口!")); ui->label_Show->setText(tr("通道处理失败!")); } /************************************************************* /函数功能:串口字符串后台显示数据传输 /函数参数:revDats:接收字符串数据 dir:传输方向 isHex:是否为hex数据 /函数返回:无 *************************************************************/ void ResHardware::UartByteArraySlot(QByteArray revDats,uartDir dir,bool isHex) { QString strShow; if(isHex==Uart_Hex) strShow=strDeal->hexToString((unsigned char *)revDats.data(),revDats.length());//hex显示 else if(isHex==Uart_NHex) strShow=revDats; if(dir==Uart_Rx) ui->textBrowserFrameShow->append("Rx: "+strShow); else if(dir==Uart_Tx) ui->textBrowserFrameShow->append("Tx: "+strShow); else ui->textBrowserFrameShow->append("Warn: "+strShow); } /*---------------------------------------this is 小屏显示处理 option-----------------------------------------*/ /************************************************************* /函数功能:清空显示缓存 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::DispBufClear() { for(unsigned char i = 0;i < 8;i++) g_DisplayBuf[i] = " "; } /************************************************************* /函数功能:更新屏显示槽函数 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::UpdateScreenSlot(unsigned char line) { ui->mainTextEdit->clear(); ui->mainTextEdit->append("<font color=yellow>" + g_DisplayBuf[0] + "</font>");//添加HTML语句,使第一行文字为黄色 //ui->mainTextEdit->append(g_DisplayBuf[0]); for(int i = 1; i <= line; i++) { if(g_DisplayBuf[i].length()>64)//字符串长度不超过64个 g_DisplayBuf[i] = g_DisplayBuf[i].left(64); ui->mainTextEdit->append(g_DisplayBuf[i]); } if(ui->linkStatusRadioButton->isChecked()==false) ui->linkStatusRadioButton->setChecked(true); } /************************************************************* /函数功能:更改数据转换模式 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::on_comboBox_MediaTrans_currentIndexChanged(int index) { strDeal->MediaTransModel(index); } /*---------------------------------------this is 组件处理函数 option-----------------------------------------*/ /************************************************************* /函数功能:上传数据信息,从小板获取项目号,再从文件中读取该项目的按键内容 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::customContextMenuUpload_clicked() { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); return ; } char read=0; keyUart->appendTxList(CMDItemRead,&read,1,CMD_NEEDNACK); ui->label_Show->setText(tr("读取:项目型号")); } /************************************************************* /函数功能:下载按键信息 /函数参数:无 /函数返回:无 *************************************************************/ void ResHardware::customContextMenuDownload_clicked() { //串口是否连接 if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); return ; } //下载项目及对应的按键: if(QMessageBox::information(NULL, tr("下载"), tr("项目名:")+ui->comboBox_itemName->currentText(), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes)//Upgrading { uint8_t downloadIndex = 0; bool isDownLoadLast = false; while(1) { //cout << downloadIndex; char buf[BUFSIZ]={0};//不可用指针,当数据较多时无法正确赋值,因未分配内存,照成数据混乱 int len = 0; QByteArray arrayBuf ; if(!downloadIndex) { arrayBuf = ui->comboBox_itemName->currentText().toLatin1();//下载项目号 len = arrayBuf.length(); strcpy(buf,arrayBuf); ui->label_Show->setText(tr("下载:项目: ")+arrayBuf); keyUart->appendTxList(CMDItemWrite,buf,len,CMD_NEEDACK); } else if(keyList.length()>(downloadIndex-1)) { //Model_String strDeal; keyControl keyInfo = keyList.at(downloadIndex-1);//下载按键信息 arrayBuf = keyInfo.name.toLatin1(); buf[0]=downloadIndex-1; strcpy(&buf[1],arrayBuf); len = arrayBuf.length()+1; buf[len++] = '*'; buf[len++]=keyInfo.isUse; buf[len++]=keyInfo.type; //协议数据传输 if((keyInfo.type == Can1_1) || (keyInfo.type == Can1_2)||(keyInfo.type == Can2_1) || (keyInfo.type == Can2_2)) { QString idStr; arrayBuf.clear(); //数据转换时奇数个将在后面补0,因此提前处理 if(keyInfo.CANID.length()%2) idStr='0'+keyInfo.CANID; else idStr=keyInfo.CANID; strDeal->StringToHex(idStr,arrayBuf); for(int i=0;i<4;i++) { if(i<(4-arrayBuf.length())) buf[len++] = 0x00; else buf[len++] = arrayBuf[i-(4-arrayBuf.length())]; } arrayBuf.clear(); strDeal->StringToHex(keyInfo.CANDat1,arrayBuf); for(int i=0;i<8;i++) { if(i<arrayBuf.length()) buf[len++] = arrayBuf[i]; else buf[len++] = 0x00; } if((keyInfo.type == Can1_2)||(keyInfo.type == Can2_2)) { arrayBuf.clear(); strDeal->StringToHex(keyInfo.CANDat2,arrayBuf); for(int i=0;i<8;i++) { if(i<arrayBuf.length()) buf[len++] = arrayBuf[i]; else buf[len++] = 0x00; } } } ui->label_Show->setText(tr("下载:按键:")+QString::number(downloadIndex)+" "+keyInfo.name); keyUart->appendTxList(CMDDownloadKey,buf,len,CMD_NEEDACK); } else { if(!isDownLoadLast) { //下发保存指令 cout <<"save keyinfo"; keyUart->appendTxList(CMDSaveKeyInfo,buf,len,CMD_NEEDACK); isDownLoadLast=true; } else { //下载完成 //cout << downloadIndex; ui->label_Show->setText(tr("下载结束,请等待小板保存完成...")); return; } } downloadIndex++; //延时:CmdACKDelay Model_Delay delayDeal; delayDeal.usleep(CmdACKDelay); } } } /************************************************************* /函数功能:CAN波特率转换 /函数参数:字符串 /函数返回:数值 *************************************************************/ uint16_t ResHardware::covCANBaudDeal(QString baud) { uint16_t Dat_temp=0; if(baud=="10K") Dat_temp=10; else if(baud=="20K") Dat_temp=20; else if(baud=="33.3K")Dat_temp=33; else if(baud=="40K") Dat_temp=40; else if(baud=="50K") Dat_temp=50; else if(baud=="80K") Dat_temp=80; else if(baud=="83.3K")Dat_temp=83; else if(baud=="100K") Dat_temp=100; else if(baud=="125K") Dat_temp=125; else if(baud=="200K") Dat_temp=200; else if(baud=="250K") Dat_temp=250; else if(baud=="400K") Dat_temp=400; else if(baud=="500K") Dat_temp=500; else if(baud=="800K") Dat_temp=800; else if(baud=="1M") Dat_temp=1000; return Dat_temp; } QString ResHardware::recovCANBaudDeal(uint16_t baud) { QString Dat_temp=NULL; if(baud==10) Dat_temp="10K"; else if(baud==20) Dat_temp="20K"; else if(baud==33) Dat_temp="33.3K"; else if(baud==40) Dat_temp="40K"; else if(baud==50) Dat_temp="50K"; else if(baud==80) Dat_temp="80K"; else if(baud==83) Dat_temp="83.3K"; else if(baud==100) Dat_temp="100K"; else if(baud==125) Dat_temp="125K"; else if(baud==200) Dat_temp="200K"; else if(baud==250) Dat_temp="250K"; else if(baud==400) Dat_temp="400K"; else if(baud==500) Dat_temp="500K"; else if(baud==800) Dat_temp="800K"; else if(baud==1000) Dat_temp="1M"; return Dat_temp; } /************************************************************* /函数功能:打开或关闭CAN1 /函数参数:checked true :开 false:关 /函数返回:无 /帧结构:Byte0:开/关 Byte1:CAN类型 Byte2~3:CAN波特率 *************************************************************/ void ResHardware::on_checkBoxENCAN1_clicked(bool checked) { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); ui->checkBoxENCAN1->setChecked(!checked); return ; } if(checked) { ui->comboBoxCAN1Baud->setEnabled(false); ui->comboBoxCAN1Type->setEnabled(false); } else { ui->comboBoxCAN1Baud->setEnabled(true); ui->comboBoxCAN1Type->setEnabled(true); } uint16_t CANbaud = covCANBaudDeal(ui->comboBoxCAN1Baud->currentText()); char buf[BUFSIZ]={0}; buf[0] = checked; if(ui->comboBoxCAN1Type->currentIndex()==0)//类型 buf[1]=CAN1CHANNEL; else buf[1]=CANSingle; buf[2]=CANbaud>>8; buf[3]=CANbaud&0x00ff; keyUart->appendTxList(CMDCANChannel,buf,4,CMD_NEEDACK); ui->label_Show->setText(tr("下载:CAN1通道配置")); } /************************************************************* /函数功能:打开或关闭CAN2 /函数参数:checked true :开 false:关 /函数返回:无 /帧结构:Byte0:开/关 Byte1:CAN类型 Byte2~3:CAN波特率 *************************************************************/ void ResHardware::on_checkBoxENCAN2_clicked(bool checked) { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); ui->checkBoxENCAN2->setChecked(!checked); return ; } if(checked) { ui->comboBoxCAN2Baud->setEnabled(false); ui->comboBoxCAN2Type->setEnabled(false); } else { ui->comboBoxCAN2Baud->setEnabled(true); ui->comboBoxCAN2Type->setEnabled(true); } uint16_t CANbaud = covCANBaudDeal(ui->comboBoxCAN2Baud->currentText()); char buf[BUFSIZ]={0}; buf[0] = checked; buf[1] = CAN2CHANNEL; buf[2]=CANbaud>>8; buf[3]=CANbaud&0x00ff; keyUart->appendTxList(CMDCANChannel,buf,4,CMD_NEEDACK); ui->label_Show->setText(tr("下载:CAN2通道配置")); } /************************************************************* /函数功能:读CAN通道配置 /函数参数:wu /函数返回:无 *************************************************************/ void ResHardware::uartReadCANParamDeal() { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); return ; } char read; keyUart->appendTxList(CMDUploadCAN,&read,1,CMD_NEEDNACK); ui->label_Show->setText(tr("读取:CAN参数配置")); } /************************************************************* /函数功能:设置BAT电压值 /函数参数:值 /函数返回:无 /帧结构:Byte0:电压值 *************************************************************/ void ResHardware::on_dialBATValue_valueChanged(int value) { ui->label_ShowBATVal->setText(toStr(value)); if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); return ; } char buf[BUFSIZ]={0}; buf[0] = value; keyUart->appendTxList(CMDBATPower,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("下载:Bat电压值")+toStr(value)); } /************************************************************* /函数功能:设置CCD电压值 /函数参数:值 /函数返回:无 /帧结构:Byte0:电压值 *************************************************************/ void ResHardware::on_dialCCDPowerValue_valueChanged(int value) { ui->label_ShowCCDVal->setText(toStr(value)); if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); return ; } char buf[BUFSIZ]={0}; buf[0] = value; keyUart->appendTxList(CMDCCDPower,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("下载:摄像头电压值")+toStr(value)); } void ResHardware::on_groupBox_CCDPowerEnable_clicked(bool checked) { if(checked) { ui->groupBox_SpeedEnable->setChecked(false); char buf[BUFSIZ]={0}; buf[0] = true; keyUart->appendTxList(CMDTempReverse,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("切换:CCDPower可调")); } } /************************************************************* /函数功能:调节速度 /函数参数:值 /函数返回:无 /帧结构:Byte0:电压值 *************************************************************/ void ResHardware::on_dialSpeedValue_valueChanged(int value) { ui->label_showSpeedVal->setText(toStr(value)); //if(keyUart->isOpenCurrentUart()==false) //{ // QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); // return ; //} char buf[BUFSIZ]={0}; buf[0] = value; keyUart->appendTxList(CMDSpeedVal,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("下载:速度")+toStr(value)); } void ResHardware::on_groupBox_SpeedEnable_clicked(bool checked) { if(checked) { ui->groupBox_CCDPowerEnable->setChecked(false); char buf[BUFSIZ]={0}; buf[0] = false; keyUart->appendTxList(CMDTempReverse,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("切换:速度可调")); } } /************************************************************* /函数功能:设置15V最大电压值 /函数参数:无 /函数返回:无 /帧结构:Byte0:false:15V最大电压;true:24V最大电压 *************************************************************/ void ResHardware::on_radioBtn15V_clicked() { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); ui->radioBtn24V->setChecked(true); return ; } char buf[BUFSIZ]={0}; buf[0] = false; keyUart->appendTxList(CMDBATMaxVal,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("下载:Bat最大工作电压")); ui->dialBATValue->setMaximum(15); ui->dialCCDPowerValue->setMaximum(15); } /************************************************************* /函数功能:设置24V最大电压值 /函数参数:wu /函数返回:无 /帧结构:Byte0:false:15V最大电压;true:24V最大电压 *************************************************************/ void ResHardware::on_radioBtn24V_clicked() { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); ui->radioBtn15V->setChecked(true); return ; } char buf[BUFSIZ]={0}; buf[0] = true; keyUart->appendTxList(CMDBATMaxVal,buf,1,CMD_NEEDACK); ui->label_Show->setText(tr("下载:Bat最大工作电压")); ui->dialBATValue->setMaximum(24); ui->dialCCDPowerValue->setMaximum(24); } /************************************************************* /函数功能:读取当前工作电压 /函数参数:wu /函数返回:无 *************************************************************/ void ResHardware::on_pushBtnReadVB_clicked() { if(keyUart->isOpenCurrentUart()==false) { QMessageBox::warning(NULL, tr("提示"), tr("未打开串口,无法进行下载操作!")); return ; } char buf[BUFSIZ]={0}; buf[0] = true; keyUart->appendTxList(CMDUploadBatVal,buf,1,CMD_NEEDNACK); ui->label_Show->setText(tr("读取当前工作电压...")); } /************************************************************* /函数功能:点击按键操作 /函数参数:无 /函数返回:无 /备注:手动点击按键,用来测试 *************************************************************/ void ResHardware::on_pushButton_KeyClicked_clicked() { char buf[2]={0}; int keyNum = getKeyNumber(ui->comboBoxKeyList->currentText()); if(keyNum != -1) { buf[0] = keyNum;//KEY1 取"1" if(ui->checkBoxONOFF->checkState() == Qt::Checked) buf[1]=1; else buf[1]=0; keyUart->appendTxList(CMDClickedKey,buf,2,CMD_NEEDACK); } } void ResHardware::on_pushBtnHelp_clicked() { QString pdfPath=QFileDialog::getOpenFileName(this , tr("选择项目文件") , "./config/Help" , tr("Text Files(*.pdf)"));//QDir::currentPath()+"/config/Help/ATtool使用说明.pdf"; if(pdfPath.isEmpty()==false) { if(QDesktopServices::openUrl(QUrl::fromLocalFile(pdfPath))==false) { QMessageBox::warning(NULL, tr("提示"), tr("打开文件错误,请重试!")); } } }
[ "lishuhui@roadrover.cn" ]
lishuhui@roadrover.cn
394e50f57f2e56cbcd3778331c6e98bf313cd97d
bef2bd65eb5bda6df245d5f387b85a91543c7875
/ColladaLoader/collada_material.cpp
a055c4f4fd829b9750f6dc8602692a3157fa4c93
[]
no_license
Hasenpfote/ColladaLoader
5f7f0bf0980f37c071796de1b7ef395bf6630021
34ed7e707181042bcc4db111f07e16fb5f479820
refs/heads/master
2021-01-10T19:38:28.725120
2012-06-11T03:21:47
2012-06-11T03:21:47
3,628,284
0
1
null
null
null
null
SHIFT_JIS
C++
false
false
13,393
cpp
#include "crc32.h" #include "collada_material.h" #include "log.h" namespace collada{ extern std::string path; extern void getFilePath(std::string* output, const char* uri); extern void getFileName(std::string* output, const char* filepath); //////////////////////////////////////////////////////////////////////////////// bool VertexInput::load(domInstance_material::domBind_vertex_input* dom_bind_vert_input){ semantic.append(dom_bind_vert_input->getSemantic()); input_semantic.append(dom_bind_vert_input->getInput_semantic()); set = dom_bind_vert_input->getInput_set(); return true; } //////////////////////////////////////////////////////////////////////////////// Material::Sampler::Sampler(){ wrap_s = Wrap_Clamp; wrap_t = Wrap_Clamp; wrap_p = Wrap_Clamp; minfilter = Filter_Linear; magfilter = Filter_Linear; mipfilter = Filter_Linear; } //////////////////////////////////////////////////////////////////////////////// Material::Param::Param(){ type = Param_Color; color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; color[3] = 1.0f; sampler = NULL; } Material::Param::~Param(){ if(sampler) delete sampler; } //////////////////////////////////////////////////////////////////////////////// Material::Material(){ shininess = 0.0f; reflectivity = 0.0f; transparency = 0.0f; index_of_refraction = 0.0f; } Material::~Material(){ cleanup(); } void Material::cleanup(){ VertexInputPtrArray::iterator it = vis.begin(); while(it != vis.end()){ delete (*it); (*it) = NULL; it++; } vis.clear(); if(emission.sampler){ delete emission.sampler; emission.sampler = NULL; } if(ambient.sampler){ delete ambient.sampler; ambient.sampler = NULL; } if(diffuse.sampler){ delete diffuse.sampler; diffuse.sampler = NULL; } if(specular.sampler){ delete specular.sampler; specular.sampler = NULL; } if(reflective.sampler){ delete reflective.sampler; reflective.sampler = NULL; } if(transparent.sampler){ delete transparent.sampler; transparent.sampler = NULL; } shininess = 0.0f; reflectivity = 0.0f; transparency = 0.0f; index_of_refraction = 0.0f; } bool Material::load(domInstance_material* dom_inst_mtrl){ const char* target = dom_inst_mtrl->getTarget().fragment().c_str(); #if 1 daeDatabase* dae_db = dom_inst_mtrl->getDAE()->getDatabase(); // <library_materials> domMaterial* dom_mtrl; if(dae_db->getElement((daeElement**)&dom_mtrl, 0, target, "material") != DAE_OK){ Log_e("element <material> %s not found.\n", target); cleanup(); return false; } domInstance_effect* dom_inst_effect = dom_mtrl->getInstance_effect(); if(!dom_inst_effect){ Log_e("failed to get.\n", target); cleanup(); return false; } // <library_effects> const char* url = dom_inst_effect->getUrl().fragment().c_str(); domEffect* dom_effect; if(dae_db->getElement((daeElement**)&dom_effect, 0, url, "effect") != DAE_OK){ Log_e("element <effect> %s not found.\n", url); cleanup(); return false; } // マテリアルを展開する // 最初に見つかった<profile_COMMON>のみ適用する bool find = false; size_t prof_count = dom_effect->getFx_profile_abstract_array().getCount(); for(size_t i = 0; i < prof_count; i++){ domFx_profile_abstract* dom_fx_abst = dom_effect->getFx_profile_abstract_array().get(i); if(strcmp(dom_fx_abst->getTypeName(), "profile_COMMON") == 0){ domProfile_COMMON* dom_prof_common = dynamic_cast<domProfile_COMMON*>(dom_fx_abst); if(!load(dom_prof_common)){ Log_e("could not load <profile_COMMON>.\n"); cleanup(); return false; } find = true; break; } } if(!find){ Log_e("material not found.\n"); cleanup(); return false; } #endif // <bind_vertex_input> size_t vi_count = dom_inst_mtrl->getBind_vertex_input_array().getCount(); for(size_t i = 0; i < vi_count; i++){ domInstance_material::domBind_vertex_input* dom_bind_vert_input = dom_inst_mtrl->getBind_vertex_input_array().get(i); VertexInput* vi; try{ vi = new VertexInput; } catch(std::bad_alloc& e){ Log_e("could not allocate memory.\n"); cleanup(); return false; } if(!vi->load(dom_bind_vert_input)){ Log_e("could not load VertexInput(%d).\n", i); delete vi; cleanup(); return false; } vis.push_back(vi); } return true; } bool Material::load(const domProfile_COMMON* dom_prof_common){ // for constant shading if(dom_prof_common->getTechnique()->getConstant()) return load(dom_prof_common->getTechnique()->getConstant()); // for lambert shading if(dom_prof_common->getTechnique()->getLambert()) return load(dom_prof_common->getTechnique()->getLambert()); // for phong shading if(dom_prof_common->getTechnique()->getPhong()) return load(dom_prof_common->getTechnique()->getPhong()); // for blinn shading if(dom_prof_common->getTechnique()->getBlinn()) return load(dom_prof_common->getTechnique()->getBlinn()); // error return false; } bool Material::load(const domProfile_COMMON::domTechnique::domConstant* dom_constant){ if(dom_constant->getEmission()) if(!load(&emission, dom_constant->getEmission())) return false; if(dom_constant->getReflective()) if(!load(&reflective, dom_constant->getReflective())) return false; if(dom_constant->getReflectivity()) reflectivity = static_cast<float>(dom_constant->getReflectivity()->getFloat()->getValue()); if(dom_constant->getTransparent()) if(!load(&transparent, dom_constant->getTransparent())) return false; if(dom_constant->getTransparency()) reflectivity = static_cast<float>(dom_constant->getTransparency()->getFloat()->getValue()); if(dom_constant->getIndex_of_refraction()) index_of_refraction = static_cast<float>(dom_constant->getIndex_of_refraction()->getFloat()->getValue()); return true; } bool Material::load(const domProfile_COMMON::domTechnique::domLambert* dom_lambert){ if(dom_lambert->getEmission()) if(!load(&emission, dom_lambert->getEmission())) return false; if(dom_lambert->getAmbient()) if(!load(&ambient, dom_lambert->getAmbient())) return false; if(dom_lambert->getDiffuse()) if(!load(&diffuse, dom_lambert->getDiffuse())) return false; if(dom_lambert->getReflective()) if(!load(&reflective, dom_lambert->getReflective())) return false; if(dom_lambert->getReflectivity()) reflectivity = static_cast<float>(dom_lambert->getReflectivity()->getFloat()->getValue()); if(dom_lambert->getTransparent()) if(!load(&transparent, dom_lambert->getTransparent())) return false; if(dom_lambert->getTransparency()) reflectivity = static_cast<float>(dom_lambert->getTransparency()->getFloat()->getValue()); if(dom_lambert->getIndex_of_refraction()) index_of_refraction = static_cast<float>(dom_lambert->getIndex_of_refraction()->getFloat()->getValue()); return true; } bool Material::load(const domProfile_COMMON::domTechnique::domPhong* dom_phong){ if(dom_phong->getEmission()) if(!load(&emission, dom_phong->getEmission())) return false; if(dom_phong->getAmbient()) if(!load(&ambient, dom_phong->getAmbient())) return false; if(dom_phong->getDiffuse()) if(!load(&diffuse, dom_phong->getDiffuse())) return false; if(dom_phong->getSpecular()) if(!load(&specular, dom_phong->getSpecular())) return false; if(dom_phong->getShininess()) shininess = static_cast<float>(dom_phong->getShininess()->getFloat()->getValue()); if(dom_phong->getReflective()) if(!load(&reflective, dom_phong->getReflective())) return false; if(dom_phong->getReflectivity()) reflectivity = static_cast<float>(dom_phong->getReflectivity()->getFloat()->getValue()); if(dom_phong->getTransparent()) if(!load(&transparent, dom_phong->getTransparent())) return false; if(dom_phong->getTransparency()) reflectivity = static_cast<float>(dom_phong->getTransparency()->getFloat()->getValue()); if(dom_phong->getIndex_of_refraction()) index_of_refraction = static_cast<float>(dom_phong->getIndex_of_refraction()->getFloat()->getValue()); return true; } bool Material::load(const domProfile_COMMON::domTechnique::domBlinn* dom_blinn){ if(dom_blinn->getEmission()) if(!load(&emission, dom_blinn->getEmission())) return false; if(dom_blinn->getAmbient()) if(!load(&ambient, dom_blinn->getAmbient())) return false; if(dom_blinn->getDiffuse()) if(!load(&diffuse, dom_blinn->getDiffuse())) return false; if(dom_blinn->getSpecular()) if(!load(&specular, dom_blinn->getSpecular())) return false; if(dom_blinn->getShininess()) shininess = static_cast<float>(dom_blinn->getShininess()->getFloat()->getValue()); if(dom_blinn->getReflective()) if(!load(&reflective, dom_blinn->getReflective())) return false; if(dom_blinn->getReflectivity()) reflectivity = static_cast<float>(dom_blinn->getReflectivity()->getFloat()->getValue()); if(dom_blinn->getTransparent()) if(!load(&transparent, dom_blinn->getTransparent())) return false; if(dom_blinn->getTransparency()) reflectivity = static_cast<float>(dom_blinn->getTransparency()->getFloat()->getValue()); if(dom_blinn->getIndex_of_refraction()) index_of_refraction = static_cast<float>(dom_blinn->getIndex_of_refraction()->getFloat()->getValue()); return true; } static domCommon_newparam_type* find(const domCommon_newparam_type_Array& dom_common_np_type_array, const char* type){ const size_t count = dom_common_np_type_array.getCount(); for(size_t i = 0; i < count; i++){ if(strcmp(type, dom_common_np_type_array.get(i)->getSid()) == 0) return dom_common_np_type_array.get(i); } return NULL; } bool Material::load(Param* param, const domCommon_color_or_texture_type* dom_common_c_or_t_type){ if(dom_common_c_or_t_type->getColor()){ param->type = Param::Param_Color; param->color[0] = static_cast<float>(dom_common_c_or_t_type->getColor()->getValue().get(0)); param->color[1] = static_cast<float>(dom_common_c_or_t_type->getColor()->getValue().get(1)); param->color[2] = static_cast<float>(dom_common_c_or_t_type->getColor()->getValue().get(2)); param->color[3] = static_cast<float>(dom_common_c_or_t_type->getColor()->getValue().get(3)); } else if(dom_common_c_or_t_type->getTexture()){ param->type = Param::Param_Texture; try{ param->sampler = new Sampler; } catch(std::bad_alloc& e){ Log_e("could not allocate memory.\n"); return false; } const char* sampler = dom_common_c_or_t_type->getTexture()->getTexture(); const char* texcoord = dom_common_c_or_t_type->getTexture()->getTexcoord(); #ifdef DEBUG param->sampler->texture.clear(); param->sampler->texture.append(sampler); param->sampler->texcoord.clear(); param->sampler->texcoord.append(texcoord); #endif // <constant> or <lambert> or <phong> or <blinn> daeElement* dae_elem = const_cast<domCommon_color_or_texture_type*>(dom_common_c_or_t_type)->getParent(); // <technique> dae_elem = dae_elem->getParent(); // <profile_COMMON> dae_elem = dae_elem->getParent(); const domProfile_COMMON* dom_prof_common = dynamic_cast<domProfile_COMMON*>(dae_elem); // <newparam> for <sampler*> domCommon_newparam_type* dom_newparam_type = find(dom_prof_common->getNewparam_array(), sampler); if(!dom_newparam_type) return false; if(!dom_newparam_type->getSampler2D()) // とりあえずSampler2Dのみ return false; if(!dom_newparam_type->getSampler2D()->getSource()) return false; const char* surface = dom_newparam_type->getSampler2D()->getSource()->getValue(); // <newparam> for <surface*> dom_newparam_type = find(dom_prof_common->getNewparam_array(), surface); if(!dom_newparam_type->getSurface()) return false; if(!dom_newparam_type->getSurface()->getFx_surface_init_common()) return false; // テクスチャを1枚制限にしているので最初の要素だけ抜き出す if(!dom_newparam_type->getSurface()->getFx_surface_init_common()->getInit_from_array().getCount()) return false; const char* image = dom_newparam_type->getSurface()->getFx_surface_init_common()->getInit_from_array().get(0)->getValue().getID(); #ifdef DEBUG param->sampler->image.clear(); param->sampler->image.append(image); #endif #if 1 daeDatabase* dae_db = const_cast<domCommon_color_or_texture_type*>(dom_common_c_or_t_type)->getDAE()->getDatabase(); domImage* dom_image; if(dae_db->getElement((daeElement**)&dom_image, 0, image, "image") != DAE_OK){ Log_e("element <image> %s not found.\n", image); return false; } const char* filepath = dom_image->getInit_from()->getValue().getPath(); std::string image_name; getFileName(&image_name, filepath); std::string temp; temp.append(path); temp.append(image_name); param->sampler->image_uid = calcCRC32(reinterpret_cast<const unsigned char*>(temp.c_str())); #endif } return true; } bool Material::load(Param* param, const domCommon_transparent_type* dom_common_trans_type){ if(dom_common_trans_type->getColor()){ param->type = Param::Param_Color; param->color[0] = static_cast<float>(dom_common_trans_type->getColor()->getValue().get(0)); param->color[1] = static_cast<float>(dom_common_trans_type->getColor()->getValue().get(1)); param->color[2] = static_cast<float>(dom_common_trans_type->getColor()->getValue().get(2)); param->color[3] = static_cast<float>(dom_common_trans_type->getColor()->getValue().get(3)); } else if(dom_common_trans_type->getTexture()){ param->type = Param::Param_Texture; // ToDo: } return true; } } // namespace collada
[ "Hasenpfote36@gmail.com" ]
Hasenpfote36@gmail.com
ad21eb57eefce19039a2a8402cd814e37fc7d8d4
9dc1571734cc1da70668a31f86bfd1dd9bc1320b
/zlibrary/ui/src/gtk/pixbuf/ZLGtkPixbufHack.cpp
9a73f151a1bb8fabc91d45b3e02769b5e1278982
[]
no_license
vSlipenchuk/fbreader_touch_dic
e3868b0175e6677393cc34fb6429d5e102735ed7
4ae38d0cad34138b1819045d90d06b7631fe5e66
refs/heads/master
2022-08-20T13:11:10.387521
2020-05-30T18:30:43
2020-05-30T18:30:43
268,138,437
0
0
null
null
null
null
UTF-8
C++
false
false
4,614
cpp
/* * Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #include "ZLGtkPixbufHack.h" #include <string.h> // // pixbuf rotation // (copied from gqview) // static void pixbuf_copy_block_rotate(guchar *src, gint src_row_stride, gint x, gint y, guchar *dest, gint dest_row_stride, gint w, gint h, gint bytes_per_pixel, bool counter_clockwise) { gint i, j; guchar *sp; guchar *dp; for (i = 0; i < h; ++i) { sp = src + ((i + y) * src_row_stride) + (x * bytes_per_pixel); for (j = 0; j < w; ++j) { if (counter_clockwise) { dp = dest + ((w - j - 1) * dest_row_stride) + (i * bytes_per_pixel); } else { dp = dest + (j * dest_row_stride) + ((h - i - 1) * bytes_per_pixel); } *(dp++) = *(sp++); /* r */ *(dp++) = *(sp++); /* g */ *(dp++) = *(sp++); /* b */ if (bytes_per_pixel == 4) *(dp) = *(sp++); /* a */ } } } static void pixbuf_copy_block(guchar *src, gint src_row_stride, gint w, gint h, guchar *dest, gint dest_row_stride, gint x, gint y, gint bytes_per_pixel) { gint i; guchar *sp; guchar *dp; for (i = 0; i < h; ++i) { sp = src + (i * src_row_stride); dp = dest + ((y + i) * dest_row_stride) + (x * bytes_per_pixel); memcpy(dp, sp, w * bytes_per_pixel); } } #define ROTATE_BUFFER_WIDTH 24 #define ROTATE_BUFFER_HEIGHT 24 /* * Returns a copy of pixbuf src rotated 90 degrees clockwise or 90 counterclockwise */ void rotate90(GdkPixbuf *dest, const GdkPixbuf *src, bool counter_clockwise) { gint has_alpha; gint sw, sh, srs; gint drs; guchar *s_pix; guchar *d_pix; gint i, j; gint a; GdkPixbuf *buffer; guchar *b_pix; gint brs; gint w, h; if (src == 0) return; sw = gdk_pixbuf_get_width(src); sh = gdk_pixbuf_get_height(src); has_alpha = gdk_pixbuf_get_has_alpha(src); srs = gdk_pixbuf_get_rowstride(src); s_pix = gdk_pixbuf_get_pixels(src); drs = gdk_pixbuf_get_rowstride(dest); d_pix = gdk_pixbuf_get_pixels(dest); a = (has_alpha ? 4 : 3); buffer = gdk_pixbuf_new(GDK_COLORSPACE_RGB, has_alpha, 8, ROTATE_BUFFER_WIDTH, ROTATE_BUFFER_HEIGHT); b_pix = gdk_pixbuf_get_pixels(buffer); brs = gdk_pixbuf_get_rowstride(buffer); for (i = 0; i < sh; i+= ROTATE_BUFFER_WIDTH) { w = MIN(ROTATE_BUFFER_WIDTH, sh - i); for (j = 0; j < sw; j += ROTATE_BUFFER_HEIGHT) { gint x, y; h = MIN(ROTATE_BUFFER_HEIGHT, sw - j); pixbuf_copy_block_rotate(s_pix, srs, j, i, b_pix, brs, h, w, a, counter_clockwise); if (counter_clockwise) { x = i; y = sw - h - j; } else { x = sh - w - i; y = j; } pixbuf_copy_block(b_pix, brs, w, h, d_pix, drs, x, y, a); } } gdk_pixbuf_unref(buffer); } void rotate180(GdkPixbuf *buffer) { if (buffer == 0) return; const gint width = gdk_pixbuf_get_width(buffer); if (width <= 1) { return; } const gint height = gdk_pixbuf_get_height(buffer); const gint brs = gdk_pixbuf_get_rowstride(buffer); guchar *s_pix = gdk_pixbuf_get_pixels(buffer); guchar *d_pix = s_pix + (height - 1) * brs; const gint a = gdk_pixbuf_get_has_alpha(buffer) ? 4 : 3; guchar * const sbuf = new guchar[width * a]; guchar * const dbuf = new guchar[width * a]; guchar * const tmp = new guchar[a]; while (s_pix < d_pix) { memcpy(sbuf, s_pix, width * a); memcpy(dbuf, d_pix, width * a); guchar *s = sbuf; guchar *d = dbuf + (width - 1) * a; for (int i = 0; i < width; ++i) { memcpy(tmp, s, a); memcpy(s, d, a); memcpy(d, tmp, a); s += a; d -= a; } memcpy(s_pix, sbuf, width * a); memcpy(d_pix, dbuf, width * a); s_pix += brs; d_pix -= brs; } if (s_pix == d_pix) { memcpy(sbuf, s_pix, width * a); guchar *s = sbuf; guchar *d = sbuf + (width - 1) * a; while (s < d) { memcpy(tmp, s, a); memcpy(s, d, a); memcpy(d, tmp, a); s += a; d -= a; } memcpy(s_pix, sbuf, width * a); } delete[] sbuf; delete[] dbuf; delete[] tmp; } // vim:ts=2:sw=2:noet
[ "vslipenchuk@gmail.com" ]
vslipenchuk@gmail.com
49147aa1f293c92b6fcd182ec698c53c7b83e3ec
f0ee987789f5a6fe8f104890e95ee56e53f5b9b2
/pythia-0.8/packages/journal/libjournal/Entry.h
b4eaf00ddb24549ad21fd1384ecd8e04ed23ead3
[]
no_license
echoi/Coupling_SNAC_CHILD
457c01adc439e6beb257ac8a33915d5db9a5591b
b888c668084a3172ffccdcc5c4b8e7fff7c503f2
refs/heads/master
2021-01-01T18:34:00.403660
2015-10-26T13:48:18
2015-10-26T13:48:18
19,891,618
1
2
null
null
null
null
UTF-8
C++
false
false
1,601
h
// -*- C++ -*- // //-------------------------------------------------------------------------------- // // Michael A.G. Aivazis // California Institute of Technology // (C) 1998-2005 All Rights Reserved // // <LicenseText> // //-------------------------------------------------------------------------------- // #if !defined(journal_Entry_h) #define journal_Entry_h // forward declarations namespace journal { class Entry; } // class journal::Entry { // types public: typedef std::string string_t; typedef std::vector<string_t> page_t; typedef std::map<string_t, string_t> meta_t; // interface public: inline void newline(string_t text); inline size_t lines() const; inline page_t::const_iterator lineEnd() const; inline page_t::const_iterator lineBegin() const; inline string_t & operator[](string_t key); inline string_t operator[](string_t key) const; inline meta_t::const_iterator metaEnd() const; inline meta_t::const_iterator metaBegin() const; static inline void defaultAttributes(const meta_t & settings); // meta-methods public: virtual ~Entry(); inline Entry(); // disable these private: Entry(const Entry &); const Entry & operator=(const Entry &); // data private: meta_t _meta; page_t _text; static meta_t _defaults; }; #endif // get the inline definitions #define journal_Entry_icc #include "Entry.icc" #undef journal_Entry_icc // version // $Id: Entry.h,v 1.1.1.1 2005/03/08 16:13:56 aivazis Exp $ // End of file
[ "echoi2@memphis.edu" ]
echoi2@memphis.edu
c8df05b500ae3559f0dbff924754e0c896546545
241ac4849e1f89d90b232766e2d5102edfa92512
/fpm/src/folly-0.47.0/folly/wangle/concurrent/CPUThreadPoolExecutor.cpp
864bd3a1dfb112d685098aad95fb44a03990048a
[ "Apache-2.0" ]
permissive
didip/mcrouter-util
0a27a9fafc486aaa0651e5ddf6a24b881dbf85c2
cdb3baff7ab94ae27c3b2f14c164be16ff8b5c0e
refs/heads/master
2023-03-25T09:42:45.715776
2015-06-24T23:26:50
2015-06-24T23:26:50
38,016,503
1
5
null
null
null
null
UTF-8
C++
false
false
4,535
cpp
/* * Copyright 2015 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <folly/wangle/concurrent/CPUThreadPoolExecutor.h> #include <folly/wangle/concurrent/PriorityLifoSemMPMCQueue.h> namespace folly { namespace wangle { const size_t CPUThreadPoolExecutor::kDefaultMaxQueueSize = 1 << 14; CPUThreadPoolExecutor::CPUThreadPoolExecutor( size_t numThreads, std::unique_ptr<BlockingQueue<CPUTask>> taskQueue, std::shared_ptr<ThreadFactory> threadFactory) : ThreadPoolExecutor(numThreads, std::move(threadFactory)), taskQueue_(std::move(taskQueue)) { addThreads(numThreads); CHECK(threadList_.get().size() == numThreads); } CPUThreadPoolExecutor::CPUThreadPoolExecutor( size_t numThreads, std::shared_ptr<ThreadFactory> threadFactory) : CPUThreadPoolExecutor( numThreads, folly::make_unique<LifoSemMPMCQueue<CPUTask>>( CPUThreadPoolExecutor::kDefaultMaxQueueSize), std::move(threadFactory)) {} CPUThreadPoolExecutor::CPUThreadPoolExecutor(size_t numThreads) : CPUThreadPoolExecutor( numThreads, std::make_shared<NamedThreadFactory>("CPUThreadPool")) {} CPUThreadPoolExecutor::CPUThreadPoolExecutor( size_t numThreads, int8_t numPriorities, std::shared_ptr<ThreadFactory> threadFactory) : CPUThreadPoolExecutor( numThreads, folly::make_unique<PriorityLifoSemMPMCQueue<CPUTask>>( numPriorities, CPUThreadPoolExecutor::kDefaultMaxQueueSize), std::move(threadFactory)) {} CPUThreadPoolExecutor::CPUThreadPoolExecutor( size_t numThreads, int8_t numPriorities, size_t maxQueueSize, std::shared_ptr<ThreadFactory> threadFactory) : CPUThreadPoolExecutor( numThreads, folly::make_unique<PriorityLifoSemMPMCQueue<CPUTask>>( numPriorities, maxQueueSize), std::move(threadFactory)) {} CPUThreadPoolExecutor::~CPUThreadPoolExecutor() { stop(); CHECK(threadsToStop_ == 0); } void CPUThreadPoolExecutor::add(Func func) { add(std::move(func), std::chrono::milliseconds(0)); } void CPUThreadPoolExecutor::add( Func func, std::chrono::milliseconds expiration, Func expireCallback) { // TODO handle enqueue failure, here and in other add() callsites taskQueue_->add( CPUTask(std::move(func), expiration, std::move(expireCallback))); } void CPUThreadPoolExecutor::addWithPriority(Func func, int8_t priority) { add(std::move(func), priority, std::chrono::milliseconds(0)); } void CPUThreadPoolExecutor::add( Func func, int8_t priority, std::chrono::milliseconds expiration, Func expireCallback) { CHECK(getNumPriorities() > 0); taskQueue_->addWithPriority( CPUTask(std::move(func), expiration, std::move(expireCallback)), priority); } uint8_t CPUThreadPoolExecutor::getNumPriorities() const { return taskQueue_->getNumPriorities(); } BlockingQueue<CPUThreadPoolExecutor::CPUTask>* CPUThreadPoolExecutor::getTaskQueue() { return taskQueue_.get(); } void CPUThreadPoolExecutor::threadRun(std::shared_ptr<Thread> thread) { thread->startupBaton.post(); while (1) { auto task = taskQueue_->take(); if (UNLIKELY(task.poison)) { CHECK(threadsToStop_-- > 0); for (auto& o : observers_) { o->threadStopped(thread.get()); } stoppedThreads_.add(thread); return; } else { runTask(thread, std::move(task)); } if (UNLIKELY(threadsToStop_ > 0 && !isJoin_)) { if (--threadsToStop_ >= 0) { stoppedThreads_.add(thread); return; } else { threadsToStop_++; } } } } void CPUThreadPoolExecutor::stopThreads(size_t n) { CHECK(stoppedThreads_.size() == 0); threadsToStop_ = n; for (size_t i = 0; i < n; i++) { taskQueue_->addWithPriority(CPUTask(), Executor::LO_PRI); } } uint64_t CPUThreadPoolExecutor::getPendingTaskCount() { return taskQueue_->size(); } }} // folly::wangle
[ "didip@newrelic.com" ]
didip@newrelic.com
274af613ef10dc3aa2c5b3454601a10629f3a2ca
b1aef802c0561f2a730ac3125c55325d9c480e45
/src/test/core/Coroutine_test.cpp
73f99241970cc534ecdbfe5566090988c221d417
[]
no_license
sgy-official/sgy
d3f388cefed7cf20513c14a2a333c839aa0d66c6
8c5c356c81b24180d8763d3bbc0763f1046871ac
refs/heads/master
2021-05-19T07:08:54.121998
2020-03-31T11:08:16
2020-03-31T11:08:16
251,577,856
6
4
null
null
null
null
UTF-8
C++
false
false
3,993
cpp
#include <ripple/core/JobQueue.h> #include <test/jtx.h> #include <chrono> #include <condition_variable> #include <mutex> namespace ripple { namespace test { class Coroutine_test : public beast::unit_test::suite { public: class gate { private: std::condition_variable cv_; std::mutex mutex_; bool signaled_ = false; public: template <class Rep, class Period> bool wait_for(std::chrono::duration<Rep, Period> const& rel_time) { std::unique_lock<std::mutex> lk(mutex_); auto b = cv_.wait_for(lk, rel_time, [=]{ return signaled_; }); signaled_ = false; return b; } void signal() { std::lock_guard<std::mutex> lk(mutex_); signaled_ = true; cv_.notify_all(); } }; void correct_order() { using namespace std::chrono_literals; using namespace jtx; Env env(*this); auto& jq = env.app().getJobQueue(); jq.setThreadCount(0, false); gate g1, g2; std::shared_ptr<JobQueue::Coro> c; jq.postCoro(jtCLIENT, "Coroutine-Test", [&](auto const& cr) { c = cr; g1.signal(); c->yield(); g2.signal(); }); BEAST_EXPECT(g1.wait_for(5s)); c->join(); c->post(); BEAST_EXPECT(g2.wait_for(5s)); } void incorrect_order() { using namespace std::chrono_literals; using namespace jtx; Env env(*this); auto& jq = env.app().getJobQueue(); jq.setThreadCount(0, false); gate g; jq.postCoro(jtCLIENT, "Coroutine-Test", [&](auto const& c) { c->post(); c->yield(); g.signal(); }); BEAST_EXPECT(g.wait_for(5s)); } void thread_specific_storage() { using namespace std::chrono_literals; using namespace jtx; Env env(*this); auto& jq = env.app().getJobQueue(); jq.setThreadCount(0, true); static int const N = 4; std::array<std::shared_ptr<JobQueue::Coro>, N> a; LocalValue<int> lv(-1); BEAST_EXPECT(*lv == -1); gate g; jq.addJob(jtCLIENT, "LocalValue-Test", [&](auto const& job) { this->BEAST_EXPECT(*lv == -1); *lv = -2; this->BEAST_EXPECT(*lv == -2); g.signal(); }); BEAST_EXPECT(g.wait_for(5s)); BEAST_EXPECT(*lv == -1); for(int i = 0; i < N; ++i) { jq.postCoro(jtCLIENT, "Coroutine-Test", [&, id = i](auto const& c) { a[id] = c; g.signal(); c->yield(); this->BEAST_EXPECT(*lv == -1); *lv = id; this->BEAST_EXPECT(*lv == id); g.signal(); c->yield(); this->BEAST_EXPECT(*lv == id); }); BEAST_EXPECT(g.wait_for(5s)); a[i]->join(); } for(auto const& c : a) { c->post(); BEAST_EXPECT(g.wait_for(5s)); c->join(); } for(auto const& c : a) { c->post(); c->join(); } jq.addJob(jtCLIENT, "LocalValue-Test", [&](auto const& job) { this->BEAST_EXPECT(*lv == -2); g.signal(); }); BEAST_EXPECT(g.wait_for(5s)); BEAST_EXPECT(*lv == -1); } void run() override { correct_order(); incorrect_order(); thread_specific_storage(); } }; BEAST_DEFINE_TESTSUITE(Coroutine,core,ripple); } }
[ "sgy-official@hotmail.com" ]
sgy-official@hotmail.com
3bf0dd22044290da7ab782d1e815aa7e080991c0
5400318df9dfa5f644ae0fc0988f5b7c2d756df6
/2017-07-25/this_point/this_point/main.cpp
6dbfd760b6cf5f0a48cd3ad6d0db5e8e3d9d00de
[]
no_license
Gno-GH/c_add_study
a39ca99e883770e74ce080b6bd603e24b311e8de
f466ecd133970ce54126b0f701874dc0b5951687
refs/heads/master
2020-12-03T00:44:17.753798
2017-09-20T12:18:55
2017-09-20T12:18:55
96,073,216
0
0
null
null
null
null
UTF-8
C++
false
false
931
cpp
// // main.cpp // this_point // // Created by Gno on 2017/7/25. // Copyright © 2017年 Gno. All rights reserved. // #include <iostream> using namespace std; class Person { public: int m_Age; mutable int m_Con; Person(int age):m_Con(age) { this->m_Age = age; } Person& addPlus(const Person &p) { this->m_Age += p.m_Age; return *this; } bool compareAge(const Person& p) { return this->m_Age == p.m_Age; } void showCon() const { cout<<"m_Con = "<<this->m_Con<<endl; } }; bool isByCompareAge(const Person &p1,const Person&p2) { return p1.m_Age == p2.m_Age; } int main(int argc, const char * argv[]) { Person p1(10); Person p2(10); if(isByCompareAge(p1, p2)) cout<<"年龄相同"<<endl; else cout<<"年龄不相同"<<endl; p1.addPlus(p2).addPlus(p2); cout<<p1.m_Age<<endl; return 0; }
[ "gno@Gno.local" ]
gno@Gno.local
8bf224d4242c3c2ef47caaa7d9cc854a69014a60
4bc7102c8dbd1d7f272a70451ee88299c5c0b188
/irrlicht_android/src/main/cpp/include/SMaterial.h
962f37877cbbe83377d020703ce45100e27e9d6d
[]
no_license
vell001/irrlicht-android
3d81a7f07548a49966414aec4f7ae9a6f82ed49d
bd6d36b20d16e278c6443beac37904091af2fc46
refs/heads/master
2021-06-25T21:43:49.825186
2020-12-16T07:57:59
2020-12-16T07:57:59
178,854,734
1
0
null
null
null
null
UTF-8
C++
false
false
27,567
h
// Copyright (C) 2002-2012 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __S_MATERIAL_H_INCLUDED__ #define __S_MATERIAL_H_INCLUDED__ #include "SColor.h" #include "matrix4.h" #include "irrArray.h" #include "irrMath.h" #include "EMaterialTypes.h" #include "EMaterialFlags.h" #include "SMaterialLayer.h" namespace irr { namespace video { class ITexture; //! Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor enum E_BLEND_FACTOR { EBF_ZERO = 0, //!< src & dest (0, 0, 0, 0) EBF_ONE, //!< src & dest (1, 1, 1, 1) EBF_DST_COLOR, //!< src (destR, destG, destB, destA) EBF_ONE_MINUS_DST_COLOR, //!< src (1-destR, 1-destG, 1-destB, 1-destA) EBF_SRC_COLOR, //!< dest (srcR, srcG, srcB, srcA) EBF_ONE_MINUS_SRC_COLOR, //!< dest (1-srcR, 1-srcG, 1-srcB, 1-srcA) EBF_SRC_ALPHA, //!< src & dest (srcA, srcA, srcA, srcA) EBF_ONE_MINUS_SRC_ALPHA, //!< src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA) EBF_DST_ALPHA, //!< src & dest (destA, destA, destA, destA) EBF_ONE_MINUS_DST_ALPHA, //!< src & dest (1-destA, 1-destA, 1-destA, 1-destA) EBF_SRC_ALPHA_SATURATE //!< src (min(srcA, 1-destA), idem, ...) }; //! Values defining the blend operation enum E_BLEND_OPERATION { EBO_NONE = 0, //!< No blending happens EBO_ADD, //!< Default blending adds the color values EBO_SUBTRACT, //!< This mode subtracts the color values EBO_REVSUBTRACT,//!< This modes subtracts destination from source EBO_MIN, //!< Choose minimum value of each color channel EBO_MAX, //!< Choose maximum value of each color channel EBO_MIN_FACTOR, //!< Choose minimum value of each color channel after applying blend factors, not widely supported EBO_MAX_FACTOR, //!< Choose maximum value of each color channel after applying blend factors, not widely supported EBO_MIN_ALPHA, //!< Choose minimum value of each color channel based on alpha value, not widely supported EBO_MAX_ALPHA //!< Choose maximum value of each color channel based on alpha value, not widely supported }; //! MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X enum E_MODULATE_FUNC { EMFN_MODULATE_1X = 1, EMFN_MODULATE_2X = 2, EMFN_MODULATE_4X = 4 }; //! Comparison function, e.g. for depth buffer test enum E_COMPARISON_FUNC { //! Depth test disabled (disable also write to depth buffer) ECFN_DISABLED=0, //! <= test, default for e.g. depth test ECFN_LESSEQUAL=1, //! Exact equality ECFN_EQUAL=2, //! exclusive less comparison, i.e. < ECFN_LESS, //! Succeeds almost always, except for exact equality ECFN_NOTEQUAL, //! >= test ECFN_GREATEREQUAL, //! inverse of <= ECFN_GREATER, //! test succeeds always ECFN_ALWAYS, //! Test never succeeds ECFN_NEVER }; //! Enum values for enabling/disabling color planes for rendering enum E_COLOR_PLANE { //! No color enabled ECP_NONE=0, //! Alpha enabled ECP_ALPHA=1, //! Red enabled ECP_RED=2, //! Green enabled ECP_GREEN=4, //! Blue enabled ECP_BLUE=8, //! All colors, no alpha ECP_RGB=14, //! All planes enabled ECP_ALL=15 }; //! Source of the alpha value to take /** This is currently only supported in EMT_ONETEXTURE_BLEND. You can use an or'ed combination of values. Alpha values are modulated (multiplied). */ enum E_ALPHA_SOURCE { //! Use no alpha, somewhat redundant with other settings EAS_NONE=0, //! Use vertex color alpha EAS_VERTEX_COLOR, //! Use texture alpha channel EAS_TEXTURE }; //! Pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam or BlendFactor /** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */ inline f32 pack_textureBlendFunc(const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE) { const u32 tmp = (alphaSource << 20) | (modulate << 16) | (srcFact << 12) | (dstFact << 8) | (srcFact << 4) | dstFact; return FR(tmp); } //! Pack srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, Modulate and alpha source to MaterialTypeParam or BlendFactor /** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */ inline f32 pack_textureBlendFuncSeparate(const E_BLEND_FACTOR srcRGBFact, const E_BLEND_FACTOR dstRGBFact, const E_BLEND_FACTOR srcAlphaFact, const E_BLEND_FACTOR dstAlphaFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE) { const u32 tmp = (alphaSource << 20) | (modulate << 16) | (srcAlphaFact << 12) | (dstAlphaFact << 8) | (srcRGBFact << 4) | dstRGBFact; return FR(tmp); } //! Unpack srcFact, dstFact, modulo and alphaSource factors /** The fields don't use the full byte range, so we could pack even more... */ inline void unpack_textureBlendFunc(E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact, E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param) { const u32 state = IR(param); alphaSource = (state & 0x00F00000) >> 20; modulo = E_MODULATE_FUNC( ( state & 0x000F0000 ) >> 16 ); srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 ); dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) ); } //! Unpack srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulo and alphaSource factors /** The fields don't use the full byte range, so we could pack even more... */ inline void unpack_textureBlendFuncSeparate(E_BLEND_FACTOR &srcRGBFact, E_BLEND_FACTOR &dstRGBFact, E_BLEND_FACTOR &srcAlphaFact, E_BLEND_FACTOR &dstAlphaFact, E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param) { const u32 state = IR(param); alphaSource = (state & 0x00F00000) >> 20; modulo = E_MODULATE_FUNC( ( state & 0x000F0000 ) >> 16 ); srcAlphaFact = E_BLEND_FACTOR ( ( state & 0x0000F000 ) >> 12 ); dstAlphaFact = E_BLEND_FACTOR ( ( state & 0x00000F00 ) >> 8 ); srcRGBFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 ); dstRGBFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) ); } //! has blend factor alphablending inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor ) { switch ( factor ) { case EBF_SRC_ALPHA: case EBF_ONE_MINUS_SRC_ALPHA: case EBF_DST_ALPHA: case EBF_ONE_MINUS_DST_ALPHA: case EBF_SRC_ALPHA_SATURATE: return true; default: return false; } } //! These flags are used to specify the anti-aliasing and smoothing modes /** Techniques supported are multisampling, geometry smoothing, and alpha to coverage. Some drivers don't support a per-material setting of the anti-aliasing modes. In those cases, FSAA/multisampling is defined by the device mode chosen upon creation via irr::SIrrCreationParameters. */ enum E_ANTI_ALIASING_MODE { //! Use to turn off anti-aliasing for this material EAAM_OFF=0, //! Default anti-aliasing mode EAAM_SIMPLE=1, //! High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode EAAM_QUALITY=3, //! Line smoothing //! Careful, enabling this can lead to software emulation under OpenGL EAAM_LINE_SMOOTH=4, //! point smoothing, often in software and slow, only with OpenGL EAAM_POINT_SMOOTH=8, //! All typical anti-alias and smooth modes EAAM_FULL_BASIC=15, //! Enhanced anti-aliasing for transparent materials /** Usually used with EMT_TRANSPARENT_ALPHA_REF and multisampling. */ EAAM_ALPHA_TO_COVERAGE=16 }; //! These flags allow to define the interpretation of vertex color when lighting is enabled /** Without lighting being enabled the vertex color is the only value defining the fragment color. Once lighting is enabled, the four values for diffuse, ambient, emissive, and specular take over. With these flags it is possible to define which lighting factor shall be defined by the vertex color instead of the lighting factor which is the same for all faces of that material. The default is to use vertex color for the diffuse value, another pretty common value is to use vertex color for both diffuse and ambient factor. */ enum E_COLOR_MATERIAL { //! Don't use vertex color for lighting ECM_NONE=0, //! Use vertex color for diffuse light, this is default ECM_DIFFUSE, //! Use vertex color for ambient light ECM_AMBIENT, //! Use vertex color for emissive light ECM_EMISSIVE, //! Use vertex color for specular light ECM_SPECULAR, //! Use vertex color for both diffuse and ambient light ECM_DIFFUSE_AND_AMBIENT }; //! Flags for the definition of the polygon offset feature /** These flags define whether the offset should be into the screen, or towards the eye. */ enum E_POLYGON_OFFSET { //! Push pixel towards the far plane, away from the eye /** This is typically used for rendering inner areas. */ EPO_BACK=0, //! Pull pixels towards the camera. /** This is typically used for polygons which should appear on top of other elements, such as decals. */ EPO_FRONT=1 }; //! Names for polygon offset direction const c8* const PolygonOffsetDirectionNames[] = { "Back", "Front", 0 }; //! Fine-tuning for SMaterial.ZWriteFineControl enum E_ZWRITE_FINE_CONTROL { //! Default. Only write zbuffer when When SMaterial::ZBuffer is true and SMaterial::isTransparent() returns false. EZI_ONLY_NON_TRANSPARENT, //! Writing will just be based on SMaterial::ZBuffer value, transparency is ignored. //! Needed mostly for certain shader materials as SMaterial::isTransparent will always return false for those. EZI_ZBUFFER_FLAG }; //! Maximum number of texture an SMaterial can have. /** SMaterial might ignore some textures in most function, like assignment and comparison, when SIrrlichtCreationParameters::MaxTextureUnits is set to a lower number. */ const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_; //! By default this is identical to MATERIAL_MAX_TEXTURES /** Users can modify this value if they are certain they don't need all available textures per material in their application. For example if you never need more than 2 textures per material you can set this to 2. We (mostly) avoid dynamic memory in SMaterial, so the extra memory will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the material comparisons and assignments can be faster. Also several other places in the engine can be faster when reducing this value to the limit you need. NOTE: This should only be changed once and before any call to createDevice. NOTE: Do not set it below 1 or above the value of _IRR_MATERIAL_MAX_TEXTURES_. NOTE: Going below 4 is usually not worth it. */ IRRLICHT_API extern u32 MATERIAL_MAX_TEXTURES_USED; //! Struct for holding parameters for a material renderer // Note for implementors: Serialization is in CNullDriver class SMaterial { public: //! Default constructor. Creates a solid, lit material with white colors SMaterial() : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255), EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255), Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f), ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f), PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT), Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false), NormalizeNormals(false), UseMipMaps(true), ZWriteFineControl(EZI_ONLY_NON_TRANSPARENT) { } //! Copy constructor /** \param other Material to copy from. */ SMaterial(const SMaterial& other) { // These pointers are checked during assignment for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) TextureLayer[i].TextureMatrix = 0; *this = other; } //! Assignment operator /** \param other Material to copy from. */ SMaterial& operator=(const SMaterial& other) { // Check for self-assignment! if (this == &other) return *this; MaterialType = other.MaterialType; AmbientColor = other.AmbientColor; DiffuseColor = other.DiffuseColor; EmissiveColor = other.EmissiveColor; SpecularColor = other.SpecularColor; Shininess = other.Shininess; MaterialTypeParam = other.MaterialTypeParam; MaterialTypeParam2 = other.MaterialTypeParam2; Thickness = other.Thickness; for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) { TextureLayer[i] = other.TextureLayer[i]; } Wireframe = other.Wireframe; PointCloud = other.PointCloud; GouraudShading = other.GouraudShading; Lighting = other.Lighting; ZWriteEnable = other.ZWriteEnable; BackfaceCulling = other.BackfaceCulling; FrontfaceCulling = other.FrontfaceCulling; FogEnable = other.FogEnable; NormalizeNormals = other.NormalizeNormals; ZBuffer = other.ZBuffer; AntiAliasing = other.AntiAliasing; ColorMask = other.ColorMask; ColorMaterial = other.ColorMaterial; BlendOperation = other.BlendOperation; BlendFactor = other.BlendFactor; PolygonOffsetFactor = other.PolygonOffsetFactor; PolygonOffsetDirection = other.PolygonOffsetDirection; UseMipMaps = other.UseMipMaps; ZWriteFineControl = other.ZWriteFineControl; return *this; } //! Texture layer array. SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]; //! Type of the material. Specifies how everything is blended together E_MATERIAL_TYPE MaterialType; //! How much ambient light (a global light) is reflected by this material. /** The default is full white, meaning objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light effects. */ SColor AmbientColor; //! How much diffuse light coming from a light source is reflected by this material. /** The default is full white. */ SColor DiffuseColor; //! Light emitted by this material. Default is to emit no light. SColor EmissiveColor; //! How much specular light (highlights from a light) is reflected. /** The default is to reflect white specular light. See SMaterial::Shininess on how to enable specular lights. */ SColor SpecularColor; //! Value affecting the size of specular highlights. /** A value of 20 is common. If set to 0, no specular highlights are being used. To activate, simply set the shininess of a material to a value in the range [0.5;128]: \code sceneNode->getMaterial(0).Shininess = 20.0f; \endcode You can change the color of the highlights using \code sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255); \endcode The specular color of the dynamic lights (SLight::SpecularColor) will influence the the highlight color too, but they are set to a useful value by default when creating the light scene node. Here is a simple example on how to use specular highlights: \code // load and display mesh scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( smgr->getMesh("data/faerie.md2")); node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights // add white light scene::ILightSceneNode* light = smgr->addLightSceneNode(0, core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f)); \endcode */ f32 Shininess; //! Free parameter, dependent on the material type. /** Mostly ignored, used for example in EMT_PARALLAX_MAP_SOLID and EMT_TRANSPARENT_ALPHA_CHANNEL. */ f32 MaterialTypeParam; //! Second free parameter, dependent on the material type. /** Mostly ignored. */ f32 MaterialTypeParam2; //! Thickness of non-3dimensional elements such as lines and points. f32 Thickness; //! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL /** If you want to disable depth test for this material just set this parameter to ECFN_DISABLED. Values are from E_COMPARISON_FUNC. */ u8 ZBuffer; //! Sets the antialiasing mode /** Values are chosen from E_ANTI_ALIASING_MODE. Default is EAAM_SIMPLE, i.e. simple multi-sample anti-aliasing. */ u8 AntiAliasing; //! Defines the enabled color planes /** Values are defined as or'ed values of the E_COLOR_PLANE enum. Only enabled color planes will be rendered to the current render target. Typical use is to disable all colors when rendering only to depth or stencil buffer, or using Red and Green for Stereo rendering. */ u8 ColorMask:4; //! Defines the interpretation of vertex color in the lighting equation /** Values should be chosen from E_COLOR_MATERIAL. When lighting is enabled, vertex color can be used instead of the material values for light modulation. This allows to easily change e.g. the diffuse light behavior of each face. The default, ECM_DIFFUSE, will result in a very similar rendering as with lighting turned off, just with light shading. */ u8 ColorMaterial:3; //! Store the blend operation of choice /** Values to be chosen from E_BLEND_OPERATION. */ E_BLEND_OPERATION BlendOperation:4; //! Store the blend factors /** textureBlendFunc/textureBlendFuncSeparate functions should be used to write properly blending factors to this parameter. If you use EMT_ONETEXTURE_BLEND type for this material, this field should be equal to MaterialTypeParam. */ f32 BlendFactor; //! Factor specifying how far the polygon offset should be made /** Specifying 0 disables the polygon offset. The direction is specified separately. The factor can be from 0 to 7.*/ u8 PolygonOffsetFactor:3; //! Flag defining the direction the polygon offset is applied to. /** Can be to front or to back, specified by values from E_POLYGON_OFFSET. */ E_POLYGON_OFFSET PolygonOffsetDirection:1; //! Draw as wireframe or filled triangles? Default: false /** The user can access a material flag using \code material.Wireframe=true \endcode or \code material.setFlag(EMF_WIREFRAME, true); \endcode */ bool Wireframe:1; //! Draw as point cloud or filled triangles? Default: false bool PointCloud:1; //! Flat or Gouraud shading? Default: true bool GouraudShading:1; //! Will this material be lighted? Default: true bool Lighting:1; //! Is the zbuffer writeable or is it read-only. Default: true. /** This flag is forced to false if the MaterialType is a transparent type and the scene parameter ALLOW_ZWRITE_ON_TRANSPARENT is not set. If you set this parameter to true, make sure that ZBuffer value is other than ECFN_DISABLED */ bool ZWriteEnable:1; //! Is backface culling enabled? Default: true bool BackfaceCulling:1; //! Is frontface culling enabled? Default: false bool FrontfaceCulling:1; //! Is fog enabled? Default: false bool FogEnable:1; //! Should normals be normalized? /** Always use this if the mesh lit and scaled. Default: false */ bool NormalizeNormals:1; //! Shall mipmaps be used if available /** Sometimes, disabling mipmap usage can be useful. Default: true */ bool UseMipMaps:1; //! Give more control how the ZWriteEnable flag is interpreted /** Note that there is also the global flag AllowZWriteOnTransparent which when set acts like all materials have set EZI_ALLOW_ON_TRANSPARENT. */ E_ZWRITE_FINE_CONTROL ZWriteFineControl:1; //! Gets the texture transformation matrix for level i /** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES \return Texture matrix for texture level i. */ core::matrix4& getTextureMatrix(u32 i) { return TextureLayer[i].getTextureMatrix(); } //! Gets the immutable texture transformation matrix for level i /** \param i The desired level. \return Texture matrix for texture level i, or identity matrix for levels larger than MATERIAL_MAX_TEXTURES. */ const core::matrix4& getTextureMatrix(u32 i) const { if (i<MATERIAL_MAX_TEXTURES) return TextureLayer[i].getTextureMatrix(); else return core::IdentityMatrix; } //! Sets the i-th texture transformation matrix /** \param i The desired level. \param mat Texture matrix for texture level i. */ void setTextureMatrix(u32 i, const core::matrix4& mat) { if (i>=MATERIAL_MAX_TEXTURES) return; TextureLayer[i].setTextureMatrix(mat); } //! Gets the i-th texture /** \param i The desired level. \return Texture for texture level i, if defined, else 0. */ ITexture* getTexture(u32 i) const { return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0; } //! Sets the i-th texture /** If i>=MATERIAL_MAX_TEXTURES this setting will be ignored. \param i The desired level. \param tex Texture for texture level i. */ void setTexture(u32 i, ITexture* tex) { if (i>=MATERIAL_MAX_TEXTURES) return; TextureLayer[i].Texture = tex; } //! Sets the Material flag to the given value /** \param flag The flag to be set. \param value The new value for the flag. */ void setFlag(E_MATERIAL_FLAG flag, bool value) { switch (flag) { case EMF_WIREFRAME: Wireframe = value; break; case EMF_POINTCLOUD: PointCloud = value; break; case EMF_GOURAUD_SHADING: GouraudShading = value; break; case EMF_LIGHTING: Lighting = value; break; case EMF_ZBUFFER: ZBuffer = value; break; case EMF_ZWRITE_ENABLE: ZWriteEnable = value; break; case EMF_BACK_FACE_CULLING: BackfaceCulling = value; break; case EMF_FRONT_FACE_CULLING: FrontfaceCulling = value; break; case EMF_BILINEAR_FILTER: { for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) TextureLayer[i].BilinearFilter = value; } break; case EMF_TRILINEAR_FILTER: { for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) TextureLayer[i].TrilinearFilter = value; } break; case EMF_ANISOTROPIC_FILTER: { if (value) for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) TextureLayer[i].AnisotropicFilter = 0xFF; else for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) TextureLayer[i].AnisotropicFilter = 0; } break; case EMF_FOG_ENABLE: FogEnable = value; break; case EMF_NORMALIZE_NORMALS: NormalizeNormals = value; break; case EMF_TEXTURE_WRAP: { for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i) { TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value; TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value; TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)value; } } break; case EMF_ANTI_ALIASING: AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break; case EMF_COLOR_MASK: ColorMask = value?ECP_ALL:ECP_NONE; break; case EMF_COLOR_MATERIAL: ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break; case EMF_USE_MIP_MAPS: UseMipMaps = value; break; case EMF_BLEND_OPERATION: BlendOperation = value?EBO_ADD:EBO_NONE; break; case EMF_BLEND_FACTOR: break; case EMF_POLYGON_OFFSET: PolygonOffsetFactor = value?1:0; PolygonOffsetDirection = EPO_BACK; break; default: break; } } //! Gets the Material flag /** \param flag The flag to query. \return The current value of the flag. */ bool getFlag(E_MATERIAL_FLAG flag) const { switch (flag) { case EMF_WIREFRAME: return Wireframe; case EMF_POINTCLOUD: return PointCloud; case EMF_GOURAUD_SHADING: return GouraudShading; case EMF_LIGHTING: return Lighting; case EMF_ZBUFFER: return ZBuffer!=ECFN_DISABLED; case EMF_ZWRITE_ENABLE: return ZWriteEnable; case EMF_BACK_FACE_CULLING: return BackfaceCulling; case EMF_FRONT_FACE_CULLING: return FrontfaceCulling; case EMF_BILINEAR_FILTER: return TextureLayer[0].BilinearFilter; case EMF_TRILINEAR_FILTER: return TextureLayer[0].TrilinearFilter; case EMF_ANISOTROPIC_FILTER: return TextureLayer[0].AnisotropicFilter!=0; case EMF_FOG_ENABLE: return FogEnable; case EMF_NORMALIZE_NORMALS: return NormalizeNormals; case EMF_TEXTURE_WRAP: return !(TextureLayer[0].TextureWrapU || TextureLayer[0].TextureWrapV || TextureLayer[0].TextureWrapW); case EMF_ANTI_ALIASING: return (AntiAliasing==1); case EMF_COLOR_MASK: return (ColorMask!=ECP_NONE); case EMF_COLOR_MATERIAL: return (ColorMaterial != ECM_NONE); case EMF_USE_MIP_MAPS: return UseMipMaps; case EMF_BLEND_OPERATION: return BlendOperation != EBO_NONE; case EMF_BLEND_FACTOR: return BlendFactor != 0.f; case EMF_POLYGON_OFFSET: return PolygonOffsetFactor != 0; } return false; } //! Inequality operator /** \param b Material to compare to. \return True if the materials differ, else false. */ inline bool operator!=(const SMaterial& b) const { bool different = MaterialType != b.MaterialType || AmbientColor != b.AmbientColor || DiffuseColor != b.DiffuseColor || EmissiveColor != b.EmissiveColor || SpecularColor != b.SpecularColor || Shininess != b.Shininess || MaterialTypeParam != b.MaterialTypeParam || MaterialTypeParam2 != b.MaterialTypeParam2 || Thickness != b.Thickness || Wireframe != b.Wireframe || PointCloud != b.PointCloud || GouraudShading != b.GouraudShading || Lighting != b.Lighting || ZBuffer != b.ZBuffer || ZWriteEnable != b.ZWriteEnable || BackfaceCulling != b.BackfaceCulling || FrontfaceCulling != b.FrontfaceCulling || FogEnable != b.FogEnable || NormalizeNormals != b.NormalizeNormals || AntiAliasing != b.AntiAliasing || ColorMask != b.ColorMask || ColorMaterial != b.ColorMaterial || BlendOperation != b.BlendOperation || BlendFactor != b.BlendFactor || PolygonOffsetFactor != b.PolygonOffsetFactor || PolygonOffsetDirection != b.PolygonOffsetDirection || UseMipMaps != b.UseMipMaps || ZWriteFineControl != b.ZWriteFineControl; ; for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i) { different |= (TextureLayer[i] != b.TextureLayer[i]); } return different; } //! Equality operator /** \param b Material to compare to. \return True if the materials are equal, else false. */ inline bool operator==(const SMaterial& b) const { return !(b!=*this); } bool isTransparent() const { if ( MaterialType==EMT_TRANSPARENT_ADD_COLOR || MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL || MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA || MaterialType==EMT_TRANSPARENT_REFLECTION_2_LAYER ) return true; if (BlendOperation != EBO_NONE && BlendFactor != 0.f) { E_BLEND_FACTOR srcRGBFact = EBF_ZERO; E_BLEND_FACTOR dstRGBFact = EBF_ZERO; E_BLEND_FACTOR srcAlphaFact = EBF_ZERO; E_BLEND_FACTOR dstAlphaFact = EBF_ZERO; E_MODULATE_FUNC modulo = EMFN_MODULATE_1X; u32 alphaSource = 0; unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulo, alphaSource, BlendFactor); if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) || textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact)) { return true; } } return false; } }; //! global const identity Material IRRLICHT_API extern SMaterial IdentityMaterial; } // end namespace video } // end namespace irr #endif
[ "vellhe@tencent.com" ]
vellhe@tencent.com
b3a85fc2894dea9b305a6b681dcf0f7d26a8ed3f
4352b5c9e6719d762e6a80e7a7799630d819bca3
/tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/4.48/e
7e324d8ce80a0ed7aa08d6586c83de55a5c3f114
[]
no_license
dashqua/epicProject
d6214b57c545110d08ad053e68bc095f1d4dc725
54afca50a61c20c541ef43e3d96408ef72f0bcbc
refs/heads/master
2022-02-28T17:20:20.291864
2019-10-28T13:33:16
2019-10-28T13:33:16
184,294,390
1
0
null
null
null
null
UTF-8
C++
false
false
179,571
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "4.48"; object e; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField nonuniform List<scalar> 22500 ( 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.27 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.26 1006.26 1006.26 1006.25 1006.25 1006.25 1006.25 1006.25 1006.25 1006.25 1006.25 1006.26 1006.26 1006.26 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.26 1006.26 1006.25 1006.25 1006.24 1006.24 1006.24 1006.24 1006.24 1006.24 1006.24 1006.24 1006.24 1006.25 1006.25 1006.25 1006.26 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.26 1006.25 1006.25 1006.24 1006.23 1006.23 1006.22 1006.22 1006.21 1006.21 1006.21 1006.21 1006.22 1006.22 1006.23 1006.23 1006.24 1006.25 1006.25 1006.26 1006.26 1006.27 1006.27 1006.27 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.26 1006.25 1006.24 1006.23 1006.22 1006.21 1006.2 1006.19 1006.18 1006.18 1006.17 1006.18 1006.18 1006.19 1006.19 1006.2 1006.21 1006.22 1006.23 1006.24 1006.25 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.26 1006.25 1006.23 1006.22 1006.21 1006.19 1006.17 1006.15 1006.14 1006.13 1006.12 1006.12 1006.12 1006.12 1006.13 1006.15 1006.16 1006.18 1006.19 1006.21 1006.22 1006.23 1006.24 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.26 1006.25 1006.24 1006.23 1006.21 1006.19 1006.17 1006.14 1006.11 1006.08 1006.06 1006.04 1006.03 1006.02 1006.02 1006.03 1006.05 1006.07 1006.1 1006.12 1006.15 1006.17 1006.19 1006.21 1006.22 1006.24 1006.25 1006.25 1006.26 1006.27 1006.27 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.26 1006.26 1006.24 1006.23 1006.21 1006.18 1006.15 1006.11 1006.07 1006.02 1005.98 1005.93 1005.9 1005.88 1005.87 1005.88 1005.89 1005.92 1005.96 1006 1006.04 1006.08 1006.12 1006.15 1006.18 1006.2 1006.22 1006.23 1006.24 1006.25 1006.26 1006.27 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.25 1006.23 1006.21 1006.17 1006.13 1006.08 1006.02 1005.95 1005.88 1005.81 1005.74 1005.69 1005.65 1005.64 1005.64 1005.67 1005.71 1005.77 1005.84 1005.91 1005.97 1006.03 1006.08 1006.13 1006.16 1006.19 1006.21 1006.23 1006.24 1006.25 1006.26 1006.27 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.25 1006.23 1006.21 1006.17 1006.12 1006.06 1005.97 1005.88 1005.77 1005.66 1005.54 1005.44 1005.36 1005.3 1005.28 1005.29 1005.33 1005.4 1005.49 1005.59 1005.7 1005.8 1005.9 1005.98 1006.05 1006.11 1006.15 1006.19 1006.21 1006.23 1006.24 1006.25 1006.26 1006.27 1006.28 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.26 1006.24 1006.22 1006.18 1006.12 1006.04 1005.94 1005.82 1005.67 1005.5 1005.33 1005.15 1004.99 1004.86 1004.77 1004.73 1004.75 1004.81 1004.92 1005.06 1005.22 1005.39 1005.55 1005.7 1005.83 1005.94 1006.03 1006.09 1006.15 1006.18 1006.21 1006.23 1006.24 1006.26 1006.26 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.25 1006.23 1006.19 1006.13 1006.04 1005.93 1005.77 1005.58 1005.36 1005.1 1004.83 1004.56 1004.32 1004.12 1003.98 1003.92 1003.94 1004.04 1004.21 1004.43 1004.67 1004.93 1005.18 1005.41 1005.61 1005.77 1005.91 1006.01 1006.09 1006.14 1006.18 1006.21 1006.23 1006.25 1006.26 1006.27 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.26 1006.24 1006.2 1006.15 1006.06 1005.93 1005.76 1005.53 1005.24 1004.9 1004.52 1004.11 1003.71 1003.34 1003.04 1002.84 1002.75 1002.78 1002.93 1003.18 1003.51 1003.88 1004.26 1004.64 1004.98 1005.28 1005.53 1005.73 1005.88 1006 1006.08 1006.14 1006.19 1006.21 1006.23 1006.25 1006.26 1006.27 1006.28 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.26 1006.25 1006.22 1006.17 1006.09 1005.96 1005.77 1005.51 1005.18 1004.76 1004.25 1003.69 1003.08 1002.49 1001.94 1001.5 1001.2 1001.07 1001.13 1001.35 1001.72 1002.2 1002.74 1003.31 1003.86 1004.37 1004.81 1005.18 1005.48 1005.71 1005.88 1006 1006.09 1006.15 1006.19 1006.22 1006.24 1006.25 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.26 1006.24 1006.2 1006.13 1006 1005.82 1005.54 1005.17 1004.68 1004.07 1003.34 1002.51 1001.64 1000.77 999.993 999.36 998.932 998.749 998.823 999.144 999.677 1000.37 1001.16 1001.98 1002.78 1003.52 1004.16 1004.7 1005.13 1005.46 1005.71 1005.89 1006.02 1006.1 1006.16 1006.2 1006.23 1006.24 1006.26 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.26 1006.23 1006.17 1006.06 1005.89 1005.62 1005.23 1004.69 1003.99 1003.11 1002.07 1000.89 999.652 998.432 997.33 996.44 995.839 995.579 995.683 996.134 996.885 997.864 998.984 1000.15 1001.3 1002.35 1003.26 1004.03 1004.65 1005.12 1005.48 1005.73 1005.91 1006.04 1006.12 1006.17 1006.21 1006.23 1006.25 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.26 1006.22 1006.13 1005.97 1005.72 1005.34 1004.8 1004.05 1003.06 1001.83 1000.36 998.716 996.99 995.301 993.778 992.546 991.71 991.346 991.481 992.099 993.137 994.495 996.054 997.689 999.288 1000.76 1002.05 1003.13 1004 1004.66 1005.16 1005.52 1005.78 1005.95 1006.06 1006.14 1006.19 1006.22 1006.24 1006.26 1006.27 1006.28 1006.29 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.28 1006.27 1006.25 1006.19 1006.07 1005.85 1005.5 1004.98 1004.23 1003.19 1001.82 1000.12 998.1 995.854 993.506 991.211 989.139 987.457 986.309 985.797 985.967 986.796 988.202 990.051 992.183 994.426 996.626 998.659 1000.44 1001.94 1003.13 1004.06 1004.75 1005.25 1005.59 1005.83 1005.99 1006.09 1006.16 1006.2 1006.23 1006.25 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.28 1006.28 1006.25 1006.16 1005.99 1005.69 1005.22 1004.51 1003.48 1002.07 1000.21 997.904 995.191 992.186 989.05 985.983 983.203 980.936 979.378 978.672 978.882 979.979 981.852 984.326 987.184 990.202 993.172 995.926 998.347 1000.38 1002.01 1003.27 1004.21 1004.89 1005.36 1005.68 1005.9 1006.04 1006.13 1006.18 1006.22 1006.24 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.27 1006.27 1006.27 1006.28 1006.29 1006.28 1006.24 1006.12 1005.88 1005.48 1004.85 1003.9 1002.53 1000.64 998.169 995.111 991.541 987.597 983.479 979.436 975.757 972.748 970.679 969.74 970.011 971.451 973.911 977.159 980.915 984.889 988.81 992.46 995.682 998.393 1000.58 1002.26 1003.52 1004.43 1005.06 1005.49 1005.78 1005.96 1006.08 1006.16 1006.2 1006.23 1006.25 1006.27 1006.28 1006.29 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.28 1006.29 1006.28 1006.22 1006.06 1005.75 1005.22 1004.39 1003.14 1001.34 998.864 995.64 991.68 987.075 981.988 976.657 971.401 966.614 962.711 960.048 958.862 959.24 961.118 964.299 968.482 973.313 978.425 983.48 988.2 992.387 995.926 998.787 1001.01 1002.66 1003.85 1004.69 1005.26 1005.63 1005.87 1006.03 1006.12 1006.18 1006.22 1006.24 1006.26 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.26 1006.27 1006.29 1006.3 1006.29 1006.2 1005.99 1005.58 1004.9 1003.83 1002.22 999.896 996.712 992.598 987.576 981.744 975.28 968.475 961.759 955.672 950.759 947.456 946.033 946.576 948.994 953.035 958.322 964.409 970.838 977.198 983.15 988.452 992.958 996.621 999.474 1001.61 1003.15 1004.23 1004.97 1005.45 1005.76 1005.96 1006.08 1006.16 1006.21 1006.24 1006.25 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.27 1006.26 1006.26 1006.27 1006.29 1006.32 1006.29 1006.17 1005.9 1005.38 1004.52 1003.17 1001.12 998.181 994.176 989.042 982.796 975.527 967.431 958.888 950.496 942.975 936.986 933.014 931.347 932.08 935.114 940.152 946.725 954.271 962.215 970.051 977.382 983.926 989.515 994.086 997.669 1000.37 1002.32 1003.69 1004.62 1005.24 1005.63 1005.88 1006.04 1006.13 1006.19 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.29 1006.29 1006.28 1006.27 1006.26 1006.26 1006.27 1006.3 1006.33 1006.3 1006.14 1005.79 1005.15 1004.08 1002.4 999.854 996.203 991.277 985.001 977.37 968.446 958.463 947.96 937.755 928.731 921.608 916.879 914.861 915.715 919.386 925.548 933.626 942.892 952.608 962.136 971.007 978.909 985.67 991.227 995.612 998.935 1001.36 1003.06 1004.22 1004.99 1005.48 1005.79 1005.99 1006.1 1006.17 1006.22 1006.24 1006.26 1006.27 1006.29 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.27 1006.26 1006.25 1006.27 1006.32 1006.35 1006.3 1006.11 1005.67 1004.89 1003.59 1001.53 998.424 993.993 988.064 980.54 971.367 960.578 948.502 935.906 923.836 913.26 904.86 899.121 896.471 897.248 901.516 908.935 918.786 930.12 941.962 953.486 964.115 973.515 981.53 988.128 993.36 997.351 1000.28 1002.35 1003.77 1004.7 1005.31 1005.69 1005.92 1006.07 1006.15 1006.2 1006.24 1006.26 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.27 1006.25 1006.25 1006.28 1006.33 1006.37 1006.31 1006.07 1005.54 1004.61 1003.05 1000.59 996.865 991.602 984.613 975.758 964.904 952.083 937.793 923.079 909.143 896.894 886.898 879.698 875.995 876.435 881.248 890.064 901.977 915.766 930.154 944.061 956.748 967.836 977.205 984.886 990.987 995.665 999.121 1001.58 1003.27 1004.39 1005.12 1005.58 1005.86 1006.03 1006.13 1006.19 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.27 1006.24 1006.24 1006.28 1006.35 1006.39 1006.32 1006.03 1005.41 1004.31 1002.49 999.588 995.224 989.106 981.031 970.785 958.152 943.209 926.7 909.927 894.107 879.937 867.876 858.701 853.574 853.521 858.895 869.229 883.405 899.926 917.208 933.863 948.932 961.939 972.79 981.605 988.582 993.942 997.924 1000.78 1002.75 1004.06 1004.92 1005.46 1005.79 1005.99 1006.11 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.26 1006.24 1006.23 1006.28 1006.37 1006.42 1006.33 1005.99 1005.28 1004.03 1001.93 998.572 993.561 986.597 977.442 965.786 951.337 934.287 915.661 896.932 879.156 862.747 848.198 836.76 830.164 829.729 835.774 847.651 864.054 883.295 903.545 923.121 940.791 955.914 968.376 978.379 986.234 992.256 996.741 999.971 1002.22 1003.73 1004.71 1005.33 1005.71 1005.95 1006.08 1006.16 1006.21 1006.24 1006.26 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.28 1006.29 1006.29 1006.29 1006.26 1006.23 1006.22 1006.28 1006.38 1006.45 1006.35 1005.96 1005.17 1003.76 1001.38 997.585 991.948 984.176 973.986 960.952 944.737 925.701 905.144 884.575 864.763 845.903 828.769 815.261 807.604 807.159 814.006 827.271 845.546 867.11 890.023 912.372 932.634 949.939 964.081 975.304 984.027 990.676 995.627 999.205 1001.71 1003.4 1004.5 1005.21 1005.64 1005.9 1006.06 1006.15 1006.2 1006.24 1006.26 1006.27 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.28 1006.28 1006.3 1006.29 1006.26 1006.22 1006.21 1006.28 1006.4 1006.48 1006.37 1005.95 1005.08 1003.52 1000.89 996.675 990.46 981.955 970.813 956.497 938.656 917.85 895.603 873.335 851.503 830.277 810.936 796.029 788.01 787.991 795.668 809.961 829.503 852.703 877.663 902.334 924.924 944.291 960.071 972.488 982.043 989.27 994.634 998.516 1001.24 1003.09 1004.31 1005.09 1005.57 1005.86 1006.04 1006.14 1006.2 1006.23 1006.26 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.29 1006.28 1006.28 1006.3 1006.3 1006.27 1006.21 1006.2 1006.28 1006.42 1006.51 1006.4 1005.95 1005.02 1003.34 1000.48 995.893 989.174 980.037 968.07 952.632 933.392 911.113 887.457 863.692 840.053 816.897 796.099 780.647 772.915 773.576 781.934 796.791 816.928 841.006 867.286 893.67 918.145 939.293 956.547 970.057 980.366 988.1 993.81 997.94 1000.85 1002.83 1004.14 1004.99 1005.51 1005.83 1006.01 1006.13 1006.19 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.29 1006.27 1006.28 1006.3 1006.31 1006.27 1006.21 1006.19 1006.26 1006.42 1006.54 1006.44 1005.98 1005 1003.23 1000.18 995.289 988.159 978.517 965.892 949.557 929.218 905.814 881.075 856.108 831.081 806.679 785.258 769.946 762.82 764.125 772.888 787.886 808.086 832.423 859.365 886.845 912.69 935.236 953.702 968.134 979.075 987.218 993.194 997.506 1000.55 1002.63 1004.01 1004.9 1005.46 1005.8 1006 1006.12 1006.19 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.29 1006.27 1006.28 1006.3 1006.31 1006.28 1006.2 1006.17 1006.25 1006.43 1006.57 1006.49 1006.02 1005.03 1003.21 1000.02 994.903 987.471 977.472 964.39 947.432 926.35 902.209 876.746 850.967 825.113 800.201 778.825 763.985 757.411 759.081 767.934 782.798 802.775 826.992 854.109 882.139 908.836 932.347 951.7 966.822 978.233 986.667 992.816 997.236 1000.35 1002.49 1003.92 1004.84 1005.42 1005.77 1005.98 1006.11 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.3 1006.31 1006.31 1006.29 1006.27 1006.27 1006.3 1006.32 1006.29 1006.21 1006.15 1006.22 1006.42 1006.6 1006.54 1006.1 1005.11 1003.27 1000.02 994.767 987.153 976.957 963.639 946.366 924.93 900.458 874.659 848.514 822.423 797.637 776.725 762.389 756.084 757.727 766.367 780.95 800.63 824.582 851.567 879.708 906.765 930.789 950.661 966.201 977.888 986.473 992.692 997.144 1000.28 1002.43 1003.87 1004.81 1005.4 1005.76 1005.98 1006.1 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.32 1006.31 1006.3 1006.31 1006.31 1006.3 1006.27 1006.26 1006.3 1006.33 1006.3 1006.21 1006.14 1006.19 1006.4 1006.61 1006.6 1006.19 1005.24 1003.43 1000.19 994.903 987.233 977.002 963.675 946.411 925.019 900.624 874.885 848.82 823.022 798.835 778.617 764.714 758.384 759.632 767.778 781.974 801.365 825.021 851.693 879.594 906.566 930.652 950.657 966.317 978.063 986.647 992.828 997.231 1000.32 1002.45 1003.88 1004.81 1005.39 1005.76 1005.97 1006.1 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.32 1006.31 1006.3 1006.31 1006.32 1006.3 1006.27 1006.26 1006.29 1006.33 1006.32 1006.23 1006.13 1006.15 1006.36 1006.61 1006.66 1006.3 1005.41 1003.69 1000.53 995.314 987.716 977.605 964.491 947.553 926.595 902.674 877.376 851.797 826.707 803.442 784.078 770.612 764.133 764.776 772.216 785.89 804.935 828.227 854.408 881.754 908.233 931.952 951.704 967.175 978.756 987.181 993.214 997.491 1000.49 1002.55 1003.93 1004.84 1005.41 1005.76 1005.98 1006.1 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.32 1006.31 1006.3 1006.3 1006.32 1006.31 1006.27 1006.25 1006.28 1006.33 1006.34 1006.25 1006.13 1006.11 1006.31 1006.59 1006.71 1006.43 1005.62 1004.02 1001.03 995.994 988.594 978.748 966.041 949.714 929.55 906.479 881.984 857.239 833.157 811.028 792.67 779.776 773.254 773.321 779.973 792.961 811.466 834.184 859.615 886.074 911.67 934.622 953.756 968.743 979.938 988.049 993.83 997.908 1000.76 1002.71 1004.03 1004.89 1005.44 1005.78 1005.99 1006.11 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.32 1006.31 1006.3 1006.3 1006.32 1006.31 1006.28 1006.25 1006.26 1006.32 1006.35 1006.28 1006.14 1006.08 1006.24 1006.55 1006.74 1006.55 1005.85 1004.41 1001.66 996.919 989.842 980.391 968.252 952.769 933.708 911.83 888.478 864.868 842.011 821.159 803.942 791.818 785.516 785.228 791.139 803.275 820.942 842.757 867.112 892.343 916.695 938.52 956.712 970.945 981.553 989.21 994.642 998.459 1001.12 1002.94 1004.17 1004.97 1005.49 1005.81 1006 1006.12 1006.19 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.32 1006.32 1006.3 1006.3 1006.31 1006.32 1006.29 1006.25 1006.25 1006.31 1006.36 1006.32 1006.18 1006.06 1006.16 1006.47 1006.74 1006.66 1006.09 1004.84 1002.39 998.045 991.417 982.479 971.033 956.561 938.835 918.437 896.537 874.333 852.883 833.404 817.404 806.209 800.399 800.033 805.309 816.464 833.007 853.593 876.556 900.255 923.053 943.446 960.419 973.673 983.523 990.607 995.612 999.115 1001.55 1003.21 1004.34 1005.07 1005.55 1005.84 1006.02 1006.13 1006.19 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.32 1006.32 1006.3 1006.29 1006.31 1006.32 1006.3 1006.25 1006.24 1006.28 1006.35 1006.35 1006.22 1006.07 1006.08 1006.36 1006.7 1006.75 1006.32 1005.28 1003.18 999.313 993.257 984.95 974.293 960.934 944.681 925.962 905.763 885.203 865.329 847.297 832.53 822.328 817.188 816.948 821.688 831.806 847.06 866.196 887.533 909.456 930.452 949.169 964.702 976.796 985.753 992.172 996.691 999.843 1002.03 1003.52 1004.53 1005.19 1005.62 1005.88 1006.04 1006.14 1006.2 1006.23 1006.26 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.31 1006.31 1006.3 1006.31 1006.32 1006.31 1006.29 1006.3 1006.32 1006.31 1006.26 1006.23 1006.26 1006.34 1006.37 1006.28 1006.1 1006.03 1006.23 1006.61 1006.79 1006.53 1005.7 1003.95 1000.64 995.275 987.718 977.938 965.747 951.024 934.086 915.743 897.011 878.868 862.341 848.784 839.568 835.16 835.131 839.401 848.511 862.448 880.04 899.598 919.565 938.571 955.431 969.365 980.171 988.143 993.836 997.831 1000.61 1002.53 1003.85 1004.73 1005.31 1005.69 1005.92 1006.07 1006.15 1006.21 1006.24 1006.26 1006.27 1006.29 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.31 1006.3 1006.31 1006.32 1006.31 1006.29 1006.29 1006.31 1006.32 1006.28 1006.23 1006.24 1006.31 1006.38 1006.34 1006.17 1006.01 1006.1 1006.46 1006.76 1006.69 1006.09 1004.69 1001.96 997.357 990.666 981.858 970.874 957.679 942.534 926.107 909.318 893.025 878.044 865.666 857.411 853.715 853.879 857.711 865.906 878.59 894.609 912.286 930.168 947.062 961.956 974.2 983.648 990.588 995.526 998.983 1001.38 1003.04 1004.17 1004.94 1005.44 1005.77 1005.97 1006.09 1006.17 1006.21 1006.24 1006.26 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.31 1006.3 1006.3 1006.32 1006.32 1006.3 1006.29 1006.3 1006.32 1006.3 1006.25 1006.22 1006.27 1006.36 1006.38 1006.25 1006.05 1006.01 1006.27 1006.65 1006.78 1006.41 1005.35 1003.18 999.379 993.65 985.914 976.181 964.497 951.092 936.557 921.759 907.378 893.949 882.745 875.447 872.399 872.666 876.073 883.472 895 909.432 925.145 940.86 955.581 968.474 979.005 987.084 992.99 997.179 1000.1 1002.14 1003.54 1004.49 1005.14 1005.57 1005.84 1006.01 1006.12 1006.18 1006.22 1006.25 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.31 1006.31 1006.3 1006.31 1006.32 1006.31 1006.29 1006.29 1006.31 1006.31 1006.27 1006.22 1006.24 1006.32 1006.39 1006.33 1006.14 1005.99 1006.1 1006.45 1006.74 1006.64 1005.91 1004.26 1001.23 996.505 989.925 981.507 971.324 959.579 946.864 934.045 921.56 909.652 899.647 893.338 890.85 891.094 894.088 900.816 911.262 924.081 937.768 951.279 963.834 974.752 983.606 990.355 995.264 998.736 1001.16 1002.84 1004 1004.79 1005.33 1005.68 1005.91 1006.05 1006.14 1006.2 1006.23 1006.25 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.31 1006.31 1006.3 1006.31 1006.32 1006.32 1006.29 1006.29 1006.3 1006.32 1006.29 1006.24 1006.22 1006.28 1006.37 1006.38 1006.24 1006.04 1005.99 1006.23 1006.58 1006.72 1006.34 1005.17 1002.86 999.088 993.692 986.644 977.962 967.803 956.845 945.96 935.271 924.808 916.064 910.782 908.721 908.815 911.452 917.625 927.009 938.155 949.772 961.105 971.565 980.599 987.867 993.366 997.347 1000.16 1002.12 1003.48 1004.42 1005.07 1005.5 1005.79 1005.98 1006.09 1006.17 1006.21 1006.24 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.32 1006.3 1006.28 1006.29 1006.31 1006.31 1006.27 1006.22 1006.24 1006.32 1006.39 1006.34 1006.15 1005.99 1006.04 1006.33 1006.62 1006.58 1005.88 1004.21 1001.31 997.059 991.38 984.157 975.521 966.302 957.287 948.214 939.114 931.72 927.449 925.631 925.511 927.912 933.618 941.88 951.259 960.805 970.052 978.558 985.856 991.676 996.045 999.194 1001.41 1002.97 1004.05 1004.8 1005.31 1005.66 1005.89 1006.03 1006.13 1006.19 1006.22 1006.25 1006.26 1006.27 1006.28 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.3 1006.31 1006.32 1006.31 1006.29 1006.28 1006.3 1006.31 1006.29 1006.24 1006.22 1006.27 1006.35 1006.38 1006.27 1006.08 1005.97 1006.08 1006.38 1006.58 1006.31 1005.23 1003.14 999.967 995.559 989.658 982.486 975.027 967.75 960.058 952.296 946.331 942.937 941.186 940.928 943.266 948.492 955.48 963.016 970.573 977.914 984.669 990.424 994.967 998.35 1000.78 1002.49 1003.69 1004.53 1005.12 1005.52 1005.79 1005.97 1006.08 1006.16 1006.2 1006.23 1006.25 1006.27 1006.28 1006.29 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.32 1006.3 1006.28 1006.29 1006.31 1006.31 1006.27 1006.23 1006.23 1006.3 1006.37 1006.35 1006.21 1006.03 1005.96 1006.12 1006.37 1006.4 1005.85 1004.55 1002.39 999.066 994.302 988.581 982.856 977.045 970.513 964.16 959.611 956.844 955.095 954.925 957.31 961.88 967.398 973.111 978.888 984.589 989.841 994.268 997.721 1000.27 1002.1 1003.39 1004.3 1004.94 1005.39 1005.69 1005.9 1006.04 1006.13 1006.18 1006.22 1006.24 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.29 1006.28 1006.29 1006.3 1006.29 1006.26 1006.23 1006.25 1006.31 1006.36 1006.32 1006.16 1006 1005.97 1006.09 1006.2 1006.05 1005.48 1004.2 1001.74 998.04 993.832 989.654 984.929 979.488 974.643 971.293 968.879 967.259 967.414 969.737 973.342 977.288 981.383 985.711 990.083 994.088 997.407 999.956 1001.82 1003.16 1004.12 1004.79 1005.27 1005.6 1005.83 1005.99 1006.09 1006.16 1006.2 1006.23 1006.25 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.28 1006.29 1006.3 1006.28 1006.25 1006.23 1006.26 1006.32 1006.35 1006.29 1006.14 1005.98 1005.91 1005.93 1006 1005.91 1005.2 1003.45 1000.91 998.199 995.174 991.276 987.058 983.662 981.104 978.925 977.69 978.191 980.093 982.481 985.015 987.893 991.16 994.491 997.478 999.891 1001.71 1003.05 1004 1004.69 1005.18 1005.53 1005.78 1005.95 1006.06 1006.14 1006.19 1006.22 1006.24 1006.26 1006.27 1006.28 1006.29 1006.29 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.28 1006.28 1006.29 1006.29 1006.27 1006.25 1006.24 1006.27 1006.32 1006.34 1006.26 1006.09 1005.91 1005.84 1005.92 1005.92 1005.42 1004.33 1002.98 1001.41 999.114 996.094 993.231 990.929 988.799 986.984 986.283 986.836 987.955 989.205 990.781 992.919 995.445 997.948 1000.1 1001.79 1003.06 1003.98 1004.65 1005.14 1005.49 1005.74 1005.91 1006.04 1006.12 1006.17 1006.21 1006.23 1006.25 1006.26 1006.27 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.29 1006.28 1006.28 1006.29 1006.29 1006.27 1006.25 1006.25 1006.28 1006.31 1006.3 1006.2 1006.07 1005.98 1005.9 1005.7 1005.29 1004.81 1004.27 1003.24 1001.49 999.53 997.811 996.108 994.339 993.101 992.785 993.003 993.332 993.915 995.084 996.823 998.778 1000.59 1002.07 1003.2 1004.05 1004.67 1005.13 1005.47 1005.71 1005.89 1006.02 1006.1 1006.16 1006.2 1006.23 1006.25 1006.26 1006.27 1006.28 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.26 1006.25 1006.26 1006.27 1006.27 1006.24 1006.14 1005.91 1005.61 1005.37 1005.21 1004.82 1003.95 1002.84 1001.8 1000.68 999.311 998.071 997.387 997.111 996.91 996.875 997.357 998.445 999.876 1001.3 1002.52 1003.48 1004.21 1004.76 1005.17 1005.48 1005.71 1005.88 1006.01 1006.09 1006.15 1006.19 1006.22 1006.24 1006.25 1006.26 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.25 1006.24 1006.26 1006.29 1006.28 1006.17 1005.99 1005.83 1005.71 1005.47 1004.97 1004.35 1003.79 1003.14 1002.23 1001.25 1000.57 1000.14 999.738 999.428 999.516 1000.14 1001.13 1002.18 1003.11 1003.86 1004.45 1004.9 1005.26 1005.53 1005.74 1005.89 1006.01 1006.09 1006.15 1006.19 1006.22 1006.24 1006.25 1006.26 1006.27 1006.28 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.26 1006.26 1006.27 1006.26 1006.22 1006.17 1006.14 1006.1 1005.94 1005.6 1005.22 1004.9 1004.52 1003.93 1003.24 1002.7 1002.31 1001.9 1001.53 1001.45 1001.77 1002.4 1003.12 1003.77 1004.31 1004.74 1005.09 1005.38 1005.6 1005.78 1005.92 1006.02 1006.09 1006.15 1006.19 1006.21 1006.23 1006.25 1006.26 1006.27 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.28 1006.28 1006.26 1006.23 1006.22 1006.23 1006.24 1006.16 1005.98 1005.8 1005.64 1005.42 1005.03 1004.57 1004.19 1003.89 1003.56 1003.23 1003.08 1003.23 1003.59 1004.02 1004.42 1004.76 1005.05 1005.3 1005.52 1005.69 1005.84 1005.95 1006.04 1006.1 1006.15 1006.19 1006.21 1006.23 1006.25 1006.26 1006.26 1006.27 1006.28 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.26 1006.25 1006.27 1006.26 1006.21 1006.13 1006.07 1006.03 1005.92 1005.69 1005.42 1005.2 1005 1004.75 1004.49 1004.34 1004.38 1004.56 1004.78 1004.98 1005.17 1005.35 1005.51 1005.66 1005.8 1005.91 1006 1006.07 1006.12 1006.16 1006.19 1006.22 1006.23 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.27 1006.26 1006.27 1006.28 1006.27 1006.24 1006.2 1006.19 1006.19 1006.13 1006.01 1005.87 1005.77 1005.66 1005.5 1005.31 1005.2 1005.19 1005.26 1005.34 1005.43 1005.51 1005.61 1005.71 1005.81 1005.9 1005.98 1006.04 1006.1 1006.14 1006.18 1006.2 1006.22 1006.24 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.28 1006.27 1006.25 1006.24 1006.25 1006.26 1006.22 1006.14 1006.09 1006.05 1006 1005.9 1005.78 1005.71 1005.69 1005.71 1005.73 1005.74 1005.77 1005.82 1005.87 1005.93 1005.99 1006.05 1006.09 1006.13 1006.16 1006.19 1006.21 1006.23 1006.24 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.26 1006.26 1006.27 1006.27 1006.24 1006.21 1006.2 1006.19 1006.16 1006.1 1006.03 1006 1005.99 1005.98 1005.97 1005.96 1005.96 1005.98 1006.01 1006.04 1006.08 1006.11 1006.14 1006.16 1006.19 1006.21 1006.22 1006.23 1006.24 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.27 1006.27 1006.27 1006.28 1006.27 1006.25 1006.24 1006.25 1006.25 1006.23 1006.19 1006.16 1006.15 1006.14 1006.13 1006.11 1006.09 1006.09 1006.09 1006.1 1006.12 1006.14 1006.16 1006.18 1006.19 1006.21 1006.22 1006.23 1006.24 1006.25 1006.25 1006.26 1006.26 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.26 1006.26 1006.27 1006.27 1006.25 1006.23 1006.22 1006.22 1006.22 1006.2 1006.18 1006.17 1006.17 1006.17 1006.17 1006.18 1006.19 1006.2 1006.21 1006.22 1006.23 1006.23 1006.24 1006.25 1006.25 1006.26 1006.26 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.27 1006.27 1006.27 1006.28 1006.27 1006.26 1006.25 1006.25 1006.25 1006.25 1006.24 1006.22 1006.22 1006.22 1006.22 1006.22 1006.22 1006.22 1006.23 1006.23 1006.23 1006.24 1006.24 1006.25 1006.25 1006.26 1006.26 1006.26 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.27 1006.27 1006.26 1006.27 1006.27 1006.26 1006.25 1006.25 1006.25 1006.25 1006.25 1006.24 1006.24 1006.24 1006.24 1006.24 1006.25 1006.25 1006.25 1006.26 1006.26 1006.26 1006.26 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.27 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.27 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.26 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.27 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 ) ; boundaryField { emptyPatches_empt { type empty; } top_cyc { type cyclic; } bottom_cyc { type cyclic; } inlet_cyc { type cyclic; } outlet_cyc { type cyclic; } } // ************************************************************************* //
[ "tdg@debian" ]
tdg@debian
ac58466270474853d057ab7434462d063e5128ed
9a83f5c0ec125e917daa5d60db985653de7fadf3
/main.cpp
fa8bc07e8e2f060072ad87ce8208df4f778cccd3
[]
no_license
Nezas/TraceLibrary
c5ef2d06d505f397f9032940017ea686a524b345
2c692c3633f95f6f9ea7fec1e185a4072627ac5f
refs/heads/master
2023-05-15T16:53:56.591882
2021-06-10T06:59:59
2021-06-10T06:59:59
375,406,417
0
0
null
null
null
null
UTF-8
C++
false
false
155
cpp
#include "logger.h" using namespace std; int main() { Logger::EnableFileOutput(); LOG_INFO("Test", "Hello World"); LOG_WARN("Test", 8); return 0; }
[ "nedas.zaksauskas@gmail.com" ]
nedas.zaksauskas@gmail.com
caaf4896b68a329b5aed9cffe22c8022b8b710de
1e481151698bf88712c21966bb9f52095587512e
/sort01.cpp
d7c9ef3e4537a2477ba06bf3b8a55d571fba7c89
[]
no_license
princegoyal-dev/Coding-Ninja-Introduction-to-Cpp-Assignment
2c201784368f6d8eeeae34ade6c81a195473c9a6
faaa7e35031913c6a6f72feb675a6afce46ede60
refs/heads/master
2023-05-28T15:26:51.887751
2021-06-23T11:22:14
2021-06-23T11:22:14
379,578,292
0
0
null
null
null
null
UTF-8
C++
false
false
1,118
cpp
//Program to sort a binary array /* Sample input 1 : 10 0 1 0 1 0 1 1 1 0 0 Sample output 1 : 0 0 0 0 0 1 1 1 1 1 Sample input 2 : 7 1 1 1 1 1 1 0 Sample output 2 : 0 1 1 1 1 1 1 */ #include<bits/stdc++.h> using namespace std; void sort01(int arr[], int length) { int i = 0; int j = length - 1; while (i < j) { if( arr[i] == 1) { while(j > i) { if(arr[j] == 0) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; break; } else { j--; } } } i++; } for ( int i = 0; i < length; i++) { cout << arr[i] << " "; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int arr[100]; int length; cin >> length; for(int i = 0; i < length; i++) { cin >> arr[i]; } sort01(arr, length); return 0; }
[ "princegoyal.dev@gmail.com" ]
princegoyal.dev@gmail.com
898e3943fa8b787d860e897ffae4bbc2809a246b
e007914d5d49b2e81b3cb4692459f88be438438a
/Lab3/Model.hpp
7b5afe4b34555d0d071c1ec98dccf0883da1740b
[]
no_license
starrrrria/animation
53b7eebc18f531f40527b47718d8dc7bbecd0500
dcd467a243f1bc480024234f1ffd6fdbfdd97345
refs/heads/main
2023-08-16T15:02:51.853955
2021-10-07T22:02:20
2021-10-07T22:02:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,311
hpp
// // Model.hpp // triangle // // Created by 补锌 on 2020/11/19. // #ifndef Model_hpp #define Model_hpp #include <vector> #include <string> #include "Mesh.hpp" #include <assimp/Importer.hpp> #include <assimp/scene.h> #include <assimp/postprocess.h> #include <iostream> #include "Shader.hpp" #include <stdio.h> #include <set> class Model { public: Model(); ~Model(); std::vector<Texture> textures_loaded; std::vector<Mesh> meshes; std::string directory; void Draw(Shader* shader); enum Mode { neutral,l_n_w,kiss,l_b_r,j_o,r_e_u_o,r_e_c,r_s,r_b_l,l_b_n,r_n_w,l_s,r_e_l_o,r_b_r,l_sad,l_p,l_e_u_o,r_p,l_e_c,l_b_l,l_e_l_o,r_b_n, r_smile,l_smile,r_sad }; Mode expression; void loadModel(std::string const path); void get_files_in_directory(std::set<std::string> &out,const std::string &directory); private: // loads a model with supported ASSIMP extensions from file and stores the resulting meshes in the meshes vector. void processNode(aiNode *node,const aiScene* scene); Mesh processMesh(aiMesh* mesh,const aiScene* scene); std::vector<Texture> loadMaterialTextures(aiMaterial *mat, aiTextureType type, std::string typeName); unsigned int TextureFromFile(const char *path, const std::string &directory); }; #endif /* Model_hpp */
[ "guok@tcd.ie" ]
guok@tcd.ie
f3139449f6b4dd6b728873899b6a1d1619871be2
0fada42f78d4ffa5146428b8b193d320f6ffbee0
/cell.h
776e7096c39fab2289a3952e7b7fa0d623ba83c5
[]
no_license
Ilya-Belyanov/KekKen-solve
5ebea7fa675c1fa394abd9db0cdd741e5b9f46db
1b220bd3346bce66ffa71b841e9b9286fdbb49e6
refs/heads/master
2023-05-03T06:47:29.906496
2021-06-08T16:10:37
2021-06-08T16:10:37
374,152,373
0
0
null
null
null
null
UTF-8
C++
false
false
2,391
h
#ifndef CELL_H #define CELL_H #include <QGraphicsItem> #include <QObject> #include <QPainter> class Cell: public QGraphicsItem { Q_PROPERTY(int width READ getWidth WRITE setWidth) Q_PROPERTY(int height READ getHeight WRITE setHeight) Q_PROPERTY(QString operation READ getOperation WRITE setOperation) Q_PROPERTY(int text READ getText WRITE setText) Q_PROPERTY(bool top READ isTop WRITE setTop) Q_PROPERTY(bool buttom READ isButtom WRITE setButtom) Q_PROPERTY(bool right READ isRight WRITE setRight) Q_PROPERTY(bool left READ isLeft WRITE setLeft) Q_PROPERTY(bool fixedText READ isfixedText WRITE setfixedText) int _width; int _height; int _defaultWidth; int _defaultHeight; int _fontSize; int _opFontSize; int _lineWidth; float _rectWidth; QString _operation; int _text; bool _isTop, _isButtom, _isRight, _isLeft; bool _fixedText = false; public: explicit Cell(int width = 0, int height = 0, QGraphicsItem *parent = 0); ~Cell(); Cell(const Cell& ); Cell& operator=(const Cell& ); QPainterPath shape() const override; QRectF boundingRect() const override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paintRect(QPainter *painter); void paintBorder(QPainter *painter); void paintText(QPainter *painter); void paintOp(QPainter *painter); int getWidth() {return _width;} int getHeight() {return _height;} void setWidth(const int w); void setHeight(const int h); void setDefaulSize(); void setDefaulWidth(); void setDefaulHeight(); QString getOperation() {return _operation;} QString getText() {return QString::number(_text);} int getNumber() {return _text;} void setOperation(const QString op); void setText(const int txt); bool isTop() {return _isTop;} bool isButtom() {return _isButtom;} bool isRight() {return _isRight;} bool isLeft() {return _isLeft;} void setTop(const bool t) {_isTop = t;}; void setButtom(const bool b) {_isButtom = b;}; void setRight(const bool r) {_isRight = r;}; void setLeft(const bool l) {_isLeft = l;}; bool isFixedText() {return _fixedText;} void setFixedText(const bool fixedText) {_fixedText = fixedText;}; private: void updateFont(); }; #endif // CELL_H
[ "belyanov.99@mail.ru" ]
belyanov.99@mail.ru
fb2ea31c34deff3f7e60d6527e609f8730bd2fd1
dca4718b3594a263f714c1d43eabbf39a7642d53
/Test/Hardware/Multiplex1ch_Serial/Multiplex1ch_Serial.ino
8731c50524dfc40c3b692fd05811e190b0b702ac
[]
no_license
yekrutdloc/Hovercraft-Project
731dc0388173f8828cbd4b9d0919c572a9c608c2
607d96cdfd811057ae92c67010e5b876eb003425
refs/heads/master
2021-06-27T03:53:07.877321
2017-09-19T07:56:29
2017-09-19T07:56:29
104,043,210
0
0
null
null
null
null
UTF-8
C++
false
false
680
ino
// Multiplex1ch_Serial.ino // // Purpose: A very simple Sketch which prints // out an analog value from a specific channel. // // @author Prince Balabis // Front Line-Sensor pins int const s0pin = 53; int const s1pin = 52; int const s2pin = 51; int const s3pin = 50; int const z = A1; void setup() { Serial.begin(9600); // Photo resistor array setup pinMode(s0pin, OUTPUT); // s0 pinMode(s1pin, OUTPUT); // s1 pinMode(s2pin, OUTPUT); // s2 pinMode(s3pin, OUTPUT); // s3 digitalWrite(s0pin, LOW); digitalWrite(s1pin, LOW); digitalWrite(s2pin, LOW); digitalWrite(s3pin, LOW); } void loop() { Serial.println(analogRead(z)); delay(200); }
[ "princebalabis@gmail.com" ]
princebalabis@gmail.com
3495956e4cc323e75d74c9fc8bcf409d4ada7b51
e6ae6070d3053ca1e4ff958c719a8cf5dfcd6b9b
/Laser_Maze.cpp
e01e5955e7b3c0f1964e9ae965f58bc89100da39
[]
no_license
Arti14/Competitive-Programming
31d246d34581599219ffb7e23a3372f02fc6dfa6
de42977b6cce39bb480d3cf90c1781d806be3b56
refs/heads/master
2021-01-25T07:34:29.240567
2015-05-08T07:07:10
2015-05-08T07:07:10
35,263,950
0
0
null
null
null
null
UTF-8
C++
false
false
464
cpp
#include <iostream> using namespace std; char arr[105][105]; bool config[105][105][4]; void findSafeConfigs(char *arr) { for(int i = 0; i < M; i++) { for(int j = 0; j < N; j++) { for(int k = 0; k < 4; k++) { config[i][j][k] = 1; } } } } int main() { int T; int M, N; cin >> T; while(T--) { cin >> M >> N; for(int i = 0; i < M; i++) { for(int j = 0; j < N; j++) { cin >> arr[i][j]; } } findSafeConfigs(arr, M, N); } }
[ "rt@rt-VGN-CS14G-B.(none)" ]
rt@rt-VGN-CS14G-B.(none)
6d13a647907c77c178869464853f3851e18cd94b
eddc84bbf831f58c5b70d9fad0c53b7c2b12af43
/Test/KickG2020/hb.cpp
af28535808cd553c70643d84dca875697af28dd2
[]
no_license
amitray1608/PCcodes
79a91a85203b488eeca695ec8048e607269882e0
e0d49c0b0c05d80d4d813e4a706a8b900de55a91
refs/heads/master
2023-06-20T02:01:05.875982
2021-07-23T02:25:54
2021-07-23T02:25:54
305,299,557
0
0
null
null
null
null
UTF-8
C++
false
false
1,324
cpp
#include <bits/stdc++.h> using namespace std; void solve(){ /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n, m; cin >> n >> m; vector<pair<int, int>> a(m); for(int i = 0; i < m; i++) { cin >> a[i].first >> a[i].second; } map<int, int> check; bool ans = 0; for(int i = 0; i < m; i++) { if(ans) continue; int c, aa = a[i].first, bb = a[i].second; (aa <= bb) ? c = bb - aa : c = bb + n - aa; while(c >= 0 and check[aa] == 0) { int p = check[aa]; if(p > c) check[aa] = c, c = p; aa++, c--; if(aa == n) aa = 0; } if(c >= 0) check[aa] = c; else ans = 1; } cout << (ans ? "NO" : "YES") << endl; } int main() { int t; cin >> t; while(t--) solve(); return 0; } #include<bits/stdc++.h> #define endl '\n' #define deb(x) cout << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef long double dd; const int MOD = 1e9 + 7; void solve(){ } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1, tt = 0; cin >> t; while(t--){ //cout << "Case #" << ++tt << ": "; solve(); } return 0; }//Hajimemashite
[ "amitray1608@gmail.com" ]
amitray1608@gmail.com
8752a7f692225bda70555d2487fd52b7e331f929
19d987b268e24ae225e25b23024a5f0120081fd1
/include/cereal/external/rapidjson/internal/strfunc.h
ee986eda910704ccdd2cb7f7fe54de7974b86f1f
[ "CC0-1.0", "MIT" ]
permissive
SaxonRah/QuestWeaver
7da32946aa8045f631a4e1b5a0aefbd5f25bde1b
f7e7b3364942336cd2ee14a6699a448a8cd55dc5
refs/heads/master
2021-01-22T13:38:10.429190
2016-09-19T05:20:56
2016-09-19T05:21:22
68,661,827
1
0
null
2016-09-20T01:34:11
2016-09-20T01:34:11
null
UTF-8
C++
false
false
734
h
#ifndef RAPIDJSON_INTERNAL_STRFUNC_H_ #define RAPIDJSON_INTERNAL_STRFUNC_H_ namespace rapidjson { namespace internal { //! Custom strlen() which works on different character types. /*! \tparam Ch Character type (e.g. char, wchar_t, short) \param s Null-terminated input string. \return Number of characters in the string. \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. */ template<typename Ch> inline SizeType StrLen(const Ch *s) { const Ch *p = s; while (*p != '\0') ++p; return SizeType(p - s); } } // namespace internal } // namespace rapidjson #endif // RAPIDJSON_INTERNAL_STRFUNC_H_
[ "galetzka@posteo.de" ]
galetzka@posteo.de
7cdc3042a64dace10874251e9b4fd295295b33dc
b84aa8a1745f3346f22b9a0ae1c977a244dfb3cd
/SDK/RC_WBP_RankedIcon_parameters.hpp
8aeec23b5123fbbb456f0896fa613ae9c06aaf88
[]
no_license
frankie-11/Rogue-SDK-11.8
615a9e51f280a504bb60a4cbddb8dfc4de6239d8
20becc4b2fff71cfec160fb7f2ee3a9203031d09
refs/heads/master
2023-01-10T06:00:59.427605
2020-11-08T16:13:01
2020-11-08T16:13:01
311,102,184
1
0
null
null
null
null
UTF-8
C++
false
false
1,213
hpp
#pragma once // RogueCompany (4.24) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace SDK { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function WBP_RankedIcon.WBP_RankedIcon_C.SetRankedTierTextByTier struct UWBP_RankedIcon_C_SetRankedTierTextByTier_Params { }; // Function WBP_RankedIcon.WBP_RankedIcon_C.SetRankedIconByTier struct UWBP_RankedIcon_C_SetRankedIconByTier_Params { }; // Function WBP_RankedIcon.WBP_RankedIcon_C.SetRankedLevel struct UWBP_RankedIcon_C_SetRankedLevel_Params { }; // Function WBP_RankedIcon.WBP_RankedIcon_C.PreConstruct struct UWBP_RankedIcon_C_PreConstruct_Params { }; // Function WBP_RankedIcon.WBP_RankedIcon_C.Construct struct UWBP_RankedIcon_C_Construct_Params { }; // Function WBP_RankedIcon.WBP_RankedIcon_C.ExecuteUbergraph_WBP_RankedIcon struct UWBP_RankedIcon_C_ExecuteUbergraph_WBP_RankedIcon_Params { }; // Function WBP_RankedIcon.WBP_RankedIcon_C.OnRankTierSet__DelegateSignature struct UWBP_RankedIcon_C_OnRankTierSet__DelegateSignature_Params { }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "60810131+frankie-11@users.noreply.github.com" ]
60810131+frankie-11@users.noreply.github.com
48b50eb0b99e9591b0863b175ee51d2c32dca30e
a7d599499ae7329da7bd7a9f8e88542cad07037e
/onvif/common/base64.cpp
99a6b25e6d11de8f578ebf42bba22ab199e11758
[]
no_license
allenway/onvif
16ecff69dc5a2ca7c9198a663e7ad76789451dd4
a5520f3e518a18fc82beab7ada85e7a68b2ce932
refs/heads/master
2020-04-10T20:12:46.019775
2016-02-04T02:07:04
2016-02-04T02:07:04
50,405,973
9
9
null
null
null
null
GB18030
C++
false
false
9,046
cpp
/* * base64.c -- Base64 Mime encoding * * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. * * See the file "license.txt" for usage and redistribution license requirements * * $Id: base64.c,v 1.1 2013/04/23 07:28:46 seven Exp $ */ /******************************** Description *********************************/ /* * The base64 command encodes and decodes a pSrc in mime base64 format */ /********************************* Includes ***********************************/ #include "debug.h" #if 0 /******************************** Local Data **********************************/ /* * Mapping of ANSI chars to base64 Mime encoding alphabet (see below) */ static short map64[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static char alphabet64[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', }; /*********************************** Code *************************************/ /* * Decode a buffer from "pSrc" and into "pDst" */ /* * fn: base64 编码 * pDst: out, 存放编码后的字符串 * pSrc: 需要编码的字串 * dstSize: pDst 所指向内存空间的长度 * 特别注意: pSrc 必须以'\0'结尾; 而且pDst 也是以'\0' 结尾 */ int Base64Decode( char *pDst, char *pSrc, int dstSize ) { unsigned long shiftbuf; char *cp, *op; int c, i, j, shift; op = pDst; *op = '\0'; cp = pSrc; while (*cp && *cp != '=') { /* * Map 4 (6bit) input bytes and store in a single long (shiftbuf) */ shiftbuf = 0; shift = 18; for (i = 0; i < 4 && *cp && *cp != '='; i++, cp++) { c = map64[*cp & 0xff]; if (c == -1) { SVPrint( "Bad pSrc: %s at | %c | index %d\r\n", pSrc, c, i); return -1; } shiftbuf = shiftbuf | (c << shift); shift -= 6; } /* * Interpret as 3 normal 8 bit bytes (fill in reverse order). * Check for potential buffer overflow before filling. */ --i; if ((op + i) >= &pDst[dstSize]) { strcpy( pDst, "String too big" ); SVPrint( "%s:%s!\r\n", "size of pDst is too less" ); return -1; } for (j = 0; j < i; j++) { *op++ = (char) ((shiftbuf >> (8 * (2 - j))) & 0xff); } *op = '\0'; } return 0; } #else //new /******************************************************************************* Base64解码方法中,最简单的也是查表法:将64个可打印字符的值作为索引,查表得到的值(范围为0-63)依次连起来,拼凑成字节形式输出,就得到解码结果。 ********************************************************************************/ const char DeBase64Tab[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, // '+' 0, 0, 0, 63, // '/' 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // '0'-'9' 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 'A'-'Z' 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // 'a'-'z' }; int Base64Decode( char* pDst, char* pSrc, int dstSize ) { int nDstLen; // 输出的字符计数 int nValue; // 解码用到的长整数 int myDeBase64Tab; int i; int nSrcLen = strlen( pSrc ); i = 0; nDstLen = 0; // 取4个字符,解码到一个长整数,再经过移位得到3个字节 while (i < nSrcLen) { if (*pSrc != '\r' && *pSrc!='\n') { myDeBase64Tab = *pSrc++; nValue = DeBase64Tab[myDeBase64Tab] << 18; myDeBase64Tab = *pSrc++; nValue += DeBase64Tab[myDeBase64Tab] << 12; *pDst++ = (nValue & 0x00ff0000) >> 16; nDstLen++; if (*pSrc != '=') { myDeBase64Tab = *pSrc++; nValue += DeBase64Tab[myDeBase64Tab] << 6; *pDst++ = (nValue & 0x0000ff00) >> 8; nDstLen++; if (*pSrc != '=') { myDeBase64Tab = *pSrc++; nValue += DeBase64Tab[myDeBase64Tab]; *pDst++ =nValue & 0x000000ff; nDstLen++; } } i += 4; } else // 回车换行,跳过 { pSrc++; i++; } } // 输出加个结束符 *pDst = '\0'; return nDstLen; } #endif #if 0 /******************************************************************************/ /* * Encode a buffer from "pSrc" into "pDst" */ /* * fn: base64 编码 * pDst: out, 存放解码后的字符串 * pSrc: 需要解码的字串 * dstSize: pDst 所指向内存空间的长度 * 特别注意: pSrc 必须以'\0'结尾; 而且pDst 也是以'\0' 结尾 */ void Base64Encode( char *pDst, char *pSrc, int dstSize ) { unsigned long shiftbuf; char *cp, *op; int x, i, j, shift; op = pDst; *op = '\0'; cp = pSrc; while (*cp) { /* * Take three characters and create a 24 bit number in shiftbuf */ shiftbuf = 0; for (j = 2; j >= 0 && *cp; j--, cp++) { shiftbuf |= ((*cp & 0xff) << (j * 8)); } /* * Now convert shiftbuf to 4 base64 letters. The i,j magic calculates * how many letters need to be output. */ shift = 18; for (i = ++j; i < 4 && op < &pDst[dstSize] ; i++) { x = (shiftbuf >> shift) & 0x3f; *op++ = alphabet64[(shiftbuf >> shift) & 0x3f]; shift -= 6; } /* * Pad at the end with '=' */ while (j-- > 0) { *op++ = '='; } *op = '\0'; } } #endif //int Base64Encode( char *in, const int inLen, char *out, int outLen ) int Base64Encode( char *pDst, char *pSrc, int dstSize ) { static const char *codes ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; char *p = pDst; int inLen = strlen(pSrc); int times = inLen / 3; int i; int base64_len = 4 * ((inLen+2)/3); if(dstSize < base64_len) { SVPrint( "Failed: dstSize(%d) < base64_len(%d)\r\n", dstSize, base64_len ); return -1; } for(i=0; i<times; ++i) { *p++ = codes[(pSrc[0] >> 2) & 0x3f]; *p++ = codes[((pSrc[0] << 4) & 0x30) + ((pSrc[1] >> 4) & 0xf)]; *p++ = codes[((pSrc[1] << 2) & 0x3c) + ((pSrc[2] >> 6) & 0x3)]; *p++ = codes[pSrc[2] & 0x3f]; pSrc += 3; } if(times * 3 + 1 == inLen) { *p++ = codes[(pSrc[0] >> 2) & 0x3f]; *p++ = codes[((pSrc[0] << 4) & 0x30) + ((pSrc[1] >> 4) & 0xf)]; *p++ = '='; *p++ = '='; } if(times * 3 + 2 == inLen) { *p++ = codes[(pSrc[0] >> 2) & 0x3f]; *p++ = codes[((pSrc[0] << 4) & 0x30) + ((pSrc[1] >> 4) & 0xf)]; *p++ = codes[((pSrc[1] << 2) & 0x3c)]; *p++ = '='; } *p = '\0'; return 0; }
[ "250214838@qq.com" ]
250214838@qq.com
3ff379b247b42287f36244bef98e31d7a4a86cac
cc62e405f2c227cf5c7b68812adcaf1c63ef4b20
/sursa.cpp
ca4368a982c72ca9f1dbf6c0a1f7ccc8d531c074
[]
no_license
bandreiionel/SNAKE
0e7caa83c96713992e41d7d2896077c5652c9bed
257b6a6d45a8c4df99c7bfa7d4cf38b90a1eddc1
refs/heads/master
2020-06-10T06:10:19.608989
2017-01-12T06:05:27
2017-01-12T06:05:27
76,061,797
1
0
null
null
null
null
UTF-8
C++
false
false
16,196
cpp
#include <iostream> #include <conio.h> #include <stdlib.h> #include <Windows.h> #include <string.h> #include <fstream> #include <stdio.h> #include <cstdio> #include <conio.h> #include <dos.h> using namespace std; void runAI(); void inceputAI(); void runSolo(); void vec0(unsigned a[], int); void sort(unsigned a[], int); void scoruri(); void adaugScor(unsigned,int); void afisHarta(); void inceput(); void move(int dx, int dy); void update(); void schimbaDirectia(char key); void mancare(); char valoareHarta(int value); enum directie { SUS, JOS, STANGA, DREAPTA }; struct coordonate { int x; int y; }; struct sarpe { coordonate cap; directie di; unsigned lungime; unsigned score; bool inViata; }s1, s2; unsigned top[50]; bool afara = false; int P[20][20]; int A[20][20]; coordonate cont; bool running; unsigned viteza; int harta[21][21]; int nrharta; char meniu[100][100]; int superscore; int superlungime; int k; void copie(char a[], char b[]){ int i = 0; int n = strlen(b); while (i<n) { a[i] = b[i]; i++; } } int nrcifre(int nr) { int cifre=0; do { cifre++; nr /= 10; } while (nr != 0); return cifre; } void vec0(unsigned vec[],int n) { for (int i = 0; i < n; i++) vec[i] = 0; } void afisaremeniu(int vec[],int k) { int l; if ((P[cont.x][cont.y] == 3 || P[cont.x][cont.y] == 14)) { fstream f("solo.txt"); l = 0; vec0(top,19); while (f >> top[l] && l <= 10) { l++; } f.close(); } else if ((P[cont.x][cont.y] == 15 || P[cont.x][cont.y] == 25)) { fstream f("AI.txt"); l = 0; vec0(top,19); if (f.is_open()) { while (!f.eof() && l <= 10) { f >> top[l]; l++; } } f.close(); } system("cls"); int i, j, ok; for (i = 0; i < k; i++) { ok = 1; for (j = 1; j <= vec[0] && ok; j++) if (i == vec[j]) ok = 0; cout << endl << "\t\t"; for (j = 0; j < 31 ; j++) if ((P[cont.x][cont.y] == 3 || (P[cont.x][cont.y] == 14 && cont.x!=10 )) && i > 4 && i < 14 && j == 10) { cout << i - 4 << ". " << top[i - 5]; j += nrcifre(top[i - 5])+2 ; } else if ((P[cont.x][cont.y] == 15 || P[cont.x][cont.y] == 25) && i > 15 && i < 25 && j == 10) { cout << i - 15 << ". " << top[i - 16]; j += nrcifre(top[i - 15]) +2; } else if (meniu[i][j] != '\#' && ok == 0) cout << ' '; else cout << meniu[i][j]; } } void _pa() { P[0][0] = 4; P[0][1] = 2; P[0][2] = 5; P[0][3] = 8; P[0][4] = 22; A[0][0] = 12; A[0][1] = 4; A[0][2] = 6; A[0][3] = 7; A[0][4] = 9; A[0][5] = 10; A[0][6] = 12; A[0][7] = 13; A[0][8] = 14; A[0][9] = 16; A[0][10] = 17; A[0][11] = 18; A[0][12] = 19; P[2][0] = 2; P[2][1] = 4; P[2][2] = 6; A[2][0] = 11; A[2][1] = 5; A[2][2] = 7; A[2][3] = 9; A[2][4] = 10; A[2][5] = 12; A[2][6] = 13; A[2][7] = 14; A[2][8] = 16; A[2][9] = 17; A[2][10] = 18; A[2][11] = 19; P[8][0] = 2; P[8][1] = 10; P[8][2] = 16; A[8][0] = 10; A[8][1] = 4; A[8][2] = 6; A[8][3] = 7; A[8][4] = 9; A[8][5] = 12; A[8][6] = 13; A[8][7] = 14; A[8][8] = 17; A[8][9] = 18; A[8][10] = 19; P[10][0] = 3; P[10][1] = 12; P[10][2] = 13; P[10][3] = 14; A[10][0] = 7; A[10][1] = 4; A[10][2] = 6; A[10][3] = 7; A[10][4] = 9; A[10][5] = 17; A[10][6] = 18; A[10][7] = 19; P[16][0] = 3; P[16][1] = 17; P[16][2] = 18; P[16][3] = 19; A[16][0] = 7; A[16][1] = 4; A[16][2] = 6; A[16][3] = 7; A[16][4] = 9; A[16][5] = 12; A[16][6] = 13; A[16][7] = 14; A[5][0] = 2; A[5][1] = 14; A[5][2] = 25; P[5][0] = 2; P[5][1] = 3; P[5][2] = 15; A[3][0] = 1; A[3][1] = 25; P[3][0] = 1; P[3][1] = 14; A[15][0] = 1; A[15][1] = 14; P[15][0] = 1; P[15][1] = 25; } void initializare(){ cont.x = 0; cont.y = 1; k = 25; copie(meniu[0],"##############################"); copie(meniu[1],"# #"); copie(meniu[2],"# > START #"); copie(meniu[3],"# #"); copie(meniu[4],"# SOLO #"); copie(meniu[5], "# SCORURI #"); copie(meniu[6],"# VS AI #"); copie(meniu[7], "# #"); copie(meniu[8],"# OPTION #"); copie(meniu[9], "# #"); copie(meniu[10],"# Viteza #"); copie(meniu[11], "# #"); copie(meniu[12],"# Slow #"); copie(meniu[13],"# Medium #"); copie(meniu[14],"# Fast #"); copie(meniu[15], "# #"); copie(meniu[16], "# HARTA #"); copie(meniu[17], "# Easy #"); copie(meniu[18], "# Medium #"); copie(meniu[19], "# Hard #"); copie(meniu[20], "# #"); copie(meniu[21], "# #"); copie(meniu[22],"# QUIT #"); copie(meniu[23], "# #"); copie(meniu[24], "##############################"); afisaremeniu(A[0],k); } void scoruri() { k = 28; copie(meniu[0], "##############################"); copie(meniu[1], "# #"); copie(meniu[2], "# SCORURI #"); copie(meniu[3], "# Solo #"); copie(meniu[4], "# #"); copie(meniu[5], "# #"); copie(meniu[6], "# #"); copie(meniu[7], "# #"); copie(meniu[8], "# #"); copie(meniu[9], "# #"); copie(meniu[10], "# #"); copie(meniu[11], "# #"); copie(meniu[12], "# #"); copie(meniu[13], "# #"); copie(meniu[14], "# RESET #"); copie(meniu[15], "# VS AI #"); copie(meniu[16], "# #"); copie(meniu[17], "# #"); copie(meniu[18], "# #"); copie(meniu[19], "# #"); copie(meniu[20], "# #"); copie(meniu[21], "# #"); copie(meniu[22], "# #"); copie(meniu[23], "# #"); copie(meniu[24], "# #"); copie(meniu[25], "# RESET #"); copie(meniu[26], "##############################"); afisaremeniu(A[0],k); } void resetfis(int fis) { if (fis == 1) { remove("solo.txt"); } else if (fis == 2) { remove("AI.txt"); } } bool pauza; void adaugScor(unsigned x, int fis) { if (fis == 1) { fstream f("solo.txt"); int i = 0; if (f.is_open()) { while (!f.eof() && i <= 10) { f >> top[i]; i++; } } top[i] = x; sort(top, i + 1); f.close(); f.open("solo.txt", ios::trunc | ios::out); for (int k = 0; k <= i; k++) { f << top[k] << " "; } f.close(); } else { fstream f("AI.txt"); int i = 0; if (f.is_open()) { while (!f.eof() && i <= 10) { f >> top[i]; i++; } } top[i] = x; sort(top, i + 1); f.close(); f.open("AI.txt", ios::trunc | ios::out); for (int k = 0; k <= i; k++) { f << top[k] << " "; } f.close(); } } void inceputAI() { for (int i = 1; i < 19; i++) for (int j = 1; j < 19; j++) harta[i][j] = 0; s2.inViata = true; s1.score = 0; s1.di = DREAPTA; s2.cap.x= s1.cap.x = 10; s1.cap.y = 12; s2.cap.y = 8; s2.di = STANGA; harta[s1.cap.x][s1.cap.y] =harta[s2.cap.x][s2.cap.y] = 1; s2.lungime=s1.lungime = 3; if (nrharta == 2) { for (int x = 0; x < 20; x++) { harta[0][x] = -1; harta[x][19] = -1; harta[x][0] = -1; harta[19][x] = -1; } } else if (nrharta == 1) { for (int x = 0; x < 20; x++) { harta[0][x] = -2; harta[x][19] = -2; harta[x][0] = -2; harta[19][x] = -2; } } else if (nrharta == 3) { for (int x = 0; x < 20; x++) { if (x % 2) { harta[0][x] = -2; harta[x][19] = -2; harta[x][0] = -2; harta[19][x] = -2; } else { harta[0][x] = -3; harta[x][19] = -3; harta[x][0] = -3; harta[19][x] = -3; } } } mancare(); } void updateAI() { if (s1.di == STANGA) move(0, -1); else if (s1.di == DREAPTA) move(0, 1); else if (s1.di == SUS) move(-1, 0); else if (s1.di == JOS) move(1, 0); if (s2.di == STANGA) move(0, -1); else if (s1.di == DREAPTA) move(0, 1); else if (s1.di == SUS) move(-1, 0); else if (s1.di == JOS) move(1, 0); for (int i = 0; i < 20; i++) for (int j = 0; j < 20; j++) { if (harta[i][j] > 0) harta[i][j]--; } if (superlungime != 0) { s1.lungime--; superlungime--; for (int i = 0; i < 20; i++) for (int j = 0; j < 20; j++) { if (harta[i][j] > 1) harta[i][j]--; } } } void runAI() { inceputAI(); running = true; while (running) { if (_kbhit()) { schimbaDirectia(_getch()); } updateAI(); system("cls"); afisHarta(); if (viteza == 1) Sleep(300); else if (viteza == 2) Sleep(150); else Sleep(10); } cout << endl << "\t\t!!!Game over!" << std::endl << "\t\tYour score is: " << s1.score; adaugScor(s1.score, 2); } void muta(char caract) { if ((caract == 'w' || caract == 'W') && cont.y > 1) { meniu[P[cont.x][cont.y]][11] = ' '; cont.y--; meniu[P[cont.x][cont.y]][11] = '\>'; afisaremeniu(A[cont.x], k); } else if ((caract == 's' || caract == 'S') && cont.y < P[cont.x][0]) { meniu[P[cont.x][cont.y]][11] = ' '; cont.y++; meniu[P[cont.x][cont.y]][11] = '\>'; afisaremeniu(A[cont.x], k); } else if ((caract == 'a' || caract == 'A') && cont.x != 0) { if (cont.x == 10 || cont.x == 16) { meniu[P[cont.x][cont.y]][11] = ' '; cont.x = 8; cont.y = 1; meniu[P[cont.x][cont.y]][11] = '\>'; afisaremeniu(A[cont.x], k); } else if (cont.x == 15 || cont.x==3) { meniu[P[cont.x][cont.y]][11] = ' '; cont.x = 5; cont.y = 1; meniu[P[cont.x][cont.y]][11] = '\>'; afisaremeniu(A[cont.x], k); } else initializare(); } else if ((caract == 'd' || caract == 'D')) { if (P[cont.x][cont.y] == 2 || P[cont.x][cont.y] == 8 || P[cont.x][cont.y] == 10 || P[cont.x][cont.y] == 16 || P[cont.x][cont.y] == 15 || P[cont.x][cont.y] == 3) { meniu[P[cont.x][cont.y]][11] = ' '; cont.x = P[cont.x][cont.y]; cont.y = 1; meniu[P[cont.x][cont.y]][11] = '\>'; afisaremeniu(A[cont.x],k); } else if (P[cont.x][cont.y] == 5) { scoruri(); cont.x = P[cont.x][cont.y]; cont.y = 1; meniu[P[cont.x][cont.y]][11] = '\>'; afisaremeniu(A[cont.x], k); } else if (P[cont.x][cont.y] == 14 && cont.x==3) { meniu[P[cont.x][cont.y]][11] = ' '; cont.x = 5; cont.y = 1; meniu[P[cont.x][cont.y]][11] = '\>'; resetfis(1); afisaremeniu(A[cont.x], k); } else if (P[cont.x][cont.y] == 25) { meniu[P[cont.x][cont.y]][11] = ' '; cont.x = 5; cont.y = 1; meniu[P[cont.x][cont.y]][11] = '\>'; resetfis(2); afisaremeniu(A[cont.x], k); } else if (P[cont.x][cont.y] == 12 || P[cont.x][cont.y] == 13 || P[cont.x][cont.y] == 14 ) { viteza = -11 + P[cont.x][cont.y]; muta('a'); } else if (P[cont.x][cont.y] == 22) { Sleep(500); afara = true; } else if (P[cont.x][cont.y] == 4) { runSolo(); Sleep(5000); initializare(); } /* else if (P[cont.x][cont.y] == 6) { runAI(); Sleep(5000); initializare(); } */ else if (P[cont.x][cont.y] == 17|| P[cont.x][cont.y] == 18 || P[cont.x][cont.y] == 19 ) { nrharta = -16 + P[cont.x][cont.y]; muta('a'); } else if (P[cont.x][cont.y] == 3 || P[cont.x][cont.y] == 15) { afisaremeniu(A[cont.x], k); } } } void menu() { viteza = nrharta = 2; _pa(); initializare(); while (!afara) { if (_kbhit()) { muta(_getch()); } } } int main() { menu(); return 0; } void sort(unsigned vec[],int n) { int i,j,aux; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if (vec[i] < vec[j]) { aux = vec[i]; vec[i] = vec[j]; vec[j] = aux; } } void runSolo() { inceput(); running = true; while (running) { if (_kbhit()) { schimbaDirectia(_getch()); } update(); system("cls"); afisHarta(); if(viteza == 1) Sleep(120); else if (viteza == 2) Sleep(40); } cout <<endl<< "\t\t!!!Game over!" << std::endl << "\t\tYour score is: " << s1.score; adaugScor(s1.score,1); } void schimbaDirectia(char key) { if ((key == 'w' || key == 'W') && s1.di != JOS) s1.di = SUS; else if ((key == 'd' || key == 'D') && s1.di != STANGA) s1.di = DREAPTA; else if ((key == 's' || key == 'S') && s1.di != SUS) s1.di = JOS; else if ((key == 'a' || key == 'a') && s1.di != DREAPTA) s1.di = STANGA; else if (key == 'p' || key == 'P') { system("pause"); } } void move(int dx, int dy) { int noux = s1.cap.x + dx; int nouy = s1.cap.y + dy; if (harta[noux][nouy] == -5) { s1.lungime++; if (superscore > 0) { superscore--; if (viteza == 1) s1.score += 5; else if (viteza == 2) s1.score += 10; else s1.score += 30; } if(viteza==1) s1.score += 5; else if (viteza == 2) s1.score += 10; else s1.score += 30; mancare(); } else if (harta[noux][nouy] == -2) { if (s1.di == SUS) noux = 18; else if (s1.di == JOS) noux = 1; else if (s1.di == DREAPTA) nouy = 1; else if (s1.di == STANGA) nouy = 18; } else if (harta[noux][nouy] == -6) { superscore += 5; } else if (harta[noux][nouy] == -7) { superlungime += 5; } else if (harta[noux][nouy] != 0) running = false; s1.cap.x = noux; s1.cap.y = nouy; harta[s1.cap.x][s1.cap.y] = s1.lungime + 1; } void mancare() { int x = 0; int y = 0; do { x = rand() % 18 + 1; y = rand() % 18 + 1; } while (harta[x][y] != 0); harta[x][y] = -5; if (s1.lungime % 6 == 0 && s1.lungime > 5) { do { x = rand() % 18 + 1; y = rand() % 18 + 1; } while (harta[x][y] != 0); harta[x][y] = (rand() % 2) - 7; } } void update() { if (s1.di == STANGA) move(0, -1); else if (s1.di == DREAPTA) move(0, 1); else if (s1.di == SUS) move(-1, 0); else if (s1.di == JOS) move(1, 0); for (int i = 0; i < 20; i++) for (int j = 0; j < 20; j++) { if (harta[i][j] > 0) harta[i][j]--; } if (superlungime != 0) { int ok = 1; for (int i = 1; i < 19; i++) for (int j = 1; j < 19; j++) { if (harta[i][j] > 1) { harta[i][j]--; ok = 0; } } if (!ok) { s1.lungime--; superlungime--; } } } void inceput() { s1.score = 0; s1.di = DREAPTA; s1.cap.x = 10; s1.cap.y = 10; harta[s1.cap.x][s1.cap.y] = 1; s1.lungime = 3; if (nrharta == 2) { for (int x = 0; x < 20; x++) { harta[0][x] = -1; harta[x][19] = -1; harta[x][0] = -1; harta[19][x] = -1; } } else if (nrharta == 1) { for (int x = 0; x < 20; x++) { harta[0][x] = -2; harta[x][19] = -2; harta[x][0] = -2; harta[19][x] = -2; } } else if (nrharta == 3) { for (int x = 0; x < 20; x++) { if (x % 2) { harta[0][x] = -2; harta[x][19] = -2; harta[x][0] = -2; harta[19][x] = -2; } else { harta[0][x] = -3; harta[x][19] = -3; harta[x][0] = -3; harta[19][x] = -3; } } } for (int i = 1; i < 19; i++) for (int j = 1; j < 19; j++) harta[i][j] = 0; mancare(); } void afisHarta() { cout << endl<<endl << "\t\tSCORUL:" <<s1.score<<endl<<"\t\t" ; for (int x = 0; x < 20; x++) { for (int y = 0; y < 20; y++) { cout << valoareHarta(harta[x][y]); } cout << endl<<"\t\t"; } } char valoareHarta(int value) { /* if (value == s1.lungime && s1.di== SUS) return '^'; else if (value == s1.lungime && s1.di == DREAPTA) return '>'; else if (value == s1.lungime && s1.di == JOS) return char (251); else if (value == s1.lungime && s1.di == STANGA) return '<'; */ if (value == s1.lungime) return char(219); else if (value > 0) return char(254); else if (value == -1) return char(219); else if (value == -2) return char(176); else if (value == -3) return char(254); else if (value == -5) return 'O'; else if (value == -6) return 'S'; else if (value == -7) return 'L'; }
[ "bandreiionel@yahoo.com" ]
bandreiionel@yahoo.com
97318c5cc969165a425673614eb009a7694394b1
6930eb5941afd18a11dfe43baccdc7efdb157288
/myfuncs.cpp
6ab64e3082a1bbaed5cdbf4be283f8bb591f165d
[]
no_license
genuinelucifer/simple_pong_game
9d0e65a609ed3e2eb6e725d5c7bcdc83ba6f0c2a
2313fd71964d70a0ac72cbaea0baf5aee96855a5
refs/heads/master
2021-01-23T14:05:32.798646
2015-03-13T14:15:00
2015-03-13T14:15:00
32,159,466
0
0
null
null
null
null
UTF-8
C++
false
false
19,144
cpp
#include"myfuncs.h" using namespace irrklang; // #pragma comment(lib, "irrKlang.lib") ISoundEngine* se = NULL; int My_PlaySound(char * filename) { // Play some sound if(se->play2D(filename) != 0) { MessageBox(gethCurrentWindow(),"Couldn't play the file...","ERROR??",MB_ICONERROR); return 0; } return 1; } HPEN red_pen=CreatePen(PS_SOLID,1,RGB(255,0,0)); HPEN green_pen=CreatePen(PS_SOLID,1,RGB(0,255,0)); HPEN blue_pen=CreatePen(PS_SOLID,1,RGB(0,0,255)); HPEN black_pen=CreatePen(PS_SOLID,1,RGB(0,0,0)); HBRUSH red_brush=CreateSolidBrush(RGB(255,0,0)); HBRUSH black_brush=CreateSolidBrush(RGB(0,0,0)); HBRUSH green_brush=CreateSolidBrush(RGB(0,255,0)); HBRUSH blue_brush=CreateSolidBrush(RGB(0,0,255)); Bat global_curBat; Ball global_curBall; GameStates global_curState; int done=0; HWND hCurrentWindow = NULL; HINSTANCE hThisInstance = NULL; HDC game_dc = NULL; Bricks ALL_BRICKS[TOTAL_BRICKS]; DEVMODE game_screen; int BricksLeft = TOTAL_BRICKS; int Cur_Level = 0; int isdone() { return done; } void setdone(int i) { done = i; } HWND gethCurrentWindow() { return hCurrentWindow; } HFONT CreateMyFont(int width,int height,int orientation) { return CreateFont(height,width,orientation,0,FW_NORMAL,FALSE,FALSE,FALSE,ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_ROMAN, "Times New Roman"); } void GameInit(HINSTANCE hinst,HWND hWindow) { done =0; hThisInstance = hinst; hCurrentWindow = hWindow; se = createIrrKlangDevice(); // check for errors with creation if(!se) { MessageBox(gethCurrentWindow(),"Couldn't create sound engine...","ERROR??",MB_ICONERROR); exit(GE_SOUND_ENGINE_NOT_CREATED); } se->setSoundVolume(100); game_screen.dmSize = sizeof (game_screen); game_screen.dmPelsWidth=SCREEN_WIDTH; game_screen.dmPelsHeight=SCREEN_HEIGHT; game_screen.dmBitsPerPel=16; game_screen.dmFields= DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL ; if (ChangeDisplaySettings(&game_screen,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) { MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By Your Video Card...","Error!!!",MB_OK|MB_ICONERROR); exit(GE_FULLSCREEN_NOT_AVAILABLE); } global_curBat.posx = WINDOW_WIDTH/2; global_curBat.speedx = 0.0f; global_curBat.curx = (float) global_curBat.posx; global_curBall.posx = WINDOW_WIDTH/2; global_curBall.posy = WINDOW_HEIGHT - BAT_HEIGHT - (BALL_HEIGHT/2); global_curBall.curx = (float) global_curBall.posx; global_curBall.cury = (float) global_curBall.posy; global_curBall.speedx = 1.5f; global_curBall.speedy = 0; game_dc = GetDC(hCurrentWindow); global_curState = GSSplashWelcome; } GameStates ShowControls(HDC hdc) { HFONT font=CreateMyFont(35,40); SetBkMode(game_dc,TRANSPARENT); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(200,180,160)); TextOut(game_dc,100,20,"PONG 2.0!",9); font=CreateMyFont(40,50); SelectObject(hdc,font); SetTextColor(hdc,RGB(120,50,20)); TextOut(hdc,60,60,"CONTROLS",8); font=CreateMyFont(12,15); SelectObject(hdc,font); SetTextColor(hdc,RGB(150,160,82)); TextOut(hdc,3,130,"*Use Left an Right arrow keys to move the bat.",45); TextOut(hdc,5,180,"*Use Esc to quit while playing.",30); font=CreateMyFont(10,12); SelectObject(hdc,font); SetTextColor(hdc,RGB(150,120,170)); TextOut(hdc,8,405,"Click anywhere OR Press Spacebar to go back.",43); DeleteObject(font); if(KEYDOWN(VK_SPACE)) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(hdc,&myrect,black_brush); My_PlaySound((char*)"sounds\\whoah.mp3"); return GSMenu; } return GSControls; } GameStates ShowCredits(HDC hdc) { HFONT font=CreateMyFont(35,40); SetBkMode(game_dc,TRANSPARENT); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(200,180,160)); TextOut(game_dc,100,10,"PONG 2.0!",9); font=CreateMyFont(25,30); SelectObject(hdc,font); SetTextColor(game_dc,RGB(80,200,60)); TextOut(hdc,10,130,"PROGRAMMER:",11); TextOut(hdc,10,250,"GRAPHICS DESIGNER:",18); font=CreateMyFont(30,35,45); SelectObject(hdc,font); SetTextColor(hdc,RGB(50,20,170)); TextOut(hdc,250,180,"&",1); SetTextColor(hdc,RGB(250,50,70)); TextOut(hdc,250,330,"Abhinav",7); font=CreateMyFont(35,40); SelectObject(hdc,font); SetTextColor(hdc,RGB(80,230,200)); TextOut(hdc,100,70,"CREDITS",7); font=CreateMyFont(10,12); SelectObject(hdc,font); SetTextColor(hdc,RGB(150,120,170)); TextOut(hdc,8,405,"Click anywhere OR Press Spacebar to go back.",43); DeleteObject(font); if(KEYDOWN(VK_SPACE)) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(hdc,&myrect,black_brush); My_PlaySound((char*)"sounds\\whoah.mp3"); return GSMenu; } return GSCredits; } DWORD welcomestart = 0; void SplashWelcome() { if(welcomestart == 0) welcomestart = GetTickCount(); HFONT font=CreateMyFont(35,40); SetBkMode(game_dc,TRANSPARENT); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(200,180,160)); TextOut(game_dc,100,20,"PONG 2.0!",9); font=CreateMyFont(35,40); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(170,80,150)); TextOut(game_dc,10,170,"Presented to You",16); TextOut(game_dc,50,210,"BY:",3); font=CreateMyFont(45,55,45); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(250,50,70)); TextOut(game_dc,200,300,"Abhinav",7); DeleteObject(font); if((GetTickCount()-welcomestart)>= WELCOME_SPLASH_TIME) { global_curState = GSMenu; My_PlaySound((char*)"sounds\\whoah.mp3"); RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); } } DWORD endstart = 0; TrueFalse SplashEnd() { if(endstart == 0) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); endstart = GetTickCount(); } HFONT font=CreateMyFont(35,40); SetBkMode(game_dc,TRANSPARENT); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(200,180,160)); TextOut(game_dc,100,20,"PONG 2.0!",9); font=CreateMyFont(28,35); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(170,80,150)); TextOut(game_dc,10,200,"Thanks For Playing...",21); DeleteObject(font); if((GetTickCount()-endstart)>= END_SPLASH_TIME) { return MY_TRUE; } return MY_FALSE; } void GameMain() { switch(global_curState) { case GSSplashWelcome: SplashWelcome(); break; case GSMenu : global_curState = ShowMenu(game_dc); break; break; case GSPlaying : global_curState = Play_MainGame(); break; case GSCredits : global_curState = ShowCredits(game_dc); break; case GSControls : global_curState = ShowControls(game_dc); break; } } char menucmds[4][16]={" Play Game "," Controls "," Credits "," Exit "}; int cursel=0; bool upp=false,dp=false; GameStates ShowMenu(HDC hdc) { HFONT font=CreateMyFont(35,40); SetBkMode(game_dc,TRANSPARENT); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(200,180,160)); TextOut(game_dc,100,20,"PONG 2.0!",9); font=CreateMyFont(20,25); SelectObject(hdc,font); SetTextColor(hdc,RGB(98,22,120)); int cury=150; for(int i=0;i<4;i++) { TextOut(hdc,170,cury,menucmds[i],15); cury+=35; } SetTextColor(hdc,RGB(210,200,225)); cury=150+(cursel*35); TextOut(hdc,170,cury,menucmds[cursel],15); DeleteObject(font); if(KEYDOWN(VK_UP)) { if(!upp) { upp=true; cursel--; if(cursel<0) cursel=3; }} else upp=false; if(KEYDOWN(VK_DOWN)) {if(!dp) { dp=true; cursel=(cursel+1)%4; }} else dp=false; if(KEYDOWN(VK_RETURN)) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(hdc,&myrect,black_brush); My_PlaySound((char *)"sounds\\whoah.mp3"); switch(cursel) { case 0: return GSPlaying; break; case 1: return GSControls; break; case 2: return GSCredits; break; case 3: done = 1; break; } } return GSMenu; } void SetupLevel() { global_curBall.speedy = -(BALL_SPEED_Y + ((float)(Cur_Level) * 2)); BricksLeft = TOTAL_BRICKS; srand(GetTickCount()); int x = 20 , y = 20; for(int i=0;i<TOTAL_BRICKS;i++) { ALL_BRICKS[i].x = x; ALL_BRICKS[i].y = y; ALL_BRICKS[i].color = rand()%4; if(ALL_BRICKS[i].color ==0) { ALL_BRICKS[i].isliving = MY_FALSE; BricksLeft--; } else { ALL_BRICKS[i].isliving = MY_TRUE; } x += 60; if(x > (WINDOW_WIDTH - 20)) { y+=30; x = 20; } } } int islevelsetup = 0; GameStates Play_MainGame() { if(islevelsetup == 0) { SetupLevel(); islevelsetup = 1; } Bat curBat = global_curBat; curBat.curx += curBat.speedx; float batwideby2 = (float)BAT_WIDTH / 2.0; if(curBat.curx < (batwideby2 + 1.0f)) { curBat.curx = batwideby2 + 1.0f; } else if(curBat.curx > ((float)WINDOW_WIDTH - batwideby2)) { curBat.curx = ((float)WINDOW_WIDTH) - batwideby2; } curBat.posx = (int) curBat.curx; Ball curBall = global_curBall; curBall.curx += curBall.speedx; float ballwideby2 = (float)BALL_WIDTH / 2.0; if(curBall.curx < ballwideby2) { curBall.curx = ballwideby2; curBall.speedx = - curBall.speedx; } else if(curBall.curx > ((float)WINDOW_WIDTH - ballwideby2)) { curBall.curx = (float)WINDOW_WIDTH - ballwideby2; curBall.speedx = -curBall.speedx; } curBall.posx = (int) curBall.curx; curBall.cury += curBall.speedy; float ballhiteby2 = (float)BALL_HEIGHT / 2.0; if(curBall.cury < ballhiteby2) { curBall.cury = ballhiteby2; curBall.speedy = - curBall.speedy; } else if(curBall.cury >= ((float)WINDOW_HEIGHT - ballhiteby2 - 3.0f)) { if( ((curBall.curx+ ballwideby2) < (curBat.curx - batwideby2 - 1.0f)) || ((curBall.curx - ballwideby2) > (curBat.curx + batwideby2 + 1.0f))) { My_PlaySound((char*)"sounds\\paddlebreak.mp3"); MessageBox(hCurrentWindow,"You Lost... \n Try again Later..... :) ","OOPS!!!",MB_OK | MB_ICONINFORMATION); islevelsetup = 0; RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); return GSMenu; } else { curBall.speedy = -curBall.speedy; curBall.speedx = (curBall.curx - curBat.curx)/10.0f; } } curBall.posy = (int) curBall.cury; for(int i=0;i<TOTAL_BRICKS;i++) { if(ALL_BRICKS[i].isliving == MY_TRUE) { int diffx = ALL_BRICKS[i].x - curBall.posx; int diffy = ALL_BRICKS[i].y - curBall.posy; if(diffx < 0) diffx = -diffx; if(diffy < 0) diffy = -diffy; if((diffx < ((BALL_WIDTH + BRICK_WIDTH)/2)) && (diffy < ((BALL_HEIGHT + BRICK_HEIGHT)/2))) { int global_diffx = ALL_BRICKS[i].x - global_curBall.posx; int global_diffy = ALL_BRICKS[i].y - global_curBall.posy; if(global_diffx < 0) global_diffx = -global_diffx; if(global_diffy < 0) global_diffy = -global_diffy; if(global_diffx > ((BALL_WIDTH + BRICK_WIDTH)/2)) /** TURN BALL ON BRICK BREAK */ curBall.speedx = -curBall.speedx; else if(global_diffy > ((BALL_HEIGHT + BRICK_HEIGHT)/2)) curBall.speedy = -curBall.speedy; ALL_BRICKS[i].isliving = MY_FALSE; RECT myrect = {(ALL_BRICKS[i].x - (BRICK_WIDTH/2)),(ALL_BRICKS[i].y - (BRICK_HEIGHT/2)), (ALL_BRICKS[i].x + (BRICK_WIDTH / 2)),(ALL_BRICKS[i].y+(BRICK_HEIGHT/2))}; FillRect(game_dc,&myrect,black_brush); BricksLeft--; My_PlaySound((char*)"sounds\\brickBreak.mp3"); if(BricksLeft == 0) { MessageBox(hCurrentWindow,"You WON... \n Continue to next Level.... :) ","WOWEEEE!!!",MB_OK | MB_ICONINFORMATION); Cur_Level++; My_PlaySound((char*)"sounds\\win.mp3"); if(Cur_Level >= MAX_LEVELS) { MessageBox(hCurrentWindow,"You COMPLETED the Whole Game.... \n Thanks For Playing..... :) ","WOWEEEEEEEEEE!!!",MB_OK | MB_ICONEXCLAMATION); RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); return GSMenu; } else { islevelsetup = 0; } } } else { HBRUSH selbrush; switch(ALL_BRICKS[i].color) { case 1: { selbrush = red_brush; }break; case 2: { selbrush = green_brush; }break; case 3: { selbrush = blue_brush; }break; default : selbrush = black_brush; break; } RECT myrect = {(ALL_BRICKS[i].x - (BRICK_WIDTH/2)),(ALL_BRICKS[i].y - (BRICK_HEIGHT/2)), (ALL_BRICKS[i].x + (BRICK_WIDTH / 2)),(ALL_BRICKS[i].y+(BRICK_HEIGHT/2))}; FillRect(game_dc,&myrect,selbrush); } } } /** ERASE BATS AND BALL */ SelectObject(game_dc,black_pen); SelectObject(game_dc,black_brush); Ellipse(game_dc,(global_curBat.posx - batwideby2),WINDOW_HEIGHT - BAT_HEIGHT - 2,(global_curBat.posx + batwideby2),WINDOW_HEIGHT - 2); Ellipse(game_dc,(global_curBall.posx - ballwideby2),(global_curBall.posy - ballhiteby2),(global_curBall.posx + ballwideby2),(global_curBall.posy + ballhiteby2)); if(KEYDOWN(VK_LEFT)) curBat.speedx = - BAT_SPEED; else if(KEYDOWN(VK_RIGHT)) curBat.speedx = BAT_SPEED; else curBat.speedx = 0.0f; global_curBall = curBall; global_curBat = curBat; /** DRAW BATS AND BALL */ SelectObject(game_dc,red_brush); SelectObject(game_dc,red_pen); Ellipse(game_dc,(global_curBat.posx - batwideby2),WINDOW_HEIGHT - BAT_HEIGHT - 2,(global_curBat.posx + batwideby2),WINDOW_HEIGHT - 2); Ellipse(game_dc,(global_curBall.posx - ballwideby2),(global_curBall.posy - ballhiteby2),(global_curBall.posx + ballwideby2),(global_curBall.posy + ballhiteby2)); /** WRITE the Required texts on Screen */ /** USE : TextOut(hdc,startx,starty,text,numberOfLetters); */ HFONT font=CreateMyFont(9,14); SelectObject(game_dc,font); SetTextColor(game_dc,RGB(150,120,170)); char s[10]; sprintf(s,"%d",(Cur_Level + 1)); TextOut(game_dc,WINDOW_WIDTH + 4,10,"LEVEL :",7); TextOut(game_dc,WINDOW_WIDTH + 18,30,s,1); SetTextColor(game_dc,RGB(20,10,200)); TextOut(game_dc,WINDOW_WIDTH + 2,50,"Welcome",7); TextOut(game_dc,WINDOW_WIDTH + 20,80,"TO",2); SetTextColor(game_dc,RGB(200,10,20)); font=CreateMyFont(10,18); SelectObject(game_dc,font); TextOut(game_dc,WINDOW_WIDTH + 5,150,"PONG!",5); TextOut(game_dc,WINDOW_WIDTH + 15,180,"2.0",3); DeleteObject(font); SelectObject(game_dc,blue_pen); MoveToEx(game_dc,WINDOW_WIDTH+1,1,NULL); LineTo(game_dc,WINDOW_WIDTH+1,WINDOW_HEIGHT); if(KEYDOWN(VK_ESCAPE)) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); My_PlaySound((char*)"sounds\\whoah.mp3"); return GSMenu; } return GSPlaying; } void GameQuit() { if(se!=NULL) se->drop(); DeleteObject(red_pen); DeleteObject(green_pen); DeleteObject(blue_pen); DeleteObject(black_pen); DeleteObject(red_brush); DeleteObject(green_brush); DeleteObject(blue_brush); DeleteObject(black_brush); ReleaseDC(hCurrentWindow,game_dc); ChangeDisplaySettings(NULL,NULL); // return to Original display } void setMousePos(int x,int y,TrueFalse lbtn) { if(global_curState == GSPlaying) { int batwideby2 = BAT_WIDTH /2; /** ERASE BAT */ SelectObject(game_dc,black_pen); SelectObject(game_dc,black_brush); Ellipse(game_dc,(global_curBat.posx - batwideby2),WINDOW_HEIGHT - BAT_HEIGHT - 2,(global_curBat.posx + batwideby2),WINDOW_HEIGHT - 2); if(x < batwideby2) x = batwideby2; else if(x> (WINDOW_WIDTH - batwideby2)) x = WINDOW_WIDTH - batwideby2; global_curBat.posx = x; global_curBat.curx = (float)x; /** DRAW BAT */ SelectObject(game_dc,red_brush); SelectObject(game_dc,red_pen); Ellipse(game_dc,(global_curBat.posx - batwideby2),WINDOW_HEIGHT - BAT_HEIGHT - 2,(global_curBat.posx + batwideby2),WINDOW_HEIGHT - 2); } else if(global_curState==GSMenu) { if(y>145 && y <=180) cursel = 0; else if(y>180 && y<=215) cursel = 1; else if(y>215 && y<=250) cursel = 2; else if(y>250 && y<=285) cursel = 3; if(lbtn == MY_TRUE) { if(y>145 && y<=285) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); My_PlaySound((char*)"sounds\\whoah.mp3"); switch(cursel) { case 0: global_curState = GSPlaying; break; case 1: global_curState = GSControls; break; case 2: global_curState = GSCredits; break; case 3: done = 1; break; } } } } else if(global_curState == GSCredits || global_curState == GSControls) { if(lbtn == MY_TRUE) { RECT myrect = {0,0,SCREEN_WIDTH,SCREEN_HEIGHT}; FillRect(game_dc,&myrect,black_brush); global_curState = GSMenu; My_PlaySound((char*)"sounds\\whoah.mp3"); } } }
[ "genuineabhinav@gmail.com" ]
genuineabhinav@gmail.com
6b252478c79be78be63609a5ff1f1dea14cd23b5
6caee5b61fb3f94973992f499cd0541ea03e8a24
/arduino/altar/lightgroup.h
35649536e18b2bd4d6c38be58325c61cf07752f1
[]
no_license
nsparisi/locurio
df40d06206434d5ac230732806f9c5afa1be870a
dc11cd00f2ede8dd725aa67b5895f0a8b5220f4f
refs/heads/master
2021-10-24T12:15:01.646271
2019-03-26T02:43:06
2019-03-26T02:43:06
34,501,868
1
1
null
null
null
null
UTF-8
C++
false
false
463
h
#ifndef LightGroup_h #define LightGroup_h #include <LedControl.h> #include <inttypes.h> class LightGroup { private: int Row; int Columns[8]; int Count; bool CurrentState; public: LightGroup(int row, int column); LightGroup(int row, int column1, int column2); LightGroup(int row, int column1, int column2, int column3); void On(); void Off(); void SetState(bool state); }; extern LedControl LedController; #endif
[ "bandrews@mofangheavyindustries.com" ]
bandrews@mofangheavyindustries.com
72742945da9c3624e79ba3c0037e95713b91ec32
b1fd48392139b5534d0c7e358a2a48dbe8382e23
/include/triton/codegen/shmem_info.h
f8325d00b8ec3ac69554a62949de7a1ef4094f89
[ "MIT" ]
permissive
zhangboyue/triton
c5a3d04182154f722cd1469f505388039cf0bb9b
126f1c410a176e239dd7497a544dae897cc36204
refs/heads/master
2020-07-01T05:14:53.782694
2019-08-07T14:03:25
2019-08-07T14:03:25
201,057,652
0
0
null
2019-08-07T13:36:59
2019-08-07T13:36:59
null
UTF-8
C++
false
false
719
h
#ifndef TDL_INCLUDE_CODEGEN_BUFFER_INFO_PASS_H #define TDL_INCLUDE_CODEGEN_BUFFER_INFO_PASS_H #include <set> #include <map> namespace triton { namespace ir { class module; class value; class phi_node; class instruction; } namespace codegen{ class shmem_info { public: void run(ir::module &mod); // queries bool is_double(ir::value *x); void add_shared(ir::value *v); bool is_shared(ir::value *x); bool is_loop_latch(ir::phi_node *phi, ir::instruction *terminator); ir::value *get_reference(ir::value *x); void replace(ir::value* before, ir::value *after); private: std::set<ir::value*> shared_; std::set<ir::value*> double_; std::map<ir::value*, ir::value*> refs_; }; } } #endif
[ "ptillet@g.harvard.edu" ]
ptillet@g.harvard.edu
fd8347bb8cb767f1b10410ee5f98ec011a59f10a
bdd9f3cdabe0c768641cf61855a6f24174735410
/src/engine/client/library/clientUserInterface/src/shared/core/CuiStringIdsCommunity.h
ec7903a849d29bb4a5fc78a9762b2f2fc29b6b11
[]
no_license
SWG-Source/client-tools
4452209136b376ab369b979e5c4a3464be28257b
30ec3031184243154c3ba99cedffb2603d005343
refs/heads/master
2023-08-31T07:44:22.692402
2023-08-28T04:34:07
2023-08-28T04:34:07
159,086,319
15
47
null
2022-04-15T16:20:34
2018-11-25T23:57:31
C++
UTF-8
C++
false
false
2,295
h
//====================================================================== // // CuiStringIdsCommunity.h // Copyright Sony Online Entertainment // //====================================================================== #ifndef INCLUDED_CuiStringIdsCommunity_H #define INCLUDED_CuiStringIdsCommunity_H #include "StringId.h" //====================================================================== #define MAKE_STRING_ID(a, b) const StringId b(#a,#b); //---------------------------------------------------------------------- namespace CuiStringIdsCommunity { MAKE_STRING_ID(ui_cmnty, any); MAKE_STRING_ID(ui_cmnty, citizenship_title); MAKE_STRING_ID(ui_cmnty, city_gcw_region_defender_title); MAKE_STRING_ID(ui_cmnty, guild_gcw_region_defender_title); MAKE_STRING_ID(ui_cmnty, clear_preference_confirmation); MAKE_STRING_ID(ui_cmnty, clear_profile_confirmation); MAKE_STRING_ID(ui_cmnty, friend_comment_success); MAKE_STRING_ID(ui_cmnty, friend_comment_usage); MAKE_STRING_ID(ui_cmnty, friend_group_success); MAKE_STRING_ID(ui_cmnty, friend_group_usage); MAKE_STRING_ID(ui_cmnty, friend_invalid); MAKE_STRING_ID(ui_cmnty, friend_list_add); MAKE_STRING_ID(ui_cmnty, friend_list_hide_offline); MAKE_STRING_ID(ui_cmnty, friend_list_modify); MAKE_STRING_ID(ui_cmnty, friend_offline); MAKE_STRING_ID(ui_cmnty, friend_online); MAKE_STRING_ID(ui_cmnty, friend_online_remote); MAKE_STRING_ID(ui_cmnty, friend_remove_confirmation); MAKE_STRING_ID(ui_cmnty, friend_status_offline); MAKE_STRING_ID(ui_cmnty, friend_status_online); MAKE_STRING_ID(ui_cmnty, match_found_prose); MAKE_STRING_ID(ui_cmnty, no_more_selections); MAKE_STRING_ID(ui_cmnty, no_title); MAKE_STRING_ID(ui_cmnty, one_selection_only); MAKE_STRING_ID(ui_cmnty, quick_match_bad_parameters); MAKE_STRING_ID(ui_cmnty, quick_match_many); MAKE_STRING_ID(ui_cmnty, quick_match_none); MAKE_STRING_ID(ui_cmnty, quick_match_one); MAKE_STRING_ID(ui_cmnty, quick_match_title); MAKE_STRING_ID(ui_cmnty, search_time_2_minutes); MAKE_STRING_ID(ui_cmnty, search_time_5_minutes); MAKE_STRING_ID(ui_cmnty, search_time_10_minutes); MAKE_STRING_ID(ui_cmnty, search_time_never); }; #undef MAKE_STRING_ID //====================================================================== #endif // INCLUDED_CuiStringIdsCommunity_H
[ "swgmaster@india.com" ]
swgmaster@india.com
7d8716d7bc7117b8387b772f19d291e4412458f2
498cbcd45d8a9e8e9d96d493d57aa874cc84de8a
/windows/runner/window_configuration.cpp
e3b0d1c1f1e88385c032de574f7ace681b55e085
[]
no_license
guarani-org/GuaraniTools
766464095f8c4abaa8d8bf269b604421a8f3ad57
ce2c4a7559c1dcf27cbbe58cd0b3fc5750c58fae
refs/heads/master
2022-11-27T01:55:05.194228
2020-08-05T19:25:04
2020-08-05T19:25:04
283,871,855
0
0
null
null
null
null
UTF-8
C++
false
false
273
cpp
#include "window_configuration.h" const wchar_t* kFlutterWindowTitle = L"gnitools"; const unsigned int kFlutterWindowOriginX = 10; const unsigned int kFlutterWindowOriginY = 10; const unsigned int kFlutterWindowWidth = 1280; const unsigned int kFlutterWindowHeight = 720;
[ "oliveira.gui5@gmail.com" ]
oliveira.gui5@gmail.com
70bb57ce2ad34a9bc06f691641a15bbfe739ba19
18d99adcfe6e4fa1bdd9a1a3a811a63b538fa082
/sources/Dispatcher.cpp
c29537d62d369999be560bfaba2d60d959946327
[]
no_license
tommyg141/EX4_b
5f15aaf618ffad68bafaba13513c3ded0ede5ab7
b827ad4470d445e9b48c4f93adf99b4003fcd815
refs/heads/main
2023-04-25T08:54:07.900297
2021-05-19T09:51:52
2021-05-19T09:51:52
368,800,409
0
0
null
null
null
null
UTF-8
C++
false
false
444
cpp
#include "Dispatcher.hpp" using namespace pandemic; using namespace std; Player &Dispatcher::fly_direct(City c) { if (city == c) { throw invalid_argument("already here"); } if ( !board.check_research_station(city) ) { if (cards.count(c)==0) { throw invalid_argument("not have station and card "); } city = c; cards.erase(c); } city = c; return *this; }
[ "tommymordhi@gmail.com" ]
tommymordhi@gmail.com
272e228238724c43a9148a1a09e22de3892d83e1
325f4a6ce8aa09a019cae883c0db967b615da5db
/SDK/PUBG_AircraftCarePackage_Test_classes.hpp
8dff90ca196f77508ac91b3c1a063170a9097ae6
[]
no_license
Rioo-may/PUBG-SDK
1c9e18b1dc0f893f5e88d5c2f631651ada7e63a4
fa64ffdc5924e5f3222a30b051daa3a5b3a86fbf
refs/heads/master
2023-01-07T22:57:11.560093
2020-11-11T05:49:47
2020-11-11T05:49:47
311,240,310
0
0
null
2020-11-11T05:51:42
2020-11-09T06:09:27
C++
UTF-8
C++
false
false
2,318
hpp
#pragma once // PlayerUnknown's Battlegrounds (2.5.39.19) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace Classes { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass AircraftCarePackage_Test.AircraftCarePackage_Test_C // 0x002C (0x0504 - 0x04D8) class AAircraftCarePackage_Test_C : public AAircraftCarePackage { public: struct FPointerToUberGraphFrame UberGraphFrame; // 0x04D8(0x0008) (CPF_ZeroConstructor, CPF_Transient, CPF_DuplicateTransient) class UParticleSystemComponent* P_AircraftRotor; // 0x04E0(0x0008) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData) class UProjectileMovementComponent* ProjectileMovement; // 0x04E8(0x0008) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData) class UAkComponent* Ak; // 0x04F0(0x0008) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData) float Sound_InterptTime; // 0x04F8(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData) float Sound_TargetValue; // 0x04FC(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData) float Sound_CurrentValue; // 0x0500(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData) static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass AircraftCarePackage_Test.AircraftCarePackage_Test_C"); return ptr; } void UserConstructionScript(); void ReceiveBeginPlay(); void ReceiveTick(float* DeltaSeconds); void ExecuteUbergraph_AircraftCarePackage_Test(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "pubgsdk@gmail.com" ]
pubgsdk@gmail.com
de88caee3e911be41e4a5b202790fbcb05412c03
4761f67aea6c997a38244ba931c99d058823fe74
/_Plugins_/plugins/minecontrol_plugin/exceptioninfo.h
c80448d3809a3624602b888087f9f78f7b8e765a
[]
no_license
HeIIoween/FawOS
674ae2e514305779287a8140479b43afceedf2ec
afc65b7931a63b0771ce28ec340694cf22cf17a9
refs/heads/master
2023-05-14T05:24:35.499717
2021-05-26T14:22:46
2021-05-26T14:22:46
109,710,781
0
1
null
null
null
null
UTF-8
C++
false
false
5,371
h
/* Taken from Dr. Dobb's "Visual C++ Exception-Handling Instrumentation" article. * http://www.ddj.com/showArticle.jhtml?documentID=win0212a&pgno=6 * * Small modifications made to also allow access to the current context. */ #include <windows.h> extern "C" { #define MAX_LANG_LEN 64 /* max language name length */ #define MAX_CTRY_LEN 64 /* max country name length */ #define MAX_MODIFIER_LEN 0 /* max modifier name length - n/a */ #define MAX_LC_LEN (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3) #ifndef _SETLOC_STRUCT_DEFINED struct _is_ctype_compatible { unsigned long id; int is_clike; }; typedef struct setloc_struct { /* getqloc static variables */ char *pchLanguage; char *pchCountry; int iLcidState; int iPrimaryLen; BOOL bAbbrevLanguage; BOOL bAbbrevCountry; LCID lcidLanguage; LCID lcidCountry; /* expand_locale static variables */ LC_ID _cacheid; UINT _cachecp; char _cachein[MAX_LC_LEN]; char _cacheout[MAX_LC_LEN]; /* _setlocale_set_cat (LC_CTYPE) static variable */ struct _is_ctype_compatible _Lcid_c[5]; } _setloc_struct, *_psetloc_struct; #define _SETLOC_STRUCT_DEFINED #endif /* _SETLOC_STRUCT_DEFINED */ struct _tiddata { unsigned long _tid; /* thread ID */ uintptr_t _thandle; /* thread handle */ int _terrno; /* errno value */ unsigned long _tdoserrno; /* _doserrno value */ unsigned int _fpds; /* Floating Point data segment */ unsigned long _holdrand; /* rand() seed value */ char * _token; /* ptr to strtok() token */ wchar_t * _wtoken; /* ptr to wcstok() token */ unsigned char * _mtoken; /* ptr to _mbstok() token */ /* following pointers get malloc'd at runtime */ char * _errmsg; /* ptr to strerror()/_strerror() buff */ wchar_t * _werrmsg; /* ptr to _wcserror()/__wcserror() buff */ char * _namebuf0; /* ptr to tmpnam() buffer */ wchar_t * _wnamebuf0; /* ptr to _wtmpnam() buffer */ char * _namebuf1; /* ptr to tmpfile() buffer */ wchar_t * _wnamebuf1; /* ptr to _wtmpfile() buffer */ char * _asctimebuf; /* ptr to asctime() buffer */ wchar_t * _wasctimebuf; /* ptr to _wasctime() buffer */ void * _gmtimebuf; /* ptr to gmtime() structure */ char * _cvtbuf; /* ptr to ecvt()/fcvt buffer */ unsigned char _con_ch_buf[MB_LEN_MAX]; /* ptr to putch() buffer */ unsigned short _ch_buf_used; /* if the _con_ch_buf is used */ /* following fields are needed by _beginthread code */ void * _initaddr; /* initial user thread address */ void * _initarg; /* initial user thread argument */ /* following three fields are needed to support signal handling and * runtime errors */ void * _pxcptacttab; /* ptr to exception-action table */ void * _tpxcptinfoptrs; /* ptr to exception info pointers */ int _tfpecode; /* float point exception code */ /* pointer to the copy of the multibyte character information used by * the thread */ pthreadmbcinfo ptmbcinfo; /* pointer to the copy of the locale informaton used by the thead */ pthreadlocinfo ptlocinfo; int _ownlocale; /* if 1, this thread owns its own locale */ /* following field is needed by NLG routines */ unsigned long _NLG_dwCode; /* * Per-Thread data needed by C++ Exception Handling */ void * _terminate; /* terminate() routine */ void * _unexpected; /* unexpected() routine */ void * _translator; /* S.E. translator */ void * _purecall; /* called when pure virtual happens */ void * _curexception; /* current exception */ void * _curcontext; /* current exception context */ int _ProcessingThrow; /* for uncaught_exception */ void * _curexcspec; /* for handling exceptions thrown from std::unexpected */ #if defined (_M_IA64) || defined (_M_AMD64) void * _pExitContext; void * _pUnwindContext; void * _pFrameInfoChain; unsigned __int64 _ImageBase; #if defined (_M_IA64) unsigned __int64 _TargetGp; #endif /* defined (_M_IA64) */ unsigned __int64 _ThrowImageBase; void * _pForeignException; #elif defined (_M_IX86) void * _pFrameInfoChain; #endif /* defined (_M_IX86) */ _setloc_struct _setloc_data; void * _encode_ptr; /* EncodePointer() routine */ void * _decode_ptr; /* DecodePointer() routine */ void * _reserved1; /* nothing */ void * _reserved2; /* nothing */ void * _reserved3; /* nothing */ int _cxxReThrow; /* Set to True if it's a rethrown C++ Exception */ unsigned long __initDomain; /* initial domain used by _beginthread[ex] for managed function */ }; typedef struct _tiddata * _ptiddata; _ptiddata __cdecl _getptd(); } const EXCEPTION_RECORD * GetCurrentExceptionRecord() { _ptiddata p = _getptd(); return (EXCEPTION_RECORD *)p->_curexception; } const _CONTEXT * GetCurrentExceptionContext() { _ptiddata p = _getptd(); return (_CONTEXT*)p->_curcontext; }
[ "primalfear@pochtamt.ru" ]
primalfear@pochtamt.ru
7743bf6c8b68fe588f4a57ac73175d34e47f6f2b
cfa0d81653558b4b5168b3e61e79dd924974101a
/12799.cpp
4044ef88d2a97cce4a94582bf20e9e33a3d9e6de
[]
no_license
AndersonZM/uva
870c3e278731df332c56e2c2e49cab181c5c10c1
071bf082f963c69ad353b87b1f2c7fce78861871
refs/heads/master
2022-10-23T09:41:00.343353
2020-06-14T21:16:58
2020-06-14T21:16:58
271,821,026
0
0
null
null
null
null
UTF-8
C++
false
false
1,436
cpp
//AC 29/09/2018 //Anderson Zudio #include <iostream> #include <cmath> using namespace std; long long int PotMod(long long int a, int b, int n){ long long int m, c, d, rb[101]; int i, j; m= b; i= 101; while (m > 0){ rb[--i]= m % 2; m= m /2; } c= 0; d= 1; for(j=i; j<= 100; j++){ d= (d*d) % n; c= 2*c; if (rb[j] == 1){ d= (d*a) % n; c++; } } return (long long int) d; } long long modInverse(long long n, long long m) { long long la = 1, lb = 0, ra = 0, rb = 1; long long i = 0, t, mod = m; while(n%m) { if(!i) { la -= n/m*ra; lb -= n/m*rb; } else { ra -= n/m*la; rb -= n/m*lb; } i = !i; t = n, n = m, m = t%m; } if(i) return (la%mod+mod)%mod; return (ra%mod+mod)%mod; } int main(){ long long int n, e, c; //pair n and e is the public key, c is the message ios_base::sync_with_stdio(false); while(cin >> n >> e >> c){ long long int tot, d; //n = (p - 1)(q - 1); tot is the totient function; d is the inverse multiplicative of e in module tot long long int m = 0; //the decrypted message int sqr = (int) sqrt(n); for(int i = 3; i < sqr; ++i){ if(n % i == 0){ tot = (i - 1) * (n/i - 1); break; } } //decode d = modInverse(e, tot); m = PotMod(c, d, n); cout << m << endl; } return 0; }
[ "ildosrel@gmail.com" ]
ildosrel@gmail.com
fa3f234e645dcba9828a5fd3b9c4cd897a69f643
8cf763c4c29db100d15f2560953c6e6cbe7a5fd4
/src/qt/qtbase/src/network/socket/qtcpsocket_p.h
a652eab190cb605bba68d1efc0e1f01d7dd51fb9
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LGPL-2.1-only", "GFDL-1.3-only", "Qt-LGPL-exception-1.1", "LicenseRef-scancode-digia-qt-commercial", "LGPL-3.0-only", "GPL-3.0-only", "LicenseRef-scancode-digia-qt-preview", "LGPL-2.1-or-later", "GPL-1.0-or-later", "LicenseRef-scancode-unknown-license-refe...
permissive
chihlee/phantomjs
69d6bbbf1c9199a78e82ae44af072aca19c139c3
644e0b3a6c9c16bcc6f7ce2c24274bf7d764f53c
refs/heads/master
2021-01-19T13:49:41.265514
2018-06-15T22:48:11
2018-06-15T22:48:11
82,420,380
0
0
BSD-3-Clause
2018-06-15T22:48:12
2017-02-18T22:34:48
C++
UTF-8
C++
false
false
2,113
h
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTCPSOCKET_P_H #define QTCPSOCKET_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of the QLibrary class. This header file may change from // version to version without notice, or even be removed. // // We mean it. // #include <QtNetwork/qtcpsocket.h> #include <private/qabstractsocket_p.h> QT_BEGIN_NAMESPACE class QTcpSocketPrivate : public QAbstractSocketPrivate { Q_DECLARE_PUBLIC(QTcpSocket) }; QT_END_NAMESPACE #endif
[ "ariya.hidayat@gmail.com" ]
ariya.hidayat@gmail.com
b3e85b668ad28b6a82e77e70493cec8a4650077e
6026ca66a25604827615a8d694711c475bec0999
/cb_class_codes/data_structure/list/inbuildlist.cpp
5eaf0dcde43b2f191b405a8743fca983b53d721c
[]
no_license
ShubhamPal19/getReady2C
7372e6b21b329fecab9e99e4b5d69b3cc1217b8d
d30b58e2b72039aecf684a40d22954213c6d50af
refs/heads/main
2023-07-14T12:33:32.193673
2021-08-27T12:50:05
2021-08-27T12:50:05
349,303,331
0
0
null
null
null
null
UTF-8
C++
false
false
283
cpp
#include <iostream> #include <list> using namespace std; int main() { list<int> l; l.push_back(1); l.push_back(2); l.push_back(3); l.push_back(4); l.push_back(5); l.push_back(6); while (!l.empty()) { cout<<l.front()<<" "; l.pop_front(); } }
[ "shubhampal2309@gmail.com" ]
shubhampal2309@gmail.com
944cf3086dcdbad98c402926dcb08670d0518e3e
bfc0dcacbedf2c1bd27ebf91c9a9db9b5476ca5f
/Intro_Dialog/Intro_DialogDlg.cpp
c4ece64b9b8bde43efeae47fec50a63ab607a6d0
[]
no_license
bettersituation/MFCProgramming
1e1bd4a12f56e1aadc9ec2136b310b682edeb131
de6b511992f85dd29448f31229443101dec3bb82
refs/heads/master
2020-06-10T22:00:33.594407
2019-07-09T18:31:20
2019-07-09T18:31:20
193,764,747
0
0
null
null
null
null
UHC
C++
false
false
6,609
cpp
// Intro_DialogDlg.cpp : implementation file // #include "stdafx.h" #include "Intro_Dialog.h" #include "Intro_DialogDlg.h" #include "afxdialogex.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CAboutDlg dialog used for App About class CAboutDlg : public CDialogEx { public: CAboutDlg(); // Dialog Data #ifdef AFX_DESIGN_TIME enum { IDD = IDD_ABOUTBOX }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) END_MESSAGE_MAP() // CIntroDialogDlg dialog CIntroDialogDlg::CIntroDialogDlg(CWnd* pParent /*=nullptr*/) : CDialogEx(IDD_INTRO_DIALOG_DIALOG, pParent) , m_strEdit(_T("")) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_bChecked[0] = m_bChecked[1] = FALSE; } void CIntroDialogDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Text(pDX, IDC_EDIT_STRING, m_strEdit); DDX_Control(pDX, IDC_LIST_OUTPUT, m_listBox); DDX_Control(pDX, IDC_COMBO_AUTO, m_cbListItem); } BEGIN_MESSAGE_MAP(CIntroDialogDlg, CDialogEx) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_CHECK2, &CIntroDialogDlg::OnBnClickedCheck2) ON_LBN_SELCHANGE(IDC_LIST_OUTPUT, &CIntroDialogDlg::OnLbnSelchangeListOutput) ON_CBN_SELCHANGE(IDC_COMBO_AUTO, &CIntroDialogDlg::OnCbnSelchangeComboAuto) ON_COMMAND(IDC_RADIO1, &CIntroDialogDlg::OnRadio1) ON_COMMAND(IDC_RADIO2, &CIntroDialogDlg::OnRadio2) ON_BN_CLICKED(IDC_CHECK1, &CIntroDialogDlg::OnClickedCheck1) ON_BN_CLICKED(IDC_BUTTON_ADD, &CIntroDialogDlg::OnClickedButtonAdd) ON_BN_CLICKED(IDC_BUTTON_INSERT, &CIntroDialogDlg::OnClickedButtonInsert) ON_BN_CLICKED(IDC_BUTTON_DELETE, &CIntroDialogDlg::OnClickedButtonDelete) END_MESSAGE_MAP() // CIntroDialogDlg message handlers BOOL CIntroDialogDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != nullptr) { BOOL bNameValid; CString strAboutMenu; bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); ASSERT(bNameValid); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control } void CIntroDialogDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialogEx::OnSysCommand(nID, lParam); } } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CIntroDialogDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialogEx::OnPaint(); } } // The system calls this function to obtain the cursor to display while the user drags // the minimized window. HCURSOR CIntroDialogDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void CIntroDialogDlg::OnBnClickedCheck2() { // TODO: Add your control notification handler code here if (m_bChecked[1] == FALSE) { m_bChecked[1] = TRUE; m_listBox.AddString(_T("2번 체크 박스 상태 TRUE")); } else { m_bChecked[1] = FALSE; m_listBox.AddString(_T("2번 체크 박스 상태 FALSE")); } UpdateComboBox(); } void CIntroDialogDlg::OnLbnSelchangeListOutput() { // TODO: Add your control notification handler code here } void CIntroDialogDlg::OnCbnSelchangeComboAuto() { // TODO: Add your control notification handler code here } void CIntroDialogDlg::UpdateComboBox() { // TODO: Add your implementation code here. int nCnt = m_listBox.GetCount(); m_cbListItem.ResetContent(); for (int i = 0; i < nCnt; ++i) { CString strItem; strItem.Format(_T("리스트 항목: %d"), i + 1); m_cbListItem.AddString(strItem); } } void CIntroDialogDlg::OnRadio1() { // TODO: Add your command handler code here m_listBox.AddString(_T("1번 라디오 버튼 선택")); UpdateComboBox(); } void CIntroDialogDlg::OnRadio2() { // TODO: Add your command handler code here m_listBox.AddString(_T("2번 라디오 버튼 선택")); UpdateComboBox(); } void CIntroDialogDlg::OnClickedCheck1() { // TODO: Add your control notification handler code here if (m_bChecked[0] == FALSE) { m_bChecked[0] = TRUE; m_listBox.AddString(_T("1번 체크 박스 상태 TRUE")); } else { m_bChecked[0] = FALSE; m_listBox.AddString(_T("1번 체크 박스 상태 FALSE")); } UpdateComboBox(); } void CIntroDialogDlg::OnClickedButtonAdd() { // TODO: Add your control notification handler code here UpdateData(TRUE); if (m_strEdit.IsEmpty() == FALSE) { m_listBox.AddString(m_strEdit); m_strEdit.Empty(); } else { AfxMessageBox(_T("에디트 상자에 문자열을 넣습니다.")); } UpdateData(FALSE); UpdateComboBox(); } void CIntroDialogDlg::OnClickedButtonInsert() { // TODO: Add your control notification handler code here CString strSelText; int index = m_cbListItem.GetCurSel(); if (index != CB_ERR) { m_listBox.GetText(index, strSelText); m_listBox.AddString(strSelText); UpdateComboBox(); } else { AfxMessageBox(_T("콤보 박스에서 삽입할 아이템을 선택하세요")); } } void CIntroDialogDlg::OnClickedButtonDelete() { // TODO: Add your control notification handler code here int index = m_cbListItem.GetCurSel(); if (index != CB_ERR) { m_listBox.DeleteString(index); UpdateComboBox(); } else { AfxMessageBox(_T("콤보 박스에서 삭제할 아이템을 선택하세요")); } }
[ "xogml9365@gmail.com" ]
xogml9365@gmail.com
0e35d729522400a018b81947c0a11f7f96bb3517
2360b6817e21d5968725b9dc98befd049a53ad04
/unoften/usbsniff/Windows/SnoopyPro-0.22/SnoopyProSrc/SnoopyPro/USBLogDoc.h
3b7ae6e6586a9fba62246aafaa43aea9ba82a41c
[]
no_license
ralex1975/sectk
b4534a552544f46b38a99364de8b1a9745133220
85194503ba16cef948c47db561b5296a87b0a87a
refs/heads/master
2021-01-19T23:41:44.730636
2016-05-12T12:28:16
2016-05-12T12:28:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,929
h
// USBLogDoc.h : interface of the CUSBLogDoc class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_USBLOGDOC_H__549F75AA_C09D_4CED_90B6_946189F6925C__INCLUDED_) #define AFX_USBLOGDOC_H__549F75AA_C09D_4CED_90B6_946189F6925C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "URB.h" class CUSBLogDoc : public CDocument { protected: // create from serialization only CUSBLogDoc(); DECLARE_DYNCREATE(CUSBLogDoc) // Attributes public: CArrayURB m_arURB; void SetTimeFormat(BOOL bRelative); BOOL IsTimeFormatRelative(void); void SetTimeStampZero(ULONG uTimeStampZero); void SetExpanded(int nURB, BOOL bIsExpanded); HANDLE m_hSniffer; ULONG m_uDeviceID; CString m_HardwareID; ULONG GetSnifferDevice(void) { return m_uDeviceID; } void AccessSniffer(ULONG uDeviceID, LPCWSTR sHardwareID); void StopAccessSniffer(void); BOOL GetNewURBSFromSniffer(void); void InsertURBs(LONG nNumOfURBs, PVOID data); int GetBufferFullnessEstimate(void); LPCTSTR GetHardwareID(void) { return m_HardwareID; } BOOL m_bSniffingEnabled; void OnPlayPause(void); void OnStop(void); BOOL IsSniffing(void); BOOL IsPaused(void); void AnalyzeLog(void); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CUSBLogDoc) public: virtual BOOL OnNewDocument(); virtual void Serialize(CArchive& ar); //}}AFX_VIRTUAL // Implementation public: virtual ~CUSBLogDoc(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CUSBLogDoc) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_USBLOGDOC_H__549F75AA_C09D_4CED_90B6_946189F6925C__INCLUDED_) //** end of USBLogDoc.h ************************************************** /************************************************************************* $Log: USBLogDoc.h,v $ Revision 1.2 2002/10/05 01:10:43 rbosa Added the basic framework for exporting a log into an XML file. The output written is fairly poor. This checkin is mainly to get the framework in place and get feedback on it. * * 4 2/22/02 6:12p Rbosa * - added some analyzing log functionality: find out endpoint address and * some directions of urbs *************************************************************************/
[ "cyphunk@gmail.com" ]
cyphunk@gmail.com
9cdc83ba4d98a01e1ccbb78378feca934ff5ec4b
ed4abdd5576cab87d677ca1549ac12a72c42b11a
/week2_algorithmic_warmup/5_fibonacci_number_again/fibonacci_huge.cpp
35a8ea99029b44270ce7e9da4bd02a0747c63594
[]
no_license
valeo88/coursera_alg_toolbox_hw
2f5a3058a7b834b5efcacb74047cc374f0591653
2ccbd24abb1da1a97f2ca6cc9b2db5400c5cb082
refs/heads/master
2023-07-10T13:04:12.885368
2021-08-22T16:36:21
2021-08-22T16:36:21
398,846,265
0
0
null
null
null
null
UTF-8
C++
false
false
1,398
cpp
#include <iostream> #include <vector> #include <cassert> #include <cstdlib> long long get_fibonacci_huge_naive(long long n, long long m) { if (n <= 1) return n; long long previous = 0; long long current = 1; for (long long i = 0; i < n - 1; ++i) { long long tmp_previous = previous; previous = current; current = tmp_previous + current; } return current % m; } // use Pisano period pi(m) <= 6 * m and always starts from 01 long long get_fibonacci_huge_fast(long long n, long long m) { if (m <= 1) return m; std::vector<long long> sequence(6 * m); sequence[0] = 0; sequence[1] = 1; int cnt = 1; for (long long i = 2; i <= 6 * m; ++i) { sequence[i] = (sequence[i-2] + sequence[i-1]) % m; ++cnt; if (sequence[i-1] == 0 && sequence[i] == 1) { // size has 2 elements from next sequence cnt -= 2; break; } } return sequence[n % cnt]; } void test_solution() { for (int n = 0; n < 10; ++n) { int a = rand() % 50; int b = rand() % 10 + 1; std::cout << a << " " << b << "\n"; assert(get_fibonacci_huge_fast(a, b) == get_fibonacci_huge_naive(a, b)); } } int main() { long long n, m; std::cin >> n >> m; std::cout << get_fibonacci_huge_fast(n, m) << '\n'; //test_solution(); }
[ "valeo.popov@gmail.com" ]
valeo.popov@gmail.com
6dd59815b1317922fbdf9dbff74fee8e4f24905b
d5e39d3d4b6cf1196d9b9c17e032022006546ba1
/target-ethos/settings/input.hpp
8bd824bdec8714bbc165d518af07c6c26c3b3f05
[]
no_license
deekthesqueak/higan
29eddadda10ced4f8a1ba5cc7fa9c79bbb8e52aa
705ad76261295904d477dfcd720d1ff514cd9219
refs/heads/master
2016-09-06T10:53:49.176470
2013-10-26T02:10:35
2013-10-26T02:10:35
13,875,760
1
0
null
null
null
null
UTF-8
C++
false
false
969
hpp
struct InputSettings : SettingsLayout { Label title; HorizontalLayout focusLayout; Label focusLabel; CheckButton focusPause; CheckButton focusAllow; HorizontalLayout selectionLayout; ComboButton systemList; ComboButton portList; ComboButton deviceList; ListView inputList; HorizontalLayout controlLayout; Button assign[3]; Widget spacer; Button resetButton; Button eraseButton; void synchronize(); Emulator::Interface& activeSystem(); Emulator::Interface::Port& activePort(); Emulator::Interface::Device& activeDevice(); void systemChanged(); void portChanged(); void deviceChanged(); void inputChanged(); void resetInput(); void eraseInput(); void assignInput(); void assignMouseInput(unsigned n); void inputEvent(unsigned scancode, int16_t value, bool allowMouseInput = false); InputSettings(); private: AbstractInput* activeInput = nullptr; }; extern InputSettings* inputSettings;
[ "deek@helios.nerdvana" ]
deek@helios.nerdvana
1e1d48f8687df2a9b98808f6cb283d734e580924
0300eb411aed196862e12ed1b7035a2f405472e6
/Plugin/Reader/vtkSU2ReaderInternal.cxx
8213ff48601b7d5e378d726932b0a690c6b6bda0
[]
no_license
ChristosT/SU2ReaderParaviewPlugin
d7f62c7a230c6ac0c03e805b2db49844cd9fe428
2b9dd953b6f45860cf4807ea5b7911a51a46be06
refs/heads/master
2022-03-31T19:03:29.368902
2020-03-17T16:07:24
2020-03-17T16:07:24
248,014,011
2
0
null
null
null
null
UTF-8
C++
false
false
11,777
cxx
#include "vtkSU2ReaderInternal.h" #include <string> #include <cstring> #include <iostream> #include <functional> #include <sstream> #include <cassert> #include <array> #include <limits> #define DPRINT(x) std::cout <<__func__ << " : " << #x << " ---> "<< x << std::endl; namespace SU2_MESH_IO { const int MAX_STRING_SIZE = 1024; const char KeywordNames[NumKw][MAX_STRING_SIZE] = { "NDIME", "NELEM", "NPOIN", "NMARK" }; // indexed by SU2Keyword element types static const std::array<int,SU2Keyword::NumTotal> ElementSize = { 0,2,3,2,0,3,0,0,0,4,4,0,8,6,5}; namespace detail { // use strinstream instead of the string that std::getline returns // that way we get split on whitespace without extra eford static std::istringstream getline(std::fstream& file) { std::string line; std::getline(file, line); std::istringstream stream(line); return stream; } static void disregard_rest_of_line(std::fstream& file) { std::string tmp; std::getline(file,tmp); // disregard rest of line, (void) tmp; } static const char space = ' '; } /* * Scan the whole file and find the locations of file keywords */ static bool find_keyword_locations(SU2_mesh& mesh) { std::string line; while(std::getline(mesh.file,line)) { // Check whether the line starts by a character // of if it is a comment if(line.size() > 0 and (line[0] != '%') and (isalpha(line[0])) ) { for(int i = 0 ; i < NumKw; i++) { int res = std::strncmp(line.c_str(),KeywordNames[i], std::min(line.size(),std::strlen(KeywordNames[i]))); if( res == 0 ) { //save position of data size in a way that next read will give the number // of entities mesh.KwLocations[i] = (std::uint64_t)mesh.file.tellg() - line.size() + std::strlen(KeywordNames[i]); break; } } // markers treatment const char* key = "MARKER_TAG"; int res = std::strncmp(line.c_str(),key, std::min(line.size(),std::strlen(key))); if( res == 0) { // split in spaces std::istringstream stream(line); std::string tag,tmp; stream >> tmp; // MARKER_TAG; stream >> tag; // actual tag //DPRINT(tag); std::getline(mesh.file,tmp); //next line DPRINT(tmp); mesh.markers[tag] = (uint64_t)mesh.file.tellg() - tmp.size() + std::strlen("MARKER_ELEMS"); } } } // clear failbit, allow for more searches mesh.file.clear(); return true; } bool open_mesh(const char* filename, enum file_mode fmode, SU2_mesh& mesh) { if( fmode == file_mode::WRITE) { mesh.fmode = fmode; mesh.file.open(filename,std::ios::out); if( not mesh.file.is_open()) { std::cerr<< " Could not open " << filename << std::endl; return false; } mesh.file.setf(std::ios_base::scientific); mesh.file.precision(std::numeric_limits< double > ::max_digits10); } else { mesh.fmode = fmode; mesh.file.open(filename,std::ios::in); if( not mesh.file.is_open()) { std::cerr<< " Could not open " << filename << std::endl; return false; } find_keyword_locations(mesh); // save dimension mesh.dim = (int)stat_kwd( mesh, NDIME); } return true; } void SU2_mesh::generate_element_type_counters() { // initialize map std::array<SU2Keyword,7> types ={ LINE, TRIANGLE, QUADRILATERAL , TETRAHEDRON , HEXAHEDRON , PRISM , PYRAMID }; for(SU2Keyword type : types) this->element_counters[type] = 0; int64_t num = stat_kwd(*this,NELEM); // go to begining of elements section for(int64_t i = 0 ; i < num ; i++) { this->element_counters.at(get_element_type(*this))++; detail::disregard_rest_of_line(this->file); } for(const auto& item : this->markers) { int64_t num = stat_kwd(*this,item.first); // go to begining of marker for(int64_t i = 0 ; i < num ; i++) { this->element_counters.at(get_element_type(*this))++; detail::disregard_rest_of_line(this->file); } } } void close_mesh(SU2_mesh& mesh) { mesh.file.close(); } /** * Read number entities under kwd and set position to this kwd */ int64_t stat_kwd(SU2_mesh& mesh, int kwd) { if ( kwd < 0 or kwd >=NumKw) { std::cerr<< "Wrong kwd value"; return -1; } // Go to the position of kwd mesh.file.seekg( mesh.KwLocations[kwd] ); std::istringstream stream = detail::getline(mesh.file); // read number of entities int64_t value; stream >> value; return value; } int64_t stat_kwd(SU2_mesh& mesh, const std::string& marker_name) { if( marker_name.empty()) { std::cerr<< "empty marker name" <<std::endl; return -1; } else if ( mesh.markers.find(marker_name) == mesh.markers.end()) { std::cerr<< "non-existent marker" <<std::endl; return -2; } // Go to the position of kwd mesh.file.seekg( mesh.markers[marker_name] ); std::istringstream stream = detail::getline(mesh.file); // read number of entities int64_t value; stream >> value; return value; } bool set_kwd(SU2_mesh& mesh, int kwd, int64_t k) { if ( kwd < 0 or kwd >=NumKw) { std::cerr<< "Wrong kwd value"; return false; } mesh.file << KeywordNames[kwd] << "=" << detail::space << k << std::endl; return true; } /** * Set number of entities under marker and set position to newline after */ bool set_kwd(SU2_mesh& mesh, const std::string& marker_name,int64_t k) { mesh.file << "MARKER_TAG=" << detail::space << marker_name << std::endl; mesh.file << "MARKER_ELEMS=" << detail::space << k << std::endl; return true; } namespace detail { // base case for compile-time recursion inline void get_line_impl(SU2_mesh& mesh) { detail::disregard_rest_of_line(mesh.file); } template<typename T, typename... Args> void get_line_impl(SU2_mesh& mesh, T& arg, Args&... arguments) { static_assert( std::is_integral<T>::value, "all arguments should be of type uint64_t"); mesh.file >> arg; get_line_impl(mesh,arguments...); } } template<typename T, typename... Args> void get_line(SU2_mesh& mesh, SU2Keyword type, T& arg, Args&... arguments) { static_assert( std::is_integral<T>::value, "all arguments should be of type uint64_t"); if( sizeof...(arguments) + 1 != ElementSize.at(type)) { std::cerr << "Wrong number of arguments" << std::endl; std::cerr << "Expected :" << ElementSize.at(type) << std::endl; std::cerr << "Got :" << sizeof...(arguments) + 1 << std::endl; std::abort(); } detail::get_line_impl(mesh,arg,arguments...); } // Explicit instatiation for connectivity reading functions template void get_line(SU2_mesh& mesh, SU2Keyword type, uint64_t& a, uint64_t& b); // TRIANGLE template void get_line(SU2_mesh& mesh, SU2Keyword type, uint64_t& a, uint64_t& b, uint64_t& c); // QUADRILATERAL/ TETRAHEDRON template void get_line(SU2_mesh& mesh, SU2Keyword type, uint64_t& a, uint64_t& b, uint64_t& c, uint64_t& d); // PYRAMID template void get_line(SU2_mesh& mesh, SU2Keyword type, uint64_t& a, uint64_t& b, uint64_t& c, uint64_t& d, uint64_t& e); // PRISM template void get_line(SU2_mesh& mesh, SU2Keyword type, uint64_t& a, uint64_t& b, uint64_t& c, uint64_t& d, uint64_t& e, uint64_t& f); // HEXAHEDRON template void get_line(SU2_mesh& mesh, SU2Keyword type, uint64_t& a, uint64_t& b, uint64_t& c, uint64_t& d, uint64_t& e, uint64_t& f, uint64_t& g, uint64_t& h); // Specialization for reading point coordinates template <> void get_line(SU2_mesh& mesh, SU2Keyword type, double& x, double& y, double& z) { assert(type == SU2Keyword::POINT3D && " keyword should be POINT3D"); std::istringstream stream = detail::getline(mesh.file); stream >> x >> y >> z; } // 2D points template <> void get_line(SU2_mesh& mesh, SU2Keyword type, double& x, double& y) { assert(type == SU2Keyword::POINT2D && " keyword should be POINT2D"); std::istringstream stream = detail::getline(mesh.file); stream >> x >> y; } // base case for compile-time recursion inline void set_line_impl(SU2_mesh& mesh) { mesh.file << "\n"; } template<typename T, typename... Args> void set_line_impl(SU2_mesh& mesh,T arg, Args... arguments) { static_assert( std::is_integral<T>::value, "all arguments should be of type uint64_t"); mesh.file << arg << detail::space ; set_line_impl(mesh,arguments...); } template<typename T, typename... Args> void set_line(SU2_mesh& mesh, SU2Keyword type, T arg, Args... arguments) { static_assert( std::is_integral<T>::value, "all arguments should be of type uint64_t"); if( sizeof...(arguments) + 1 != ElementSize.at(type)) { std::cerr << "Wrong number of arguments" << std::endl; std::cerr << "Expected :" << ElementSize.at(type) << std::endl; std::cerr << "Got :" << sizeof...(arguments) + 1 << std::endl; std::abort(); } mesh.file << type << detail::space ; set_line_impl(mesh,arg,arguments...); } // Explicit instatiation for connectivity reading functions template void set_line(SU2_mesh& mesh, SU2Keyword type, uint64_t a, uint64_t b); // TRIANGLE template void set_line(SU2_mesh& mesh, SU2Keyword type, uint64_t a, uint64_t b, uint64_t c); // QUADRILATERAL/ TETRAHEDRON template void set_line(SU2_mesh& mesh, SU2Keyword type, uint64_t a, uint64_t b, uint64_t c, uint64_t d); // PYRAMID template void set_line(SU2_mesh& mesh, SU2Keyword type, uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e); // PRISM template void set_line(SU2_mesh& mesh, SU2Keyword type, uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f); // HEXAHEDRON template void set_line(SU2_mesh& mesh, SU2Keyword type, uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, uint64_t g, uint64_t h); // Specialization for reading point coordinates template <> void set_line(SU2_mesh& mesh, SU2Keyword type, double x, double y, double z) { assert(type == SU2Keyword::POINT3D && " keyword should be POINT3D"); mesh.file.precision(std::numeric_limits< double > ::max_digits10); mesh.file << x << detail::space << y << detail::space << z << std::endl; } // 2D points template <> void set_line(SU2_mesh& mesh, SU2Keyword type, double x, double y) { assert(type == SU2Keyword::POINT2D && " keyword should be POINT2D"); mesh.file.precision(std::numeric_limits< double > ::max_digits10); mesh.file << x << detail::space << y << detail::space << std::endl; } SU2Keyword get_element_type(SU2_mesh& mesh) { int c; mesh.file >> c; SU2Keyword type = static_cast<SU2Keyword>(c); return type; } void set_element_type(SU2_mesh& mesh,SU2Keyword kwd) { mesh.file << KeywordNames[kwd] << detail::space; } std::vector<std::string> get_marker_tags(SU2_mesh& mesh) { std::vector<std::string> res; res.reserve(mesh.markers.size()); for(auto& item : mesh.markers) res.push_back(item.first); return res; } }
[ "ctsolakis@cs.odu.edu" ]
ctsolakis@cs.odu.edu
b0dacac7f4df25c7a46975e55aac90cc01e1f774
f78c20457c0ac31faecfb456e6ce6e4bf9e31a37
/Lionheart/lionheartAllFiles/lvb.h
5fe7c2bc47ddab9b2efc979edbf3bc0f19af97b1
[]
no_license
gloryobi/Cpp
a2231cf44081f9f86bc3019a74ad4e217885824f
ea12e89144ed83aa7822896f1f5d29fd8bed8213
refs/heads/master
2021-07-04T01:50:27.635490
2017-09-22T02:34:27
2017-09-22T02:34:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
496
h
#ifndef lvb_H #define lvb_H #include "unit.h" #include <iostream> #include <string> #include <cstdlib> #include <cmath> using namespace std; class lvb : public Unit { public: lvb():Unit(){} lvb(int ir,int ic,int ihp,Dir idir,Rank irank, bool idead, string itla): Unit(ir,ic,ihp,idir,irank,idead,itla){} void Place(int minR,int maxR,int minC,int maxC, SitRep sitrep); // put unit on board Action Recommendation(SitRep sitrep); // tell someone what you want to do private: }; #endif
[ "gloryobielodan@gmail.com" ]
gloryobielodan@gmail.com
8e3478d6bad59078188400b09350a6f8c793c5dd
e05d0e29fd3ed940c18bfb75978a4a0c40aee9ac
/platforms/android/android_std.h
26c7bbf869a37f7554fd4fcb09ccdce04f7b2dc7
[ "FTL", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-happy-bunny", "RSA-MD", "MIT" ]
permissive
templeblock/meow-engine
e7f7d94e1938ccbb9e2eacc0b523815e65e42930
25f5396136d90691e4a4451f382a45da9fdcebc0
refs/heads/master
2022-01-18T06:16:20.853005
2019-07-17T03:11:47
2019-07-17T03:11:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,388
h
/* * Copyright 2019 Julian Haldenby * * 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. * */ #ifndef NYAN_ANDROID_ANDROID_STD_H #define NYAN_ANDROID_ANDROID_STD_H #include <string> #include <sstream> template <typename T> std::string to_string(T value) { std::ostringstream os ; os << value ; return os.str() ; } #endif //NYAN_ANDROID_ANDROID_STD_H
[ "j.haldenby@gmail.com" ]
j.haldenby@gmail.com
3735c7095078b71e7cdc39da94f90bd2f539e3f8
55730b0594e0f94834c01cb1e032dd096fe8b433
/OpenGLProject/Src/EntryPoint/DeferedShading.cpp
4928e2acb06e9f19c7582fd529ea2eba6df50b63
[]
no_license
PhamTDuc/OpenGLProject
10bd21a10b32d5d340440dc3afbb97da4c48d496
a93c766669adfa1f06095e338db1220a256acdad
refs/heads/master
2020-04-26T19:10:55.661212
2019-07-05T06:48:21
2019-07-05T06:48:21
165,866,652
0
0
null
null
null
null
UTF-8
C++
false
false
12,781
cpp
#include <iostream> #include <random> #include <GLAD/glad.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <glm/gtx/euler_angles.hpp> #include "../../LoadingTexture.h" #include "../../Shader.h" #include "../../Camera.h" #include "../../Model.h" float deltaTime = 0.0f; // Time between current frame and last frame float lastFrame = 0.0f; // Time of last frame float x_g = 0.0f; float y_g = 0.0f; void processInput(GLFWwindow *window); void framebuffer_size_callback(GLFWwindow* window, int width, int height); void mouse_callback(GLFWwindow* window, double xpos, double ypos); bool firstMouse = true; float lastX = 0.0f, lastY = 0.0f; float ratio = (float)4 / 3; Camera cam(glm::vec3(0.0f, 1.0f, 5.0f)); int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); #ifdef __APPLE__ glfwWindowHint(GLFW_OPENGL_FORWARD_COMpAT, GL_TRUE); #endif // __APPLE__ GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << "Failed to initialize GLAD" << std::endl; return -1; } //glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glViewport(0, 0, 800, 600); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetCursorPosCallback(window, mouse_callback); float transparentVertices[] = { // positions // texture Coords (swapped y coordinates because texture is flipped upside down) 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.5f, 0.0f, 0.0f ,0.0f, 1.0f, 1.0f, 0.0f }; unsigned int VAO[2], VBO[2]; glGenBuffers(2, VBO); glGenVertexArrays(2, VAO); glBindVertexArray(VAO[0]); glBindBuffer(GL_ARRAY_BUFFER, VBO[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(transparentVertices), &transparentVertices, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 8, (void*)0); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 8, (void*)(sizeof(float) * 3)); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 8, (void*)(sizeof(float) * 6)); float postQuad[]{ //Left Down Triangle. -1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, //Up Right Triangle. 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f }; unsigned int quadVAO, quadVBO; glGenBuffers(1, &quadVBO); glGenVertexArrays(1, &quadVAO); glBindVertexArray(quadVAO); glBindBuffer(GL_ARRAY_BUFFER, quadVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(postQuad), &postQuad, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void*)0); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void*)(sizeof(float) * 2)); glBindVertexArray(0); //Create GBuffer object //Create GBuffer object unsigned int gBuffer; glGenFramebuffers(1, &gBuffer); glBindFramebuffer(GL_FRAMEBUFFER, gBuffer); unsigned int gPosition, gNormal, gColorSpec; // - position color buffer glGenTextures(1, &gPosition); glBindTexture(GL_TEXTURE_2D, gPosition); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 800, 600, 0, GL_RGB, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gPosition, 0); glBindTexture(GL_TEXTURE_2D, 0); // - normal color buffer glGenTextures(1, &gNormal); glBindTexture(GL_TEXTURE_2D, gNormal); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 800, 600, 0, GL_RGB, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, gNormal, 0); glBindTexture(GL_TEXTURE_2D, 0); // - color + specular color buffer glGenTextures(1, &gColorSpec); glBindTexture(GL_TEXTURE_2D, gColorSpec); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 800, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, gColorSpec, 0); glBindTexture(GL_TEXTURE_2D, 0); unsigned int attachments[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 }; glDrawBuffers(3, attachments); //using RenderBufferObject to make sure Depth testing happen unsigned int rbo; glGenRenderbuffers(1, &rbo); glBindRenderbuffer(GL_RENDERBUFFER, rbo); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 800, 600); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "ERROR::FRAMEBUFFER:: Framebuffer is not complete!" << std::endl; glBindFramebuffer(GL_FRAMEBUFFER, 0); Model nanosuit("Model/Nanosuit/nanosuit.obj"); Model lightSphere("Model/Sphere/LightSphere.obj"); Shader shade("GLSL/Model/Vertex.vs", "GLSL/Model/DeferredShading.fs"); Shader light("GLSL/LightShade/Vertex.vs", "GLSL/LightShade/Fragment.fs"); Shader check("GLSL/PostProcessing/Vertex.vs", "GLSL/LightShade/Fragment.fs"); Shader postShader("GLSL/PostProcessing/Vertex.vs", "GLSL/PostProcessing/DeferredShading.fs"); //Generate random number; std::random_device rd; std::mt19937 gen(rd()); std::uniform_real_distribution<float> disx(-4.0f, 8.0f); std::uniform_real_distribution<float> disz(-5.0f, 5.0f); float randomPos[40][2]; float randomLightPos[40][2]; for (int i = 0; i < 40; i++) { randomPos[i][0] = disx(gen); randomPos[i][1] = disz(gen); randomLightPos[i][0] = disz(gen); randomLightPos[i][1] = disx(gen); } glm::mat4 projection = glm::perspective(glm::radians(35.0f), ratio, 0.1f, 1000.0f); while (!glfwWindowShouldClose(window)) { glfwPollEvents(); processInput(window); glEnable(GL_DEPTH_TEST); glEnable(GL_STENCIL_TEST); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); //First Step glBindFramebuffer(GL_FRAMEBUFFER, gBuffer); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); shade.use(); shade.setMat4fv("view", 1, GL_FALSE, cam.getView()); shade.setMat4fv("projection", 1, GL_FALSE, projection); for (int i = 0; i < 20; i++) { glm::mat4 model_plane(1.0f); model_plane = glm::translate(model_plane, glm::vec3(randomPos[i][0], 0.0f,randomPos[i][1])); //model_plane = glm::rotate(glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)); model_plane = glm::scale(model_plane, glm::vec3(0.2f)); shade.setMat4fv("model", 1, GL_FALSE, model_plane); nanosuit.Draw(shade); } //Second Step glBindFramebuffer(GL_FRAMEBUFFER, 0); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //Draw Light Circle Radius //Draw Light Circle Radius glStencilFunc(GL_ALWAYS, 1, 0xff); glStencilMask(0xff); glDisable(GL_DEPTH_TEST); for (int i = 0; i < 40; i++) { glm::mat4 model_light(1.0f); model_light = glm::translate(model_light, glm::vec3(x_g + randomLightPos[i][1], y_g + randomLightPos[i][0] / 10, 0.1f)); const float constant = 1.0; // note that we don't send this to the shader, we assume it is always 1.0 (in our case) const float linear = 0.7; const float quadratic = 1.8; const float maxBrightness = 20.0f; float radius = (-linear + std::sqrt(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))); model_light = glm::scale(model_light, glm::vec3(radius / 20)); light.use(); light.setVec3("color", glm::vec3(1.0f, 0.5f, 1.0f)); light.setMat4fv("view", 1, GL_FALSE, cam.getView()); light.setMat4fv("projection", 1, GL_FALSE, projection); light.setMat4fv("model", 1, GL_FALSE, model_light); lightSphere.Draw(light); } glEnable(GL_DEPTH_TEST); glStencilFunc(GL_EQUAL, 1, 0xff); glStencilMask(0x00); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, gPosition); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, gNormal); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, gColorSpec); postShader.use(); postShader.setVec3("viewPos", cam.getPos()); postShader.setInt("gPosition", 0); postShader.setInt("gNormal", 1); postShader.setInt("gColorSpec", 2); for (int i = 0; i < 40; i++) { postShader.setVec3("lights["+ std::to_string(i) + "].pos", glm::vec3(x_g+ randomLightPos[i][1],y_g+randomLightPos[i][0]/10,0.1f)); postShader.setVec3("lights["+ std::to_string(i) + "].diffuse", glm::vec3(1.0f,0.5f,1.0f)*80.0f); const float constant = 1.0; // note that we don't send this to the shader, we assume it is always 1.0 (in our case) const float linear = 0.7; const float quadratic = 1.8; const float maxBrightness = 20.0f; float radius = (-linear + std::sqrt(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))); postShader.setFloat("lights["+std::to_string(i)+"].radius",radius); } //check.use(); //check.setVec3("color", glm::vec3(0.0f, 1.0f, 0.0f)); glBindVertexArray(quadVAO); glDrawArrays(GL_TRIANGLES, 0, 6); glStencilMask(0xff); glStencilFunc(GL_ALWAYS, 0, 0xff); glDisable(GL_STENCIL_TEST); //Combine with forward rendering //Combine with forward rendering glBindFramebuffer(GL_READ_FRAMEBUFFER, gBuffer); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // write to default framebuffer glBlitFramebuffer(0, 0, 800, 600, 0, 0, 800, 600, GL_DEPTH_BUFFER_BIT, GL_NEAREST); glBindFramebuffer(GL_FRAMEBUFFER, 0); for (int i = 0; i < 40; i++) { glm::mat4 model_light(1.0f); model_light = glm::translate(model_light, glm::vec3(x_g + randomLightPos[i][1], y_g + randomLightPos[i][0]/10, 0.1f)); const float constant = 1.0; // note that we don't send this to the shader, we assume it is always 1.0 (in our case) const float linear = 0.7; const float quadratic = 1.8; const float maxBrightness = 20.0f; float radius = (-linear + std::sqrt(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))); model_light = glm::scale(model_light, glm::vec3(radius/800)); light.use(); light.setVec3("color", glm::vec3(0.0f, 0.5f, 1.0f)); light.setMat4fv("view", 1, GL_FALSE, cam.getView()); light.setMat4fv("projection", 1, GL_FALSE, projection); light.setMat4fv("model", 1, GL_FALSE, model_light); lightSphere.Draw(light); } glfwSwapBuffers(window); } glDeleteVertexArrays(2, VAO); glDeleteBuffers(2, VBO); glfwDestroyWindow(window); glfwTerminate(); return 0; } void framebuffer_size_callback(GLFWwindow* window, int width, int height) { ratio = (float)width / height; glViewport(0, 0, width, height); } void processInput(GLFWwindow *window) { float currentFrame = glfwGetTime(); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) cam.ProcessKeyboard(FORWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) cam.ProcessKeyboard(BACKWARD, deltaTime); if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) cam.ProcessKeyboard(LEFT, deltaTime); if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) cam.ProcessKeyboard(RIGHT, deltaTime); if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS) y_g += 0.75*deltaTime; if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS) y_g -= 0.75*deltaTime; if (glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_PRESS) x_g += 0.75*deltaTime; if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS) x_g -= 0.75*deltaTime; } void mouse_callback(GLFWwindow* window, double xpos, double ypos) { if (firstMouse) { lastX = xpos; lastY = ypos; firstMouse = false; } float xoffset = xpos - lastX; float yoffset = lastY - ypos; lastX = xpos; lastY = ypos; cam.ProcessMouseMovement(xoffset, yoffset, true, 0.1); }
[ "phamduc0701@gmail.com" ]
phamduc0701@gmail.com
d25dec41859f2b539b2c37ab7bfd7bf376e9340c
f62ae83fb64fed4efb99cd578f901ea3eb1a0451
/source/includes/OpenHome/Private/Network.h
d0d7a7482416aa9a48dd5875195b72c381672f2c
[]
no_license
ChriD/RaumserverInstallerLib
be217837224bac06e7f3b1da02edadd495d95b81
e37a345750e14d79a6bfc350273a73fa7725d658
refs/heads/master
2020-04-06T10:33:56.800968
2016-11-09T18:46:09
2016-11-09T18:46:09
55,795,954
0
1
null
null
null
null
UTF-8
C++
false
false
9,224
h
#ifndef HEADER_NETWORK #define HEADER_NETWORK #include <OpenHome/Types.h> #include <OpenHome/Buffer.h> #include <OpenHome/Exception.h> #include <OpenHome/Private/Thread.h> #include <OpenHome/Private/Stream.h> #include <OpenHome/OsTypes.h> #include <OpenHome/Private/Env.h> #include <vector> EXCEPTION(NetworkError) EXCEPTION(NetworkAddressInUse) EXCEPTION(NetworkTimeout) namespace OpenHome { enum ESocketType { eSocketTypeStream = 1, /// Tcp stream eSocketTypeDatagram = 2, /// Udp }; // Addressing // The Endpoint class has been designed with a restricted interface in order to facilitate // the move to different addressing schemes in the future (IPv6) class Endpoint { public: static const TUint kMaxAddressBytes = 16; static const TUint kMaxEndpointBytes = 22; typedef Bws<kMaxAddressBytes> AddressBuf; typedef Bws<kMaxEndpointBytes> EndpointBuf; public: Endpoint(); Endpoint(TUint aPort, const Brx& aAddress); // specify port, specify ip address from string e.g. "192.168.0.1" Endpoint(TUint aPort, TIpAddress aAddress); // specify port, specify ip address from uint void SetPort(TUint aPort); // set port void SetPort(const Endpoint& aEndpoint); // set port from other endpoint void SetAddress(const Brx& aAddress); // set address from string e.g. "192.168.0.1" void SetAddress(TIpAddress aAddress); void SetAddress(const Endpoint& aEndpoint); // set address from other endpoint void Replace(const Endpoint& aEndpoint); // set endpoint from other endpoint TBool Equals(const Endpoint& aEndpoint) const; // test if this endpoint is equal to the specified endpoint TIpAddress Address() const; TUint16 Port() const; // return port as a network order uint16 void AppendAddress(Bwx& aAddress) const; void AppendEndpoint(Bwx& aEndpoint) const; void GetAddressOctets(TByte (&aOctets)[4]) const; static void AppendAddress(Bwx& aAddressBuffer, TIpAddress aAddress); private: TIpAddress iAddress; TUint16 iPort; }; class Socket : public INonCopyable { public: void Close(); void Interrupt(TBool aInterrupt); void SetSendBufBytes(TUint aBytes); void SetRecvBufBytes(TUint aBytes); void SetRecvTimeout(TUint aMs); void LogVerbose(TBool aLog, TBool aHex = false); protected: Socket(); virtual ~Socket() {} TBool TryClose(); void Send(const Brx& aBuffer); void SendTo(const Brx& aBuffer, const Endpoint& aEndpoint); void Receive(Bwx& aBuffer); void Receive(Bwx& aBuffer, TUint aBytes); void ReceiveFrom(Bwx& aBuffer, Endpoint& aEndpoint); void Bind(const Endpoint& aEndpoint); void GetPort(TUint& aPort); void Listen(TUint aSlots); THandle Accept(Endpoint& aClientEndpoint); private: void Log(const char* aPrefix, const Brx& aBuffer) const; protected: THandle iHandle; private: static const uint32_t kLogNone = 0; static const uint32_t kLogPlainText = 1; static const uint32_t kLogHex = 2; uint32_t iLog; mutable Mutex iLock; }; /** * Utility class. * * Create an AutoSocket on the stack using a reference to an opened Socket. * It will automatically be closed on stack cleanup (ie on return or when * an exception passes up). */ class AutoSocket : public INonCopyable { public: AutoSocket(Socket& aSocket); ~AutoSocket(); private: Socket& iSocket; }; /** * Utility class. * * Calls ReadFlush() on its IReader and Close() on its Socket on destruction. */ class AutoSocketReader : public AutoSocket { public: AutoSocketReader(Socket& aSocket, IReader& aReader); ~AutoSocketReader(); private: IReader& iReader; }; /// Shared Tcp client / Tcp session base class class SocketTcp : public Socket, public IWriter, public IReaderSource { public: /** * Block until aBytes bytes are received, replace buffer * Throw NetworkError on network error * Throw NetworkError on remote socket close - returns with aBuffer.Bytes() < aBytes */ void Receive(Bwx& aBuffer, TUint aBytes); // IWriter /** * Send the buffer, block until all bytes are sent * Throw NetworkError on network error */ void Write(TByte aValue); void Write(const Brx& aBuffer); void WriteFlush(); // IReaderSource /** * Receive between [0, aBuffer.MaxBytes()] bytes, replace buffer * Throw NetworkError on network error * On return, aBuffer.Bytes() == 0 means remote socket closed */ void Read(Bwx& aBuffer); void Read(Bwx& aBuffer, TUint aBytes); void ReadFlush(); void ReadInterrupt(); protected: SocketTcp(); }; class Environment; /// Tcp client class SocketTcpClient : public SocketTcp { public: void Open(Environment& aEnv); void Connect(const Endpoint& aEndpoint, TUint aTimeoutMs); }; /// Tcp Session class SocketTcpServer; class SocketTcpSession : public SocketTcp /// Derive from this class to instantiate tcp server behaviour { friend class SocketTcpServer; protected: SocketTcpSession(); virtual void Run() = 0; virtual ~SocketTcpSession(); Endpoint ClientEndpoint() const; private: void Add(SocketTcpServer& aServer, const TChar* aName, TUint aPriority, TUint aStackBytes); void Start(); void Open(THandle aHandle); void Close(); void Terminate(); /// Called by owning TcpServer *before* invoking dtor. Waits for TcpSession::Run() to exit. private: Mutex iMutex; TBool iOpen; SocketTcpServer* iServer; ThreadFunctor* iThread; Endpoint iClientEndpoint; }; // Tcp Server class SocketTcpServer : public Socket { friend class SocketTcpSession; public: SocketTcpServer(Environment& aEnv, const TChar* aName, TUint aPort, TIpAddress aInterface, TUint aSessionPriority = kPriorityHigh, TUint aSessionStackBytes = Thread::kDefaultStackBytes, TUint aSlots = 128); // Add is not thread safe, but why would you want that? void Add(const TChar* aName, SocketTcpSession* aSession, TInt aPriorityOffset = 0); TUint Port() const { return iPort; } TIpAddress Interface() const { return iInterface; } ~SocketTcpServer(); // Closes the server private: TBool Terminating(); // indicates server is in process of being destroyed THandle Accept(Endpoint& aClientEndpoint); // accept a connection and return the session handle private: Mutex iMutex; // allows one thread to accept at a time TUint iSessionPriority; // priority given to all session threads TUint iSessionStackBytes; // stack bytes given to all session threads TBool iTerminating; std::vector<SocketTcpSession*> iSessions; TUint iPort; TIpAddress iInterface; }; // general udp socket; class SocketUdpBase : public Socket { public: void SetTtl(TUint aTtl); void Send(const Brx& aBuffer, const Endpoint& aEndpoint); Endpoint Receive(Bwx& aBuffer); TUint Port() const; ~SocketUdpBase(); protected: SocketUdpBase(Environment& aEnv); void ReCreate(); private: void Create(); protected: Environment& iEnv; TUint iPort; }; class SocketUdp : public SocketUdpBase { public: SocketUdp(Environment& aEnv); // lets the os select a port SocketUdp(Environment& aEnv, TUint aPort); // stipulate a port SocketUdp(Environment& aEnv, TUint aPort, TIpAddress aInterface); // stipulate a port and an interface void ReBind(TUint aPort, TIpAddress aInterface); void SetMulticastIf(TIpAddress aInterface); private: void Bind(TUint aPort, TIpAddress aInterface); }; // multicast receiver class SocketUdpMulticast : public SocketUdpBase { public: SocketUdpMulticast(Environment& aEnv, TIpAddress aInterface, const Endpoint& aEndpoint); ~SocketUdpMulticast(); void ReCreate(); private: TIpAddress iInterface; TIpAddress iAddress; }; /** * Utility class which enforces the Read() - ReadFlush() useage pattern * This class may be useful to subclasses of SocketUdpClient or * SocketUdpMulticast but its use is entirely optional */ class UdpReader : public IReaderSource, public INonCopyable { public: UdpReader(); UdpReader(SocketUdpBase& aSocket); void SetSocket(SocketUdpBase& aSocket); void ClearSocket(); Endpoint Sender() const; // sender of last completed Read() public: // from IReaderSource void Read(Bwx& aBuffer); void ReadFlush(); void ReadInterrupt(); protected: SocketUdpBase* iSocket; private: Endpoint iSender; TBool iOpen; }; /** * Utility class which enforces the Write() - WriteFlush() useage pattern * This class may be useful to subclasses of SocketUdp or SocketUdpMulticast */ class UdpWriter : public IWriter, public INonCopyable { public: UdpWriter(SocketUdpBase& aSocket, const Endpoint& aEndpoint); virtual void Write(TByte aValue); virtual void Write(const Brx& aBuffer); virtual void WriteFlush(); private: SocketUdpBase& iSocket; Endpoint iEndpoint; TBool iOpen; }; } // namespace OpenHome #endif // HEADER_NETWORK
[ "chris_d85@hotmail.com" ]
chris_d85@hotmail.com
22d5a99a6f257c88daf416093d02686dbe105154
8c3ed3954ad165e94a662b20ffb72bda45e9da64
/3dsound_ALSA_NOT_IMPORTANT/CircularBuffer.h
2db7b228879884e2129bcbffcfbd707e213a0c13
[]
no_license
ese350/2015-ESE519-3DSound
4adf6298245b87939fdf762d5697055509429369
1abc41c06ab9fd40422c2e3e776c9d3e95e88419
refs/heads/master
2020-08-07T05:53:27.169361
2015-05-05T02:36:50
2015-05-05T02:36:50
35,067,044
0
0
null
null
null
null
UTF-8
C++
false
false
2,739
h
#ifndef _CircularBuffer_h #define _CircularBuffer_h #define INITIAL 3000 #define MAXSIZE 1024 #define EXTRASIZE 4096 class CircularBuffer{ /* If wptr == rptr, it is empty */ /* Remember: capacity-1 is all you can store */ private: size_t rptr,wptr,capacity; unsigned short data[MAXSIZE+EXTRASIZE]; public: CircularBuffer(size_t cap){ rptr = 0; wptr = 0; //printf("\r\n%u %u",rptr,wptr); //fflush(stdout); capacity = MAXSIZE+EXTRASIZE; //clear(); } ~CircularBuffer(){ //delete[] data; } size_t writeSizeRemaining(); void write(unsigned short *dataPtr, size_t samples); void writeOneSample(unsigned short dac_data); size_t readSizeRemaining(); void read(unsigned short *dataPtr, size_t samples); unsigned short readOneSample(); void clear(); }; size_t CircularBuffer::writeSizeRemaining() { return capacity-readSizeRemaining()-1; } void CircularBuffer::write(unsigned short *dataPtr, size_t samples) { /* Assumes enough space is avilable in data */ //Condition 1 if wptr+samples<capacity //Condition 2 else two for loops size_t sizeRemaining = capacity - wptr; if(sizeRemaining <= samples){ size_t i=0; for(; wptr<capacity; i++) data[wptr++] = dataPtr[i]; for(wptr = 0; i < samples; i++) data[wptr++] = dataPtr[i]; } else { for(size_t i=0; i<samples; i++) data[wptr++] = dataPtr[i]; } // printf("\r\nwptr: %u,rptr: %u",wptr,rptr); // fflush(stdout); } size_t CircularBuffer::readSizeRemaining(){ return (wptr >= rptr) ? wptr - rptr : (capacity-rptr+wptr); } void CircularBuffer::read(unsigned short *buf, size_t samples) { /* Assumes enough space is avilable in data */ //Condition 1 if wptr+samples<capacity //Condition 2 else two for loops size_t sizeRemaining = capacity - rptr; if(sizeRemaining <= samples){ size_t i=0; for(; rptr < capacity; rptr++) { buf[i++] = data[rptr]; } for(rptr = 0; i<samples; i++) buf[i] = data[rptr++]; } else { for(size_t i=0; i < samples ; i++) buf[i] = data[rptr++]; } } unsigned short CircularBuffer::readOneSample() { if(rptr>=capacity){ rptr=0; } return data[rptr++]; } /*void CircularBuffer::writeOneSample(unsigned short dac_data) { if(wptr>=capacity){ wptr=0; } data[wptr++] = dac_data; }*/ void CircularBuffer::clear() { wptr = capacity-1; rptr = 0; for(size_t i = 0; i<capacity; i=i+2){ data[i] = INITIAL; data[i+1] = 0; } } #endif
[ "nvel@seas.upenn.edu" ]
nvel@seas.upenn.edu
fb78479758dd82ce7629c7706141f2f7cfe687b4
0fb994d4fb28021f338d190d980a4a20653a00f0
/tests/unit_tests/command_line.cpp
645346621810bdc050b5cef7068b8510ec468438
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Plop2323/cred
e490f87f9ca28309fdb4c2cd6ccae7e2ad0b6398
451cf7aaecf41fba7586825263b6e04dc2503230
refs/heads/master
2023-03-17T18:23:40.169777
2018-08-25T18:34:46
2018-08-25T18:34:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,372
cpp
// Copyright (c) 2014-2018, The Cred Project // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its contributors may be // used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "gtest/gtest.h" #include "common/command_line.h" TEST(CommandLine, IsYes) { EXPECT_TRUE(command_line::is_yes("Y")); EXPECT_TRUE(command_line::is_yes("y")); EXPECT_TRUE(command_line::is_yes("YES")); EXPECT_TRUE(command_line::is_yes("YEs")); EXPECT_TRUE(command_line::is_yes("YeS")); EXPECT_TRUE(command_line::is_yes("yES")); EXPECT_TRUE(command_line::is_yes("Yes")); EXPECT_TRUE(command_line::is_yes("yeS")); EXPECT_TRUE(command_line::is_yes("yEs")); EXPECT_TRUE(command_line::is_yes("yes")); EXPECT_FALSE(command_line::is_yes("")); EXPECT_FALSE(command_line::is_yes("yes-")); EXPECT_FALSE(command_line::is_yes("NO")); EXPECT_FALSE(command_line::is_yes("No")); EXPECT_FALSE(command_line::is_yes("nO")); EXPECT_FALSE(command_line::is_yes("no")); }
[ "vangyangpao@gmail.com" ]
vangyangpao@gmail.com
bd25e47d49874ee760b411698836e99168218bd5
d550e123a8fa7f7820ec5484e944d0bdb03ea70d
/P10VehiculoServomotores/c_2servos1sentido.ino
3d75af0e66c8cc1a050029507916042c6896e529
[]
no_license
Josepujol/KiwibotShield
c7b4fad3170a8e87dbc62b6438d67e4da8616f1b
b8a28ce61e046f1e5367fd3e0d2f219e18b33723
refs/heads/master
2021-05-15T01:03:31.797324
2019-05-23T06:31:50
2019-05-23T06:31:50
56,967,500
1
2
null
2018-01-25T17:26:18
2016-04-24T11:13:33
Arduino
UTF-8
C++
false
false
650
ino
/* Programa para controlar 2 servomotores continuos Derecho sentido horario, Izquierdo sentido antihorario Para que vehiculo avance Jose Pujol Mayo 2016 */ // pin conexion servomotor const int servoR = 4; // servo derecha const int servoL = 7; // servo izquierda void setup() { // servomotores salida digital pinMode(servoR, OUTPUT); pinMode(servoL, OUTPUT); } void loop() { // servoR 2 pulsos periodo 20ms // servoL 1 pulso periodo 20ms digitalWrite(servoR, HIGH); digitalWrite(servoL, HIGH); delayMicroseconds(1000); digitalWrite(servoL, LOW); delayMicroseconds(1000); digitalWrite(servoR, LOW); delayMicroseconds(18000); }
[ "Josepujol@users.noreply.github.com" ]
Josepujol@users.noreply.github.com
61a4d5845ca3e7ecc17c31f93aeec2babb8597cd
3ff1fe3888e34cd3576d91319bf0f08ca955940f
/tdcpg/include/tencentcloud/tdcpg/v20211118/model/Cluster.h
e0db004049d3f5df24c669b018ebb0522c3904d3
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-cpp
9f5df8220eaaf72f7eaee07b2ede94f89313651f
42a76b812b81d1b52ec6a217fafc8faa135e06ca
refs/heads/master
2023-08-30T03:22:45.269556
2023-08-30T00:45:39
2023-08-30T00:45:39
188,991,963
55
37
Apache-2.0
2023-08-17T03:13:20
2019-05-28T08:56:08
C++
UTF-8
C++
false
false
24,579
h
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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. */ #ifndef TENCENTCLOUD_TDCPG_V20211118_MODEL_CLUSTER_H_ #define TENCENTCLOUD_TDCPG_V20211118_MODEL_CLUSTER_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/tdcpg/v20211118/model/Endpoint.h> namespace TencentCloud { namespace Tdcpg { namespace V20211118 { namespace Model { /** * 集群信息 */ class Cluster : public AbstractModel { public: Cluster(); ~Cluster() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取集群ID,集群的唯一标识 * @return ClusterId 集群ID,集群的唯一标识 * */ std::string GetClusterId() const; /** * 设置集群ID,集群的唯一标识 * @param _clusterId 集群ID,集群的唯一标识 * */ void SetClusterId(const std::string& _clusterId); /** * 判断参数 ClusterId 是否已赋值 * @return ClusterId 是否已赋值 * */ bool ClusterIdHasBeenSet() const; /** * 获取集群名字,不修改时默认和集群ID相同 * @return ClusterName 集群名字,不修改时默认和集群ID相同 * */ std::string GetClusterName() const; /** * 设置集群名字,不修改时默认和集群ID相同 * @param _clusterName 集群名字,不修改时默认和集群ID相同 * */ void SetClusterName(const std::string& _clusterName); /** * 判断参数 ClusterName 是否已赋值 * @return ClusterName 是否已赋值 * */ bool ClusterNameHasBeenSet() const; /** * 获取地域 * @return Region 地域 * */ std::string GetRegion() const; /** * 设置地域 * @param _region 地域 * */ void SetRegion(const std::string& _region); /** * 判断参数 Region 是否已赋值 * @return Region 是否已赋值 * */ bool RegionHasBeenSet() const; /** * 获取可用区 * @return Zone 可用区 * */ std::string GetZone() const; /** * 设置可用区 * @param _zone 可用区 * */ void SetZone(const std::string& _zone); /** * 判断参数 Zone 是否已赋值 * @return Zone 是否已赋值 * */ bool ZoneHasBeenSet() const; /** * 获取TDSQL-C PostgreSQL 合入的社区版本号 * @return DBVersion TDSQL-C PostgreSQL 合入的社区版本号 * */ std::string GetDBVersion() const; /** * 设置TDSQL-C PostgreSQL 合入的社区版本号 * @param _dBVersion TDSQL-C PostgreSQL 合入的社区版本号 * */ void SetDBVersion(const std::string& _dBVersion); /** * 判断参数 DBVersion 是否已赋值 * @return DBVersion 是否已赋值 * */ bool DBVersionHasBeenSet() const; /** * 获取项目ID * @return ProjectId 项目ID * */ uint64_t GetProjectId() const; /** * 设置项目ID * @param _projectId 项目ID * */ void SetProjectId(const uint64_t& _projectId); /** * 判断参数 ProjectId 是否已赋值 * @return ProjectId 是否已赋值 * */ bool ProjectIdHasBeenSet() const; /** * 获取集群状态。目前包括 - creating :创建中 - running : 运行中 - isolating : 隔离中 - isolated : 已隔离 - recovering : 恢复中 - deleting : 删除中 - deleted : 已删除 * @return Status 集群状态。目前包括 - creating :创建中 - running : 运行中 - isolating : 隔离中 - isolated : 已隔离 - recovering : 恢复中 - deleting : 删除中 - deleted : 已删除 * */ std::string GetStatus() const; /** * 设置集群状态。目前包括 - creating :创建中 - running : 运行中 - isolating : 隔离中 - isolated : 已隔离 - recovering : 恢复中 - deleting : 删除中 - deleted : 已删除 * @param _status 集群状态。目前包括 - creating :创建中 - running : 运行中 - isolating : 隔离中 - isolated : 已隔离 - recovering : 恢复中 - deleting : 删除中 - deleted : 已删除 * */ void SetStatus(const std::string& _status); /** * 判断参数 Status 是否已赋值 * @return Status 是否已赋值 * */ bool StatusHasBeenSet() const; /** * 获取集群状态中文含义 * @return StatusDesc 集群状态中文含义 * */ std::string GetStatusDesc() const; /** * 设置集群状态中文含义 * @param _statusDesc 集群状态中文含义 * */ void SetStatusDesc(const std::string& _statusDesc); /** * 判断参数 StatusDesc 是否已赋值 * @return StatusDesc 是否已赋值 * */ bool StatusDescHasBeenSet() const; /** * 获取集群创建时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * @return CreateTime 集群创建时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * */ std::string GetCreateTime() const; /** * 设置集群创建时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * @param _createTime 集群创建时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * */ void SetCreateTime(const std::string& _createTime); /** * 判断参数 CreateTime 是否已赋值 * @return CreateTime 是否已赋值 * */ bool CreateTimeHasBeenSet() const; /** * 获取存储当前使用量,单位GiB * @return StorageUsed 存储当前使用量,单位GiB * */ double GetStorageUsed() const; /** * 设置存储当前使用量,单位GiB * @param _storageUsed 存储当前使用量,单位GiB * */ void SetStorageUsed(const double& _storageUsed); /** * 判断参数 StorageUsed 是否已赋值 * @return StorageUsed 是否已赋值 * */ bool StorageUsedHasBeenSet() const; /** * 获取存储最大使用量,单位GiB * @return StorageLimit 存储最大使用量,单位GiB * */ uint64_t GetStorageLimit() const; /** * 设置存储最大使用量,单位GiB * @param _storageLimit 存储最大使用量,单位GiB * */ void SetStorageLimit(const uint64_t& _storageLimit); /** * 判断参数 StorageLimit 是否已赋值 * @return StorageLimit 是否已赋值 * */ bool StorageLimitHasBeenSet() const; /** * 获取付费模式: - PREPAID : 预付费,即包年包月 - POSTPAID_BY_HOUR : 按小时结算后付费 * @return PayMode 付费模式: - PREPAID : 预付费,即包年包月 - POSTPAID_BY_HOUR : 按小时结算后付费 * */ std::string GetPayMode() const; /** * 设置付费模式: - PREPAID : 预付费,即包年包月 - POSTPAID_BY_HOUR : 按小时结算后付费 * @param _payMode 付费模式: - PREPAID : 预付费,即包年包月 - POSTPAID_BY_HOUR : 按小时结算后付费 * */ void SetPayMode(const std::string& _payMode); /** * 判断参数 PayMode 是否已赋值 * @return PayMode 是否已赋值 * */ bool PayModeHasBeenSet() const; /** * 获取预付费集群到期时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * @return PayPeriodEndTime 预付费集群到期时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * */ std::string GetPayPeriodEndTime() const; /** * 设置预付费集群到期时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * @param _payPeriodEndTime 预付费集群到期时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 * */ void SetPayPeriodEndTime(const std::string& _payPeriodEndTime); /** * 判断参数 PayPeriodEndTime 是否已赋值 * @return PayPeriodEndTime 是否已赋值 * */ bool PayPeriodEndTimeHasBeenSet() const; /** * 获取预付费集群自动续费标签 - 0 : 到期不自动续费 - 1 : 到期自动续费 * @return AutoRenewFlag 预付费集群自动续费标签 - 0 : 到期不自动续费 - 1 : 到期自动续费 * */ uint64_t GetAutoRenewFlag() const; /** * 设置预付费集群自动续费标签 - 0 : 到期不自动续费 - 1 : 到期自动续费 * @param _autoRenewFlag 预付费集群自动续费标签 - 0 : 到期不自动续费 - 1 : 到期自动续费 * */ void SetAutoRenewFlag(const uint64_t& _autoRenewFlag); /** * 判断参数 AutoRenewFlag 是否已赋值 * @return AutoRenewFlag 是否已赋值 * */ bool AutoRenewFlagHasBeenSet() const; /** * 获取数据库字符集 * @return DBCharset 数据库字符集 * */ std::string GetDBCharset() const; /** * 设置数据库字符集 * @param _dBCharset 数据库字符集 * */ void SetDBCharset(const std::string& _dBCharset); /** * 判断参数 DBCharset 是否已赋值 * @return DBCharset 是否已赋值 * */ bool DBCharsetHasBeenSet() const; /** * 获取集群内实例的数量 * @return InstanceCount 集群内实例的数量 * */ uint64_t GetInstanceCount() const; /** * 设置集群内实例的数量 * @param _instanceCount 集群内实例的数量 * */ void SetInstanceCount(const uint64_t& _instanceCount); /** * 判断参数 InstanceCount 是否已赋值 * @return InstanceCount 是否已赋值 * */ bool InstanceCountHasBeenSet() const; /** * 获取集群内访问点信息 * @return EndpointSet 集群内访问点信息 * */ std::vector<Endpoint> GetEndpointSet() const; /** * 设置集群内访问点信息 * @param _endpointSet 集群内访问点信息 * */ void SetEndpointSet(const std::vector<Endpoint>& _endpointSet); /** * 判断参数 EndpointSet 是否已赋值 * @return EndpointSet 是否已赋值 * */ bool EndpointSetHasBeenSet() const; /** * 获取TDSQL-C PostgreSQL 合入的社区主要版本号 * @return DBMajorVersion TDSQL-C PostgreSQL 合入的社区主要版本号 * */ std::string GetDBMajorVersion() const; /** * 设置TDSQL-C PostgreSQL 合入的社区主要版本号 * @param _dBMajorVersion TDSQL-C PostgreSQL 合入的社区主要版本号 * */ void SetDBMajorVersion(const std::string& _dBMajorVersion); /** * 判断参数 DBMajorVersion 是否已赋值 * @return DBMajorVersion 是否已赋值 * */ bool DBMajorVersionHasBeenSet() const; /** * 获取TDSQL-C PostgreSQL 内核版本号 * @return DBKernelVersion TDSQL-C PostgreSQL 内核版本号 * */ std::string GetDBKernelVersion() const; /** * 设置TDSQL-C PostgreSQL 内核版本号 * @param _dBKernelVersion TDSQL-C PostgreSQL 内核版本号 * */ void SetDBKernelVersion(const std::string& _dBKernelVersion); /** * 判断参数 DBKernelVersion 是否已赋值 * @return DBKernelVersion 是否已赋值 * */ bool DBKernelVersionHasBeenSet() const; /** * 获取存储付费模式 - PREPAID:预付费,即包年包月 - POSTPAID_BY_HOUR:按小时后付费 注意:此字段可能返回 null,表示取不到有效值。 * @return StoragePayMode 存储付费模式 - PREPAID:预付费,即包年包月 - POSTPAID_BY_HOUR:按小时后付费 注意:此字段可能返回 null,表示取不到有效值。 * */ std::string GetStoragePayMode() const; /** * 设置存储付费模式 - PREPAID:预付费,即包年包月 - POSTPAID_BY_HOUR:按小时后付费 注意:此字段可能返回 null,表示取不到有效值。 * @param _storagePayMode 存储付费模式 - PREPAID:预付费,即包年包月 - POSTPAID_BY_HOUR:按小时后付费 注意:此字段可能返回 null,表示取不到有效值。 * */ void SetStoragePayMode(const std::string& _storagePayMode); /** * 判断参数 StoragePayMode 是否已赋值 * @return StoragePayMode 是否已赋值 * */ bool StoragePayModeHasBeenSet() const; private: /** * 集群ID,集群的唯一标识 */ std::string m_clusterId; bool m_clusterIdHasBeenSet; /** * 集群名字,不修改时默认和集群ID相同 */ std::string m_clusterName; bool m_clusterNameHasBeenSet; /** * 地域 */ std::string m_region; bool m_regionHasBeenSet; /** * 可用区 */ std::string m_zone; bool m_zoneHasBeenSet; /** * TDSQL-C PostgreSQL 合入的社区版本号 */ std::string m_dBVersion; bool m_dBVersionHasBeenSet; /** * 项目ID */ uint64_t m_projectId; bool m_projectIdHasBeenSet; /** * 集群状态。目前包括 - creating :创建中 - running : 运行中 - isolating : 隔离中 - isolated : 已隔离 - recovering : 恢复中 - deleting : 删除中 - deleted : 已删除 */ std::string m_status; bool m_statusHasBeenSet; /** * 集群状态中文含义 */ std::string m_statusDesc; bool m_statusDescHasBeenSet; /** * 集群创建时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 */ std::string m_createTime; bool m_createTimeHasBeenSet; /** * 存储当前使用量,单位GiB */ double m_storageUsed; bool m_storageUsedHasBeenSet; /** * 存储最大使用量,单位GiB */ uint64_t m_storageLimit; bool m_storageLimitHasBeenSet; /** * 付费模式: - PREPAID : 预付费,即包年包月 - POSTPAID_BY_HOUR : 按小时结算后付费 */ std::string m_payMode; bool m_payModeHasBeenSet; /** * 预付费集群到期时间。按照RFC3339标准表示,并且使用东八区时区时间,格式为:YYYY-MM-DDThh:mm:ss+08:00。 */ std::string m_payPeriodEndTime; bool m_payPeriodEndTimeHasBeenSet; /** * 预付费集群自动续费标签 - 0 : 到期不自动续费 - 1 : 到期自动续费 */ uint64_t m_autoRenewFlag; bool m_autoRenewFlagHasBeenSet; /** * 数据库字符集 */ std::string m_dBCharset; bool m_dBCharsetHasBeenSet; /** * 集群内实例的数量 */ uint64_t m_instanceCount; bool m_instanceCountHasBeenSet; /** * 集群内访问点信息 */ std::vector<Endpoint> m_endpointSet; bool m_endpointSetHasBeenSet; /** * TDSQL-C PostgreSQL 合入的社区主要版本号 */ std::string m_dBMajorVersion; bool m_dBMajorVersionHasBeenSet; /** * TDSQL-C PostgreSQL 内核版本号 */ std::string m_dBKernelVersion; bool m_dBKernelVersionHasBeenSet; /** * 存储付费模式 - PREPAID:预付费,即包年包月 - POSTPAID_BY_HOUR:按小时后付费 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_storagePayMode; bool m_storagePayModeHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_TDCPG_V20211118_MODEL_CLUSTER_H_
[ "tencentcloudapi@tencent.com" ]
tencentcloudapi@tencent.com