blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
158
eb388a3e50cdf65db2226b534e7b63b649f0105e
c1d4b3313aa6e48bebfeb4e3cfb7b5eeb54ced86
/windows/cpp/samples/enc_mp4_avc_aac_push/avencode.cpp
2d0cd40cc895d8adbe2571e2992e6a58b554897b
[ "MIT" ]
permissive
avblocks/avblocks-samples
447a15eed12d4ac03c929bc7b368fe37fadc0762
7388111a27c8110a9f7222e86e912fe38f444543
refs/heads/main
2021-06-04T13:41:30.387450
2021-02-01T00:28:09
2021-02-01T00:28:09
334,783,633
1
1
null
null
null
null
UTF-8
C++
false
false
6,840
cpp
#include "stdafx.h" #include "util.h" using namespace primo::codecs; using namespace primo::avblocks; using namespace std; class UncompressedAVSplitter { public: ~UncompressedAVSplitter() { inframe->release(); } UncompressedAVSplitter() : inframe(primo::avblocks::Library::createMediaSample()), uncompressed_frame_size(0), inframe_count(0), eos(true), media_type(MediaType::Unknown) {} void init(const MediaSocket* socket, const wstring& filename) { if (!socket || filename.empty()) { return; } infile.open(filename, ios::in | ios::binary); if (!infile) { throw std::logic_error("Cannot open file"); } StreamInfo* sinfo = socket->pins()->at(0)->streamInfo(); media_type = sinfo->mediaType(); if (sinfo->mediaType() == MediaType::Video) { init((VideoStreamInfo*)sinfo); } else if (sinfo->mediaType() == MediaType::Audio) { init((AudioStreamInfo*)sinfo); } else { throw std::logic_error("Unsupported: unknown media type"); } eos = false; } MediaSample* get_frame() { if (eos) return NULL; if (media_type == MediaType::Video) { infile.read((char*)inframe->buffer()->start(), uncompressed_frame_size); int bytes_read = (int)infile.gcount(); if (bytes_read < uncompressed_frame_size) { eos = true; } else { inframe->buffer()->setData(0, uncompressed_frame_size); double time = inframe_count / frame_rate; inframe->setStartTime(time); inframe->setEndTime(-1.0); ++inframe_count; } } else if (media_type == MediaType::Audio) { if (inframe->buffer()->dataSize() == 0) { infile.read((char*)inframe->buffer()->start(), uncompressed_frame_size); int bytes_read = (int)infile.gcount(); if (0 == bytes_read) { eos = true; } else { inframe->buffer()->setData(0, bytes_read); double time = inframe_count / frame_rate; inframe->setStartTime(time); inframe->setEndTime(-1.0); ++inframe_count; } } } return (eos ? NULL : inframe); } private: void init(VideoStreamInfo* vinfo) { if (vinfo->streamType() == StreamType::UncompressedVideo) { uncompressed_frame_size = vinfo->frameWidth() * vinfo->frameHeight() * 3 / 2; // assume YUV 4:2:0 MediaBuffer* buffer = (primo::avblocks::Library::createMediaBuffer(uncompressed_frame_size)); inframe->setBuffer(buffer); buffer->release(); } else { throw std::logic_error("Unsupported: video input is compressed"); } frame_rate = vinfo->frameRate(); } void init(AudioStreamInfo* ainfo) { if (ainfo->streamType() == StreamType::LPCM) { if (ainfo->bytesPerFrame() == 0) { ainfo->setBytesPerFrame(ainfo->bitsPerSample() / 8 * ainfo->channels()); } frame_rate = 10; uncompressed_frame_size = ainfo->bytesPerFrame() * ainfo->sampleRate() / (int32_t)frame_rate; MediaBuffer* buffer(primo::avblocks::Library::createMediaBuffer(uncompressed_frame_size)); inframe->setBuffer(buffer); buffer->release(); } else { throw std::logic_error ("Unsupported: audio input is compressed"); } } MediaType::Enum media_type; MediaSample* inframe; std::ifstream infile; int uncompressed_frame_size; int inframe_count; double frame_rate; bool eos; }; struct TrackState { enum { Disabled = -1, }; TrackState() : frame(NULL), index(Disabled), frame_count(0), progress (-1.0) {} MediaSample* frame; int32_t index; int32_t frame_count; double progress; }; TrackState* select_mux_track(TrackState& vtrack, TrackState& atrack) { if (vtrack.index != TrackState::Disabled && atrack.index != TrackState::Disabled) { if (!vtrack.frame) return &vtrack; if (!atrack.frame) return &atrack; return vtrack.frame->startTime() <= atrack.frame->startTime() ? &vtrack : &atrack; } if (vtrack.index != TrackState::Disabled) { return &vtrack; } if (atrack.index != TrackState::Disabled) { return &atrack; } return NULL; } /* mix and encode uncompressed audio and video input files */ bool_t av_encode(MediaSocket* vinput, const wstring& vfile, MediaSocket* ainput, const wstring& afile, MediaSocket* output) { bool_t res; TrackState vtrack, atrack; UncompressedAVSplitter vsplit, asplit; try { if (vinput) { wcout << "video input file: \"" << vfile << "\"" << endl; vsplit.init(vinput, vfile); wcout << "OK" << endl; } if (ainput) { wcout << "audio input file: \"" << afile << "\"" << endl; asplit.init(ainput, afile); wcout << "OK" << endl; } } catch (std::exception& ex) { wcout << ex.what() << endl; return FALSE; } // setup transcoder auto transcoder = primo::make_ref(primo::avblocks::Library::createTranscoder()); // in order to use the OEM release for testing (without a valid license) the demo mode must be enabled. transcoder->setAllowDemoMode(TRUE); int track_index = 0; // start index if (vinput) { transcoder->inputs()->add(vinput); vtrack.index = track_index++; } if (ainput) { transcoder->inputs()->add(ainput); atrack.index = track_index++; } transcoder->outputs()->add(output); res = transcoder->open(); printError(L"transcoder open", transcoder->error()); if (!res) return FALSE; // transcoding loop for(;;) { if (vtrack.index != TrackState::Disabled && !vtrack.frame) { vtrack.frame = vsplit.get_frame(); } if (atrack.index != TrackState::Disabled && !atrack.frame) { atrack.frame = asplit.get_frame(); } TrackState* track = select_mux_track(vtrack, atrack); if (!track) break; // log if (track->frame) { if (track->frame->startTime() - track->progress >= 1.0) { track->progress = track->frame->startTime(); wcout << "track " << track->index << " frame #" << track->frame_count << " pts:" << track->frame->startTime() << endl; } } else { wcout << "track " << track->index << " eos" << endl; } if (track->frame) { res = transcoder->push(track->index, track->frame); if (!res) { printError(L"transcoder push frame", transcoder->error()); return FALSE; } track->frame = NULL; // clear the muxed frame in order to read to the next one track->frame_count++; } else { res = transcoder->push(track->index, NULL); if (!res) { printError(L"transcoder push eos", transcoder->error()); return FALSE; } track->index = TrackState::Disabled; // disable track } } res = transcoder->flush(); if (!res) { printError(L"transcoder flush", transcoder->error()); return FALSE; } transcoder->close(); return TRUE; }
fda117ce90fd4e6d995ff49c0c4b61c9fb750096
be776c320d6f321ec4e73340e8b52f187fd5ae10
/jwl模板/欧拉筛求欧拉函数-jwl.cpp
5b3148f28983ed70499c301d6624f01752165090
[]
no_license
Deathcup/NOIP
b988296c57416f67972170be9f14aea056f17c4e
50991526aff27208b97b41f1742497f8746f2bc8
refs/heads/master
2021-09-08T16:59:40.964560
2021-09-06T06:09:09
2021-09-06T06:09:09
108,225,834
1
0
null
null
null
null
UTF-8
C++
false
false
466
cpp
#include<iostream> #include<cstdio> using namespace std; const int N=1e6; bool ispr[N]; int pr[N],tot,n; int phi[N]; void shai(){ for(int i=2;i<=n;i++){ if(!ispr[i]) pr[++tot]=i,phi[i]=i-1;; for(int j=1;pr[j]*i<=n&&j<=tot;j++){ ispr[pr[j]*i]=1; if(i%pr[j]==0){ phi[i*pr[j]]=pr[j]*phi[i]; break; } else{ phi[i*pr[j]]=(pr[j]-1)*phi[i]; } } } } int main(){ cin>>n; shai(); for(int i=1;i<=tot;i++){ cout<<phi[i]<<" "; } }
b91c62c83aaeba8dd921641dc64d033ee3c7975e
b2ac2cc956c5b7dc8a38e7a44364d0282241ed8e
/tags/release-0.9.5/Sources/MFile.cpp
4bc3e601dceccc7d17a6d0484e67aee839faeba8
[]
no_license
BackupTheBerlios/japi-svn
b2a9971644a4740d10aef614e09f3fdd49e8460d
f9a5b284e285442b485ef05824ed8e55499c8d61
refs/heads/master
2016-09-15T17:14:35.504291
2010-12-03T11:39:25
2010-12-03T11:39:25
40,801,061
0
0
null
null
null
null
UTF-8
C++
false
false
14,607
cpp
/* Copyright (c) 2006, Maarten L. Hekkelman 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 Maarten L. Hekkelman nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "MJapi.h" #include <unistd.h> #include <cstring> #include <sys/stat.h> #include <dirent.h> #include <stack> #include <fstream> #include <cassert> #include <cerrno> #include <magic.h> #include "MFile.h" #include "MUrl.h" #include "MError.h" #include "MUnicode.h" #include "MUtils.h" #include "MStrings.h" #include "MJapiApp.h" using namespace std; // ------------------------------------------------------------------ // // libmagic support // class MLibMagic { public: static MLibMagic& Instance(); bool IsText( const fs::path& inPath); private: MLibMagic(); ~MLibMagic(); magic_t mCookie; }; MLibMagic::MLibMagic() { int flags = MAGIC_MIME | MAGIC_SYMLINK; #if defined(MAGIC_NO_CHECK_COMPRESS) flags |= MAGIC_NO_CHECK_COMPRESS; flags |= MAGIC_NO_CHECK_TAR; flags |= MAGIC_NO_CHECK_SOFT; flags |= MAGIC_NO_CHECK_APPTYPE; flags |= MAGIC_NO_CHECK_ELF; flags |= MAGIC_NO_CHECK_TROFF; flags |= MAGIC_NO_CHECK_TOKENS; #endif mCookie = magic_open(flags); if (mCookie != nil) magic_load(mCookie, nil); } MLibMagic::~MLibMagic() { magic_close(mCookie); } MLibMagic& MLibMagic::Instance() { static MLibMagic sInstance; return sInstance; } bool MLibMagic::IsText( const fs::path& inPath) { bool result = false; const char* t; if (mCookie != nil and (t = magic_file(mCookie, inPath.string().c_str())) != nil) result = strncmp(t, "text/", 5) == 0; return result; } // ------------------------------------------------------------------ // // Three different implementations of extended attributes... // // ------------------------------------------------------------------ // FreeBSD #if defined(__FreeBSD__) and (__FreeBSD__ > 0) #include <sys/extattr.h> ssize_t read_attribute(const fs::path& inPath, const char* inName, void* outData, size_t inDataSize) { string path = inPath.string(); return extattr_get_file(path.c_str(), EXTATTR_NAMESPACE_USER, inName, outData, inDataSize); } void write_attribute(const fs::path& inPath, const char* inName, const void* inData, size_t inDataSize) { string path = inPath.string(); time_t t = last_write_time(inPath); int r = extattr_set_file(path.c_str(), EXTATTR_NAMESPACE_USER, inName, inData, inDataSize); last_write_time(inPath, t); } #endif // ------------------------------------------------------------------ // Linux #if defined(__linux__) #include <attr/attributes.h> ssize_t read_attribute(const fs::path& inPath, const char* inName, void* outData, size_t inDataSize) { string path = inPath.string(); int length = inDataSize; int err = ::attr_get(path.c_str(), inName, reinterpret_cast<char*>(outData), &length, 0); if (err != 0) length = 0; return length; } void write_attribute(const fs::path& inPath, const char* inName, const void* inData, size_t inDataSize) { string path = inPath.string(); (void)::attr_set(path.c_str(), inName, reinterpret_cast<const char*>(inData), inDataSize, 0); } #endif // ------------------------------------------------------------------ // MacOS X #if defined(__APPLE__) #include <sys/xattr.h> ssize_t read_attribute(const fs::path& inPath, const char* inName, void* outData, size_t inDataSize) { string path = inPath.string(); return ::getxattr(path.c_str(), inName, outData, inDataSize, 0, 0); } void write_attribute(const fs::path& inPath, const char* inName, const void* inData, size_t inDataSize) { string path = inPath.string(); (void)::setxattr(path.c_str(), inName, inData, inDataSize, 0, 0); } #endif namespace { bool Match(const char* inPattern, const char* inName); bool Match( const char* inPattern, const char* inName) { for (;;) { char op = *inPattern; switch (op) { case 0: return *inName == 0; case '*': { if (inPattern[1] == 0) // last '*' matches all return true; const char* n = inName; while (*n) { if (Match(inPattern + 1, n)) return true; ++n; } return false; } case '?': if (*inName) return Match(inPattern + 1, inName + 1); else return false; default: if (tolower(*inName) == tolower(op)) { ++inName; ++inPattern; } else return false; break; } } } } bool FileNameMatches( const char* inPattern, const fs::path& inFile) { return FileNameMatches(inPattern, inFile.leaf()); } bool FileNameMatches( const char* inPattern, const string& inFile) { bool result = false; if (inFile.length() > 0) { string p(inPattern); while (not result and p.length()) { string::size_type s = p.find(';'); string pat; if (s == string::npos) { pat = p; p.clear(); } else { pat = p.substr(0, s); p.erase(0, s + 1); } result = Match(pat.c_str(), inFile.c_str()); } } return result; } // ------------------------------------------------------------ struct MFileIteratorImp { struct MInfo { fs::path mParent; DIR* mDIR; struct dirent mEntry; }; MFileIteratorImp() : mOnlyTEXT(false) , mReturnDirs(false) {} virtual ~MFileIteratorImp() {} virtual bool Next(fs::path& outFile) = 0; bool IsTEXT( const fs::path& inFile); string mFilter; bool mOnlyTEXT; bool mReturnDirs; }; bool MFileIteratorImp::IsTEXT(const fs::path& inFile) { return MLibMagic::Instance().IsText(inFile); } struct MSingleFileIteratorImp : public MFileIteratorImp { MSingleFileIteratorImp( const fs::path& inDirectory); virtual ~MSingleFileIteratorImp(); virtual bool Next( fs::path& outFile); MInfo mInfo; }; MSingleFileIteratorImp::MSingleFileIteratorImp( const fs::path& inDirectory) { mInfo.mParent = inDirectory; mInfo.mDIR = opendir(inDirectory.string().c_str()); memset(&mInfo.mEntry, 0, sizeof(mInfo.mEntry)); } MSingleFileIteratorImp::~MSingleFileIteratorImp() { if (mInfo.mDIR != nil) closedir(mInfo.mDIR); } bool MSingleFileIteratorImp::Next( fs::path& outFile) { bool result = false; while (not result) { struct dirent* e = nil; if (mInfo.mDIR != nil) THROW_IF_POSIX_ERROR(::readdir_r(mInfo.mDIR, &mInfo.mEntry, &e)); if (e == nil) break; if (strcmp(e->d_name, ".") == 0 or strcmp(e->d_name, "..") == 0) continue; outFile = mInfo.mParent / e->d_name; // struct stat statb; // // if (stat(outFile.string().c_str(), &statb) != 0) // continue; // // if (S_ISDIR(statb.st_mode) != mReturnDirs) // continue; if (is_directory(outFile) and not mReturnDirs) continue; if (mOnlyTEXT and not IsTEXT(outFile)) continue; if (mFilter.length() == 0 or FileNameMatches(mFilter.c_str(), outFile)) { result = true; } } return result; } struct MDeepFileIteratorImp : public MFileIteratorImp { MDeepFileIteratorImp( const fs::path& inDirectory); virtual ~MDeepFileIteratorImp(); virtual bool Next(fs::path& outFile); stack<MInfo> mStack; }; MDeepFileIteratorImp::MDeepFileIteratorImp(const fs::path& inDirectory) { MInfo info; info.mParent = inDirectory; info.mDIR = opendir(inDirectory.string().c_str()); memset(&info.mEntry, 0, sizeof(info.mEntry)); mStack.push(info); } MDeepFileIteratorImp::~MDeepFileIteratorImp() { while (not mStack.empty()) { closedir(mStack.top().mDIR); mStack.pop(); } } bool MDeepFileIteratorImp::Next( fs::path& outFile) { bool result = false; while (not result and not mStack.empty()) { struct dirent* e = nil; MInfo& top = mStack.top(); if (top.mDIR != nil) THROW_IF_POSIX_ERROR(::readdir_r(top.mDIR, &top.mEntry, &e)); if (e == nil) { if (top.mDIR != nil) closedir(top.mDIR); mStack.pop(); } else { outFile = top.mParent / e->d_name; struct stat st; if (stat(outFile.string().c_str(), &st) < 0 or S_ISLNK(st.st_mode)) continue; if (S_ISDIR(st.st_mode)) { if (strcmp(e->d_name, ".") and strcmp(e->d_name, "..")) { MInfo info; info.mParent = outFile; info.mDIR = opendir(outFile.string().c_str()); memset(&info.mEntry, 0, sizeof(info.mEntry)); mStack.push(info); } continue; } if (mOnlyTEXT and not IsTEXT(outFile)) continue; if (mFilter.length() and not FileNameMatches(mFilter.c_str(), outFile)) continue; result = true; } } return result; } MFileIterator::MFileIterator( const fs::path& inDirectory, uint32 inFlags) { if (inFlags & kFileIter_Deep) mImpl = new MDeepFileIteratorImp(inDirectory); else mImpl = new MSingleFileIteratorImp(inDirectory); mImpl->mReturnDirs = (inFlags & kFileIter_ReturnDirectories) != 0; mImpl->mOnlyTEXT = (inFlags & kFileIter_TEXTFilesOnly) != 0; } MFileIterator::~MFileIterator() { delete mImpl; } bool MFileIterator::Next( fs::path& outFile) { return mImpl->Next(outFile); } void MFileIterator::SetFilter( const string& inFilter) { mImpl->mFilter = inFilter; } // ---------------------------------------------------------------------------- // relative_path fs::path relative_path(const fs::path& inFromDir, const fs::path& inFile) { // assert(false); fs::path::iterator d = inFromDir.begin(); fs::path::iterator f = inFile.begin(); while (d != inFromDir.end() and f != inFile.end() and *d == *f) { ++d; ++f; } fs::path result; if (d == inFromDir.end() and f == inFile.end()) result = "."; else { while (d != inFromDir.end()) { result /= ".."; ++d; } while (f != inFile.end()) { result /= *f; ++f; } } return result; } bool ChooseDirectory( fs::path& outDirectory) { GtkWidget* dialog = nil; bool result = false; try { dialog = gtk_file_chooser_dialog_new(_("Select Folder"), nil, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); THROW_IF_NIL(dialog); if (gApp->GetCurrentFolder().length() > 0) { gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER(dialog), gApp->GetCurrentFolder().c_str()); } if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char* uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); MUrl url(uri); outDirectory = url.GetPath(); g_free(uri); result = true; gApp->SetCurrentFolder( gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog))); } } catch (exception& e) { if (dialog) gtk_widget_destroy(dialog); throw; } gtk_widget_destroy(dialog); return result; } bool ChooseOneFile( MUrl& ioFile) { GtkWidget* dialog = nil; bool result = false; try { dialog = gtk_file_chooser_dialog_new(_("Select File"), nil, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); THROW_IF_NIL(dialog); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), false); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), false); if (ioFile.IsValid()) { gtk_file_chooser_set_uri( GTK_FILE_CHOOSER(dialog), ioFile.str().c_str()); } else if (gApp->GetCurrentFolder().length() > 0) { gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER(dialog), gApp->GetCurrentFolder().c_str()); } if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char* uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); ioFile = uri; result = true; g_free(uri); gApp->SetCurrentFolder( gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog))); } } catch (exception& e) { if (dialog) gtk_widget_destroy(dialog); throw; } gtk_widget_destroy(dialog); return result; } bool ChooseFiles( bool inLocalOnly, std::vector<MUrl>& outFiles) { GtkWidget* dialog = nil; try { dialog = gtk_file_chooser_dialog_new(_("Open"), nil, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); THROW_IF_NIL(dialog); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), true); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), inLocalOnly); if (gApp->GetCurrentFolder().length() > 0) { gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER(dialog), gApp->GetCurrentFolder().c_str()); } if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { GSList* uris = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(dialog)); GSList* file = uris; while (file != nil) { MUrl url(reinterpret_cast<char*>(file->data)); g_free(file->data); file->data = nil; outFiles.push_back(url); file = file->next; } g_slist_free(uris); } char* cwd = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog)); if (cwd != nil) { gApp->SetCurrentFolder(cwd); g_free(cwd); } } catch (exception& e) { if (dialog) gtk_widget_destroy(dialog); throw; } gtk_widget_destroy(dialog); return outFiles.size() > 0; }
[ "hekkel@6969af58-1542-49b8-b3af-dcaebf5f4018" ]
hekkel@6969af58-1542-49b8-b3af-dcaebf5f4018
b0e2fbd49b933fc382367a0b0759bbc3b1cf93cf
6e3b592de89cb3e7d594993c784e7059bdb2a9ae
/Source/AllProjects/CQCAdmin/CQCAdmin_TrigEvTab.hpp
c0514d5838a5c959a23ad1f5fa6377d5a3914b24
[ "MIT" ]
permissive
jjzhang166/CQC
9aae1b5ffeddde2c87fafc3bb4bd6e3c7a98a1c2
8933efb5d51b3c0cb43afe1220cdc86187389f93
refs/heads/master
2023-08-28T04:13:32.013199
2021-04-16T14:41:21
2021-04-16T14:41:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,927
hpp
// // FILE NAME: CQCAdmin_TrigEvTab.hpp // // AUTHOR: Dean Roddey // // CREATED: 12/07/2015 // // COPYRIGHT: Charmed Quark Systems, Ltd @ 2020 // // This software is copyrighted by 'Charmed Quark Systems, Ltd' and // the author (Dean Roddey.) It is licensed under the MIT Open Source // license: // // https://opensource.org/licenses/MIT // // DESCRIPTION: // // This is the header for the CQCClient_TrigEvTab.cpp file, which implements a // tab window that allows the user to configure a triggered event. // // CAVEATS/GOTCHAS: // // LOG: // #pragma once // --------------------------------------------------------------------------- // CLASS: TTrigEvTab // PREFIX: wnd // --------------------------------------------------------------------------- class TTrigEvTab : public TContentTab { public : // ------------------------------------------------------------------- // Constructors and destructor // ------------------------------------------------------------------- TTrigEvTab ( const TString& strPath , const TString& strRelPath ); TTrigEvTab(const TTrigEvTab&) = delete; TTrigEvTab(TTrigEvTab&&) = delete; ~TTrigEvTab(); // ------------------------------------------------------------------- // Public operators // ------------------------------------------------------------------- TTrigEvTab& operator=(const TTrigEvTab&) = delete; TTrigEvTab& operator=(TTrigEvTab&&) = delete; // ------------------------------------------------------------------- // Public, non-virtual methods // ------------------------------------------------------------------- tCIDLib::TVoid CreateTab ( TTabbedWnd& wndParent , const TString& strTabText , const TCQCTrgEvent& csrcEdit ); tCIDLib::TVoid UpdatePauseState ( const tCIDLib::TBoolean bToSet ); protected : // ------------------------------------------------------------------- // Protected, inherited method // ------------------------------------------------------------------- tCIDLib::TVoid AreaChanged ( const TArea& areaPrev , const TArea& areaNew , const tCIDCtrls::EPosStates ePosState , const tCIDLib::TBoolean bOrgChanged , const tCIDLib::TBoolean bSizeChanged , const tCIDLib::TBoolean bStateChanged ) final; tCIDLib::TBoolean bCreated() final; tCIDLib::ESaveRes eDoSave ( TString& strErr , const tCQCAdmin::ESaveModes eMode , tCIDLib::TBoolean& bChangedSaved ) final; private : // ------------------------------------------------------------------- // Private data members // // m_csrcEdit // The event we are editing. // // m_pwndEditor // The actual editor stuff is provided as a reusable bit which we create // and use. // // m_strPrefTxt_XXX // Some strings that we pre-load and swap into the field value // prefix control depending on what type of filter is selected. // ------------------------------------------------------------------- TCQCTrgEvent m_csrcEdit; TEditTrigEvWnd* m_pwndEditor; // ------------------------------------------------------------------- // Do any needed magic macros // ------------------------------------------------------------------- RTTIDefs(TTrigEvTab, TContentTab) };
a8be34ad8acfe02e07e0a3ce9772087204a5a371
abc963c15bc10cb413e23626fa71cfbbb4f7b42e
/source/handler/cache/packets_snap/packet_snap_mover_behavior_2.hpp
2cf5df4f789daa4412aaecb011f86f4e1fdad1a7
[]
no_license
zetsumi/Flyff-Engine
d78707bea3c345c7f94826fb1054e1c14a0a0792
8bcecb1e1708ad46950e28dcd7022906e0e201ec
refs/heads/master
2023-05-01T15:34:34.783839
2023-04-17T19:28:28
2023-04-17T19:28:28
226,941,886
4
1
null
2023-04-17T19:28:29
2019-12-09T18:41:12
C++
UTF-8
C++
false
false
1,103
hpp
#pragma once namespace fe { namespace snapshot { struct SnapshotMoverBehavior2 : public Snapshot { fe::util::Vector3D<float> pos{ 0.f, 0.f, 0.f }; fe::util::Vector3D<float> delta{ 0.f, 0.f, 0.f }; float angle = 0.f; float angleX = 0.f; float accPower = 0.f; float turnAngle = 0.f; std::uint32_t state = 0; std::uint32_t stateFlag = 0; std::uint32_t motion = 0; std::int32_t motionExtend = 0; std::int32_t loop = 0; std::uint32_t motionOption = 0; std::int64_t tickCount = 0; std::uint8_t frame = 0; SnapshotMoverBehavior2() = default; ~SnapshotMoverBehavior2() = default; SnapshotMoverBehavior2& operator<<(fe::PacketBuilder& pb) override { pos.x = pb.read<float>(); pos.y = pb.read<float>(); pos.z = pb.read<float>(); delta.x = pb.read<float>(); delta.y = pb.read<float>(); delta.z = pb.read<float>(); pb >> angle >> angleX >> accPower >> turnAngle; pb >> state >> stateFlag >> motion; pb >> motionExtend >> loop; pb >> motionOption >> tickCount; pb >> frame; return *this; } }; } }
b0c971f1694958d77db3dcde5714834bd9a13b42
05cd81cfea6430930279a81c0b50d4821dabecf2
/main.cpp
5de4f51f52395f609b8568bf5528b27e590d11f3
[]
no_license
markbugatti/GraphProjectFramework
bcdddb23a5feb163e2a5f0facbd51068c6a3f8ec
ca02106327f7f13ff2678f052f2fbe24258f10a5
refs/heads/master
2021-01-20T08:53:54.554616
2017-05-03T22:07:17
2017-05-03T22:07:17
90,196,943
0
0
null
null
null
null
UTF-8
C++
false
false
1,026
cpp
#include "main.h" HWND hWnd; // descriptor HINSTANCE hInst; WCHAR szTitleName[MAX_LOADSTRING]; WCHAR szMainClassName[MAX_LOADSTRING]; LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); LoadStringW(hInstance, IDS_APP_TITLE, szTitleName, MAX_LOADSTRING); LoadStringW(hInstance, IDS_GRAPHPROJECT, szMainClassName, MAX_LOADSTRING); MyRegisterClass(hInstance, MainWndProc, szMainClassName); // create window CreateMainWnd(hWnd, hInst, nCmdShow, szMainClassName, szTitleName); HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_ACCELERATOR)); MSG msg; while (GetMessage(&msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int)msg.wParam; }
74a0519f7e811e7b5abcf094b4289f0636515ded
da6b0aac69330596d61d7257be8b3f06d2975b83
/ResearchEngine/SkyExamples/PerezModel.hpp
89df06abd6f56cce18e7042c25f305ac7088b228
[]
no_license
veldrinlab/researchEngine
6293bfbe09f5d1fc6b35e571a6219d975b77fde0
7ee4623ef2077785537efdd9dbbe2fcee24ebf40
refs/heads/master
2020-06-06T19:26:18.529683
2013-09-18T16:25:47
2013-09-18T16:25:47
12,928,240
1
0
null
null
null
null
WINDOWS-1250
C++
false
false
419
hpp
/* * * Projekt C-Way * Efekty nieba, chmur i słońca w grze 2D z widokiem z boku * Szymon Jabłoński * pod kierunkiem Tomasza Martyna * Instytut Informatyki * Politechnika Warszawska */ #ifndef PEREZMODEL_HPP #define PEREZMODEL_HPP struct PerezModel { float lightDirection[3]; float zenithYxy[3]; float turbidity; float AYxy[3]; float BYxy[3]; float CYxy[3]; float DYxy[3]; float EYxy[3]; }; #endif
10c2ac1f78e693043163f0b131b295af105522b3
4e7f736969804451a12bf2a1124b964f15cc15e8
/Codeforces/div3/690/C.cpp
b6500b657caaa41991cc1ac3841f85da8d7028f9
[]
no_license
hayaten0415/Competitive-programming
bb753303f9d8d1864991eb06fa823a9f74e42a4c
ea8bf51c1570566e631699aa7739cda973133f82
refs/heads/master
2022-11-26T07:11:46.953867
2022-11-01T16:18:04
2022-11-01T16:18:04
171,068,479
0
0
null
null
null
null
UTF-8
C++
false
false
1,326
cpp
#pragma region Macros // #pragma GCC target("avx2") #pragma GCC optimize("O3") #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define ALL(v) v.begin(), v.end() #define pb push_back #define eb emplace_back #define endl "\n" using namespace std; using P = pair<int, int>; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const int fx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const int fy[8] = {1, 1, 0, -1, -1, -1, 0, 1}; void solve() { int x; cin >> x; if(x < 10){ cout << x << endl; return; } if(x > 45){ cout << -1 << endl; return; } vector<int> A(50); rep(i, 10) A[i] = i; int i = 10; int tmp = 9; int cn = 1; while(i <= 45){ for (int j = 8; j > 0; j--){ for (int d = 0; d < j; d++){ A[i + d] = A[tmp] + (d + 1) * pow(10, cn); //cout << i + d << " " << tmp << endl; } i += j; tmp = i - 1; cn++; } } cout << A[x] << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); int t; cin >> t; while(t--) solve(); }
f9a58a7667e18f3629e010c07ce1e60babf21d0a
8ece556102944d8a7787281bb76d435293c86e2a
/Framework/Inputs/KeyboardInput.h
d8e6868385e81da57e04f2f9bd1c38a4f55aeee5
[ "Apache-2.0" ]
permissive
DhirajWishal/Dynamik
06055b7df7affede6e1df4f347288da9193bc025
84a8e2488e316451b67de30acee5e95783ff8731
refs/heads/release
2023-02-19T12:28:57.274149
2021-01-17T11:59:21
2021-01-17T11:59:21
263,411,272
0
0
NOASSERTION
2021-01-17T11:59:23
2020-05-12T17:55:56
C++
UTF-8
C++
false
false
277
h
// Copyright 2020 Dhiraj Wishal // SPDX-License-Identifier: Apache-2.0 #pragma once #include "ButtonInput.h" namespace DMK { namespace Inputs { /** * Key Input obect. */ class KeyInput : public ButtonInput { public: KeyInput() {} ~KeyInput() {} }; } }
8e017fea47fbd1351d15a481f6454f5bb1f29546
1aa36cad409fcc3651a28b14737ab97c2cbfbd81
/Atcoder/diverta 2019 Programming Contest 0511/D/sol.cpp
2d7621faadb061aae55e7aa11fd133f3081a483a
[]
no_license
Pengjq0000000/ICPC
10f1afc8fbe69c27f6dcb1848e52070ca50e5110
035923da45082a3253c80288b37cca9d802bbbc8
refs/heads/master
2021-07-20T11:18:10.524316
2020-05-06T11:17:07
2020-05-06T11:17:07
154,973,170
0
0
null
null
null
null
UTF-8
C++
false
false
439
cpp
#include<bits/stdc++.h> #define LL long long #define MEM(x,y) memset(x,y,sizeof(x)) #define MOD(x) ((x)%mod) #define mod 1000000007 #define pb push_back #define STREAM_FAST ios::sync_with_stdio(false) using namespace std; int main() { LL n; scanf("%lld", &n); LL ans = 0; for (LL x = 1; x <= sqrt(n + 0.5); x++) { LL m = n / x - 1; if (m == 0) continue; if ((n / m) == (n % m)) ans += m; } printf("%lld\n", ans); return 0; }
061aabb7d19c92a138e8a7399b8fb0653ec4514d
bc76e4b85590cd612f6ffc5e8c665dd8dfd77bb1
/GwentGame/GwentGame/CP_AllCards.h
bb3e89b7aae926951740fcb1620c2c7510a1fc36
[]
no_license
0123goodvegetable/GwentGame
da6e982f586e849583b413a75e878091109a8895
40190a0199e34faa2ef138cc78b5a87a7915a5db
refs/heads/master
2021-06-29T02:46:00.193989
2017-09-16T15:41:43
2017-09-16T15:41:43
null
0
0
null
null
null
null
GB18030
C++
false
false
2,170
h
//定义了所有卡牌的信息数字 #pragma once #ifndef CP_ALLCARDS_H #define CP_ALLCARDS_H class AllCards { public: AllCards() {} ~AllCards() {} int Unseen_Elder_No = 13010590; int Bekker_Twister_Mirror_No = 25020011; int Impenetrable_Fog_No = 35030012; int Biting_Frost_No = 45040012; int Dagon_No = 53050690; int Archgriffin_No = 63060812; int Archgriffin2_No = 63060822; int Archgriffin3_No = 63060832; int Ge_Els_No = 73070110; int Geralt_Igni_No = 83080510; int Caranthir_No = 93090810; int Wild_Hunt_Rider_No = 103100812; int Crone_Whispess_No = 112110611; int Crone_Weavess_No = 122120611; int Crone_Brewess_No = 132130811; int Thunderbolt_potion_No = 145140012; int Woodland_Spirit_No = 153150510; int Raging_Wolf_No = 160160112; int Raging_Wolf2_No = 160160122; int Raging_Wolf3_No = 160160132; int Roach_No = 173170411; int Roach2_No = 173170421; int Roach3_No = 173170431; int First_Light_No = 185180012; int Torrential_Rain_No = 195190012; int Celaeno_Harpy_No = 203200512; int Lacerate_No = 215210012; int Earth_Elemental_No = 220220612; int Frightener_No = 234231211; int Vran_Warrior_No = 243240612; int Foglet_No = 253250412; int Arachas_No = 261260312; int Arachas2_No = 261260322; int Arachas3_No = 261260332; int Arachas_Behemoth_No = 272270612; int Harpy_Egg_No = 283280112; int Harpy_Egg2_No = 283280122; int Commander_Horn_No = 295290011; int Lesser_Earth_Elemental_No = 300300212; int Lesser_Earth_Elemental2_No = 300300222; const int AllCardsNo[35] = { 0, Unseen_Elder_No, Bekker_Twister_Mirror_No, Impenetrable_Fog_No, Biting_Frost_No, Dagon_No, Archgriffin_No, Archgriffin2_No, Archgriffin3_No, Ge_Els_No, Geralt_Igni_No, Caranthir_No, Wild_Hunt_Rider_No, Crone_Whispess_No, Crone_Weavess_No, Crone_Brewess_No, Thunderbolt_potion_No, Woodland_Spirit_No, Roach_No, Roach2_No, Roach3_No, First_Light_No, Torrential_Rain_No, Celaeno_Harpy_No, Lacerate_No, Earth_Elemental_No, Frightener_No, Vran_Warrior_No, Foglet_No, Arachas_No, Arachas2_No, Arachas3_No, Arachas_Behemoth_No, Commander_Horn_No }; }; #endif // !CP_ALLCARDS_H
a426fed3d4ad1c19acdc9fe19c3e76887de6f785
6afeef38988aec261b5f73e195f1a4335613825e
/代码/L6 增加坦克碰撞检测/Tank.hpp
903914336083a750bc9ec61c224ec1d671b259e8
[ "MIT" ]
permissive
ConsoleTank/ConsoleTank
ed7c338af1cdc9e66ca2728833dabecf57cc1e4e
d488532ce8d9b14013d3ab124598abb2f7e67014
refs/heads/master
2020-12-10T07:42:32.794815
2020-01-17T10:24:43
2020-01-17T10:24:43
233,537,229
0
0
null
null
null
null
UTF-8
C++
false
false
3,067
hpp
#pragma once #include "Common.h" #include "tools.hpp" #include"bullet.h" #include "GameMode.h" #include <list> #include "Map.hpp" class GameMode; class Tank { public: ~Tank() { for (auto i=my_bullet.begin();i!=my_bullet.end();i++) { delete (*i); (*i) = NULL; } my_bullet.clear(); bul_num = 0; } void draw_tank() { static int tank_map[4][9] = { {0,5,0,5,5,5,5,0,5}, {5,0,5,5,5,5,0,5,0} , {0,5,5,5,5,0,0,5,5}, {5,5,0,0,5,5,5,5,0} }; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (GameMode::instance().m_pmap->map[(i + pos_x)*Common::LEN + pos_y + j] == Common::GRASS) continue; GameMode::instance().m_pmap->map[(i + pos_x)*Common::LEN + pos_y + j] = tank_map[(int)m_dir][i * 3 + j]; } } GameMode::instance().m_pmap->draw(); } void clear() { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (GameMode::instance().m_pmap->map[(i + pos_x)*Common::LEN + pos_y + j] == Common::GRASS) continue; GameMode::instance().m_pmap->map[(i + pos_x) * Common::LEN + pos_y + j] = Common::WALK; } } } void fire() { bullet *bul = new bullet(this); my_bullet.push_back( bul); bul_num++; bul->fire(); } void tank_tick() { for (auto i = my_bullet.begin(); i != my_bullet.end(); i++) { (*i)->tick(); } for (auto i = my_bullet.begin(); i != my_bullet.end();) { if (!(*i)->m_bIsAlife) { bullet* temp = *i; i = my_bullet.erase(i); delete temp; } else ++i; } } bool judge(int offset, bool if_col) { for (int i = 0; i < 3; i++) { int judge_op = 0; if(if_col) judge_op = GameMode::instance().m_pmap->map[(pos_x + offset)* Common::LEN + pos_y + i]; else judge_op = GameMode::instance().m_pmap->map[(pos_x + i)* Common::LEN + pos_y + offset]; if (judge_op == Common::STONE || judge_op == Common::WALL || judge_op == Common::WATER) return false; } return true; } void Move(ETankDir dir) { clear(); m_dir = dir; switch (dir) { case E_DIR_T: { if (!judge(-1, true)) break; else pos_x--; break; } case E_DIR_B: { if (!judge(3, true)) break; else pos_x++; break; } case E_DIR_L: { if (!judge(-1, false)) break; else pos_y--; break; } case E_DIR_R: { if (!judge(3, false)) break; else pos_y++; break; } } draw_tank(); } void ProcessKeyBoard(char ch) { switch (ch) { case 'j': case 'J': fire(); break; case 'q': case 'Q': Exit(); break; case 'w': case 'W': { Move(E_DIR_T); break; } case's': case'S': { Move(E_DIR_B); break; } case'a': case'A': { Move(E_DIR_L); break; } case'd': case'D': { Move(E_DIR_R); break; } } } void Exit() { for (auto i = my_bullet.begin(); i != my_bullet.end(); i++) { (*i) ->clear(); } GameMode::instance().ReturnToMainMenu(); } public: int pos_x; int pos_y; list <bullet*>my_bullet; int bul_num; ETankDir m_dir; };
ea1ee970aa5802deafa328ed0fb4501f1f581946
7743f13fc8e3da34a69467824c9ea02fef89ec6c
/LeftView.cpp
ca98d0b121927f76efac7975f5048c56bbf6ac46
[]
no_license
Aniketdimri/Practice-Questions
569db64fd923f576fed49492fabc40a88e42f337
ae9e67cc2ad07ee05c50ffdce4342159c9d06aff
refs/heads/master
2023-03-11T18:08:55.113247
2021-02-28T05:19:22
2021-02-28T05:19:22
343,025,000
0
0
null
null
null
null
UTF-8
C++
false
false
642
cpp
#include<bits/stdc++.h> using namespace std; struct Node{ int data; Node* left; Node* right; Node(int x){ data=x; left=right=NULL; } }; vector<int> leftView(Node* node){ vector<int> ans; queue<int> q; if(!node){return ans;} q.push(node); while(!q.empty()){ int s=q.size(); ans.push_back(q.front()->data); while(s--){ Node* n=q.front(); if(n->left){q.push(n->left);} if(n->right){q.push(n->right);} q.pop(); } } return ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); }
f732c137a7d711ae8a11b08fee72ff8081070686
c234fd428970f35aa09ceef70d14c790c7a987e4
/src/main.cpp
2c5e8b55b5f16455d400303b0b1457b7415e3d93
[]
no_license
SuZhang37/flocking
55a8040a0c7d64c4f5b6c96919d4499723789cb2
9b47463b887fe8b0c4fc1640e8bd41bc18662b2a
refs/heads/master
2021-01-21T10:53:06.308411
2017-03-01T23:15:15
2017-03-01T23:15:15
83,498,319
0
0
null
null
null
null
UTF-8
C++
false
false
1,822
cpp
// ============================================================================= // // Source code for section 1.ii.e. Fleeing Triangle Brush from the Introduction // to Graphics chapter of ofBook (https://github.com/openframeworks/ofBook). // // Copyright (c) 2014 Michael Hadley, mikewesthad.com // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // ============================================================================= #include "ofMain.h" #include "ofApp.h" //======================================================================== int main( ){ ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: ofRunApp(new ofApp()); }
1f2e23dcda04e27092b5222f0e9e30f8b7968193
b7f1b4df5d350e0edf55521172091c81f02f639e
/chrome/browser/chromeos/fileapi/recent_arc_media_source_unittest.cc
c41232114f9f5a94a46d49ae8773487f4e70e064
[ "BSD-3-Clause" ]
permissive
blusno1/chromium-1
f13b84547474da4d2702341228167328d8cd3083
9dd22fe142b48f14765a36f69344ed4dbc289eb3
refs/heads/master
2023-05-17T23:50:16.605396
2018-01-12T19:39:49
2018-01-12T19:39:49
117,339,342
4
2
NOASSERTION
2020-07-17T07:35:37
2018-01-13T11:48:57
null
UTF-8
C++
false
false
7,629
cc
// Copyright 2017 The Chromium 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 <utility> #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/histogram_tester.h" #include "base/time/time.h" #include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_mounter.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h" #include "chrome/browser/chromeos/fileapi/recent_arc_media_source.h" #include "chrome/browser/chromeos/fileapi/recent_file.h" #include "chrome/browser/chromeos/fileapi/recent_source.h" #include "chrome/test/base/testing_profile.h" #include "components/arc/arc_bridge_service.h" #include "components/arc/arc_service_manager.h" #include "components/arc/common/file_system.mojom.h" #include "components/arc/test/connection_holder_util.h" #include "components/arc/test/fake_file_system_instance.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { namespace { const char kMediaDocumentsProviderAuthority[] = "com.android.providers.media.documents"; const char kImagesRootId[] = "images_root"; std::unique_ptr<KeyedService> CreateFileSystemOperationRunnerForTesting( content::BrowserContext* context) { return arc::ArcFileSystemOperationRunner::CreateForTesting( context, arc::ArcServiceManager::Get()->arc_bridge_service()); } arc::FakeFileSystemInstance::Document MakeDocument( const std::string& document_id, const std::string& parent_document_id, const std::string& display_name, const std::string& mime_type, const base::Time& last_modified) { return arc::FakeFileSystemInstance::Document( kMediaDocumentsProviderAuthority, // authority document_id, // document_id parent_document_id, // parent_document_id display_name, // display_name mime_type, // mime_type 0, // size last_modified.ToJavaTime()); // last_modified } } // namespace class RecentArcMediaSourceTest : public testing::Test { public: RecentArcMediaSourceTest() = default; void SetUp() override { arc_service_manager_ = base::MakeUnique<arc::ArcServiceManager>(); profile_ = base::MakeUnique<TestingProfile>(); arc_service_manager_->set_browser_context(profile_.get()); runner_ = static_cast<arc::ArcFileSystemOperationRunner*>( arc::ArcFileSystemOperationRunner::GetFactory() ->SetTestingFactoryAndUse( profile_.get(), &CreateFileSystemOperationRunnerForTesting)); // Mount ARC file systems. arc::ArcFileSystemMounter::GetForBrowserContext(profile_.get()); // Add documents to FakeFileSystemInstance. Note that they are not available // until EnableFakeFileSystemInstance() is called. AddDocumentsToFakeFileSystemInstance(); source_ = base::MakeUnique<RecentArcMediaSource>(profile_.get()); } void TearDown() override { arc_service_manager_->arc_bridge_service()->file_system()->CloseInstance( &fake_file_system_); } protected: void AddDocumentsToFakeFileSystemInstance() { auto root_doc = MakeDocument(kImagesRootId, "", "", arc::kAndroidDirectoryMimeType, base::Time::FromJavaTime(1)); auto cat_doc = MakeDocument("cat", kImagesRootId, "cat.png", "image/png", base::Time::FromJavaTime(2)); auto dog_doc = MakeDocument("dog", kImagesRootId, "dog.jpg", "image/jpeg", base::Time::FromJavaTime(3)); auto fox_doc = MakeDocument("fox", kImagesRootId, "fox.gif", "image/gif", base::Time::FromJavaTime(4)); auto elk_doc = MakeDocument("elk", kImagesRootId, "elk.tiff", "image/tiff", base::Time::FromJavaTime(5)); fake_file_system_.AddDocument(root_doc); fake_file_system_.AddDocument(cat_doc); fake_file_system_.AddDocument(dog_doc); fake_file_system_.AddDocument(fox_doc); fake_file_system_.AddRecentDocument(kImagesRootId, root_doc); fake_file_system_.AddRecentDocument(kImagesRootId, cat_doc); fake_file_system_.AddRecentDocument(kImagesRootId, dog_doc); fake_file_system_.AddRecentDocument(kImagesRootId, elk_doc); } void EnableFakeFileSystemInstance() { arc_service_manager_->arc_bridge_service()->file_system()->SetInstance( &fake_file_system_); arc::WaitForInstanceReady( arc_service_manager_->arc_bridge_service()->file_system()); } std::vector<RecentFile> GetRecentFiles() { std::vector<RecentFile> files; base::RunLoop run_loop; source_->GetRecentFiles(RecentSource::Params( nullptr /* file_system_context */, GURL() /* origin */, 1 /* max_files: ignored */, base::Time() /* cutoff_time: ignored */, base::BindOnce( [](base::RunLoop* run_loop, std::vector<RecentFile>* out_files, std::vector<RecentFile> files) { run_loop->Quit(); *out_files = std::move(files); }, &run_loop, &files))); run_loop.Run(); return files; } void EnableDefer() { runner_->SetShouldDefer(true); } content::TestBrowserThreadBundle thread_bundle_; arc::FakeFileSystemInstance fake_file_system_; // Use the same initialization/destruction order as // ChromeBrowserMainPartsChromeos. std::unique_ptr<arc::ArcServiceManager> arc_service_manager_; std::unique_ptr<TestingProfile> profile_; arc::ArcFileSystemOperationRunner* runner_; std::unique_ptr<RecentArcMediaSource> source_; }; TEST_F(RecentArcMediaSourceTest, Normal) { EnableFakeFileSystemInstance(); std::vector<RecentFile> files = GetRecentFiles(); ASSERT_EQ(2u, files.size()); EXPECT_EQ(arc::GetDocumentsProviderMountPath(kMediaDocumentsProviderAuthority, kImagesRootId) .Append("cat.png"), files[0].url().path()); EXPECT_EQ(base::Time::FromJavaTime(2), files[0].last_modified()); EXPECT_EQ(arc::GetDocumentsProviderMountPath(kMediaDocumentsProviderAuthority, kImagesRootId) .Append("dog.jpg"), files[1].url().path()); EXPECT_EQ(base::Time::FromJavaTime(3), files[1].last_modified()); } TEST_F(RecentArcMediaSourceTest, ArcNotAvailable) { std::vector<RecentFile> files = GetRecentFiles(); EXPECT_EQ(0u, files.size()); } TEST_F(RecentArcMediaSourceTest, Deferred) { EnableFakeFileSystemInstance(); EnableDefer(); std::vector<RecentFile> files = GetRecentFiles(); EXPECT_EQ(0u, files.size()); } TEST_F(RecentArcMediaSourceTest, UmaStats) { EnableFakeFileSystemInstance(); base::HistogramTester histogram_tester; GetRecentFiles(); histogram_tester.ExpectTotalCount(RecentArcMediaSource::kLoadHistogramName, 1); } TEST_F(RecentArcMediaSourceTest, UmaStats_Deferred) { EnableFakeFileSystemInstance(); EnableDefer(); base::HistogramTester histogram_tester; GetRecentFiles(); histogram_tester.ExpectTotalCount(RecentArcMediaSource::kLoadHistogramName, 0); } } // namespace chromeos
ee15c5fe09fde0b2ed4edebc19feb1ce7baf9a7e
87f7bcbca0ee9cfabb6192054e51eb895a5b4a0a
/LineDevice/DeviceThreads/ThreadWenglorSR.h
19cf52da1d0985ec9af18b391b5d4fc29d13ff0c
[]
no_license
zhengbenchang/Baolong
54fefaff2d40f4af345288daf33c8e5c9023c837
aea6267d67ca21a1a6a1da3888408308b7ca6c6b
refs/heads/master
2022-01-05T23:27:17.159649
2018-09-25T00:49:27
2018-09-25T00:49:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
678
h
#ifndef THREADWENGLORSR_H #define THREADWENGLORSR_H #include "../Device/DeviceThread.h" #include "./LineDevice/ScannerDevice/WenglorSR.h" #include "./LineDriver/LogicalDriver.h" using namespace std; class ThreadWenglorSR : public DeviceThread { public: ThreadWenglorSR(); ThreadWenglorSR(DeviceInfo di); ~ThreadWenglorSR(); bool Start(); bool Stop(); void threadprocess(); static void *Start_Thread(void*arg); private: bool _stopprocess; bool _updateFlag; string _iValue; string _cValue; string _lastProductModel; string _productModel; pthread_t pth; WenglorSR *myDevice; }; #endif // THREADWENGLORSR_H
3d551e6ddf07cdb5c1208ca8ea839a6b072897ff
b513e7f49bb96c88081e04a8c1ae84d931496c36
/Multi-trait/src/VarianceTarget.h
4c50ef2d9ea7e00c8ffdba9ff1c9a1088aa930ff
[]
no_license
daniel-trejobanos/MultiTrait
e11f142472318b627da0a34dee8949a821fce369
6e1bba5040aea3480b0cad0268d10a9620cb1d39
refs/heads/master
2021-02-09T22:48:30.118101
2020-05-08T13:48:15
2020-05-08T13:48:15
244,331,559
0
0
null
null
null
null
UTF-8
C++
false
false
677
h
// #ifndef VARIANCETARGET_H #define VARIANCETARGET_H #include <Eigen/Core> #include "TargetDist.h" class VarianceTarget:public TargetDist{ public: //initialize the prior hyper paramters VarianceTarget(double _v, double _tau,int _size): tau(_tau), v(_v){ BtB(_size,_size); BtB.setZero(); S(_size,_size); S.setZero(); R(_size,_size); R.setZero(); Rinv(_size,_size); R.setZero(); idx = 0; M = 1; }; void update_log_kernel(); void update_gradient(); void update_hessian(); Eigen::MatrixXd S; Eigen::MatrixXd R; Eigen::MatrixXd BtB; Eigen::MatrixXd Rinv; double v; double tau; int idx; int M; }; #endif
36c8d7c44b48ba76678b77b7d205271c513b97ef
a423f6618bb14a390c746c5145f300bb9aa7063e
/Cruncher/LosingCombo.h
41b93a4676d4f73ca47cf6fba6d2090aaebeec21
[]
no_license
rcurtis/RedSand
2bcee50438aedd94a81b06c9fd4c881d965a4fde
da0a759252562f8f98a758e02f0dcb20e5a845eb
refs/heads/master
2020-05-31T20:20:39.921170
2019-06-05T21:59:28
2019-06-05T21:59:28
190,473,515
0
0
null
null
null
null
UTF-8
C++
false
false
210
h
#pragma once #include <string> namespace Cruncher { class LosingCombo { friend class LosingCombos; friend class Cruncher; public: LosingCombo(); ~LosingCombo(); private: std::string Reels; }; }
c172e6e6f59703de7f446c1c27e6c3f1e4977981
06272c885255918a1f99a22d47ad9b238c279083
/file_reader.cpp
ca77d57d101dde9776ef54742ede50f2b915bfa9
[]
no_license
Praksitel/esu
c507019480e5ee9b48e082f9151b2b82b887edad
9b3111e0d35e0d9d8145c598a02baefeacb352e7
refs/heads/master
2021-01-25T10:56:23.012618
2017-06-11T00:52:36
2017-06-11T00:52:36
93,895,866
0
0
null
null
null
null
UTF-8
C++
false
false
861
cpp
#include "file_reader.h" #include<QDebug> file_reader::file_reader(QWidget * parent) { m_parent = parent; } QString file_reader::read_file() { QString fileName = QFileDialog::getOpenFileName(m_parent, tr("Откройте файл со списком аплинков"), "\\fido\\etc", tr("Conf files (*.*);;Text Files (*.txt);;Any File (*.*)")); if (!fileName.isEmpty()) { QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { QMessageBox::critical(m_parent, tr("Error"), tr("Файл не открывается")); return QString(); } QTextStream in(&file); return in.readAll(); } else { return QString(); } } file_reader::~file_reader() { qDebug()<<"file_reader::~file_reader() begin"; qDebug()<<"file_reader::~file_reader() end"; }
94c1885db63826e85a20407c330304adc83dd1d0
4afdf9d08d48e1edd3ddff30768417f0134a7726
/mordor/tests/buffered_stream.cpp
ca852def931285dc90bb14abcc4d22a44d8bad49
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
zalemwoo/mordor-base
95a1a22a10592215a0dd26bac9e8100a949b7934
d8877e0f045eacce5413fcb3b1774768ee881034
refs/heads/master
2021-01-13T02:31:44.758617
2014-10-28T18:11:17
2014-10-28T18:11:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
24,356
cpp
// Copyright (c) 2009 - Mozy, Inc. #include "mordor/streams/memory.h" #include "mordor/streams/buffered.h" #include "mordor/streams/null.h" #include "mordor/streams/singleplex.h" #include "mordor/streams/test.h" #include "mordor/test/test.h" #include "mordor/thread.h" using namespace Mordor; using namespace Mordor::Test; MORDOR_UNITTEST(BufferedStream, read) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("01234567890123456789"))); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 20); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 20); Buffer output; MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 0), 0u); // Nothing has been read yet MORDOR_TEST_ASSERT_EQUAL(output.readAvailable(), 0u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 2), 2u); MORDOR_TEST_ASSERT(output == "01"); // baseStream should have had a full buffer read from it MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); // But the bufferedStream is hiding it MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 2); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 2), 2u); MORDOR_TEST_ASSERT(output == "23"); // baseStream stays at the same position, because the read should have been // satisfied by the buffer MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 4); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 7), 7u); MORDOR_TEST_ASSERT(output == "4567890"); // baseStream should have had two buffer-fuls read MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 15); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 11); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 2), 2u); MORDOR_TEST_ASSERT(output == "12"); // baseStream stays at the same position, because the read should have been // satisfied by the buffer MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 15); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 13); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 10), 7u); MORDOR_TEST_ASSERT(output == "3456789"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 20); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 20); // Make sure the buffered stream gives us EOF properly output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 10), 0u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 20); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 20); } MORDOR_UNITTEST(BufferedStream, partialReadGuarantee) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("01234567890123456789"))); TestStream::ptr testStream(new TestStream(baseStream)); BufferedStream::ptr bufferedStream(new BufferedStream(testStream)); testStream->maxReadSize(2); Buffer output; MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 5), 5u); MORDOR_TEST_ASSERT(output == "01234"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 6); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 5); bufferedStream->allowPartialReads(true); output.clear(); // Use up the rest of what's buffered MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 5), 1u); MORDOR_TEST_ASSERT(output == "5"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 6); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 6); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 5), 2u); MORDOR_TEST_ASSERT(output == "67"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 8); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 8); } MORDOR_UNITTEST(BufferedStream, partialReadRawPointer) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("0123456789"))); TestStream::ptr testStream(new TestStream(baseStream)); BufferedStream::ptr bufferedStream(new BufferedStream(testStream)); testStream->maxReadSize(2); char output[6]; memset(output, 0, 6); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 5), 5u); MORDOR_TEST_ASSERT_EQUAL((const char *)output, "01234"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 6); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 5); } MORDOR_UNITTEST(BufferedStream, write) { MemoryStream::ptr baseStream(new MemoryStream()); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("abc", 3), 3u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 3); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("de", 2), 2u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("fgh", 3), 3u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 8); bufferedStream->flush(); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 8); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 8); MORDOR_TEST_ASSERT(baseStream->buffer() == "abcdefgh"); } MORDOR_UNITTEST(BufferedStream, partialWriteGuarantee) { MemoryStream::ptr baseStream(new MemoryStream()); TestStream::ptr testStream(new TestStream(baseStream)); BufferedStream::ptr bufferedStream(new BufferedStream(testStream)); bufferedStream->bufferSize(5); testStream->maxWriteSize(2); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("hello", 5), 5u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 2); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("abcdefghijklmnopqrstuvwxyz", 26), 26u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 28); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 31); bufferedStream->bufferSize(20); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("abcdefghijklmnopqrstuvwxyz", 26), 26u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 38); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 57); bufferedStream->flush(); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 57); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 57); MORDOR_TEST_ASSERT(baseStream->buffer() == "helloabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); } MORDOR_UNITTEST(BufferedStream, unread) { Stream::ptr baseStream(new MemoryStream(Buffer("01234567890123456789"))); baseStream.reset(new SingleplexStream(baseStream, SingleplexStream::READ)); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 20); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 20); Buffer output; MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 6), 6u); MORDOR_TEST_ASSERT(output == "012345"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 6); output.consume(3); bufferedStream->unread(output); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 3); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 6), 6u); MORDOR_TEST_ASSERT(output == "345678"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 9); output.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 6), 6u); MORDOR_TEST_ASSERT(output == "901234"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 15); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 15); } MORDOR_UNITTEST(BufferedStream, find) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("01234567890123456789"))); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); MORDOR_TEST_ASSERT(bufferedStream->supportsFind()); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->find('0'), 0); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->find("01234"), 0); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); Buffer output; MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 1), 1u); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->find("0123"), 9); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 15); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 1); } MORDOR_UNITTEST(BufferedStream, findSanityChecks) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("01234567890123456789"))); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); // Buffer size is 5, default sanity size is twice the buffer size MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->find('\n'), BufferOverflowException); MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->find("\r\n"), BufferOverflowException); MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->find('\n', 20), UnexpectedEofException); MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->find("\r\n", 20), UnexpectedEofException); MORDOR_TEST_ASSERT_LESS_THAN(bufferedStream->find('\n', ~0, false), 0); MORDOR_TEST_ASSERT_LESS_THAN(bufferedStream->find("\r\n", ~0, false), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->find('\n', 20, false), -21); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->find("\r\n", 20, false), -21); } MORDOR_UNITTEST(BufferedStream, testEmptyBuffer) { MemoryStream::ptr baseStream(new MemoryStream(Buffer())); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); MORDOR_TEST_ASSERT_EQUAL( bufferedStream->getDelimited("\r\n", true, false), ""); MORDOR_TEST_ASSERT_EXCEPTION( bufferedStream->getDelimited("\r\n", false, false), UnexpectedEofException); } static void throwRuntimeError() { throw std::runtime_error(""); } MORDOR_UNITTEST(BufferedStream, errorOnRead) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("01234567890123456789"))); TestStream::ptr testStream(new TestStream(baseStream)); BufferedStream::ptr bufferedStream(new BufferedStream(testStream)); testStream->onRead(&throwRuntimeError); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); Buffer output; MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->read(output, 5), std::runtime_error); MORDOR_TEST_ASSERT_EQUAL(output.readAvailable(), 0u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); testStream->onRead(&throwRuntimeError, 2); // Partial read still allowed on exception (it's assumed the next read // will be either EOF or error) MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(output, 5), 2u); MORDOR_TEST_ASSERT(output == "01"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 2); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 2); output.clear(); // Make sure that's correct MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->read(output, 5), std::runtime_error); MORDOR_TEST_ASSERT_EQUAL(output.readAvailable(), 0u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 2); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 2); } MORDOR_UNITTEST(BufferedStream, errorOnWrite) { MemoryStream::ptr baseStream(new MemoryStream()); TestStream::ptr testStream(new TestStream(baseStream)); BufferedStream::ptr bufferedStream(new BufferedStream(testStream)); bufferedStream->bufferSize(5); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 0); testStream->onWrite(&throwRuntimeError); MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->write("hello", 5), std::runtime_error); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 0); testStream->onWrite(&throwRuntimeError, 3); // Exception swallowed; only 3 written to underlying stream (flush will // either clear buffer, or expose error); partial write guarantee still // enforced MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("helloworld", 10), 10u); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 3); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 10); MORDOR_TEST_ASSERT_EXCEPTION(bufferedStream->flush(), std::runtime_error); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 3); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 10); testStream->onWrite(NULL); bufferedStream->flush(); MORDOR_TEST_ASSERT_EQUAL(baseStream->size(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->size(), 10); } MORDOR_UNITTEST(BufferedStream, seek) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("abcdefghijklmnopqrstuvwxyz0123456789"))); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); // We all start out at 0 MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); // Seeking to current position doesn't do anything MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(0), 0); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); // Seeking with nothing in the buffer sets both streams to exactly // where we ask MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(1), 1); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 1); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 1); // Make sure the data corresponds to where we are Buffer buffer; MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "bc"); // Buffered readahead of 5 + 1 (current pos) MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 6); // But we're really at 3 MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 3); // Seeking to current position doesn't do anything MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(3), 3); // Even to the underlying stream MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 6); buffer.clear(); // Double-check the actual data again MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "de"); // It should have been buffered and not touch the baseStream MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 6); // But did change our position MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 5); // Seeking outside of the buffer should clear it (and seek the baseStream) MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(0), 0); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 0); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 0); // Double-check actual data buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "ab"); // Buffered read-ahead MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 2); // Seek to the end of the buffer MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(5), 5); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 5); // Double-check actual data buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "fg"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 7); // Seek into the buffer should keep the buffer, and not touch the baseStream MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(8), 8); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 8); buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "ij"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 10); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 10); // Relative seek, with no buffer MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(1, Stream::CURRENT), 11); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 11); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 11); buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "lm"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 16); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 13); // Relative forward seek into the buffer should keep the buffer, and not touch baseStream MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(1, Stream::CURRENT), 14); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 16); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 14); buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "op"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 16); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 16); // Buffer some data bufferedStream->bufferSize(20); buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "qr"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 36); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 18); // Absolute seek to beginning of buffer does nothing MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(18), 18); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 36); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 18); buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "st"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 36); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 20); // Relative backward seek beyond buffer should discard buffer, and seek baseStream MORDOR_TEST_ASSERT_EQUAL(bufferedStream->seek(-18, Stream::CURRENT), 2); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 2); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 2); buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 4), 4u); MORDOR_TEST_ASSERT(buffer == "cdef"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 22); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 6); } MORDOR_UNITTEST(BufferedStream, readAndWrite) { MemoryStream::ptr baseStream(new MemoryStream(Buffer("abcdefghijklmnopqrstuvwxyz0123456789"))); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(5); Buffer buffer; MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "ab"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 2); // Buffer a write (doesn't touch the read buffer yet) MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("CD", 2), 2u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 5); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 4); // Now flush the write, and it should re-seek the baseStream bufferedStream->flush(); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 4); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 4); MORDOR_TEST_ASSERT(baseStream->buffer() == "abCDefghijklmnopqrstuvwxyz0123456789"); // Read some into the buffer buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "ef"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 9); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 6); // Buffer a write (doesn't touch the read buffer yet) MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("GH", 2), 2u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 9); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 8); // Check that the read buffer is in sync (implicitly flushes) buffer.clear(); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT(buffer == "ij"); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 13); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 10); MORDOR_TEST_ASSERT(baseStream->buffer() == "abCDefGHijklmnopqrstuvwxyz0123456789"); // Manual flush does nothing bufferedStream->flush(); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 13); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 10); // Extra-large write flushes in progress MORDOR_TEST_ASSERT_EQUAL(bufferedStream->write("KLMNOPQRS", 9), 9u); MORDOR_TEST_ASSERT_EQUAL(baseStream->tell(), 19); MORDOR_TEST_ASSERT_EQUAL(bufferedStream->tell(), 19); MORDOR_TEST_ASSERT(baseStream->buffer() == "abCDefGHijKLMNOPQRStuvwxyz0123456789"); } MORDOR_UNITTEST(BufferedStream, partiallyBufferedReadRawBuffer) { MemoryStream::ptr baseStream(new MemoryStream("0123456789")); BufferedStream::ptr bufferedStream(new BufferedStream(baseStream)); bufferedStream->bufferSize(3); Stream::ptr stream = bufferedStream; char buffer[3]; buffer[2] = '\0'; MORDOR_TEST_ASSERT_EQUAL(stream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT_EQUAL((const char *)buffer, "01"); MORDOR_TEST_ASSERT_EQUAL(stream->read(buffer, 2), 2u); MORDOR_TEST_ASSERT_EQUAL((const char *)buffer, "23"); } namespace { void doWrite(Stream::ptr stream, size_t totalSize) { size_t write = 0; char data[4096] = {0}; while (write < totalSize) { int writeSize = rand() % 2048 + 2048; write += stream->write(&data, writeSize); } } void doRead(Stream::ptr stream, size_t totalSize) { size_t read = 0; char data[4096] = {0}; while(read < totalSize) { int readSize = rand() % 2048 + 2048; stream->read(&data, readSize); read += readSize; } } void parallelReadWrite(Stream::ptr stream) { size_t totalSize = 16 * 1024 * 1024ull; // 16MB std::shared_ptr<Thread> writeThread(new Thread(std::bind(doWrite, stream, totalSize))); std::shared_ptr<Thread> readThread(new Thread(std::bind(doRead, stream, totalSize))); writeThread->join(); readThread->join(); } class SeeklessStream : public FilterStream { public: SeeklessStream(Stream::ptr parent, bool own=true) : FilterStream(parent, own) {} bool supportsSeek() { return false; } size_t read(Buffer &buffer, size_t length) { return parent()->read(buffer, length); } size_t read(void *buffer, size_t length) { return parent()->read(buffer, length); } size_t write(const Buffer &buffer, size_t length) { return parent()->write(buffer, length); } size_t write(const void *buffer, size_t length) { return parent()->write(buffer, length); } }; } MORDOR_UNITTEST(BufferedStream, parallelReadWriteNullStream) { // NullStream is a read-write thread-safe stream parallelReadWrite(NullStream::get_ptr()); } /* Comment out because BufferedStream is not read-write thread-safe currently for seekable stream MORDOR_UNITTEST(BufferedStream, parallelReadWriteBufferedStream) { // wrapping with BufferedStream, it is no longer read-write thread-safe parallelReadWrite(Stream::ptr(new BufferedStream(NullStream::get_ptr()))); } */ MORDOR_UNITTEST(BufferedStream, parallelReadWriteSeeklessStream) { // wrapping with BufferedStream, it is still read-write thread-safe // as long as parent stream is seekless parallelReadWrite(Stream::ptr(new BufferedStream( Stream::ptr(new SeeklessStream(NullStream::get_ptr()))))); }
0d35c3f51da896b9604805d32598d08963311b34
8c2ac47b063171f2879a0c953afcbd562aed7e17
/学生宿舍/trueChange.h
fc15189d2ee5556f89d7869568c1afb468a1cc78
[]
no_license
130000002947823457136193789891/StudentDormManagementSystem
11adaf084af527d96d77ae54b28042d94f4eef57
b6a22fed8582722ae6f2b91a881dc67214d823d1
refs/heads/master
2020-03-30T06:25:32.983153
2018-09-29T12:02:22
2018-09-29T12:02:22
150,860,136
0
0
null
null
null
null
GB18030
C++
false
false
524
h
#pragma once // trueChange 对话框 class trueChange : public CDialogEx { DECLARE_DYNAMIC(trueChange) public: trueChange(CWnd* pParent = NULL); // 标准构造函数 virtual ~trueChange(); // 对话框数据 enum { IDD = IDD_DIALOG5 }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: bool m_bMale; afx_msg void OnBnClickedMale(); afx_msg void OnBnClickedFemale(); virtual BOOL OnInitDialog(); CString m_strID; CString m_strStudentName; };
b25ea2f1187ec07448b2bd5bae1532a1c419420b
3963cc1be4daffdc10d63b820ede53f7f12bbfa9
/place_receivers/src/Reader.h
41fc7a62d2924f339d7b4a4769f1132169708b7f
[]
no_license
SeisSol/Meshing
82bae2c5784813d02c7899a3eb38f5394744f631
c1ff3f693593b984da9937bf160040700d1ba1b9
refs/heads/master
2023-08-30T04:00:36.443172
2023-04-20T11:26:07
2023-04-20T11:26:07
66,639,419
5
11
null
2023-07-25T09:03:35
2016-08-26T10:29:33
C++
UTF-8
C++
false
false
2,393
h
/** * @file * This file is part of SeisSol. * * @author Carsten Uphoff (c.uphoff AT tum.de, http://www5.in.tum.de/wiki/index.php/Carsten_Uphoff,_M.Sc.) * * @section LICENSE * Copyright (c) 2016, SeisSol Group * 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. * * @section DESCRIPTION **/ #ifndef READER_H_ #define READER_H_ #include <string> #include <vector> #include "KDTree.h" class Mesh { public: explicit Mesh(std::string const& fileName); ~Mesh(); void readPartition(int partition); size_t partitions; int* elementSize; int* vertexSize; int* elementBoundaries; int* elementVertices; double* vertexCoordinates; private: int ncid; int ncVarElemVertices; int ncVarElemBoundaries; int ncVarVrtxCoords; }; std::vector<Point> readReceiverFile(std::string const& fileName); void writeReceiverFile(KDTree const& tree, std::string const& fileName); #endif
571419256b9005f3425d9aced3f93b35ec975cf0
84161e06a39ed7357647ebfbed0cf2ef8f2f841a
/contest/1110/d/d.cpp
74438a3618e43fc284a916292549edcf801e3959
[]
no_license
chachabai/cf
7dee0a989c19a7abe96b439032c1ba898790fb80
069fad31f2e2a5bad250fe44bb982220d651b74a
refs/heads/master
2022-12-30T09:16:30.876496
2020-10-20T06:39:15
2020-10-20T06:39:15
293,874,493
0
0
null
null
null
null
UTF-8
C++
false
false
646
cpp
#include<bits/stdc++.h> using namespace std; using LL = long long; int main(){ //freopen("in","r",stdin) std::ios::sync_with_stdio(false);std::cin.tie(nullptr); int cnt,m; cin>>cnt>>m; int c[m+1]={}; for(int i=0,x;i<cnt;++i){ cin>>x; ++c[x]; } int dp[3][3],new_dp[3][3]; memset(dp,-1,sizeof(dp)); dp[0][0] = 0; for(int n=0;n<m;++n){ memset(new_dp,-1,sizeof(new_dp)); for(int i=0;i<3;++i){ for(int j=0;j<3;++j){ for(int k=0;k<3;++k){ if(i+j+k<=c[n+1]&&dp[i][j]>=0){ new_dp[j][k] = max(new_dp[j][k],dp[i][j]+i+(c[n+1]-i-j-k)/3); } } } } swap(new_dp,dp); } cout<<dp[0][0]<<endl; return 0; }
5d316f233f037f93a672e62f2e39b93e49662d88
f7993f65596b07bbab7e903f7d7bb37f05d793c3
/05_Study/05_Study.h
1bcc1a27f87d9ba0e896ec7d1f5faba28094f3fd
[]
no_license
yelinjo18/HCI_WindowsProgramming_Git
246480ac7d8807abe141ff4f6d1d59d5c4264466
705e8f4f7a3a8c57c35754756cff7e5941107085
refs/heads/main
2023-06-03T16:47:53.319238
2021-06-18T06:43:55
2021-06-18T06:43:55
349,286,449
0
0
null
null
null
null
UTF-8
C++
false
false
640
h
 // 05_Study.h: 05_Study 애플리케이션의 기본 헤더 파일 // #pragma once #ifndef __AFXWIN_H__ #error "PCH에 대해 이 파일을 포함하기 전에 'pch.h'를 포함합니다." #endif #include "resource.h" // 주 기호입니다. // CMy05StudyApp: // 이 클래스의 구현에 대해서는 05_Study.cpp을(를) 참조하세요. // class CMy05StudyApp : public CWinApp { public: CMy05StudyApp() noexcept; // 재정의입니다. public: virtual BOOL InitInstance(); virtual int ExitInstance(); // 구현입니다. public: afx_msg void OnAppAbout(); DECLARE_MESSAGE_MAP() }; extern CMy05StudyApp theApp;
19fc706b1d9819e307e1c86970bddfeab47f3e81
6d72a0c21817704594dd81284380f9bb074246b8
/src/miner.cpp
a58c64de324d1b290a97112f3545b982547f05f3
[ "MIT" ]
permissive
bitsex/bitsex
191c61241fab25c3c609fdb4f1c656fe0612d08c
2de6d9271b58b6372e89f13d040c574d30ea07ad
refs/heads/master
2020-04-09T18:45:51.885921
2018-12-05T13:37:20
2018-12-05T13:37:20
160,523,020
0
0
null
null
null
null
UTF-8
C++
false
false
26,900
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2017 The PIVX developers // Copyright (c) 2017 The Bitsex developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "miner.h" #include "amount.h" #include "hash.h" #include "main.h" #include "masternode-sync.h" #include "net.h" #include "pow.h" #include "primitives/block.h" #include "primitives/transaction.h" #include "timedata.h" #include "util.h" #include "utilmoneystr.h" #ifdef ENABLE_WALLET #include "wallet.h" #endif #include "masternode-payments.h" #include "accumulators.h" #include "spork.h" #include <boost/thread.hpp> #include <boost/tuple/tuple.hpp> using namespace std; ////////////////////////////////////////////////////////////////////////////// // // BitsexMiner // // // Unconfirmed transactions in the memory pool often depend on other // transactions in the memory pool. When we select transactions from the // pool, we select by highest priority or fee rate, so we might consider // transactions that depend on transactions that aren't yet in the block. // The COrphan class keeps track of these 'temporary orphans' while // CreateBlock is figuring out which transactions to include. // class COrphan { public: const CTransaction* ptx; set<uint256> setDependsOn; CFeeRate feeRate; double dPriority; COrphan(const CTransaction* ptxIn) : ptx(ptxIn), feeRate(0), dPriority(0) { } }; uint64_t nLastBlockTx = 0; uint64_t nLastBlockSize = 0; int64_t nLastCoinStakeSearchInterval = 0; // We want to sort transactions by priority and fee rate, so: typedef boost::tuple<double, CFeeRate, const CTransaction*> TxPriority; class TxPriorityCompare { bool byFee; public: TxPriorityCompare(bool _byFee) : byFee(_byFee) {} bool operator()(const TxPriority& a, const TxPriority& b) { if (byFee) { if (a.get<1>() == b.get<1>()) return a.get<0>() < b.get<0>(); return a.get<1>() < b.get<1>(); } else { if (a.get<0>() == b.get<0>()) return a.get<1>() < b.get<1>(); return a.get<0>() < b.get<0>(); } } }; void UpdateTime(CBlockHeader* pblock, const CBlockIndex* pindexPrev) { pblock->nTime = std::max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime()); // Updating time can change work required on testnet: if (Params().AllowMinDifficultyBlocks()) pblock->nBits = GetNextWorkRequired(pindexPrev, pblock); } std::pair<int, uint256> nCheckpointLast; CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, bool fProofOfStake) { CReserveKey reservekey(pwallet); // Create new block unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate()); if (!pblocktemplate.get()) return NULL; CBlock* pblock = &pblocktemplate->block; // pointer for convenience // -regtest only: allow overriding block.nVersion with // -blockversion=N to test forking scenarios if (Params().MineBlocksOnDemand()) pblock->nVersion = GetArg("-blockversion", pblock->nVersion); // Make sure to create the correct block version after zerocoin is enabled bool fZerocoinActive = chainActive.Height() + 1 >= Params().Zerocoin_StartHeight(); if (fZerocoinActive) pblock->nVersion = 4; else pblock->nVersion = 3; // Create coinbase tx CMutableTransaction txNew; txNew.vin.resize(1); txNew.vin[0].prevout.SetNull(); txNew.vout.resize(1); txNew.vout[0].scriptPubKey = scriptPubKeyIn; pblock->vtx.push_back(txNew); pblocktemplate->vTxFees.push_back(-1); // updated at end pblocktemplate->vTxSigOps.push_back(-1); // updated at end // ppcoin: if coinstake available add coinstake tx static int64_t nLastCoinStakeSearchTime = GetAdjustedTime(); // only initialized at startup if (fProofOfStake) { boost::this_thread::interruption_point(); pblock->nTime = GetAdjustedTime(); CBlockIndex* pindexPrev = chainActive.Tip(); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock); CMutableTransaction txCoinStake; int64_t nSearchTime = pblock->nTime; // search to current time bool fStakeFound = false; if (nSearchTime >= nLastCoinStakeSearchTime) { unsigned int nTxNewTime = 0; if (pwallet->CreateCoinStake(*pwallet, pblock->nBits, nSearchTime - nLastCoinStakeSearchTime, txCoinStake, nTxNewTime)) { pblock->nTime = nTxNewTime; pblock->vtx[0].vout[0].SetEmpty(); pblock->vtx.push_back(CTransaction(txCoinStake)); fStakeFound = true; } nLastCoinStakeSearchInterval = nSearchTime - nLastCoinStakeSearchTime; nLastCoinStakeSearchTime = nSearchTime; } if (!fStakeFound) return NULL; } // Largest block you're willing to create: unsigned int nBlockMaxSize = GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE); // Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity: unsigned int nBlockMaxSizeNetwork = MAX_BLOCK_SIZE_CURRENT; nBlockMaxSize = std::max((unsigned int)1000, std::min((nBlockMaxSizeNetwork - 1000), nBlockMaxSize)); // How much of the block should be dedicated to high-priority transactions, // included regardless of the fees they pay unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE); nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize); // Minimum block size you want to create; block will be filled with free transactions // until there are no more or the block reaches this size: unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE); nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize); // Collect memory pool transactions into the block CAmount nFees = 0; { LOCK2(cs_main, mempool.cs); CBlockIndex* pindexPrev = chainActive.Tip(); const int nHeight = pindexPrev->nHeight + 1; CCoinsViewCache view(pcoinsTip); // Priority order to process transactions list<COrphan> vOrphan; // list memory doesn't move map<uint256, vector<COrphan*> > mapDependers; bool fPrintPriority = GetBoolArg("-printpriority", false); // This vector will be sorted into a priority queue: vector<TxPriority> vecPriority; vecPriority.reserve(mempool.mapTx.size()); for (map<uint256, CTxMemPoolEntry>::iterator mi = mempool.mapTx.begin(); mi != mempool.mapTx.end(); ++mi) { const CTransaction& tx = mi->second.GetTx(); if (tx.IsCoinBase() || tx.IsCoinStake() || !IsFinalTx(tx, nHeight)){ continue; } if (GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && tx.ContainsZerocoins()) continue; COrphan* porphan = NULL; double dPriority = 0; CAmount nTotalIn = 0; bool fMissingInputs = false; for (const CTxIn& txin : tx.vin) { //zerocoinspend has special vin if (tx.IsZerocoinSpend()) { nTotalIn = tx.GetZerocoinSpent(); break; } // Read prev transaction if (!view.HaveCoins(txin.prevout.hash)) { // This should never happen; all transactions in the memory // pool should connect to either transactions in the chain // or other transactions in the memory pool. if (!mempool.mapTx.count(txin.prevout.hash)) { LogPrintf("ERROR: mempool transaction missing input\n"); if (fDebug) assert("mempool transaction missing input" == 0); fMissingInputs = true; if (porphan) vOrphan.pop_back(); break; } // Has to wait for dependencies if (!porphan) { // Use list for automatic deletion vOrphan.push_back(COrphan(&tx)); porphan = &vOrphan.back(); } mapDependers[txin.prevout.hash].push_back(porphan); porphan->setDependsOn.insert(txin.prevout.hash); nTotalIn += mempool.mapTx[txin.prevout.hash].GetTx().vout[txin.prevout.n].nValue; continue; } const CCoins* coins = view.AccessCoins(txin.prevout.hash); assert(coins); CAmount nValueIn = coins->vout[txin.prevout.n].nValue; nTotalIn += nValueIn; int nConf = nHeight - coins->nHeight; dPriority += (double)nValueIn * nConf; } if (fMissingInputs) continue; // Priority is sum(valuein * age) / modified_txsize unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); dPriority = tx.ComputePriority(dPriority, nTxSize); uint256 hash = tx.GetHash(); mempool.ApplyDeltas(hash, dPriority, nTotalIn); CFeeRate feeRate(nTotalIn - tx.GetValueOut(), nTxSize); if (porphan) { porphan->dPriority = dPriority; porphan->feeRate = feeRate; } else vecPriority.push_back(TxPriority(dPriority, feeRate, &mi->second.GetTx())); } // Collect transactions into block uint64_t nBlockSize = 1000; uint64_t nBlockTx = 0; int nBlockSigOps = 100; bool fSortedByFee = (nBlockPrioritySize <= 0); TxPriorityCompare comparer(fSortedByFee); std::make_heap(vecPriority.begin(), vecPriority.end(), comparer); vector<CBigNum> vBlockSerials; vector<CBigNum> vTxSerials; while (!vecPriority.empty()) { // Take highest priority transaction off the priority queue: double dPriority = vecPriority.front().get<0>(); CFeeRate feeRate = vecPriority.front().get<1>(); const CTransaction& tx = *(vecPriority.front().get<2>()); std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer); vecPriority.pop_back(); // Size limits unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); if (nBlockSize + nTxSize >= nBlockMaxSize) continue; // Legacy limits on sigOps: unsigned int nMaxBlockSigOps = MAX_BLOCK_SIGOPS_CURRENT; unsigned int nTxSigOps = GetLegacySigOpCount(tx); if (nBlockSigOps + nTxSigOps >= nMaxBlockSigOps) continue; // Skip free transactions if we're past the minimum block size: const uint256& hash = tx.GetHash(); double dPriorityDelta = 0; CAmount nFeeDelta = 0; mempool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta); if (!tx.IsZerocoinSpend() && fSortedByFee && (dPriorityDelta <= 0) && (nFeeDelta <= 0) && (feeRate < ::minRelayTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) continue; // Prioritise by fee once past the priority size or we run out of high-priority // transactions: if (!fSortedByFee && ((nBlockSize + nTxSize >= nBlockPrioritySize) || !AllowFree(dPriority))) { fSortedByFee = true; comparer = TxPriorityCompare(fSortedByFee); std::make_heap(vecPriority.begin(), vecPriority.end(), comparer); } if (!view.HaveInputs(tx)) continue; // double check that there are no double spent zBTSX spends in this block or tx if (tx.IsZerocoinSpend()) { int nHeightTx = 0; if (IsTransactionInChain(tx.GetHash(), nHeightTx)) continue; bool fDoubleSerial = false; for (const CTxIn txIn : tx.vin) { if (txIn.scriptSig.IsZerocoinSpend()) { libzerocoin::CoinSpend spend = TxInToZerocoinSpend(txIn); if (!spend.HasValidSerial(Params().Zerocoin_Params())) fDoubleSerial = true; if (count(vBlockSerials.begin(), vBlockSerials.end(), spend.getCoinSerialNumber())) fDoubleSerial = true; if (count(vTxSerials.begin(), vTxSerials.end(), spend.getCoinSerialNumber())) fDoubleSerial = true; if (fDoubleSerial) break; vTxSerials.emplace_back(spend.getCoinSerialNumber()); } } //This zBTSX serial has already been included in the block, do not add this tx. if (fDoubleSerial) continue; } CAmount nTxFees = view.GetValueIn(tx) - tx.GetValueOut(); nTxSigOps += GetP2SHSigOpCount(tx, view); if (nBlockSigOps + nTxSigOps >= nMaxBlockSigOps) continue; // Note that flags: we don't want to set mempool/IsStandard() // policy here, but we still have to ensure that the block we // create only contains transactions that are valid in new blocks. CValidationState state; if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) continue; CTxUndo txundo; UpdateCoins(tx, state, view, txundo, nHeight); // Added pblock->vtx.push_back(tx); pblocktemplate->vTxFees.push_back(nTxFees); pblocktemplate->vTxSigOps.push_back(nTxSigOps); nBlockSize += nTxSize; ++nBlockTx; nBlockSigOps += nTxSigOps; nFees += nTxFees; for (const CBigNum bnSerial : vTxSerials) vBlockSerials.emplace_back(bnSerial); if (fPrintPriority) { LogPrintf("priority %.1f fee %s txid %s\n", dPriority, feeRate.ToString(), tx.GetHash().ToString()); } // Add transactions that depend on this one to the priority queue if (mapDependers.count(hash)) { BOOST_FOREACH (COrphan* porphan, mapDependers[hash]) { if (!porphan->setDependsOn.empty()) { porphan->setDependsOn.erase(hash); if (porphan->setDependsOn.empty()) { vecPriority.push_back(TxPriority(porphan->dPriority, porphan->feeRate, porphan->ptx)); std::push_heap(vecPriority.begin(), vecPriority.end(), comparer); } } } } } if (!fProofOfStake) { //Masternode and general budget payments FillBlockPayee(txNew, nFees, fProofOfStake); //Make payee if (txNew.vout.size() > 1) { pblock->payee = txNew.vout[1].scriptPubKey; } } nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; LogPrintf("CreateNewBlock(): total size %u\n", nBlockSize); // Compute final coinbase transaction. if (!fProofOfStake) { pblock->vtx[0] = txNew; pblocktemplate->vTxFees[0] = -nFees; } pblock->vtx[0].vin[0].scriptSig = CScript() << nHeight << OP_0; // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); if (!fProofOfStake) UpdateTime(pblock, pindexPrev); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock); pblock->nNonce = 0; uint256 nCheckpoint = 0; if (chainActive.Height() + 1 == nCheckpointLast.first) nCheckpoint = nCheckpointLast.second; else if(fZerocoinActive && !CalculateAccumulatorCheckpoint(nHeight, nCheckpoint)){ LogPrintf("%s: failed to get accumulator checkpoint\n", __func__); } pblock->nAccumulatorCheckpoint = nCheckpoint; nCheckpointLast.first = chainActive.Height() + 1; nCheckpointLast.second = nCheckpoint; pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); CValidationState state; if (!TestBlockValidity(state, *pblock, pindexPrev, false, false)) { LogPrintf("CreateNewBlock() : TestBlockValidity failed\n"); mempool.clear(); return NULL; } } return pblocktemplate.release(); } void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce) { // Update nExtraNonce static uint256 hashPrevBlock; if (hashPrevBlock != pblock->hashPrevBlock) { nExtraNonce = 0; hashPrevBlock = pblock->hashPrevBlock; } ++nExtraNonce; unsigned int nHeight = pindexPrev->nHeight + 1; // Height first in coinbase required for block.version=2 CMutableTransaction txCoinbase(pblock->vtx[0]); txCoinbase.vin[0].scriptSig = (CScript() << nHeight << CScriptNum(nExtraNonce)) + COINBASE_FLAGS; assert(txCoinbase.vin[0].scriptSig.size() <= 100); pblock->vtx[0] = txCoinbase; pblock->hashMerkleRoot = pblock->BuildMerkleTree(); } #ifdef ENABLE_WALLET ////////////////////////////////////////////////////////////////////////////// // // Internal miner // double dHashesPerSec = 0.0; int64_t nHPSTimerStart = 0; CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, CWallet* pwallet, bool fProofOfStake) { CPubKey pubkey; if (!reservekey.GetReservedKey(pubkey)) return NULL; CScript scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; return CreateNewBlock(scriptPubKey, pwallet, fProofOfStake); } bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) { LogPrintf("%s\n", pblock->ToString()); LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue)); // Found a solution { LOCK(cs_main); if (pblock->hashPrevBlock != chainActive.Tip()->GetBlockHash()) return error("BitsexMiner : generated block is stale"); } // Remove key from key pool reservekey.KeepKey(); // Track how many getdata requests this block gets { LOCK(wallet.cs_wallet); wallet.mapRequestCount[pblock->GetHash()] = 0; } // Process this block the same as if we had received it from another node CValidationState state; if (!ProcessNewBlock(state, NULL, pblock)) return error("BitsexMiner : ProcessNewBlock, block not accepted"); for (CNode* node : vNodes) { node->PushInventory(CInv(MSG_BLOCK, pblock->GetHash())); } return true; } bool fGenerateBitcoins = false; // ***TODO*** that part changed in bitcoin, we are using a mix with old one here for now void BitcoinMiner(CWallet* pwallet, bool fProofOfStake) { LogPrintf("BitsexMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); RenameThread("bitsex-miner"); // Each thread has its own key and counter CReserveKey reservekey(pwallet); unsigned int nExtraNonce = 0; //control the amount of times the client will check for mintable coins static bool fMintableCoins = false; static int nMintableLastCheck = 0; if (fProofOfStake && (GetTime() - nMintableLastCheck > 5 * 60)) // 5 minute check time { nMintableLastCheck = GetTime(); fMintableCoins = pwallet->MintableCoins(); } while (fGenerateBitcoins || fProofOfStake) { if (fProofOfStake) { if (chainActive.Tip()->nHeight < Params().LAST_POW_BLOCK()) { MilliSleep(5000); continue; } while (chainActive.Tip()->nTime < 1525981707 || vNodes.empty() || pwallet->IsLocked() || !fMintableCoins || nReserveBalance >= pwallet->GetBalance()) { nLastCoinStakeSearchInterval = 0; MilliSleep(5000); if (!fGenerateBitcoins && !fProofOfStake) continue; } if (mapHashedBlocks.count(chainActive.Tip()->nHeight)) //search our map of hashed blocks, see if bestblock has been hashed yet { if (GetTime() - mapHashedBlocks[chainActive.Tip()->nHeight] < max(pwallet->nHashInterval, (unsigned int)1)) // wait half of the nHashDrift with max wait of 3 minutes { MilliSleep(5000); continue; } } } MilliSleep(1000); // // Create new block // unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated(); CBlockIndex* pindexPrev = chainActive.Tip(); if (!pindexPrev) continue; unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey, pwallet, fProofOfStake)); if (!pblocktemplate.get()) continue; CBlock* pblock = &pblocktemplate->block; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); //Stake miner main if (fProofOfStake) { LogPrintf("CPUMiner : proof-of-stake block found %s \n", pblock->GetHash().ToString().c_str()); if (!pblock->SignBlock(*pwallet)) { LogPrintf("BitcoinMiner(): Signing new block failed \n"); continue; } LogPrintf("CPUMiner : proof-of-stake block was signed %s \n", pblock->GetHash().ToString().c_str()); SetThreadPriority(THREAD_PRIORITY_NORMAL); ProcessBlockFound(pblock, *pwallet, reservekey); SetThreadPriority(THREAD_PRIORITY_LOWEST); continue; } LogPrintf("Running BitsexMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(), ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); // // Search // int64_t nStart = GetTime(); uint256 hashTarget = uint256().SetCompact(pblock->nBits); while (true) { unsigned int nHashesDone = 0; uint256 hash; while (true) { boost::this_thread::interruption_point(); hash = pblock->GetHash(); if (hash <= hashTarget) { // Found a solution SetThreadPriority(THREAD_PRIORITY_NORMAL); LogPrintf("BitcoinMiner:\n"); LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex(), hashTarget.GetHex()); ProcessBlockFound(pblock, *pwallet, reservekey); SetThreadPriority(THREAD_PRIORITY_LOWEST); // In regression test mode, stop mining after a block is found. This // allows developers to controllably generate a block on demand. if (Params().MineBlocksOnDemand()) throw boost::thread_interrupted(); break; } pblock->nNonce += 1; nHashesDone += 1; if ((pblock->nNonce & 0xFF) == 0) break; } // Meter hashes/sec static int64_t nHashCounter; if (nHPSTimerStart == 0) { nHPSTimerStart = GetTimeMillis(); nHashCounter = 0; } else nHashCounter += nHashesDone; if (GetTimeMillis() - nHPSTimerStart > 4000) { static CCriticalSection cs; { LOCK(cs); if (GetTimeMillis() - nHPSTimerStart > 4000) { dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nHPSTimerStart); nHPSTimerStart = GetTimeMillis(); nHashCounter = 0; static int64_t nLogTime; if (GetTime() - nLogTime > 30 * 60) { nLogTime = GetTime(); LogPrintf("hashmeter %6.0f khash/s\n", dHashesPerSec / 1000.0); } } } } // Check for stop or if block needs to be rebuilt boost::this_thread::interruption_point(); // Regtest mode doesn't require peers if (vNodes.empty() && Params().MiningRequiresPeers()) break; if (pblock->nNonce >= 0xffff0000) break; if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60) break; if (pindexPrev != chainActive.Tip()) break; // Update nTime every few seconds UpdateTime(pblock, pindexPrev); if (Params().AllowMinDifficultyBlocks()) { // Changing pblock->nTime can change work required on testnet: hashTarget.SetCompact(pblock->nBits); } } } } void static ThreadBitcoinMiner(void* parg) { boost::this_thread::interruption_point(); CWallet* pwallet = (CWallet*)parg; try { BitcoinMiner(pwallet, false); boost::this_thread::interruption_point(); } catch (std::exception& e) { LogPrintf("ThreadBitcoinMiner() exception"); } catch (...) { LogPrintf("ThreadBitcoinMiner() exception"); } LogPrintf("ThreadBitcoinMiner exiting\n"); } void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads) { static boost::thread_group* minerThreads = NULL; fGenerateBitcoins = fGenerate; if (nThreads < 0) { // In regtest threads defaults to 1 if (Params().DefaultMinerThreads()) nThreads = Params().DefaultMinerThreads(); else nThreads = boost::thread::hardware_concurrency(); } if (minerThreads != NULL) { minerThreads->interrupt_all(); delete minerThreads; minerThreads = NULL; } if (nThreads == 0 || !fGenerate) return; minerThreads = new boost::thread_group(); for (int i = 0; i < nThreads; i++) minerThreads->create_thread(boost::bind(&ThreadBitcoinMiner, pwallet)); } #endif // ENABLE_WALLET
[ "root@localhost" ]
root@localhost
111bae14ae61b6c6953090825ffb2d448d1622b7
b40c7be7981f8dc0183792c5946c19e3c6fee8b9
/sql/executor/ExHdfsScan.cpp
11ca2ceaa26d46a5e090d1472dbe5ec42bbfcf63
[ "Apache-2.0" ]
permissive
jmhsieh/core
763530f55d41538ef7c0198e8bd1cc569f4a66e5
a13345b44f9bd9edae73cc8a2410f087ce3a75eb
refs/heads/master
2021-01-15T21:24:15.162737
2014-06-13T22:16:03
2014-06-13T22:16:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
39,958
cpp
// ********************************************************************** // @@@ START COPYRIGHT @@@ // // (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P. // // 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. // // @@@ END COPYRIGHT @@@ // ********************************************************************** #include "Platform.h" #include "ex_stdh.h" #include "ComTdb.h" #include "ex_tcb.h" #include "ExHdfsScan.h" #include "ex_exe_stmt_globals.h" #include "ExpLOBinterface.h" #include "SequenceFileReader.h" ex_tcb * ExHdfsScanTdb::build(ex_globals * glob) { ExExeStmtGlobals * exe_glob = glob->castToExExeStmtGlobals(); ex_assert(exe_glob,"This operator cannot be in DP2"); ExHdfsScanTcb *tcb = NULL; tcb = new(exe_glob->getSpace()) ExHdfsScanTcb( *this, exe_glob); ex_assert(tcb, "Error building ExHdfsScanTcb."); return (tcb); } //////////////////////////////////////////////////////////////// // Constructor and initialization. //////////////////////////////////////////////////////////////// ExHdfsScanTcb::ExHdfsScanTcb( const ExHdfsScanTdb &hdfsScanTdb, ex_globals * glob ) : ex_tcb( hdfsScanTdb, 1, glob) , workAtp_(NULL) , bytesLeft_(0) , hdfsScanBuffer_(NULL) , hdfsBufNextRow_(NULL) , debugPrevRow_(NULL) , hdfsSqlBuffer_(NULL) , hdfsSqlData_(NULL) , pool_(NULL) , step_(NOT_STARTED) , matches_(0) , matchBrkPoint_(0) , endOfRequestedRange_(NULL) , isSequenceFile_(false) , sequenceFileReader_(NULL) , seqScanAgain_(false) , hdfo_(NULL) , numBytesProcessedInRange_(0) { Space * space = (glob ? glob->getSpace() : 0); CollHeap * heap = (glob ? glob->getDefaultHeap() : 0); const int readBufSize = (Int32)hdfsScanTdb.hdfsBufSize_; hdfsScanBuffer_ = new(space) char[ readBufSize + 1 ]; hdfsScanBuffer_[readBufSize] = '\0'; moveExprColsBuffer_ = new(space) ExSimpleSQLBuffer( 1, // one row (Int32)hdfsScanTdb.moveExprColsRowLength_, space); short error = moveExprColsBuffer_->getFreeTuple(moveExprColsTupp_); ex_assert((error == 0), "get_free_tuple cannot hold a row."); moveExprColsData_ = moveExprColsTupp_.getDataPointer(); hdfsSqlBuffer_ = new(space) ExSimpleSQLBuffer( 1, // one row (Int32)hdfsScanTdb.hdfsSqlMaxRecLen_, space); error = hdfsSqlBuffer_->getFreeTuple(hdfsSqlTupp_); ex_assert((error == 0), "get_free_tuple cannot hold a row."); hdfsSqlData_ = hdfsSqlTupp_.getDataPointer(); hdfsAsciiSourceBuffer_ = new(space) ExSimpleSQLBuffer( 1, // one row (Int32)hdfsScanTdb.asciiRowLen_ * 2, // just in case space); error = hdfsAsciiSourceBuffer_->getFreeTuple(hdfsAsciiSourceTupp_); ex_assert((error == 0), "get_free_tuple cannot hold a row."); hdfsAsciiSourceData_ = hdfsAsciiSourceTupp_.getDataPointer(); pool_ = new(space) sql_buffer_pool(hdfsScanTdb.numBuffers_, hdfsScanTdb.bufferSize_, space, ((ExHdfsScanTdb &)hdfsScanTdb).denseBuffers() ? SqlBufferBase::DENSE_ : SqlBufferBase::NORMAL_); pool_->setStaticMode(TRUE); defragTd_ = NULL; // removing the cast produce a compile error if (((ExHdfsScanTdb &)hdfsScanTdb).useCifDefrag()) { defragTd_ = pool_->addDefragTuppDescriptor(hdfsScanTdb.outputRowLength_); } // Allocate the queue to communicate with parent allocateParentQueues(qparent_); workAtp_ = allocateAtp(hdfsScanTdb.workCriDesc_, space); // fixup expressions if (selectPred()) selectPred()->fixup(0, getExpressionMode(), this, space, heap); if (moveExpr()) moveExpr()->fixup(0, getExpressionMode(), this, space, heap); if (convertExpr()) convertExpr()->fixup(0, getExpressionMode(), this, space, heap); if (moveColsConvertExpr()) moveColsConvertExpr()->fixup(0, getExpressionMode(), this, space, heap); // Register subtasks with the scheduler registerSubtasks(); registerResizeSubtasks(); } ExHdfsScanTcb::~ExHdfsScanTcb() { freeResources(); } void ExHdfsScanTcb::freeResources() { if (workAtp_) { workAtp_->release(); deallocateAtp(workAtp_, getSpace()); workAtp_ = NULL; } if (hdfsScanBuffer_) { NADELETEBASIC(hdfsScanBuffer_, getSpace()); hdfsScanBuffer_ = NULL; } if (hdfsAsciiSourceBuffer_) { NADELETEBASIC(hdfsAsciiSourceBuffer_, getSpace()); hdfsAsciiSourceBuffer_ = NULL; } // hdfsSqlTupp_.release() ; // ??? if (hdfsSqlBuffer_) { delete hdfsSqlBuffer_; hdfsSqlBuffer_ = NULL; } if (moveExprColsBuffer_) { delete moveExprColsBuffer_; moveExprColsBuffer_ = NULL; } if (pool_) { delete pool_; pool_ = NULL; } if (qparent_.up) { delete qparent_.up; qparent_.up = NULL; } if (qparent_.down) { delete qparent_.down; qparent_.down = NULL; } ExpLOBinterfaceCleanup (lobGlob_, getGlobals()->getDefaultHeap()); } NABoolean ExHdfsScanTcb::needStatsEntry() { // stats are collected for ALL and OPERATOR options. if ((getGlobals()->getStatsArea()->getCollectStatsType() == ComTdb::ALL_STATS) || (getGlobals()->getStatsArea()->getCollectStatsType() == ComTdb::OPERATOR_STATS)) return TRUE; else if ( getGlobals()->getStatsArea()->getCollectStatsType() == ComTdb::PERTABLE_STATS) return TRUE; else return FALSE; } ExOperStats * ExHdfsScanTcb::doAllocateStatsEntry( CollHeap *heap, ComTdb *tdb) { ExOperStats * stats = NULL; ExHdfsScanTdb * myTdb = (ExHdfsScanTdb*) tdb; return new(heap) ExHdfsScanStats(heap, this, tdb); ComTdb::CollectStatsType statsType = getGlobals()->getStatsArea()->getCollectStatsType(); if (statsType == ComTdb::OPERATOR_STATS) { return ex_tcb::doAllocateStatsEntry(heap, tdb); } else if (statsType == ComTdb::PERTABLE_STATS) { // sqlmp style per-table stats, one entry per table stats = new(heap) ExPertableStats(heap, this, tdb); ((ExOperStatsId*)(stats->getId()))->tdbId_ = tdb->getPertableStatsTdbId(); return stats; } else { ExHdfsScanTdb * myTdb = (ExHdfsScanTdb*) tdb; return new(heap) ExHdfsScanStats(heap, this, tdb); } } void ExHdfsScanTcb::registerSubtasks() { ExScheduler *sched = getGlobals()->getScheduler(); sched->registerInsertSubtask(sWork, this, qparent_.down,"PD"); sched->registerUnblockSubtask(sWork, this, qparent_.up, "PU"); sched->registerCancelSubtask(sWork, this, qparent_.down,"CN"); } ex_tcb_private_state *ExHdfsScanTcb::allocatePstates( Lng32 &numElems, // inout, desired/actual elements Lng32 &pstateLength) // out, length of one element { PstateAllocator<ex_tcb_private_state> pa; return pa.allocatePstates(this, numElems, pstateLength); } Int32 ExHdfsScanTcb::fixup() { lobGlob_ = NULL; ExpLOBinterfaceInit (lobGlob_, getGlobals()->getDefaultHeap()); return 0; } void brkpoint() {} ExWorkProcRetcode ExHdfsScanTcb::work() { Lng32 retcode = 0; SFR_RetCode sfrRetCode = SFR_OK; char *errorDesc = NULL; char cursorId[8]; HdfsFileInfo *hdfo = NULL; Int64 preOpen = 0; while (!qparent_.down->isEmpty()) { ex_queue_entry *pentry_down = qparent_.down->getHeadEntry(); if (pentry_down->downState.request == ex_queue::GET_NOMORE) step_ = DONE; switch (step_) { case NOT_STARTED: { matches_ = 0; hdfsStats_ = NULL; if (getStatsEntry()) hdfsStats_ = getStatsEntry()->castToExHdfsScanStats(); ex_assert(hdfsStats_, "hdfs stats cannot be null"); if (hdfsStats_) hdfsStats_->init(); beginRangeNum_ = -1; numRanges_ = -1; hdfsOffset_ = 0; if (hdfsScanTdb().getHdfsFileInfoList()->isEmpty()) { step_ = DONE; break; } myInstNum_ = getGlobals()->getMyInstanceNumber(); beginRangeNum_ = *(Lng32*)hdfsScanTdb().getHdfsFileRangeBeginList()->get(myInstNum_); numRanges_ = *(Lng32*)hdfsScanTdb().getHdfsFileRangeNumList()->get(myInstNum_); currRangeNum_ = beginRangeNum_; hdfsScanBufMaxSize_ = hdfsScanTdb().hdfsBufSize_; if (numRanges_ > 0) step_ = INIT_HDFS_CURSOR; else step_ = DONE; } break; case INIT_HDFS_CURSOR: { if (NOT hdfsScanTdb().useCursorMulti()) { hdfo_ = (HdfsFileInfo*) hdfsScanTdb().getHdfsFileInfoList()->get(currRangeNum_); hdfsOffset_ = hdfo_->getStartOffset(); bytesLeft_ = hdfo_->getBytesToRead(); hdfsFileName_ = hdfo_->fileName(); sprintf(cursorId_, "%d", currRangeNum_); } else { // tbd - Ask Viral about cursorMulti status. I cannot see // how it can be correct for cursorMulti to cycle back // to INIT_HDFS_CURSOR, since that results in resetting // bytesLeft_ to the original value. If this problem gets // fixed, make sure we still refresh hdfo_ for new range. hdfo_ = (HdfsFileInfo*) hdfsScanTdb().getHdfsFileInfoList()->get(beginRangeNum_); bytesLeft_ = 0; for (Lng32 i = beginRangeNum_; i < (beginRangeNum_ + numRanges_); i++) { bytesLeft_ += hdfo_->getBytesToRead(); hdfsScanTdb().getHdfsFileInfoList()->advance(); hdfo_ = (HdfsFileInfo*) hdfsScanTdb().getHdfsFileInfoList()->getCurr(); } // tbd - does CursorMulti update currRangeNum_ // correctly for this usage? (Note that it is true that // ExpLOBInterfaceSelectCursorMulti does side-effect // currRangeNum_. hdfo_ = (HdfsFileInfo*) hdfsScanTdb().getHdfsFileInfoList()->get(currRangeNum_); hdfsOffset_ = hdfo_->getStartOffset(); } stopOffset_ = hdfsOffset_ + hdfo_->getBytesToRead(); step_ = OPEN_HDFS_CURSOR; } break; case OPEN_HDFS_CURSOR: { retcode = 0; if (isSequenceFile() && !sequenceFileReader_) { sequenceFileReader_ = new(getSpace()) SequenceFileReader((NAHeap *)getSpace()); sfrRetCode = sequenceFileReader_->init(); if (sfrRetCode != JNI_OK) { ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8447), NULL, NULL, NULL, NULL, sequenceFileReader_->getErrorText(sfrRetCode), NULL); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } } if (isSequenceFile()) { sfrRetCode = sequenceFileReader_->open(hdfsFileName_); if (sfrRetCode == JNI_OK) { // Seek to start offset sfrRetCode = sequenceFileReader_->seeknSync(hdfsOffset_); } if (sfrRetCode != JNI_OK) { ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8447), NULL, NULL, NULL, NULL, sequenceFileReader_->getErrorText(sfrRetCode), NULL); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } } else { if (NOT hdfsScanTdb().useCursorMulti()) { preOpen = 0; retcode = ExpLOBInterfaceSelectCursor (lobGlob_, hdfsFileName_, //hdfsScanTdb().hdfsFileName_, NULL, //(char*)"", (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, (Lng32)bytesLeft_, // max bytes cursorId_, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op hdfsOffset_, hdfsScanBufMaxSize_, preOpen, NULL, 1 // open ); // preopen next range. if ( (currRangeNum_ + 1) < (beginRangeNum_ + numRanges_) ) { hdfo = (HdfsFileInfo*) hdfsScanTdb().getHdfsFileInfoList()->get(currRangeNum_ + 1); hdfsFileName_ = hdfo->fileName(); sprintf(cursorId, "%d", currRangeNum_ + 1); preOpen = 1; retcode = ExpLOBInterfaceSelectCursor (lobGlob_, hdfsFileName_, //hdfsScanTdb().hdfsFileName_, NULL, //(char*)"", (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, hdfo->getBytesToRead(), // max bytes cursorId, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op hdfo->getStartOffset(), hdfsScanBufMaxSize_, preOpen, NULL, 1 // open ); hdfsFileName_ = hdfo_->fileName(); } } else { retcode = ExpLOBInterfaceSelectCursorMulti (lobGlob_, hdfsScanTdb().getHdfsFileInfoList(), beginRangeNum_, numRanges_, currRangeNum_, (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op hdfsScanBufMaxSize_, bytesRead_, hdfsScanBuffer_, 1 // open ); } if (retcode < 0) { Lng32 cliError = 0; Lng32 intParam1 = -retcode; ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8442), NULL, &intParam1, &cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/open", getLobErrStr(intParam1)); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } } trailingPrevRead_ = 0; firstBufOfFile_ = true; numBytesProcessedInRange_ = 0; step_ = GET_HDFS_DATA; } break; case GET_HDFS_DATA: { Int64 bytesToRead = hdfsScanBufMaxSize_ - trailingPrevRead_; ex_assert(bytesToRead >= 0, "bytesToRead less than zero."); if (hdfo_->fileIsSplitEnd() && !isSequenceFile()) { if (bytesLeft_ > 0) bytesToRead = min(bytesToRead, (bytesLeft_ + hdfsScanTdb().rangeTailIOSize_)); else bytesToRead = hdfsScanTdb().rangeTailIOSize_; } else { ex_assert(bytesLeft_ >= 0, "Bad assumption at e-o-f"); if (bytesToRead > bytesLeft_ + 1 // plus one for end-of-range files with no // record delimiter at eof. ) bytesToRead = bytesLeft_ + 1; } ex_assert(bytesToRead + trailingPrevRead_ <= hdfsScanBufMaxSize_, "too many bites."); if (hdfsStats_) hdfsStats_->getTimer().start(); retcode = 0; if (isSequenceFile()) { sfrRetCode = sequenceFileReader_->fetchRowsIntoBuffer(stopOffset_, hdfsScanBuffer_, hdfsScanBufMaxSize_, //bytesToRead, bytesRead_, hdfsScanTdb().recordDelimiter_); if (sfrRetCode != JNI_OK && sfrRetCode != SFR_NOMORE) { ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8447), NULL, NULL, NULL, NULL, sequenceFileReader_->getErrorText(sfrRetCode), NULL); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } else { seqScanAgain_ = (sfrRetCode != SFR_NOMORE); } } else { if (NOT hdfsScanTdb().useCursorMulti()) { retcode = ExpLOBInterfaceSelectCursor (lobGlob_, hdfsFileName_, NULL, (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, 0, cursorId_, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op hdfsOffset_, bytesToRead, bytesRead_, hdfsScanBuffer_ + trailingPrevRead_, 2 // read ); } else { retcode = ExpLOBInterfaceSelectCursorMulti (lobGlob_, hdfsScanTdb().getHdfsFileInfoList(), beginRangeNum_, numRanges_, currRangeNum_, (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op bytesToRead, bytesRead_, hdfsScanBuffer_ + trailingPrevRead_, 2 // read ); } if (hdfsStats_) hdfsStats_->getTimer().stop(); if (retcode < 0) { Lng32 cliError = 0; Lng32 intParam1 = -retcode; ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8442), NULL, &intParam1, &cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/read", getLobErrStr(intParam1)); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } } if (bytesRead_ <= 0) { // Finished with this file. Unexpected? Warning/event? step_ = CLOSE_HDFS_CURSOR; break; } else { char * lastByteRead = hdfsScanBuffer_ + trailingPrevRead_ + bytesRead_ - 1; if ((bytesRead_ < bytesToRead) && (*lastByteRead != hdfsScanTdb().recordDelimiter_)) { // Some files end without a record delimiter but // hive treats the end-of-file as a record delimiter. lastByteRead[1] = hdfsScanTdb().recordDelimiter_; bytesRead_++; } if (bytesRead_ > bytesLeft_) { if (isSequenceFile()) endOfRequestedRange_ = hdfsScanBuffer_ + bytesRead_; else endOfRequestedRange_ = hdfsScanBuffer_ + trailingPrevRead_ + bytesLeft_; } else endOfRequestedRange_ = NULL; if (isSequenceFile()) { // If the file is compressed, we don't know the real value // of bytesLeft_, but it doesn't really matter. if (seqScanAgain_ == false) bytesLeft_ = 0; } else bytesLeft_ -= bytesRead_; } if (hdfsStats_) hdfsStats_->incBytesRead(bytesRead_); if (firstBufOfFile_ && hdfo_->fileIsSplitBegin() && !isSequenceFile()) { // Position in the hdfsScanBuffer_ to the // first record delimiter. hdfsBufNextRow_ = strchr(hdfsScanBuffer_, hdfsScanTdb().recordDelimiter_); // May be that the record is too long? Or data isn't ascii? // Or delimiter is incorrect. if (! hdfsBufNextRow_) { ComDiagsArea *diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8446), NULL, NULL, NULL, NULL, (char*)"No record delimiter found in buffer from hdfsRead.", NULL); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } hdfsBufNextRow_ += 1; // point past record delimiter. } else hdfsBufNextRow_ = hdfsScanBuffer_; debugPrevRow_ = hdfsScanBuffer_; // By convention, at // beginning of scan, the // prev is set to next. debugtrailingPrevRead_ = 0; debugPenultimatePrevRow_ = NULL; firstBufOfFile_ = false; hdfsOffset_ += bytesRead_; step_ = PROCESS_HDFS_ROW; } break; case PROCESS_HDFS_ROW: { debugPenultimatePrevRow_ = debugPrevRow_; debugPrevRow_ = hdfsBufNextRow_; int formattedRowLength = 0; ComDiagsArea *transformDiags = NULL; int err = 0; char *startOfNextRow = extractAndTransformAsciiSourceToSqlRow(err, transformDiags); if(err) { if (transformDiags) pentry_down->setDiagsArea(transformDiags); step_ = HANDLE_ERROR; break; } if (startOfNextRow == NULL) { step_ = REPOS_HDFS_DATA; break; } else { numBytesProcessedInRange_ += startOfNextRow - hdfsBufNextRow_; hdfsBufNextRow_ = startOfNextRow; } if (hdfsStats_) hdfsStats_->incAccessedRows(); workAtp_->getTupp(hdfsScanTdb().workAtpIndex_) = hdfsSqlTupp_; bool rowWillBeSelected = true; if (selectPred()) { ex_expr::exp_return_type evalRetCode = selectPred()->eval(pentry_down->getAtp(), workAtp_); if (evalRetCode == ex_expr::EXPR_FALSE) rowWillBeSelected = false; else if (evalRetCode == ex_expr::EXPR_ERROR) { step_ = HANDLE_ERROR; break; } else ex_assert(evalRetCode == ex_expr::EXPR_TRUE, "invalid return code from expr eval"); } if (rowWillBeSelected) { if (moveColsConvertExpr()) { ex_expr::exp_return_type evalRetCode = moveColsConvertExpr()->eval(workAtp_, workAtp_); if (evalRetCode == ex_expr::EXPR_ERROR) { step_ = HANDLE_ERROR; break; } } if (hdfsStats_) hdfsStats_->incUsedRows(); step_ = RETURN_ROW; break; } break; } case RETURN_ROW: { if (qparent_.up->isFull()) return WORK_OK; ex_queue_entry *up_entry = qparent_.up->getTailEntry(); up_entry->copyAtp(pentry_down); up_entry->upState.parentIndex = pentry_down->downState.parentIndex; up_entry->upState.downIndex = qparent_.down->getHeadIndex(); up_entry->upState.status = ex_queue::Q_OK_MMORE; if (moveExpr()) { UInt32 maxRowLen = hdfsScanTdb().outputRowLength_; UInt32 rowLen = maxRowLen; if (hdfsScanTdb().useCifDefrag() && !pool_->currentBufferHasEnoughSpace((Lng32)hdfsScanTdb().outputRowLength_)) { up_entry->getTupp(hdfsScanTdb().tuppIndex_) = defragTd_; defragTd_->setReferenceCount(1); ex_expr::exp_return_type evalRetCode = moveExpr()->eval(up_entry->getAtp(), workAtp_,0,-1,&rowLen); if (evalRetCode == ex_expr::EXPR_ERROR) { // Get diags from up_entry onto pentry_down, which // is where the HANDLE_ERROR step expects it. ComDiagsArea *diagsArea = pentry_down->getDiagsArea(); if (diagsArea == NULL) { diagsArea = ComDiagsArea::allocate(getGlobals()->getDefaultHeap()); pentry_down->setDiagsArea (diagsArea); } pentry_down->getDiagsArea()-> mergeAfter(*up_entry->getDiagsArea()); up_entry->setDiagsArea(NULL); step_ = HANDLE_ERROR; break; } if (pool_->get_free_tuple( up_entry->getTupp(hdfsScanTdb().tuppIndex_), rowLen)) return WORK_POOL_BLOCKED; str_cpy_all(up_entry->getTupp(hdfsScanTdb().tuppIndex_).getDataPointer(), defragTd_->getTupleAddress(), rowLen); } else { if (pool_->get_free_tuple( up_entry->getTupp(hdfsScanTdb().tuppIndex_), (Lng32)hdfsScanTdb().outputRowLength_)) return WORK_POOL_BLOCKED; ex_expr::exp_return_type evalRetCode = moveExpr()->eval(up_entry->getAtp(), workAtp_,0,-1,&rowLen); if (evalRetCode == ex_expr::EXPR_ERROR) { // Get diags from up_entry onto pentry_down, which // is where the HANDLE_ERROR step expects it. ComDiagsArea *diagsArea = pentry_down->getDiagsArea(); if (diagsArea == NULL) { diagsArea = ComDiagsArea::allocate(getGlobals()->getDefaultHeap()); pentry_down->setDiagsArea (diagsArea); } pentry_down->getDiagsArea()-> mergeAfter(*up_entry->getDiagsArea()); up_entry->setDiagsArea(NULL); step_ = HANDLE_ERROR; break; } if (hdfsScanTdb().useCif() && rowLen != maxRowLen) { pool_->resizeLastTuple(rowLen, up_entry->getTupp(hdfsScanTdb().tuppIndex_).getDataPointer()); } } } up_entry->upState.setMatchNo(++matches_); if (matches_ == matchBrkPoint_) brkpoint(); qparent_.up->insert(); // use ExOperStats now, to cover OPERATOR stats as well as // ALL stats. if (getStatsEntry()) getStatsEntry()->incActualRowsReturned(); workAtp_->setDiagsArea(NULL); // get rid of warnings. if ((pentry_down->downState.request == ex_queue::GET_N) && (pentry_down->downState.requestValue == matches_)) step_ = CLOSE_FILE; else step_ = PROCESS_HDFS_ROW; break; } case REPOS_HDFS_DATA: { bool scanAgain = false; if (isSequenceFile()) scanAgain = seqScanAgain_; else { if (hdfo_->fileIsSplitEnd()) { if (numBytesProcessedInRange_ < hdfo_->getBytesToRead()) scanAgain = true; } else if (bytesLeft_ > 0) scanAgain = true; } if (scanAgain) { // Get ready for another gulp of hdfs data. debugtrailingPrevRead_ = trailingPrevRead_; trailingPrevRead_ = bytesRead_ - (hdfsBufNextRow_ - (hdfsScanBuffer_ + trailingPrevRead_)); // Move trailing data from the end of buffer to the front. // The GET_HDFS_DATA step will use trailingPrevRead_ to // adjust the read buffer ptr so that the next read happens // contiguously to the final byte of the prev read. It will // also use trailingPrevRead_ to to adjust the size of // the next read so that fixed size buffer is not overrun. // Finally, trailingPrevRead_ is used in the // extractSourceFields method to keep from processing // bytes left in the buffer from the previous read. if ((trailingPrevRead_ > 0) && (hdfsBufNextRow_[0] == '\0')) { step_ = CLOSE_HDFS_CURSOR; break; } memmove(hdfsScanBuffer_, hdfsBufNextRow_, (size_t)trailingPrevRead_); step_ = GET_HDFS_DATA; } else step_ = CLOSE_HDFS_CURSOR; break; } case CLOSE_HDFS_CURSOR: { retcode = 0; if (isSequenceFile()) { sfrRetCode = sequenceFileReader_->close(); if (sfrRetCode != JNI_OK) { ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8447), NULL, NULL, NULL, NULL, sequenceFileReader_->getErrorText(sfrRetCode), NULL); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } } else { if (NOT hdfsScanTdb().useCursorMulti()) { retcode = ExpLOBInterfaceSelectCursor (lobGlob_, hdfsFileName_, NULL, (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, 0, cursorId_, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op 0, hdfsScanBufMaxSize_, bytesRead_, hdfsScanBuffer_, 3); // close } else { retcode = ExpLOBInterfaceSelectCursorMulti (lobGlob_, hdfsScanTdb().getHdfsFileInfoList(), beginRangeNum_, numRanges_, currRangeNum_, (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, requestTag_, 0, // not check status (NOT hdfsScanTdb().hdfsPrefetch()), //1, // waited op hdfsScanBufMaxSize_, bytesRead_, hdfsScanBuffer_, 3 // close ); } if (retcode < 0) { Lng32 cliError = 0; Lng32 intParam1 = -retcode; ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8442), NULL, &intParam1, &cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/close", getLobErrStr(intParam1)); pentry_down->setDiagsArea(diagsArea); step_ = HANDLE_ERROR; break; } } step_ = CLOSE_FILE; } break; case HANDLE_ERROR: { if (qparent_.up->isFull()) return WORK_OK; ex_queue_entry *up_entry = qparent_.up->getTailEntry(); up_entry->copyAtp(pentry_down); up_entry->upState.parentIndex = pentry_down->downState.parentIndex; up_entry->upState.downIndex = qparent_.down->getHeadIndex(); if (workAtp_->getDiagsArea()) { ComDiagsArea *diagsArea = up_entry->getDiagsArea(); if (diagsArea == NULL) { diagsArea = ComDiagsArea::allocate(getGlobals()->getDefaultHeap()); up_entry->setDiagsArea (diagsArea); } up_entry->getDiagsArea()->mergeAfter(*workAtp_->getDiagsArea()); workAtp_->setDiagsArea(NULL); } up_entry->upState.status = ex_queue::Q_SQLERROR; qparent_.up->insert(); step_ = ERROR_CLOSE_FILE; break; } case CLOSE_FILE: case ERROR_CLOSE_FILE: { if (getStatsEntry()) { ExHdfsScanStats * stats = getStatsEntry()->castToExHdfsScanStats(); if (stats) { ExLobStats s; s.init(); retcode = ExpLOBinterfaceStats (lobGlob_, &s, hdfsFileName_, //hdfsScanTdb().hdfsFileName_, NULL, //(char*)"", (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_, hdfsScanTdb().useCursorMulti()); *stats->lobStats() = *stats->lobStats() + s; } } // if next file is not same as current file, then close the current file. bool closeFile = true; if ( (step_ == CLOSE_FILE) && ((currRangeNum_ + 1) < (beginRangeNum_ + numRanges_)) ) { hdfo = (HdfsFileInfo*) hdfsScanTdb().getHdfsFileInfoList()->get(currRangeNum_ + 1); if (strcmp(hdfsFileName_, hdfo->fileName()) == 0) closeFile = false; } if (closeFile) { retcode = ExpLOBinterfaceCloseFile (lobGlob_, (hdfsScanTdb().useCursorMulti() ? (char*)hdfsScanTdb().getHdfsFileInfoList() : hdfsFileName_), NULL, (Lng32)Lob_External_HDFS_File, hdfsScanTdb().hostName_, hdfsScanTdb().port_); if ((step_ == CLOSE_FILE) && (retcode < 0)) { Lng32 cliError = 0; Lng32 intParam1 = -retcode; ComDiagsArea * diagsArea = NULL; ExRaiseSqlError(getHeap(), &diagsArea, (ExeErrorCode)(8442), NULL, &intParam1, &cliError, NULL, (char*)"ExpLOBinterfaceCloseFile", getLobErrStr(intParam1)); pentry_down->setDiagsArea(diagsArea); } } if (step_ == CLOSE_FILE) { if (NOT hdfsScanTdb().useCursorMulti()) { currRangeNum_++; if (currRangeNum_ < (beginRangeNum_ + numRanges_)) { // move to the next file. step_ = INIT_HDFS_CURSOR; break; } } } step_ = DONE; } break; case DONE: { if (qparent_.up->isFull()) return WORK_OK; ex_queue_entry *up_entry = qparent_.up->getTailEntry(); up_entry->copyAtp(pentry_down); up_entry->upState.parentIndex = pentry_down->downState.parentIndex; up_entry->upState.downIndex = qparent_.down->getHeadIndex(); up_entry->upState.status = ex_queue::Q_NO_DATA; up_entry->upState.setMatchNo(matches_); qparent_.up->insert(); qparent_.down->removeHead(); step_ = NOT_STARTED; break; } default: { break; } } // switch } // while return WORK_OK; } char * ExHdfsScanTcb::extractAndTransformAsciiSourceToSqlRow(int &err, ComDiagsArea* &diagsArea) { err = 0; char *sourceData = hdfsBufNextRow_; char *sourceDataEnd = strchr(sourceData, hdfsScanTdb().recordDelimiter_); char *sourceColEnd = NULL; if (!sourceDataEnd) { return NULL; } else if (sourceDataEnd >= (hdfsScanBuffer_ + trailingPrevRead_ + bytesRead_)) { return NULL; } NABoolean isTrailingMissingColumn = FALSE; if ((endOfRequestedRange_) && (sourceDataEnd >= endOfRequestedRange_)) *(sourceDataEnd +1)= '\0'; ExpTupleDesc * asciiSourceTD = hdfsScanTdb().workCriDesc_->getTupleDescriptor(hdfsScanTdb().asciiTuppIndex_); if (asciiSourceTD->numAttrs() == 0) { // no columns need to be converted. For e.g. count(*) with no predicate return sourceDataEnd+1; } const char delimiter = hdfsScanTdb().columnDelimiter_; Lng32 neededColIndex = 0; Attributes * attr = NULL; for (Lng32 i = 0; i < hdfsScanTdb().convertSkipListSize_; i++) { // we have scanned for all needed columns from this row // all remainin columns wil be skip columns, don't bother // finding their column delimiters if (neededColIndex == asciiSourceTD->numAttrs()) continue; if (hdfsScanTdb().convertSkipList_[i] > 0) { attr = asciiSourceTD->getAttr(neededColIndex); neededColIndex++; } else attr = NULL; if (!isTrailingMissingColumn) sourceColEnd = strchr(sourceData, delimiter); if(!isTrailingMissingColumn) { short len = 0; if (sourceColEnd && sourceColEnd <= sourceDataEnd) len = sourceColEnd - sourceData; else { len = sourceDataEnd - sourceData; if (i != hdfsScanTdb().convertSkipListSize_ - 1) isTrailingMissingColumn = TRUE; } if (attr) // this is a needed column. We need to convert { *(short*)&hdfsAsciiSourceData_[attr->getVCLenIndOffset()] = len; if (attr->getNullFlag()) { if (len == 0) *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = -1; else if (memcmp(sourceData, "\\N", len) == 0) *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = -1; else *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = 0; } if (len > 0) { // move address of data into the source operand. // convertExpr will dereference this addr and get to the actual // data. *(Int64*)&hdfsAsciiSourceData_[attr->getOffset()] = (Int64)sourceData; } } // if(attr) } // if (!trailingMissingColumn) else { // A delimiter was found, but not enough columns. // Treat the rest of the columns as NULL. if (attr && attr->getNullFlag()) *(short *)&hdfsAsciiSourceData_[attr->getNullIndOffset()] = -1; } sourceData = sourceColEnd + 1 ; } workAtp_->getTupp(hdfsScanTdb().workAtpIndex_) = hdfsSqlTupp_; workAtp_->getTupp(hdfsScanTdb().asciiTuppIndex_) = hdfsAsciiSourceTupp_; // for later workAtp_->getTupp(hdfsScanTdb().moveExprColsTuppIndex_) = moveExprColsTupp_; if (convertExpr()) { ex_expr::exp_return_type evalRetCode = convertExpr()->eval(workAtp_, workAtp_); if (evalRetCode == ex_expr::EXPR_ERROR) err = -1; else err = 0; } return sourceDataEnd+1; }
4b0af9d7db2c5889c2df26a4ba84a357f6c91a6f
85cce50c27d7bbd6d098ec0af7b5ec712ad6abd8
/CodeChef/C++/LongContest/may16/Partial/distnum2.cpp
ebc01e0cc393f5aae961b65ac801b6ae0a36a9f5
[]
no_license
saikiran03/competitive
69648adcf783183a6767caf6db2f63aa5be4aa25
c65e583c46cf14e232fdb5126db1492f958ba267
refs/heads/master
2020-04-06T07:04:06.577311
2016-10-05T08:28:19
2016-10-05T08:28:19
53,259,126
0
0
null
null
null
null
UTF-8
C++
false
false
1,699
cpp
// 10 points solution #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> ii; typedef vi::iterator vit; #define boost ios_base::sync_with_stdio(false); cin.tie(0); #define tcase int _tc; cin >> _tc; while(_tc--) #define rep(i,n) for(int i=0; i<n; i++) #define FOR(i,a,b) for(int i=a; i<=b; i++) #define tr(it,x) for(auto it=x.begin(); it!=x.end(); it++) #define all(x) x.begin(), x.end() #define mp make_pair #define pb push_back #define rf freopen("in.txt","r",stdin); #define wf freopen("out.txt","w",stdout); #define DBG_VEC(x) tr(it,x) cout << *it << " "; cout << endl; const int MAX = 100005; int arr[MAX]; vi tree[4*MAX]; vi nil; vi Merge(vit a, vit b, vit e, vit f){ vi r(b-a + f-e); merge(a,b,e,f,r.begin()); vit it = unique(all(r)); r.resize( distance(r.begin() ,it) ); return r; } void build(int s, int e, int n){ if(s==e){ tree[n].pb(arr[s]); return; } int m = (s+e)/2; build(s, m, 2*n); build(m+1, e, 2*n+1); tree[n] = Merge(all(tree[2*n]), all(tree[2*n+1])); return; } vi query(int s, int e, int l, int r, int n){ if(s>r || e<l || l>r) return nil; if(s<=l && e>=r) return tree[n]; int m = (l+r)/2; vi t = query(s, e, l, m, 2*n); vi u = query(s, e, m+1, r, 2*n+1); return Merge( all(t), all(u)); } int main(){ boost; int n,q,a,b,c,d,k,l,r,pa=0; vi s; cin >> n >> q; rep(i,n) cin >> arr[i]; build(0,n-1,1); rep(i,q){ cin >> a >> b >> c >> d >> k; l = (a*max(pa,0) + b)%n; r = (c*max(pa,0) + d)%n; if(l>r) swap(l,r); s = query(l,r,0,n-1,1); if(k > s.size()) pa=-1; else pa = s[k-1]; cout << pa << endl; } }
c645274fde09a3e80eca7bad79cb861234f92cbf
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/httpd/gumtree/httpd_patch_hunk_4910.cpp
5ac3c54e37a8bcea18e30cbc0ffc1cc7fda1b03e
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,096
cpp
pfd.desc.s = lr->sd; pfd.reqevents = APR_POLLIN; pfd.client_data = lr; status = apr_pollset_add(pollset, &pfd); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf, APLOGNO(00157) - "Couldn't add listener to pollset; check system or user limits"); - clean_child_exit(APEXIT_CHILDSICK); + /* If the child processed a SIGWINCH before setting up the + * pollset, this error path is expected and harmless, + * since the listener fd was already closed; so don't + * pollute the logs in that case. */ + if (!die_now) { + ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf, APLOGNO(00157) + "Couldn't add listener to pollset; check system or user limits"); + clean_child_exit(APEXIT_CHILDSICK); + } + clean_child_exit(0); } lr->accept_func = ap_unixd_accept; } mpm_state = AP_MPMQ_RUNNING;
4e328fa6fd94a158cce367b9f4ac5c40df1b4f76
7e74cedd3c80e46f202070719b7b08c37766ae5b
/rectangle.cpp
285477269bcbbbacc78fb4e085b66c98dd89abae
[]
no_license
uni1234/cpp
174ab78c1a022ee9019c89c1f292bf0d487274ac
dfdfac440d0acce2b5dc12c0b2c41b47f10f4062
refs/heads/master
2020-03-25T16:54:11.173865
2018-08-08T03:26:10
2018-08-08T03:26:10
143,953,041
0
0
null
null
null
null
UTF-8
C++
false
false
128
cpp
#include<cstdio> int main() { int a,b; scanf ("%d%d",&a,&b); printf("%d %d\n",a * b,2 * a + 2 * b); return 0; }
cf772b6985e9fb28ab038a8235a64325bbbef8df
039428f449916c79e60da5969c2b7cee4615d058
/src/saliencyOptimised.cpp
fafa0256a6b37a988d9a2e13f394f0cf27323a98
[]
no_license
1143stuff/saliency_computation
e910f37e4c64dde9711c805038bc4bb06a54f109
88e6b1cff11361c001f3c7d0f030078649f8b039
refs/heads/master
2021-03-12T23:10:44.983487
2014-11-13T10:12:51
2014-11-13T10:12:51
26,381,758
2
0
null
null
null
null
UTF-8
C++
false
false
8,868
cpp
/* Aditya Sundararajan and team (Inside Intel) Nanyang Technological University, Singapore www.github.com/1143stuff */ #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include <sys/time.h> #include "stdio.h" using namespace cv; static struct timeval tm1; //Start timer static inline void mystart() { gettimeofday(&tm1, NULL); } //Stop timer and display time taken static inline void stop() { struct timeval tm2; gettimeofday(&tm2, NULL); unsigned long long t = 1000 * (tm2.tv_sec - tm1.tv_sec) + (tm2.tv_usec - tm1.tv_usec) / 1000; printf ("%llu ms\n", t); } // Generate Gaussian Pyramid of intensity image void buildGaussianPyramid(Mat &intensity, vector<Mat> &GauPyr) { vector<Mat> bgr(3); split(intensity, bgr); //Split the input image into 3 separate channels and store it in bgr intensity = (bgr[0] + bgr[1] + bgr[2]) / 3; //Take average of the 3 separated channels. This is the intensity. buildPyramid(intensity, GauPyr, 8); //Construct Gaussian Pyramid of the intensity image } //Resize all the images of Feature Map and add them for conspicuity map void resizeMap(vector<Mat> &featureMap, Mat &conspicuity) { int i; Mat dest; conspicuity = Mat::zeros(featureMap[5].size(), 0); //Initialize all pixels to zero for(i = 0; i < 6; i++) { while(featureMap[i].rows != featureMap[5].rows) //Perform pyrDown till the all the images of a Map are of same size { pyrDown(featureMap[i], dest); featureMap[i] = dest; } conspicuity += featureMap[i]; //Add all the images of a feature map and store it in conspicuity map. } } //Generate Feature Maps void buildMap(vector<Mat> &pyramid, Mat &conspicuity) { int i, c, del, j; Mat src, dest; vector<Mat> featureMap(6); i = 0; // Perform centre-surround of Gaussian Pyramid // surround = 2 to 4; centre = c + del = 5 to 8 for(c = 2; c <= 4; c++) { for(del = 3; del <= 4; del++) { src = pyramid[c + del]; for(j = 1; j <= del; j++) { pyrUp(src, dest); src = dest; } featureMap[i] = abs(pyramid[c] - src(Range(0, pyramid[c].rows), Range(0, pyramid[c].cols))); i++; } } resizeMap(featureMap, conspicuity); } //Generate Red, Green, Blue, and Yellow maps required for Color Map void buildRGBY(vector<Mat> bgr, Mat &intensity, Mat &imageCopy, vector<Mat> &R_GauPyr, vector<Mat> &G_GauPyr, vector<Mat> &B_GauPyr, vector<Mat> &Y_GauPyr) { double maxVal; int i, j; Vec3b zero(0, 0, 0); #if 0 vector<Mat> channel(3); minMaxLoc(intensity, NULL, &maxVal, NULL, NULL); for(i = 0; i < imageCopy.rows; i++) { for(j = 0; j < imageCopy.cols; j++) { if(intensity.at<uchar>(i,j) > (int)(maxVal/10)) { imageCopy.at<Vec3b>(i, j)[0] = saturate_cast<uchar>( (255 *imageCopy.at<Vec3b>(i, j)[0])/maxVal ); imageCopy.at<Vec3b>(i, j)[1] = saturate_cast<uchar>( (255 *imageCopy.at<Vec3b>(i, j)[1])/maxVal ); imageCopy.at<Vec3b>(i, j)[2] = saturate_cast<uchar>( (255 *imageCopy.at<Vec3b>(i, j)[2])/maxVal ); } else { imageCopy.at<Vec3b>(i, j) = zero; } } } split(imageCopy, channel); Mat R = channel[2] - ((channel[1] + channel[0]) / 2) ; threshold(R, R, 0, 255, THRESH_TOZERO); Mat G = channel[1] - ((channel[0] + channel[2]) / 2); threshold(G, G, 0, 255, THRESH_TOZERO); Mat B = channel[0] - ((channel[1] + channel[2]) / 2); threshold(B, B, 0, 255, THRESH_TOZERO); Mat Y = (((bgr[2] + bgr[1]) / 2) - abs(bgr[2] - bgr[1]) / 2 - bgr[0]); threshold(Y, Y, 0, 255, THRESH_TOZERO); //stop(); buildPyramid(R, R_GauPyr, 8); buildPyramid(G, G_GauPyr, 8); buildPyramid(B, B_GauPyr, 8); buildPyramid(Y, Y_GauPyr, 8); #else Mat Y = (((bgr[2] + bgr[1]) / 2) - abs(bgr[2] - bgr[1]) / 2 - bgr[0]); threshold(Y, Y, 0, 255, THRESH_TOZERO); //Here, find RED GREEN BLUE directly from input image buildPyramid(bgr[2], R_GauPyr, 8); buildPyramid(bgr[1], G_GauPyr, 8); buildPyramid(bgr[0], B_GauPyr, 8); buildPyramid(Y, Y_GauPyr, 8); #endif } //Generate Intensity Map void buildIntensityMap(vector<Mat> &GauPyr, Mat &I_bar) { buildMap(GauPyr, I_bar); } //Generate Color Map void buildColorMap(Mat &intensity, Mat &imageCopy, Mat &C_bar) { vector<Mat> R_GauPyr(9); vector<Mat> G_GauPyr(9); vector<Mat> B_GauPyr(9); vector<Mat> Y_GauPyr(9); vector<Mat> RG(6); vector<Mat> BY(6); vector<Mat> colorMap(6); Mat temp1, temp2, src, dest; int i, c, del, j; buildRGBY(intensity, imageCopy, R_GauPyr, G_GauPyr, B_GauPyr, Y_GauPyr); // Perform centre-surround of Gaussian Pyramid; // surround = 2 to 4; centre = c + del = 5 to 8 i = 0; for(c = 2; c <= 4; c++) { for(del = 3; del <= 4; del++) { temp1 = R_GauPyr[c + del] - G_GauPyr[c + del]; temp2 = Y_GauPyr[c + del] - B_GauPyr[c + del]; for(j = 1; j <= del; j++) { pyrUp(temp1, dest); temp1 = dest; pyrUp(temp2, dest); temp2 = dest; } RG[i] = abs((R_GauPyr[c] - G_GauPyr[c]) - (temp1(Range(0, R_GauPyr[c].rows), Range(0, R_GauPyr[c].cols)))); BY[i] = abs(temp1(Range(0, B_GauPyr[c].rows), Range(0, B_GauPyr[c].cols)) - (B_GauPyr[c] - Y_GauPyr[c])); colorMap[i] = RG[i] + BY[i]; i++; } } resizeMap(colorMap, C_bar); } //Generate Orientation Map void buildOrientationMap(Mat &intensity, Mat &O_bar) { vector<Mat> kernel(4); vector<Mat> gaborImage(4); vector<Mat> GauPyr_0(9); vector<Mat> GauPyr_45(9); vector<Mat> GauPyr_90(9); vector<Mat> GauPyr_135(9); Mat totalOriMap_0, totalOriMap_45, totalOriMap_90, totalOriMap_135; int theta, i, j = 0; //Calculate Gabor Filter for theta = 0, 45, 90, 135 for(theta = 0; theta < 4; theta++) { kernel[theta] = getGaborKernel(Size (7, 7), 3, theta * (CV_PI/4), 1.0, 0, 0); filter2D(intensity, gaborImage[theta], -1, kernel[theta]); } buildPyramid(gaborImage[0], GauPyr_0, 8); buildPyramid(gaborImage[1], GauPyr_45, 8); buildPyramid(gaborImage[2], GauPyr_90, 8); buildPyramid(gaborImage[3], GauPyr_135, 8); buildMap(GauPyr_0, totalOriMap_0); buildMap(GauPyr_45, totalOriMap_45); buildMap(GauPyr_90, totalOriMap_90); buildMap(GauPyr_135, totalOriMap_135); //Add each conspicuity map for theta = 0, 45, 90, 135 //This will give conspicuity map for orientation O_bar = totalOriMap_0 + totalOriMap_45 + totalOriMap_90 + totalOriMap_135; } //Build Saliency Map void buildSaliencyMap(Mat &I_bar, Mat &C_bar, Mat &O_bar, Mat &image) { double maxVal; Mat dest; Mat saliencyMap = (I_bar + C_bar + O_bar) / 3; //Saliency Map is average of the 3 conspicuity maps resize(saliencyMap, dest, image.size(), 0, 0, INTER_LINEAR); //resize saliency map to size of input image saliencyMap = dest; //imwrite("sal_map.bmp", saliencyMap); int i = 0, count = 0; int thresh = 160; threshold(saliencyMap, saliencyMap, thresh, 255, THRESH_BINARY); //Perform binary threshold on Saliency Map image //imwrite("sal_map2.bmp", saliencyMap); Point prevmaxLoc, maxLoc; minMaxLoc(saliencyMap, NULL, &maxVal, NULL, &maxLoc); prevmaxLoc = maxLoc; while(maxVal > 0 && count < 8) { if(i != 0) circle(image, maxLoc, 50, Scalar(255, 0, 0), 2, 8, 0); //Draw circle on salient object else circle(image, maxLoc, 50, Scalar(0, 0, 255), 2, 8, 0); //Draw circle on first salient object line(image, prevmaxLoc, maxLoc, CV_RGB(0, 0, 0), 2, 8, 0); //Draw line passing through each salient object circle(saliencyMap, maxLoc, 150, Scalar(0, 0, 0), -1); //After detection of salient object, remove that object prevmaxLoc = maxLoc; minMaxLoc(saliencyMap, NULL, &maxVal, NULL, &maxLoc); i++; count++; } imwrite("saliencyOut_unoptimised.bmp", image); //output image stop(); } int main(int argc, char *argv[]) { time_t start, end; vector<Mat> GauPyr(9); Mat I_bar, C_bar, O_bar; mystart(); Mat image = imread(argv[1]); stop(); Mat imageCopy = image; Mat intensity = image; mystart(); buildGaussianPyramid(intensity, GauPyr); //Generate Gaussian Pyramid printf("\nGuassianPyramid::"); stop(); buildIntensityMap(GauPyr, I_bar); //Generate Intensity Map printf("\nIntensity Map::"); stop(); buildColorMap(intensity, imageCopy, C_bar); //Generate Color Map printf("\nColor Map::"); stop(); buildOrientationMap(intensity, O_bar); //Generate Orientation Map printf("\nOrientation Map::"); stop(); buildSaliencyMap(I_bar, C_bar, O_bar, image); //Generate Saliency Map printf("\nSaliency Map::"); stop(); return 0; }
c30d5e78b145834647551a8ee099bf50948103d3
f53c7c2f0678793ed76a2c18a1e934fa7acd3bed
/example/ViT/two_diverse/aie/mm_graph_small.h
30cc01e5cffe8b006b507766c8ddea185c5cfda6
[ "MIT" ]
permissive
JinmingZhuang/CHARM
28c94de84669119eb656e558bc255ff98c2dc7ae
e4f507c088b89ad9b91ea64fb719073750f51073
refs/heads/main
2023-04-13T23:08:16.218665
2022-12-26T22:20:30
2022-12-26T22:20:30
558,491,173
7
1
null
null
null
null
UTF-8
C++
false
false
1,582
h
#include <adf.h> #include "para.h" using namespace adf; template <int COL_OFFSET, int ROW_OFFSET> class mm_x2_graph : public adf::graph { private: adf::kernel mm_x2 [NUM_ENGINES_PER_PAC_SMALL]; adf::pktsplit<NUM_ENGINES_PER_PAC_SMALL> sp_a0; adf::pktsplit<NUM_ENGINES_PER_PAC_SMALL> sp_b0; public: adf::port<input> in[2]; adf::port<output> out; mm_x2_graph() { // packet stream to different engines sp_a0 = adf::pktsplit<NUM_ENGINES_PER_PAC_SMALL>::create(); sp_b0 = adf::pktsplit<NUM_ENGINES_PER_PAC_SMALL>::create(); adf::connect< adf::pktstream > (in[0], sp_a0.in[0]); adf::connect< adf::pktstream > (in[1], sp_b0.in[0]); // create NUM_ENGINES_PER_COL get_particles_i and n-body kernels for (int row =0; row<NUM_ENGINES_PER_PAC_SMALL; row++) { if(row==0){ mm_x2[row] = adf::kernel::create(mm_kernel0); adf::source(mm_x2[row]) = "aie/mm_kernel0.cc"; } else{ mm_x2[row] = adf::kernel::create(mm_kernel1); adf::source(mm_x2[row]) = "aie/mm_kernel1.cc"; } } for (int row =0; row<NUM_ENGINES_PER_PAC_SMALL; row++) { adf::runtime<ratio>(mm_x2[row]) = 1; adf::location<kernel>(mm_x2[row]) = adf::tile(COL_OFFSET,ROW_OFFSET+row); adf::connect<pktstream, window<h1*w1*4>> (sp_a0.out[row], mm_x2[row].in[0]); adf::connect<pktstream, window<w1*w2*4>> (sp_b0.out[row], mm_x2[row].in[1]); if(row<NUM_ENGINES_PER_PAC_SMALL-1){ adf::connect<window<h1*w2*4>> (mm_x2[row].out[0], mm_x2[row+1].in[2]); } else{ adf::connect<window<h1*w2*4>>(mm_x2[row].out[0], out); } } }; };
5c6378e448923feddf86aa34582b1c3722f48a84
363687005f5b1d145336bf29d47f3c5c7b867b5b
/atcoder/agc049/b/Main.cpp
7c1fce91bb6c740760a1f02874d242afd8d0815a
[]
no_license
gky360/contests
0668de0e973c0bbbcb0ccde921330810265a986c
b0bb7e33143a549334a1c5d84d5bd8774c6b06a0
refs/heads/master
2022-07-24T07:12:05.650017
2022-01-17T14:01:33
2022-07-10T14:01:33
113,739,612
1
0
null
null
null
null
UTF-8
C++
false
false
887
cpp
/* [agc049] B - Flip Digits */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double DD; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, ll> pll; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(c) (c).begin(), (c).end() const int MAX_N = 5e5; int N; string S, T; int f[2][MAX_N + 1]; ll solve() { int a[MAX_N + 1], b[MAX_N + 1]; a[0] = b[0] = 0; REP(i, N) { a[i + 1] = a[i] ^ (S[i] - '0'); b[i + 1] = b[i] ^ (T[i] - '0'); } ll ans = 0; int x = 0; REP(i, N + 1) { x = max(x, i); if (a[x] == b[i]) continue; while (x + 1 <= N && a[x] == a[x + 1]) x++; if (x == N) return -1; x++; ans += x - i; } return ans; } int main() { cin >> N; cin >> S >> T; cout << solve() << endl; return 0; }
a9f2bf1f2c1719955d87d01cdbb2b39d5bda6be9
bb4df3f28904ea8f8f08728ed955885b650c16ab
/tomada de tempo.cpp
46731c1e4dd873379178cacf7ef1e545e9fe0025
[]
no_license
SanDiegoCastilho/LabProgramacao
f0c50e5914dae9a1776ddb5f981a2d601772d62d
f46fdd395c31389cbe965e42644191463d782363
refs/heads/main
2023-06-02T22:21:24.156581
2021-06-21T04:07:01
2021-06-21T04:07:01
377,002,322
0
0
null
null
null
null
UTF-8
C++
false
false
539
cpp
#include <ctime> using std::clock; using std::clock_t; #include <iostream> using std::cin; using std::cout; #include <new> using std::nothrow; int main () { int tam; do { cout << "tam: "; cin >> tam; } while (tam < 1); int *v = new(nothrow) int[tam]; if (v == nullptr) return 1; clock_t i = clock(); for (int j = 0; j < tam; ++j) v[j] = j*j*j*j; clock_t f = clock(); // Tambemm poderia declarar "i" e "f" usando "auto". cout << "Tempo de CPU: " << (f-i) / (double) CLOCKS_PER_SEC << " segundos.\n"; delete[] v; }
43e22b73cbac1fc13d61f83c3c60ce0d56556d24
6ec22e4f426431c34745d5094ac3a332e978f381
/Iris 2D Biscuit/Iris 2D Biscuit/Iris 2D Biscuit-Onion(API)/src/Iris 2D/IrisEncripedResourceManager.cpp
ae403cb68687fdd1029924b778543c37fa548240
[]
no_license
wakinpang/Iris-2D-Project
05db4e791dceaa4f26c85becd19fb08fe9f99d5d
424976e8205a755247cc87f915c1e8cc1640ce25
refs/heads/master
2021-01-16T21:55:33.939617
2015-06-14T06:40:27
2015-06-14T06:40:27
30,752,948
0
0
null
2015-02-13T11:07:12
2015-02-13T11:07:11
null
UTF-8
C++
false
false
2,462
cpp
#include "IrisEncripedResourceManager.h" namespace Iris2D { IrisEncripedResourceManager* IrisEncripedResourceManager::_instance = NULL; IrisEncripedResourceManager* IrisEncripedResourceManager::Instance(){ if (_instance == NULL) _instance = new IrisEncripedResourceManager(); return _instance; } IrisEncripedResourceManager::IrisEncripedResourceManager() : m_lsExtracts(), m_lsGenExtracts() { } void IrisEncripedResourceManager::AddGeneralResource(wstring strPackagePath, SafetyFunc pfFunc){ GeneralEncriptySourceExtract* geseObj = new GeneralEncriptySourceExtract(); geseObj->InitPackageData(WStringToString(strPackagePath), pfFunc); m_lsGenExtracts.push_back(geseObj); } void IrisEncripedResourceManager::AddGraphResource(wstring strPackagePath, SafetyFunc pfFunc){ IrisGraphicsSourceExtract* igseObj = new IrisGraphicsSourceExtract(); igseObj->InitPackageData(WStringToString(strPackagePath), pfFunc); m_lsExtracts.push_back(igseObj); } bool IrisEncripedResourceManager::GetBitmapData(wstring wstrFilePath, char** ppData, int* nWidth, int* nHeight){ list<IrisGraphicsSourceExtract*>::iterator it; for (it = m_lsExtracts.begin(); it != m_lsExtracts.end(); ++it){ if ((*it)->IsHaveFile(WStringToString(wstrFilePath))) { (*it)->GetBitmapData(WStringToString(wstrFilePath), ppData, nWidth, nHeight); return true; } } return false; } bool IrisEncripedResourceManager::HaveSource(wstring wstrFilePath){ list<IrisGraphicsSourceExtract*>::iterator it; for (it = m_lsExtracts.begin(); it != m_lsExtracts.end(); ++it){ if ((*it)->IsHaveFile(WStringToString(wstrFilePath))) { return true; } } return false; } bool IrisEncripedResourceManager::GetGeneralData(wstring wstrFilePath, char** ppData, int* nSize){ list<GeneralEncriptySourceExtract*>::iterator it; for (it = m_lsGenExtracts.begin(); it != m_lsGenExtracts.end(); ++it){ if ((*it)->IsHaveFile(WStringToString(wstrFilePath))) { (*it)->GetGeneralData(WStringToString(wstrFilePath), ppData, nSize); return true; } } return false; } bool IrisEncripedResourceManager::HaveGeneralSource(wstring wstrFilePath){ list<GeneralEncriptySourceExtract*>::iterator it; for (it = m_lsGenExtracts.begin(); it != m_lsGenExtracts.end(); ++it){ if ((*it)->IsHaveFile(WStringToString(wstrFilePath))) { return true; } } return false; } IrisEncripedResourceManager::~IrisEncripedResourceManager() { } };
e136c446b3c3271dc05ca4d2ee4b33ffe514f59a
1f2737e41a6d72dff53a5e7949d1da9a1011cb99
/tinyxml/tinystr.h
29570a9920771e7c7aa1f55777f9c7af3aa0ad07
[]
no_license
leadcoder/gass-dependencies
bd58c3c7502562b41a8ebb868e841491bba7925e
7c0895f54a22313071a8b556a664f2e0f995b4de
refs/heads/master
2021-01-23T18:48:29.500615
2019-04-23T20:59:48
2019-04-23T20:59:48
40,589,311
1
1
null
null
null
null
UTF-8
C++
false
false
9,057
h
/* www.sourceforge.net/projects/tinyxml Original file by Yves Berquin. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005. * * - completely rewritten. compact, clean, and fast implementation. * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems) * - fixed reserve() to work as per specification. * - fixed buggy compares operator==(), operator<(), and operator>() * - fixed operator+=() to take a const ref argument, following spec. * - added "copy" constructor with length, and most compare operators. * - added swap(), clear(), size(), capacity(), operator+(). */ #ifndef TIXML_USE_STL #ifndef TIXML_STRING_INCLUDED #define TIXML_STRING_INCLUDED #if defined (_WIN32) #if defined(SHARED_LIB) #if defined(tinyxml_EXPORTS) #define EXPORT __declspec(dllexport) #else #define EXPORT __declspec(dllimport) #endif #else #define EXPORT #endif #else #define EXPORT #endif #include <assert.h> #include <string.h> /* The support for explicit isn't that universal, and it isn't really required - it is used to check that the TiXmlString class isn't incorrectly used. Be nice to old compilers and macro it here: */ #if defined(_MSC_VER) && (_MSC_VER >= 1200 ) // Microsoft visual studio, version 6 and higher. #define TIXML_EXPLICIT explicit #elif defined(__GNUC__) && (__GNUC__ >= 3 ) // GCC version 3 and higher.s #define TIXML_EXPLICIT explicit #else #define TIXML_EXPLICIT #endif /* TiXmlString is an emulation of a subset of the std::string template. Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. Only the member functions relevant to the TinyXML project have been implemented. The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase a string and there's no more room, we allocate a buffer twice as big as we need. */ class EXPORT TiXmlString { public : // The size type used typedef size_t size_type; // Error value for find primitive static const size_type npos; // = -1; // TiXmlString empty constructor TiXmlString () : rep_(&nullrep_) { } // TiXmlString copy constructor TiXmlString ( const TiXmlString & copy) : rep_(0) { init(copy.length()); memcpy(start(), copy.data(), length()); } // TiXmlString constructor, based on a string TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) { init( static_cast<size_type>( strlen(copy) )); memcpy(start(), copy, length()); } // TiXmlString constructor, based on a string TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) { init(len); memcpy(start(), str, len); } // TiXmlString destructor ~TiXmlString () { quit(); } // = operator TiXmlString& operator = (const char * copy) { return assign( copy, (size_type)strlen(copy)); } // = operator TiXmlString& operator = (const TiXmlString & copy) { return assign(copy.start(), copy.length()); } // += operator. Maps to append TiXmlString& operator += (const char * suffix) { return append(suffix, static_cast<size_type>( strlen(suffix) )); } // += operator. Maps to append TiXmlString& operator += (char single) { return append(&single, 1); } // += operator. Maps to append TiXmlString& operator += (const TiXmlString & suffix) { return append(suffix.data(), suffix.length()); } // Convert a TiXmlString into a null-terminated char * const char * c_str () const { return rep_->str; } // Convert a TiXmlString into a char * (need not be null terminated). const char * data () const { return rep_->str; } // Return the length of a TiXmlString size_type length () const { return rep_->size; } // Alias for length() size_type size () const { return rep_->size; } // Checks if a TiXmlString is empty bool empty () const { return rep_->size == 0; } // Return capacity of string size_type capacity () const { return rep_->capacity; } // single char extraction const char& at (size_type index) const { assert( index < length() ); return rep_->str[ index ]; } // [] operator char& operator [] (size_type index) const { assert( index < length() ); return rep_->str[ index ]; } // find a char in a string. Return TiXmlString::npos if not found size_type find (char lookup) const { return find(lookup, 0); } // find a char in a string from an offset. Return TiXmlString::npos if not found size_type find (char tofind, size_type offset) const { if (offset >= length()) return npos; for (const char* p = c_str() + offset; *p != '\0'; ++p) { if (*p == tofind) return static_cast< size_type >( p - c_str() ); } return npos; } void clear () { //Lee: //The original was just too strange, though correct: // TiXmlString().swap(*this); //Instead use the quit & re-init: quit(); init(0,0); } /* Function to reserve a big amount of data when we know we'll need it. Be aware that this function DOES NOT clear the content of the TiXmlString if any exists. */ void reserve (size_type cap); TiXmlString& assign (const char* str, size_type len); TiXmlString& append (const char* str, size_type len); void swap (TiXmlString& other) { Rep* r = rep_; rep_ = other.rep_; other.rep_ = r; } private: void init(size_type sz) { init(sz, sz); } void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } char* start() const { return rep_->str; } char* finish() const { return rep_->str + rep_->size; } struct Rep { size_type size, capacity; char str[1]; }; void init(size_type sz, size_type cap) { if (cap) { // Lee: the original form: // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); // doesn't work in some cases of new being overloaded. Switching // to the normal allocation, although use an 'int' for systems // that are overly picky about structure alignment. const size_type bytesNeeded = sizeof(Rep) + cap; const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); rep_->str[ rep_->size = sz ] = '\0'; rep_->capacity = cap; } else { rep_ = &nullrep_; } } void quit() { if (rep_ != &nullrep_) { // The rep_ is really an array of ints. (see the allocator, above). // Cast it back before delete, so the compiler won't incorrectly call destructors. delete [] ( reinterpret_cast<int*>( rep_ ) ); } } Rep * rep_; static Rep nullrep_; } ; inline bool operator == (const TiXmlString & a, const TiXmlString & b) { return ( a.length() == b.length() ) // optimization on some platforms && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare } inline bool operator < (const TiXmlString & a, const TiXmlString & b) { return strcmp(a.c_str(), b.c_str()) < 0; } inline EXPORT bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } inline EXPORT bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } inline EXPORT bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } inline EXPORT bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } inline EXPORT bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } inline EXPORT bool operator == (const char* a, const TiXmlString & b) { return b == a; } inline EXPORT bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } inline EXPORT bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } EXPORT TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); EXPORT TiXmlString operator + (const TiXmlString & a, const char* b); EXPORT TiXmlString operator + (const char* a, const TiXmlString & b); /* TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. Only the operators that we need for TinyXML have been developped. */ class EXPORT TiXmlOutStream : public TiXmlString { public : // TiXmlOutStream << operator. TiXmlOutStream & operator << (const TiXmlString & in) { *this += in; return *this; } // TiXmlOutStream << operator. TiXmlOutStream & operator << (const char * in) { *this += in; return *this; } } ; #endif // TIXML_STRING_INCLUDED #endif // TIXML_USE_STL
[ "leadcoder@03e3fbca-29a6-eb1c-c96b-1d8cf88ad296" ]
leadcoder@03e3fbca-29a6-eb1c-c96b-1d8cf88ad296
128e48d6ff90354d5c68a2d350a62f71b0d0048f
3d1eb084697e24615f222c9141930fca01ffabce
/Piece.cpp
eaaf8fec1105bb6f34cadebb255fe4c3d6e5e140
[ "MIT" ]
permissive
korosuke613/CTeto
0a63bedfe547f207c894c60010eae62dcfe52cb8
6ab0835230e2e8d8b55f51a9010a73e948c0c882
refs/heads/master
2021-01-23T10:19:53.293393
2019-02-24T14:42:28
2019-02-24T14:42:28
93,048,648
2
0
null
null
null
null
UTF-8
C++
false
false
1,198
cpp
#include "Piece.h" //オブジェクトの回転 void Piece::rotate(bool isClockwise) { constexpr int isBlock = '1'; char temp[9] = "00000000"; int i = 0; if (isClockwise) { while (m[i] != '\0') { if (m[i] == isBlock) { if (i < 6) { temp[i + 2] = '1'; } else { temp[i - 6] = '1'; } } i++; } } else { while (m[i] != '\0') { if (m[i] == isBlock) { if (i > 1) { temp[i - 2] = '1'; } else { temp[i + 6] = '1'; } } i++; } } for (i = 0; i < 9; i++) { m[i] = temp[i]; } setLRU(); } void Piece::setLRU() { int i = 0; lmax = rmax = umax = 0; while (m[i] != '\0') { if (m[i] == '1') { /* 012 7 3 654 */ switch (i) { case 0: case 7: lmax = 1; break; case 2: case 3: rmax = 1; break; case 4: rmax = umax = 1; break; case 5: umax = 1; break; case 6: lmax = umax = 1; break; default: break; } } i++; } }
e3da9787ce93c4cc312c54d26fbf0a80771a3b53
abb327f4a8a3054d5389941594e4a8c42d6be8f7
/exe/src/model/map/map.cpp
b14518140c26cb8acd91263076f99bfc93538d64
[ "MIT" ]
permissive
jonpetri/CollectGame
bc7595898e3850ab97f496dadf59b2b5314e0ae1
251beb560f8246468479f04461bfc0b1298a7e70
refs/heads/master
2020-04-04T12:53:15.092395
2018-11-12T11:51:54
2018-11-12T11:51:54
155,940,961
0
0
null
null
null
null
UTF-8
C++
false
false
12,534
cpp
#include "map.h" #include <random> #include "model/game/gameparameters.h" #include "model/node/node.h" //----------------------------------------------------------------------------------------------------------------------- // Map :: Constructors / Destructors //----------------------------------------------------------------------------------------------------------------------- Map::Map() : m_grid(std::make_shared<NodeGrid>()) , m_graph(std::make_shared<NodeGraph>()) , m_candidateNodes() { } Map::~Map() { } /** * The class has enable_shared_from_this, * so we have to make sure the class will always be stored in a std::shared_ptr<>. * The constructor is private, must use that method instead. * @return properly build Class */ std::shared_ptr<Map> Map::createObject() { struct make_shared_enabler : public Map {}; return std::make_shared<make_shared_enabler>(); } //----------------------------------------------------------------------------------------------------------------------- // Map :: Getters //----------------------------------------------------------------------------------------------------------------------- const std::shared_ptr<Array2d<std::shared_ptr<Node> > > Map::grid() const { return m_grid; } const std::shared_ptr<NodeGraph> Map::graph() const { return m_graph; } //----------------------------------------------------------------------------------------------------------------------- // Map :: Setters //----------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------- // Map :: Methods //----------------------------------------------------------------------------------------------------------------------- /** * Create a new random map, according the parameters of gameParameters * @param [in] gameParameters */ void Map::createNewMap(const std::shared_ptr<GameParameters> & gameParameters) { unsigned int iGridSize = gameParameters->gridSideSize(); // clean of former game // ------------- this->clear(); // Grid creation + Insertion off all the node in the graph // ------------------------------------------------------ // The grid is a square of gridSize x gridSize m_grid->redimColSize(iGridSize); m_grid->redimRowSize(iGridSize); for (unsigned int x = 0 ; x < iGridSize ; ++x) { for (unsigned int y = 0 ; y < iGridSize ; ++y) { std::shared_ptr<Node> newNode = Node::create(); // Connection of nodes signals newNode->setAdjacentsAsCandidate.connect( boost::bind( &NodeGraph::setAdjacentsCandidate, m_graph, _1)); newNode->addToCandidateList.connect( boost::bind( &Map::addToCandidatesNodes, shared_from_this(), _1)); newNode->removeFromCandidateList.connect( boost::bind( &Map::remomoveFromCandidatesNodes, shared_from_this(), _1)); newNode->setX(x); newNode->setY(y); m_grid->set(x, y, newNode); m_graph->addIsolateNode(newNode); } } // Connection of the physically adjacent nodes // ------------------------------------------------------ // The adjacent nodes in the grid are linked in the graph // e.g. (x=0, y=0) with (x=1, y=0) for (unsigned int x = 0 ; x < iGridSize ; ++x) { for (unsigned int y = 0 ; y < iGridSize ; ++y) { if (y > 0) m_graph->connectNodes(m_grid->get(x, y), m_grid->get(x, y - 1)); if (x > 0) { m_graph->connectNodes(m_grid->get(x, y), m_grid->get(x - 1, y)); if ( y > 0) // and x > 0 { m_graph->connectNodes(m_grid->get(x, y), m_grid->get(x - 1, y -1)); //if (y < iGridSize -1) // and x > 0, y > 0 m_graph->connectNodes(m_grid->get(x -1 , y), m_grid->get(x, y - 1)); } } } } // std::cout << this->consolePrint(true) << std::endl; // std::cout << "edge count= " << m_graph->edgeCount() << std::endl; // Choice of the first existing node randomly // ------------------------------------------------------ std::random_device rd; //Will be used to obtain a seed for the random number engine std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd() std::uniform_int_distribution<unsigned int> randomDistributionXY(0, iGridSize-1); unsigned int iXFirstNode = randomDistributionXY(gen); unsigned int iYFirstNode = randomDistributionXY(gen); m_grid->get(iXFirstNode, iYFirstNode)->setIntoExistingState(); // this changes the adjacent nodes into the 'Candidate' state, thought node's signal // Creation of X existing nodes // --------------------- // In order to make sure that all the created nodes can be connected (neighbour from each other) // the nodes to be created are chosen among the candidate nodes. // The candidate nodes are the nodes at the cliff / limit between created nodes and absent nodes. for (unsigned long l = 0 ; l < gameParameters->nodeCount() - 1 ; ++l) { if (m_candidateNodes.size() == 0) throw std::out_of_range( "in Map::createNewMap()" ); std::uniform_int_distribution<unsigned long> candidatesRandomDistribution(0, m_candidateNodes.size() - 1); m_candidateNodes[candidatesRandomDistribution(gen)]->setIntoExistingState(); // -> this changes the adjacent nodes into the 'Candidate' state, thought node's signal } // Remove of edges linked to absent and candidate nodes in the graph // ----------------------------------------------------------------- m_graph->removeAbsentNodesAndEdges(); // Remove of random edges // ---------------------- // Edges are removed to try to reach the number target. // The removable edges count is limited because the graph has to remain connected. m_graph->removeNonBridgeEdges(gameParameters->edgeTargetCount()); } /** * Retrieve the string to be displayed in the console in order to show the graph to the user. * @param [in] bPrintNodeIds If true, don ot print "O" for nodes, but ID's (useful for debug) * @return string of the view */ std::string Map::consolePrint(bool bPrintNodeIds) const { /* The return print is: X 1 2 3 4 //<- sXindex (header) Y ----------------> X //<- sXLine (header) 1 | O O – @ //<- sNodeLine y=1 (grid) | | X | / //<- sEdgeLine y=1 (grid) 2 | O – O – O //<- sNodeLine y=2 (grid) | | \ //<- sEdgeLine y=2 (grid) 3 | O O // ++y ... V Y */ std::string sConsolePrint(""); std::string sXindex(""); std::string sXLine(""); std::string sNodeLine(""); std::string sEdgeLine(""); if (m_grid->size() == 0) throw std::logic_error( "Generate the map before operating." ); if (bPrintNodeIds) m_graph->updateNodeIds(); // the header // ---------- sXindex += " X "; sXLine += "Y -"; for (unsigned int x = 0 ; x < m_grid->size() ; ++x) { sXindex += getNumberInTwoChar(x+1) + " "; sXLine += "----"; } sXLine += "> X"; sConsolePrint += sXindex + "\n"; sConsolePrint += sXLine + "\n"; // the grid // ---------- std::shared_ptr<Node> node; for (unsigned int y = 0 ; y < m_grid->size() - 1 ; ++y) { sNodeLine.clear(); sEdgeLine.clear(); sNodeLine += getNumberInTwoChar(y+1) + "| "; sEdgeLine += " | "; for (unsigned int x = 0 ; x < m_grid->size() -1 ; ++x) { node = m_grid->get(x,y); if (bPrintNodeIds) sNodeLine += getNumberInTwoChar(node->graphIndex()) + edgeCharacterRightOfNode(node); else sNodeLine += node->consolePrintCharacter() + edgeCharacterRightOfNode(node); sEdgeLine += edgeCharacterBelowOfNode(node) + edgeCharacterDiagonaleOfNode(node); } node = m_grid->get(m_grid->size() - 1 , y); if (bPrintNodeIds) sNodeLine += getNumberInTwoChar(node->graphIndex()) ; else sNodeLine += node->consolePrintCharacter() ; sEdgeLine += edgeCharacterBelowOfNode(node); sConsolePrint += sNodeLine + "\n"; sConsolePrint += sEdgeLine + "\n"; } // last row of node // ----------------- unsigned int y =m_grid->size() - 1; sNodeLine.clear(); sNodeLine += getNumberInTwoChar(y + 1) + "| "; for (unsigned int x = 0 ; x < m_grid->size() -1 ; ++x) { node = m_grid->get(x,y); if (bPrintNodeIds) sNodeLine += getNumberInTwoChar(node->graphIndex()) + edgeCharacterRightOfNode(node); else sNodeLine += node->consolePrintCharacter() + edgeCharacterRightOfNode(node); } node = m_grid->get(m_grid->size() - 1 , y); if (bPrintNodeIds) sNodeLine +=getNumberInTwoChar(node->graphIndex()) ; else sNodeLine += node->consolePrintCharacter() ; // end arrow of Y index // --------------------- sConsolePrint += sNodeLine + "\n"; sConsolePrint += " V\n"; sConsolePrint += " Y\n"; return sConsolePrint; } /** * Empty all the containers of node */ void Map::clear() { m_candidateNodes.clear(); m_grid->clear(); m_graph->clear(); } /** * Add the node to the member list m_candidateNodes. * The candidate nodes are the nodes at the cliff / limit between created nodes and absent nodes. * the nodes to be created are chosen among the candidate nodes. * @param [in] n node */ void Map::addToCandidatesNodes(const std::shared_ptr<Node> &n) { m_candidateNodes.push_back(n); } /** * remoce the node from the member list m_candidateNodes. * The candidate nodes are the nodes at the cliff / limit between created nodes and absent nodes. * the nodes to be created are chosen among the candidate nodes. * @param [in] n node */ void Map::remomoveFromCandidatesNodes(const std::shared_ptr<Node> &n) { std::vector<std::shared_ptr<Node>>::iterator it; for(it = m_candidateNodes.end()-1; it+1 != m_candidateNodes.begin(); it-- ) { if(*it == n) m_candidateNodes.erase(it); } } /** * (private) * Retrieve the edge character to be displayed right to a node. * @param [in] n node * @return " - " or " " */ std::string Map::edgeCharacterRightOfNode(const std::shared_ptr<Node> &n) const { std::shared_ptr<Node> adjacentRightNode = m_grid->get(n->x() + 1, n->y()); if(m_graph->edgeExists(n, adjacentRightNode) == true) return " - "; else return " "; } /** * (private) * Retrieve the edge character to be displayed below a node * @param [in] n node * @return "|" or " " */ std::string Map::edgeCharacterBelowOfNode(const std::shared_ptr<Node> &n) const { std::shared_ptr<Node> adjacentBelowNode = m_grid->get(n->x(), n->y() + 1); if(m_graph->edgeExists(n, adjacentBelowNode) == true) return "|"; else return " "; } /** * (private) * Retrieve the edge character to be displayed at the right/below a node * @param [in] n node * @return " X ", " / ", " \ " or " " */ std::string Map::edgeCharacterDiagonaleOfNode(const std::shared_ptr<Node> &n) const { std::shared_ptr<Node> adjacentDiagonalNode = m_grid->get(n->x() + 1, n->y() + 1); std::shared_ptr<Node> adjacentBelowNode = m_grid->get(n->x(), n->y() + 1); std::shared_ptr<Node> adjacentRightNode = m_grid->get(n->x() + 1, n->y()); bool bNeedAntiSlash = m_graph->edgeExists(n, adjacentDiagonalNode); bool bNeedSlash = m_graph->edgeExists(adjacentBelowNode, adjacentRightNode); if( bNeedSlash and bNeedAntiSlash) return " X "; else if( bNeedSlash ) return " / "; else if( bNeedAntiSlash ) return " \\ "; else return " "; } /** * (private) * Retrieve the number in string of 2 characters * @param [in] iNumber * @return string */ std::string Map::getNumberInTwoChar(unsigned long lNumber) { std::string sResult; sResult = std::to_string(lNumber); while (sResult.length() < 2) { sResult= sResult + " " ; } return sResult; }
ac765874fbc087ca637b8175d0f6c603156eb4d9
b82e2062512c204697b5ea6740b05b1a104abac3
/Counter_LedSwitch_Zedboard.gen/sources_1/bd/ZynqSystem/ip/ZynqSystem_xbar_0/sim/ZynqSystem_xbar_0_sc.h
90d32fb6e2c6b78af529f3c7306d6c781cc05501
[]
no_license
UssashArafat/Zynq_GPIO
fd2971d24de83c60112dc2f3e9602ffa50b5927f
e12ae7549f48686ddfb92e92bdd400bcf84de599
refs/heads/master
2023-04-09T21:09:46.684222
2021-04-18T09:31:33
2021-04-18T09:31:33
339,369,757
0
0
null
null
null
null
UTF-8
C++
false
false
3,436
h
#ifndef IP_ZYNQSYSTEM_XBAR_0_SC_H_ #define IP_ZYNQSYSTEM_XBAR_0_SC_H_ // (c) Copyright 1995-2021 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant any // rights to the materials distributed herewith. Except as // otherwise provided in a valid license issued to you by // Xilinx, and to the maximum extent permitted by applicable // law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND // WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES // AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING // BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- // INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and // (2) Xilinx shall not be liable (whether in contract or tort, // including negligence, or under any other theory of // liability) for any loss or damage of any kind or nature // related to, arising under or in connection with these // materials, including for any direct, or any indirect, // special, incidental, or consequential loss or damage // (including loss of data, profits, goodwill, or any type of // loss or damage suffered as a result of any action brought // by a third party) even if such damage or loss was // reasonably foreseeable or Xilinx had been advised of the // possibility of the same. // // CRITICAL APPLICATIONS // Xilinx products are not designed or intended to be fail- // safe, or for use in any application requiring fail-safe // performance, such as life-support or safety devices or // systems, Class III medical devices, nuclear facilities, // applications related to the deployment of airbags, or any // other applications that could lead to death, personal // injury, or severe property or environmental damage // (individually and collectively, "Critical // Applications"). Customer assumes the sole risk and // liability of any use of Xilinx products in Critical // Applications, subject only to applicable laws and // regulations governing limitations on product liability. // // THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS // PART OF THIS FILE AT ALL TIMES. // // DO NOT MODIFY THIS FILE. #ifndef XTLM #include "xtlm.h" #endif #ifndef SYSTEMC_INCLUDED #include <systemc> #endif #if defined(_MSC_VER) #define DllExport __declspec(dllexport) #elif defined(__GNUC__) #define DllExport __attribute__ ((visibility("default"))) #else #define DllExport #endif class axi_crossbar; class DllExport ZynqSystem_xbar_0_sc : public sc_core::sc_module { public: ZynqSystem_xbar_0_sc(const sc_core::sc_module_name& nm); virtual ~ZynqSystem_xbar_0_sc(); // module socket-to-socket AXI TLM interfaces xtlm::xtlm_aximm_target_socket* target_0_rd_socket; xtlm::xtlm_aximm_target_socket* target_0_wr_socket; xtlm::xtlm_aximm_initiator_socket* initiator_0_rd_socket; xtlm::xtlm_aximm_initiator_socket* initiator_0_wr_socket; xtlm::xtlm_aximm_initiator_socket* initiator_1_rd_socket; xtlm::xtlm_aximm_initiator_socket* initiator_1_wr_socket; // module socket-to-socket TLM interfaces protected: axi_crossbar* mp_impl; private: ZynqSystem_xbar_0_sc(const ZynqSystem_xbar_0_sc&); const ZynqSystem_xbar_0_sc& operator=(const ZynqSystem_xbar_0_sc&); }; #endif // IP_ZYNQSYSTEM_XBAR_0_SC_H_
a926929dfc306c7b6844652814dc3da1191bbfa9
5b6d379937b6e472817f31f146fdc56fc02fe8df
/include/planner/io/tex.h
47a9d6539de4b67cd5a4debb27342ab8da4f0a48
[ "MIT" ]
permissive
RomanCPodolski/samling_based_planning
43fe98b9b7de8d12be8ebda5bbf59d355c0db9f2
30a064d60e1f278459dfeacbc764022346f6ec84
refs/heads/master
2021-08-19T19:09:10.409625
2017-11-27T07:01:25
2017-11-27T07:01:25
110,194,570
3
1
null
null
null
null
UTF-8
C++
false
false
2,923
h
#ifndef PLANNER_IO_TEX_H_ #define PLANNER_IO_TEX_H_ #include <boost/format.hpp> #include <iostream> #include "planner/baseframe.h" #include "planner/car.h" #include "planner/maneuver.h" #include "planner/planner.h" #include "planner/pose.h" namespace planner { namespace io { class tex_mapper { private: std::ostream &_os; std::string _axis_props; void write_header() { _os << "% Autor: Roman C. Podolski <[email protected]>\n"; _os << "% this is a generated file, please do not alter\n\n"; _os << "\\documentclass{standalone}[preview]\n"; _os << "\\usepackage{tikz}\n"; _os << "\\usetikzlibrary{decorations.markings,calc}\n"; _os << "\\usepackage{pgfplots}\n"; _os << "\\usepackage{pgfplotstable}\n"; _os << "\\usepackage[svgnames]{xcolor}\n"; _os << "% Settings for pgfplots\n"; _os << "\\pgfplotsset{compat=1.9}\n"; _os << "\\pgfplotsset{cycle list={black}}\n"; _os << "\\begin{document}\n"; _os << "\\begin{tikzpicture}[scale=1.0]\n"; _os << boost::format("\\begin{axis}[%s]\n") % _axis_props; } void write_footer() { _os << "\\end{axis}\n"; _os << "\\end{tikzpicture}\n"; _os << "\\end{document}\n"; } public: tex_mapper(std::ostream &os, std::string axis_props = "axis equal") : _os(os), _axis_props{axis_props} { write_header(); } virtual ~tex_mapper() { write_footer(); } void map(Baseframe b, std::string props = "color=blue", const double ds = 1.0) { _os << boost::format("\\addplot[%s] coordinates {\n") % props; for (double s = 0.1; s < b.length(); s += ds) { auto p = b.P(s); _os << boost::format("(%d,%d)\n") % p.x() % p.y(); } _os << "};\n"; } void map(Maneuver m, std::string props = "color=black") { map(m.path(), props); } void map(std::vector<pose> path, std::string props = "color=black") { _os << boost::format("\\addplot[%s] coordinates {\n") % props; for (auto point : path) { _os << boost::format("(%d,%d)\n") % point.x() % point.y(); } _os << "};\n"; } void map(std::vector<std::pair<double, double>> wp, std::string props = "color=blue,mark=x") { _os << boost::format("\\addplot[only marks, %s] coordinates {\n") % props; for (const auto &p : wp) { _os << boost::format("(%d,%d)\n") % p.first % p.second; } _os << "};\n"; } void map(polygon p, std::string props = "") { _os << boost::format("\\addplot[%s] coordinates {\n") % props; for (auto point : p.outer()) { _os << boost::format("(%d,%d)\n") % point.x() % point.y(); } _os << "} --cycle;\n"; } void map(const pose &pose, std::string props = "") { Car car; map(car.obb(pose), props); } void map(box b, std::string props = "") { polygon tmp; bg::convert(b, tmp); map(tmp, props); } }; } // namespace io } // namespace planner #endif /* PLANNER_IO_TEX_H_ */
6f4a46ee71d0fb20c4122743d3fdbc703aae8b0f
d1fbe841056e70eee2777d673c1540271fab1e2f
/leetcode_54.h
187cacd9ad59cafc7f5d50261adb3cec151c2126
[]
no_license
StanleyZhang1992/Algorithms
be6a59651c3355bc514a050dae182c5204a192df
497fd1b5c1ba08de69a0afad5a047e1e4cef6716
refs/heads/master
2022-12-24T17:03:25.473184
2020-10-01T17:10:20
2020-10-01T17:10:20
292,068,545
0
0
null
null
null
null
UTF-8
C++
false
false
1,783
h
#pragma once /* 54. Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] Output: [1,2,3,6,9,8,7,4,5] Example 2: Input: [ [1, 2, 3, 4], [5, 6, 7, 8], [9,10,11,12] ] Output: [1,2,3,4,8,12,11,10,9,5,6,7] */ #include<vector> using namespace std; /* take care of the outer-most layer, then the rest can be taken care of by recursion O(n) time */ void dfs(vector<int>& res, vector<vector<int> >& matrix, int row_upper, int row_down, int col_left, int col_right) { // base case if (row_upper > row_down || col_left > col_right) return; if (row_upper == row_down) { for (int j = col_left; j <= col_right; ++j) { res.push_back(matrix[row_upper][j]); } return; } if (col_left == col_right) { for (int i = row_upper; i <= row_down; ++i) { res.push_back(matrix[i][col_left]); } return; } // recursive case for (int j = col_left; j <= col_right; ++j) { res.push_back(matrix[row_upper][j]); } for (int i = row_upper + 1; i <= row_down; ++i) { res.push_back(matrix[i][col_right]); } for (int j = col_right - 1; j >= col_left; --j) { res.push_back(matrix[row_down][j]); } for (int i = row_down - 1; i > row_upper; --i) { res.push_back(matrix[i][col_left]); } dfs(res, matrix, row_upper + 1, row_down - 1, col_left + 1, col_right - 1); } vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> res; if (matrix.size() == 0 || matrix[0].size() == 0) { return res; } dfs(res, matrix, 0, matrix.size() - 1, 0, matrix[0].size() - 1); return res; }
34d3929df27a5a2e995594f995332210ebdcebc6
56544f3536d7333e846521c8536ef5916df2e8db
/HDU_3068.cpp
1252984735dd5d6c40d69b9e98e113d48b994e53
[]
no_license
Just-it/ACM-algorithm
c9ccc078258986038fff5bdbdf65e0bbbbd2e6b8
019a920c4d6f45cceb2facfb69affddb68830453
refs/heads/master
2021-01-10T15:56:17.858334
2016-04-23T08:06:04
2016-04-23T08:06:04
54,938,766
0
0
null
null
null
null
UTF-8
C++
false
false
700
cpp
#include <iostream> #include <string> using namespace std; string ReverString(string st) { char temp; int len = st.length(); for (int i=0;i<(len/2);i++) { temp = st[i]; st[i] = st[len-1-i]; st[len-1-i] = temp; } return st; } int Find_Max_String(string st) { int left_value,right_value; string reverSt = ReverString(st); int len = st.length(); if (reverSt == st) return len; left_value = Find_Max_String(st.substr(1,len-1)); right_value = Find_Max_String(st.substr(0,len-1)); return left_value>right_value?left_value:right_value; } int main() { string testString; while (cin >> testString) { int length = Find_Max_String(testString); cout << length << endl; } return 0; }
a26f1ca72835bd5c29968c4c6e60781f70850a85
247ecf0e1ea30057cecd315a969d811cfcb5d3c9
/level_editor/LevelEditor/subarrayeditwindow.h
6e20a3218a5a8a111cc2a6570b08bc342e7cf3c9
[]
no_license
dmaulikr/Ballgame
131c43e052de6c1bab6043aef79698f5f4c7b395
cec942b796ae86989048da4eb216bce02332c3dc
refs/heads/master
2021-01-02T22:55:18.849077
2011-09-12T04:14:33
2011-09-12T04:14:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
929
h
#ifndef SUBARRAYEDITWINDOW_H #define SUBARRAYEDITWINDOW_H #include <QWidget> #include <QList> #include <QMap> #include <QVariant> #include <QTableWidgetItem> #include <QDebug> class MainWindow; namespace Ui { class SubArrayEditWindow; } class SubArrayEditWindow : public QWidget { Q_OBJECT public: explicit SubArrayEditWindow(QWidget * parent = 0, Qt::WindowFlags f = 0); ~SubArrayEditWindow(); void loadData(QVariant*, QWidget* parentWin); signals: void doneEditingSublist(); private slots: void objectChanged(QTableWidgetItem*); void comboBoxSelected(int); void doneClicked(); void addItemClicked(); void deleteItemClicked(); void tableCellClicked(int, int); private: Ui::SubArrayEditWindow *ui; void updateComboBox(); void updateObjectTable(int index); void clearObjectTable(); QVariant *list; bool noEmit; }; #endif // SUBARRAYEDITWINDOW_H
466f69813bfcde37a86ad452de498cf4a16383cb
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-ec2/source/model/DescribeVerifiedAccessTrustProvidersRequest.cpp
02e28af2badade249e70e00ab26c303466168db0
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
1,892
cpp
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/ec2/model/DescribeVerifiedAccessTrustProvidersRequest.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> using namespace Aws::EC2::Model; using namespace Aws::Utils; DescribeVerifiedAccessTrustProvidersRequest::DescribeVerifiedAccessTrustProvidersRequest() : m_verifiedAccessTrustProviderIdsHasBeenSet(false), m_maxResults(0), m_maxResultsHasBeenSet(false), m_nextTokenHasBeenSet(false), m_filtersHasBeenSet(false), m_dryRun(false), m_dryRunHasBeenSet(false) { } Aws::String DescribeVerifiedAccessTrustProvidersRequest::SerializePayload() const { Aws::StringStream ss; ss << "Action=DescribeVerifiedAccessTrustProviders&"; if(m_verifiedAccessTrustProviderIdsHasBeenSet) { unsigned verifiedAccessTrustProviderIdsCount = 1; for(auto& item : m_verifiedAccessTrustProviderIds) { ss << "VerifiedAccessTrustProviderId." << verifiedAccessTrustProviderIdsCount << "=" << StringUtils::URLEncode(item.c_str()) << "&"; verifiedAccessTrustProviderIdsCount++; } } if(m_maxResultsHasBeenSet) { ss << "MaxResults=" << m_maxResults << "&"; } if(m_nextTokenHasBeenSet) { ss << "NextToken=" << StringUtils::URLEncode(m_nextToken.c_str()) << "&"; } if(m_filtersHasBeenSet) { unsigned filtersCount = 1; for(auto& item : m_filters) { item.OutputToStream(ss, "Filter.", filtersCount, ""); filtersCount++; } } if(m_dryRunHasBeenSet) { ss << "DryRun=" << std::boolalpha << m_dryRun << "&"; } ss << "Version=2016-11-15"; return ss.str(); } void DescribeVerifiedAccessTrustProvidersRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const { uri.SetQueryString(SerializePayload()); }
9f12ceefbb748f4ec7d891b0fcd2e0b6ba924f3b
673bfa5c8ce5046f340b8adc3176a5981b4acbe4
/c_DERS/ortaya karışık/string_karsılastırma.cpp
90375c66c50946d16455045794e6dc3e11183916
[]
no_license
ysfkymz/my-c-codes
20f207862327647568733f928931c66088995521
80b13a8f3aa1e0cc18f1bff5a472305f8d142ed5
refs/heads/master
2020-06-03T14:10:18.966307
2019-06-12T15:35:05
2019-06-12T15:35:05
191,598,755
0
0
null
null
null
null
UTF-8
C++
false
false
434
cpp
#include<stdio.h> #include<conio.h> #include<string.h> int durum=0; void esitmi(char *a, char *b){ for( ; *a|| *b ; b++, a++) { if(*a!= *b){ durum=1; break; } } } main(){ char a[10],b[10]; puts("kelime:"); scanf("%s %s",a,b); esitmi(a,b); if(durum==1) printf("esit degil"); else printf("esit"); getch(); return 0;}
8a166bb671c2fa2296d28da6b5b0fb6d713a3c87
046ccce3543f93896ce595c44a343c210353e397
/ConvertSortedListToBalancedBST/convert_sorted_list_to_balanced_bst.cpp
979c2e572ca8b2a74569daf77aff98f9eea4a9bf
[]
no_license
suzyz/LintCode
06e964c6abd0e615fcf40365767de8d4e4e35093
d575bf0482e5f74adb7065cf6997acfa8f46f124
refs/heads/master
2021-09-26T22:08:49.362562
2018-11-03T10:17:10
2018-11-03T10:17:10
104,197,868
0
0
null
null
null
null
UTF-8
C++
false
false
1,482
cpp
#include <iostream> #include <cstdio> #include <cstring> using namespace std; class ListNode { public: int val; ListNode *next; ListNode(int val) { this->val = val; this->next = NULL; } }; class TreeNode { public: int val; TreeNode *left, *right; TreeNode(int val) { this->val = val; this->left = this->right = NULL; } }; class Solution { public: /* * @param head: The first node of linked list. * @return: a tree node */ TreeNode * sortedListToBST(ListNode * head) { if (head == NULL) return NULL; int n = 0; ListNode *cur = head, *pre; while (cur) { ++n; cur = cur->next; } int mid = n/2; cur = pre = head; for (int i = 0; i < mid; ++i) { pre = cur; cur = cur->next; } pre->next = NULL; // printf("n:%d mid:%d %d %d\n",n,mid,head->val,cur->val ); TreeNode *res = new TreeNode(cur->val); if (n > 1) { if (mid) res->left = sortedListToBST(head); if (n - mid - 1) res->right = sortedListToBST(cur->next); } return res; } }; int main(int argc, char const *argv[]) { ListNode *l = new ListNode(1); l->next = new ListNode(2); l->next->next = new ListNode(3); Solution s; s.sortedListToBST(l); return 0; }
57379267cd8d03f6cbf7c5b053a5f376bcd321de
37bad9655442cecda6ee314a08eb7e773de8e79a
/sleighcraft/src/cpp/gen/flex/slghscan.cpp
30115a45b4f18a1d11be2d926a15c0f4e3c4410d
[ "Apache-2.0" ]
permissive
Escapingbug/sleighcraft
423b5cdbd5cc9914259d47762b69154bafc2d906
4680e36ca6cc5bbdfa07bf5865988a54367e4ab2
refs/heads/master
2023-08-01T07:20:23.396481
2021-09-23T07:24:54
2021-09-23T07:24:54
407,790,457
0
0
Apache-2.0
2021-09-18T07:32:35
2021-09-18T07:32:34
null
UTF-8
C++
false
false
97,360
cpp
#line 2 "/mnt/c/Users/ding6/Code/starcross/bincraft/sleighcraft/cpp/build_test/flex/slghscan.cpp" #line 4 "/mnt/c/Users/ding6/Code/starcross/bincraft/sleighcraft/cpp/build_test/flex/slghscan.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include <inttypes.h> typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* begin standard C++ headers. */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an * integer in range [0..255] for use as an array index. */ #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); void yy_delete_buffer ( YY_BUFFER_STATE b ); void yy_flush_buffer ( YY_BUFFER_STATE b ); void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); void yypop_buffer_state ( void ); static void yyensure_buffer_stack ( void ); static void yy_load_buffer_state ( void ); static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); void *yyalloc ( yy_size_t ); void *yyrealloc ( void *, yy_size_t ); void yyfree ( void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) typedef flex_uint8_t YY_CHAR; FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr yytext static yy_state_type yy_get_previous_state ( void ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); static int yy_get_next_buffer ( void ); static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 164 #define YY_END_OF_BUFFER 165 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static const flex_int16_t yy_accept[527] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 14, 7, 8, 6, 14, 3, 13, 4, 13, 13, 13, 13, 5, 1, 58, 56, 57, 58, 50, 58, 25, 51, 52, 52, 26, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 23, 22, 20, 21, 22, 17, 19, 18, 15, 68, 66, 67, 61, 68, 61, 64, 62, 64, 59, 96, 94, 95, 96, 89, 96, 85, 88, 90, 91, 91, 88, 88, 90, 83, 84, 87, 90, 90, 71, 86, 69, 161, 159, 160, 153, 154, 161, 153, 153, 155, 156, 156, 153, 153, 153, 153, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 153, 99, 97, 164, 164, 163, 162, 7, 6, 0, 13, 13, 13, 13, 13, 1, 1, 56, 0, 55, 50, 0, 51, 0, 0, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 23, 23, 20, 0, 19, 15, 15, 66, 0, 65, 0, 64, 63, 59, 59, 94, 76, 89, 0, 0, 0, 0, 90, 90, 0, 0, 91, 75, 77, 78, 74, 90, 90, 69, 69, 159, 106, 154, 0, 101, 155, 0, 0, 156, 104, 107, 105, 108, 103, 102, 155, 155, 155, 155, 155, 155, 155, 155, 155, 0, 118, 116, 117, 119, 122, 0, 123, 155, 155, 144, 155, 155, 155, 155, 155, 155, 155, 110, 109, 112, 113, 155, 155, 155, 155, 155, 155, 100, 97, 97, 0, 163, 162, 162, 0, 13, 13, 13, 13, 0, 54, 53, 51, 41, 51, 51, 38, 51, 51, 37, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 0, 0, 0, 0, 80, 0, 82, 93, 92, 90, 90, 0, 158, 157, 133, 155, 155, 155, 155, 155, 155, 155, 155, 155, 121, 124, 120, 125, 155, 155, 155, 155, 132, 155, 155, 155, 155, 114, 115, 111, 155, 155, 155, 155, 155, 155, 2, 0, 13, 13, 13, 12, 24, 0, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 43, 51, 51, 28, 51, 51, 51, 16, 0, 60, 0, 70, 0, 79, 81, 90, 90, 98, 0, 155, 155, 146, 155, 135, 155, 155, 155, 155, 155, 155, 145, 155, 155, 155, 155, 155, 155, 155, 155, 129, 134, 155, 126, 13, 13, 9, 51, 51, 51, 51, 51, 51, 46, 51, 51, 51, 51, 51, 51, 27, 32, 51, 51, 51, 90, 90, 155, 151, 127, 141, 155, 155, 155, 155, 136, 155, 152, 155, 155, 155, 137, 155, 155, 140, 11, 10, 51, 51, 51, 51, 39, 42, 36, 45, 51, 51, 51, 35, 47, 51, 51, 90, 72, 128, 155, 155, 150, 155, 155, 155, 155, 147, 155, 130, 51, 51, 33, 30, 49, 51, 51, 51, 51, 90, 155, 155, 155, 155, 155, 155, 131, 51, 34, 51, 51, 51, 44, 90, 155, 155, 155, 155, 155, 143, 40, 29, 51, 48, 73, 155, 148, 155, 138, 142, 51, 149, 155, 51, 139, 51, 51, 31, 0 } ; static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 7, 8, 9, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 1, 32, 33, 34, 1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 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 const YY_CHAR yy_meta[65] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 4, 1, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 5, 4, 1, 1, 1, 4, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1 } ; static const flex_int16_t yy_base[564] = { 0, 0, 897, 64, 896, 128, 895, 192, 894, 256, 893, 320, 892, 0, 382, 919, 926, 916, 926, 0, 907, 926, 0, 926, 862, 876, 879, 870, 926, 909, 926, 909, 926, 905, 0, 899, 926, 0, 350, 369, 926, 862, 864, 857, 866, 856, 864, 859, 356, 861, 863, 357, 350, 345, 864, 849, 894, 926, 894, 926, 885, 926, 0, 926, 891, 926, 891, 926, 926, 887, 881, 0, 926, 837, 886, 926, 886, 926, 862, 0, 385, 926, 926, 870, 361, 393, 374, 376, 0, 926, 926, 926, 839, 836, 926, 926, 880, 926, 880, 926, 856, 0, 870, 926, 870, 0, 367, 397, 382, 853, 396, 844, 840, 374, 389, 836, 816, 423, 824, 397, 823, 391, 822, 393, 436, 818, 830, 806, 926, 864, 926, 863, 926, 862, 862, 0, 0, 0, 809, 822, 824, 806, 856, 926, 856, 852, 851, 0, 0, 0, 432, 0, 436, 812, 392, 806, 421, 815, 794, 797, 803, 809, 808, 798, 799, 804, 411, 809, 798, 792, 413, 789, 837, 926, 837, 0, 0, 835, 926, 835, 831, 830, 0, 0, 0, 831, 926, 831, 926, 0, 0, 784, 779, 781, 813, 0, 445, 0, 458, 926, 926, 926, 926, 779, 784, 823, 926, 823, 926, 0, 0, 926, 0, 448, 0, 462, 926, 926, 926, 926, 926, 926, 771, 771, 779, 422, 778, 771, 770, 772, 767, 791, 926, 926, 926, 926, 790, 789, 788, 763, 757, 0, 756, 772, 760, 750, 756, 751, 749, 926, 926, 778, 459, 753, 766, 742, 747, 743, 739, 926, 793, 926, 792, 926, 791, 926, 782, 757, 748, 738, 747, 777, 470, 0, 746, 0, 734, 731, 0, 749, 740, 0, 728, 742, 734, 726, 740, 743, 733, 727, 735, 736, 733, 732, 715, 726, 730, 756, 755, 754, 726, 926, 711, 0, 472, 0, 726, 714, 749, 474, 0, 0, 707, 712, 711, 704, 709, 705, 700, 717, 702, 926, 926, 926, 926, 451, 701, 729, 713, 0, 698, 709, 690, 696, 926, 926, 926, 691, 690, 687, 686, 691, 684, 926, 726, 699, 687, 685, 0, 926, 722, 684, 696, 691, 674, 693, 681, 673, 676, 685, 684, 669, 668, 681, 0, 680, 670, 0, 678, 681, 662, 926, 703, 926, 702, 926, 701, 926, 926, 676, 660, 926, 698, 659, 669, 0, 647, 0, 659, 651, 644, 650, 647, 648, 0, 659, 652, 661, 647, 643, 656, 641, 640, 0, 0, 654, 0, 648, 650, 0, 641, 639, 628, 639, 636, 644, 0, 625, 627, 631, 629, 624, 639, 0, 0, 623, 639, 631, 627, 626, 614, 0, 0, 0, 634, 616, 614, 647, 0, 620, 0, 621, 609, 615, 0, 613, 602, 0, 0, 0, 621, 618, 604, 603, 0, 0, 0, 0, 606, 620, 615, 0, 0, 607, 592, 598, 0, 0, 595, 603, 0, 608, 598, 607, 597, 0, 587, 0, 595, 603, 0, 0, 0, 604, 588, 600, 599, 598, 593, 586, 588, 598, 595, 577, 0, 576, 0, 590, 594, 574, 0, 572, 579, 570, 574, 518, 506, 0, 0, 0, 476, 0, 0, 474, 0, 464, 0, 0, 448, 0, 443, 461, 0, 458, 455, 0, 926, 500, 505, 510, 512, 517, 522, 527, 529, 534, 536, 541, 546, 548, 553, 558, 560, 565, 570, 572, 577, 582, 587, 589, 591, 465, 593, 595, 597, 426, 599, 404, 602, 605, 608, 611, 614, 617 } ; static const flex_int16_t yy_def[564] = { 0, 526, 1, 526, 3, 526, 5, 526, 7, 526, 9, 526, 11, 527, 528, 526, 526, 526, 526, 529, 526, 526, 530, 526, 530, 530, 530, 530, 526, 531, 526, 526, 526, 532, 533, 526, 526, 534, 526, 526, 526, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 535, 526, 526, 526, 526, 526, 536, 526, 537, 526, 526, 526, 526, 538, 526, 539, 526, 539, 540, 526, 526, 526, 526, 541, 526, 526, 526, 542, 526, 526, 526, 526, 542, 526, 526, 526, 542, 542, 526, 526, 543, 526, 526, 526, 526, 544, 526, 526, 526, 545, 526, 526, 526, 526, 526, 526, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 526, 526, 546, 526, 547, 526, 548, 526, 529, 549, 530, 530, 530, 530, 530, 531, 526, 526, 532, 526, 533, 550, 534, 526, 551, 526, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 535, 526, 526, 552, 536, 537, 526, 526, 538, 526, 553, 539, 539, 540, 526, 526, 526, 541, 554, 526, 526, 526, 542, 542, 526, 555, 526, 526, 526, 526, 526, 542, 542, 543, 526, 526, 526, 544, 556, 526, 545, 526, 557, 526, 526, 526, 526, 526, 526, 526, 545, 545, 545, 545, 545, 545, 545, 545, 545, 526, 526, 526, 526, 526, 526, 526, 526, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 526, 526, 526, 526, 545, 545, 545, 545, 545, 545, 526, 546, 526, 547, 526, 548, 526, 558, 530, 530, 530, 530, 559, 526, 551, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 560, 561, 562, 526, 526, 526, 542, 526, 555, 542, 542, 563, 526, 557, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 526, 526, 526, 526, 545, 545, 545, 545, 545, 545, 545, 545, 545, 526, 526, 526, 545, 545, 545, 545, 545, 545, 526, 558, 530, 530, 530, 530, 526, 559, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 526, 560, 526, 561, 526, 562, 526, 526, 542, 542, 526, 563, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 530, 530, 530, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 542, 542, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 530, 530, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 542, 542, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 534, 534, 534, 534, 534, 534, 534, 534, 534, 542, 545, 545, 545, 545, 545, 545, 545, 534, 534, 534, 534, 534, 534, 542, 545, 545, 545, 545, 545, 545, 534, 534, 534, 534, 542, 545, 545, 545, 545, 545, 534, 545, 545, 534, 545, 534, 534, 534, 0, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526 } ; static const flex_int16_t yy_nxt[991] = { 0, 16, 17, 18, 16, 16, 19, 20, 16, 16, 21, 21, 16, 16, 21, 21, 22, 16, 16, 16, 16, 16, 23, 16, 16, 16, 16, 16, 16, 22, 22, 16, 16, 16, 22, 24, 22, 22, 25, 22, 22, 22, 22, 22, 22, 22, 22, 26, 22, 22, 22, 22, 22, 22, 22, 22, 22, 27, 22, 22, 22, 28, 16, 16, 16, 30, 31, 32, 30, 33, 34, 35, 30, 30, 36, 36, 30, 30, 36, 30, 37, 30, 38, 39, 39, 39, 36, 40, 30, 36, 30, 30, 30, 37, 37, 36, 36, 30, 37, 41, 42, 43, 44, 45, 37, 37, 46, 37, 37, 37, 47, 37, 48, 49, 50, 37, 51, 52, 53, 37, 54, 55, 37, 37, 37, 30, 30, 30, 30, 57, 58, 59, 57, 57, 57, 60, 57, 57, 61, 61, 57, 57, 61, 57, 62, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 62, 62, 57, 57, 57, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 57, 57, 57, 65, 66, 67, 68, 69, 68, 70, 68, 68, 68, 68, 68, 68, 68, 68, 71, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 71, 71, 68, 68, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 73, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 68, 68, 68, 68, 75, 76, 77, 78, 75, 79, 80, 75, 81, 82, 82, 82, 82, 82, 82, 83, 82, 84, 85, 85, 85, 82, 82, 86, 82, 87, 75, 75, 88, 88, 89, 90, 91, 88, 88, 88, 88, 88, 88, 88, 92, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 93, 88, 88, 88, 88, 88, 94, 95, 75, 82, 97, 98, 99, 100, 97, 101, 102, 103, 104, 103, 103, 103, 103, 103, 103, 105, 103, 106, 107, 107, 107, 103, 103, 108, 109, 110, 97, 97, 105, 105, 103, 103, 111, 105, 112, 113, 114, 115, 116, 117, 118, 105, 119, 105, 105, 120, 105, 121, 105, 122, 105, 123, 124, 125, 105, 105, 105, 105, 105, 126, 97, 127, 128, 103, 132, 150, 152, 152, 152, 152, 160, 164, 166, 168, 190, 165, 196, 199, 200, 167, 201, 202, 213, 169, 161, 216, 217, 151, 310, 133, 198, 198, 198, 198, 215, 215, 215, 215, 197, 191, 219, 220, 223, 225, 214, 244, 231, 226, 224, 245, 305, 247, 275, 192, 232, 233, 241, 234, 227, 235, 228, 248, 193, 249, 242, 276, 236, 237, 238, 272, 272, 289, 250, 152, 152, 152, 152, 278, 294, 251, 279, 252, 304, 304, 295, 309, 309, 314, 239, 273, 290, 253, 254, 315, 255, 198, 198, 198, 198, 215, 215, 215, 215, 335, 336, 392, 256, 272, 272, 304, 304, 309, 309, 525, 524, 523, 522, 521, 520, 393, 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 135, 519, 135, 135, 135, 137, 137, 142, 142, 142, 142, 142, 145, 145, 145, 145, 145, 147, 518, 147, 147, 147, 149, 149, 172, 172, 172, 172, 172, 176, 176, 177, 177, 177, 177, 177, 180, 180, 180, 180, 180, 183, 183, 185, 185, 185, 185, 185, 189, 517, 189, 189, 189, 195, 195, 205, 205, 205, 205, 205, 209, 516, 209, 209, 209, 212, 212, 260, 260, 260, 260, 260, 262, 262, 262, 262, 262, 264, 264, 264, 264, 264, 266, 266, 271, 271, 297, 297, 298, 298, 299, 299, 308, 308, 344, 344, 344, 350, 350, 350, 372, 372, 372, 374, 374, 374, 376, 376, 376, 382, 382, 382, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 381, 429, 428, 375, 373, 371, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 349, 409, 408, 407, 343, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 391, 390, 389, 388, 387, 386, 385, 384, 383, 381, 380, 379, 378, 377, 375, 373, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 349, 348, 347, 346, 345, 343, 265, 263, 261, 342, 341, 340, 339, 338, 337, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 313, 312, 311, 207, 206, 307, 306, 303, 302, 301, 300, 187, 186, 180, 181, 179, 178, 174, 173, 296, 293, 292, 291, 288, 287, 286, 285, 284, 283, 282, 281, 280, 277, 274, 145, 146, 144, 143, 270, 269, 268, 267, 134, 265, 263, 261, 259, 258, 257, 246, 243, 240, 230, 229, 222, 221, 218, 211, 210, 208, 207, 206, 204, 203, 194, 188, 187, 186, 184, 182, 181, 179, 178, 175, 174, 173, 171, 170, 163, 162, 159, 158, 157, 156, 155, 154, 153, 148, 146, 144, 143, 141, 140, 139, 138, 136, 134, 526, 129, 96, 74, 64, 56, 29, 15, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526 } ; static const flex_int16_t yy_chk[991] = { 0, 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, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 14, 38, 39, 39, 39, 39, 48, 51, 52, 53, 80, 51, 84, 86, 86, 52, 87, 87, 106, 53, 48, 108, 108, 38, 557, 14, 85, 85, 85, 85, 107, 107, 107, 107, 84, 80, 110, 110, 113, 114, 106, 121, 117, 114, 113, 121, 555, 123, 154, 80, 117, 117, 119, 117, 114, 117, 114, 123, 80, 124, 119, 154, 117, 117, 117, 150, 150, 166, 124, 152, 152, 152, 152, 156, 170, 124, 156, 124, 196, 196, 170, 213, 213, 225, 117, 551, 166, 124, 124, 225, 124, 198, 198, 198, 198, 215, 215, 215, 215, 252, 252, 325, 124, 272, 272, 304, 304, 309, 309, 524, 523, 521, 520, 518, 515, 325, 527, 527, 527, 527, 527, 528, 528, 528, 528, 528, 529, 513, 529, 529, 529, 530, 530, 531, 531, 531, 531, 531, 532, 532, 532, 532, 532, 533, 510, 533, 533, 533, 534, 534, 535, 535, 535, 535, 535, 536, 536, 537, 537, 537, 537, 537, 538, 538, 538, 538, 538, 539, 539, 540, 540, 540, 540, 540, 541, 506, 541, 541, 541, 542, 542, 543, 543, 543, 543, 543, 544, 505, 544, 544, 544, 545, 545, 546, 546, 546, 546, 546, 547, 547, 547, 547, 547, 548, 548, 548, 548, 548, 549, 549, 550, 550, 552, 552, 553, 553, 554, 554, 556, 556, 558, 558, 558, 559, 559, 559, 560, 560, 560, 561, 561, 561, 562, 562, 562, 563, 563, 563, 504, 503, 502, 501, 499, 498, 497, 495, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 479, 478, 476, 474, 473, 472, 471, 469, 468, 465, 464, 463, 460, 459, 458, 453, 452, 451, 450, 446, 445, 443, 442, 441, 439, 437, 436, 435, 434, 430, 429, 428, 427, 426, 425, 422, 421, 420, 419, 418, 417, 415, 414, 413, 412, 411, 410, 408, 407, 405, 402, 401, 400, 399, 398, 397, 396, 395, 393, 392, 391, 390, 389, 388, 386, 384, 383, 382, 380, 379, 376, 374, 372, 370, 369, 368, 366, 365, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 347, 346, 345, 344, 342, 341, 340, 339, 338, 337, 333, 332, 331, 330, 328, 327, 326, 320, 319, 318, 317, 316, 315, 314, 313, 312, 308, 307, 306, 302, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 280, 279, 277, 276, 274, 271, 270, 269, 268, 267, 266, 264, 262, 260, 258, 257, 256, 255, 254, 253, 251, 248, 247, 246, 245, 244, 243, 242, 240, 239, 238, 237, 236, 231, 230, 229, 228, 227, 226, 224, 223, 222, 207, 205, 204, 203, 194, 193, 192, 191, 187, 185, 181, 180, 179, 177, 174, 172, 171, 169, 168, 167, 165, 164, 163, 162, 161, 160, 159, 158, 157, 155, 153, 146, 145, 144, 142, 141, 140, 139, 138, 134, 133, 131, 129, 127, 126, 125, 122, 120, 118, 116, 115, 112, 111, 109, 104, 102, 100, 98, 96, 93, 92, 83, 78, 76, 74, 73, 70, 69, 66, 64, 60, 58, 56, 55, 54, 50, 49, 47, 46, 45, 44, 43, 42, 41, 35, 33, 31, 29, 27, 26, 25, 24, 20, 17, 15, 12, 10, 8, 6, 4, 2, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "./slghscan.l" /* ### * IP: GHIDRA * NOTE: flex skeletons are NOT bound by flex's BSD license * * 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. */ #line 18 "./slghscan.l" #include "slgh_compile.hh" #include "slghparse.hh" #define yywrap() 1 #define YY_SKIP_YYWRAP /* If we are building don't include unistd.h */ /* flex provides us with this macro for turning it off */ #ifdef _WIN32 #define YY_NO_UNISTD_H static int isatty (int fildes) { return 0; } #endif struct FileStreamState { YY_BUFFER_STATE lastbuffer; // Last lex buffer corresponding to the stream FILE *file; // The NEW file stream }; extern SleighCompile *slgh; int4 last_preproc; // lex state before last preprocessing erasure int4 actionon; // whether '&' '|' and '^' are treated as actionon in pattern section int4 withsection = 0; // whether we are between the 'with' keyword and its open brace '{' vector<FileStreamState> filebuffers; vector<int4> ifstack; int4 negative_if = -1; void preproc_error(const string &err) { slgh->reportError((const Location *)0, err); cerr << "Terminating due to error in preprocessing" << endl; exit(1); } void check_to_endofline(istream &s) { // Make sure there is nothing to the end of the line s >> ws; if (!s.eof()) if (s.peek() != '#') preproc_error("Extra characters in preprocessor directive"); } string read_identifier(istream &s) { // Read a proper identifier from the stream s >> ws; // Skip any whitespace string res; while(!s.eof()) { char tok = s.peek(); if (isalnum(tok) || (tok == '_')) { s >> tok; res += tok; } else break; } return res; } void preprocess_string(istream &s,string &res) { // Grab string surrounded by double quotes from stream or call preprocess_error int4 val; s >> ws; // Skip any whitespace val = s.get(); if (val != '\"') preproc_error("Expecting double quoted string"); val = s.get(); while((val != '\"')&&(val>=0)) { res += (char)val; val = s.get(); } if (val != '\"') preproc_error("Missing terminating double quote"); } extern int4 preprocess_if(istream &s); // Forward declaration for recursion int4 read_defined_operator(istream &s) { // We have seen a -defined- keyword in an if or elif // Read macro name used as input, return 1 if it is defined char tok = ' '; string macroname; s >> ws >> tok; if (tok != '(') preproc_error("Badly formed \"defined\" operator"); macroname = read_identifier(s); int4 res = slgh->getPreprocValue(macroname,macroname) ? 1 : 0; s >> ws >> tok; if (tok != ')') preproc_error("Badly formed \"defined\" operator"); return res; } int4 read_boolean_clause(istream &s) { // We have seen an if or elif // return 1 if condition is true or else 0 s >> ws; if (s.peek()=='(') { // Parenthetical expression spawns recursion int4 val = s.get(); int4 res = preprocess_if(s); s >> ws; val = s.get(); if (val != ')') preproc_error("Unbalanced parentheses"); return res; } // Otherwise we must have a normal comparison operator string lhs,rhs,comp; if (s.peek()=='\"') // Read left-hand side string preprocess_string(s,lhs); else { lhs = read_identifier(s); if (lhs == "defined") return read_defined_operator(s); if (!slgh->getPreprocValue(lhs,lhs)) preproc_error("Could not find preprocessor macro "+lhs); } char tok; s >> tok; // Read comparison symbol comp += tok; s >> tok; comp += tok; s >> ws; if (s.peek()=='\"') // Read right-hand side string preprocess_string(s,rhs); else { rhs = read_identifier(s); if (!slgh->getPreprocValue(rhs,rhs)) preproc_error("Could not find preprocessor macro "+rhs); } if (comp == "==") return (lhs == rhs) ? 1 : 0; else if (comp=="!=") return (lhs != rhs) ? 1 : 0; else preproc_error("Syntax error in condition"); return 0; } int4 preprocess_if(istream &s) { int4 res = read_boolean_clause(s); s >> ws; while((!s.eof())&&(s.peek()!=')')) { string boolop; char tok; s >> tok; boolop += tok; s >> tok; boolop += tok; int4 res2 = read_boolean_clause(s); if (boolop == "&&") res = res & res2; else if (boolop == "||") res = res | res2; else if (boolop == "^^") res = res ^ res2; else preproc_error("Syntax error in expression"); s >> ws; } return res; } void expand_preprocmacros(string &str) { string::size_type pos; string::size_type lastpos = 0; pos = str.find("$(",lastpos); if (pos == string::npos) return; string res; for(;;) { if (pos == string::npos) { res += str.substr(lastpos); str = res; return; } else { res += str.substr(lastpos,(pos-lastpos)); string::size_type endpos = str.find(')',pos+2); if (endpos == string::npos) { preproc_error("Unterminated macro in string"); break; } string macro = str.substr(pos+2, endpos - (pos+2)); string value; if (!slgh->getPreprocValue(macro,value)) { preproc_error("Unknown preprocessing macro "+macro); break; } res += value; lastpos = endpos + 1; } pos = str.find("$(",lastpos); } } int4 preprocess(int4 cur_state,int4 blank_state) { string str(yytext); string::size_type pos = str.find('#'); if (pos != string::npos) str.erase(pos); istringstream s(str); string type; if (cur_state != blank_state) last_preproc = cur_state; s.get(); // Skip the preprocessor marker s >> type; if (type == "include") { if (negative_if == -1) { // Not in the middle of a false if clause filebuffers.push_back(FileStreamState()); // Save state of current file filebuffers.back().lastbuffer = YY_CURRENT_BUFFER; filebuffers.back().file = (FILE *)0; s >> ws; string fname; preprocess_string(s,fname); expand_preprocmacros(fname); slgh->parseFromNewFile(fname); fname = slgh->grabCurrentFilePath(); yyin = fopen(fname.c_str(),"r"); if (yyin == (FILE *)0) preproc_error("Could not open included file "+fname); filebuffers.back().file = yyin; yy_switch_to_buffer( yy_create_buffer(yyin, YY_BUF_SIZE) ); check_to_endofline(s); } } else if (type == "define") { if (negative_if == -1) { string varname; string value; varname = read_identifier(s); // Get name of variable being defined s >> ws; if (s.peek() == '\"') preprocess_string(s,value); else value = read_identifier(s); if (varname.size()==0) preproc_error("Error in preprocessor definition"); slgh->setPreprocValue(varname,value); check_to_endofline(s); } } else if (type == "undef") { if (negative_if == -1) { string varname; varname = read_identifier(s); // Name of variable to undefine if (varname.size()==0) preproc_error("Error in preprocessor undef"); slgh->undefinePreprocValue(varname); check_to_endofline(s); } } else if (type=="ifdef") { string varname; varname = read_identifier(s); if (varname.size()==0) preproc_error("Error in preprocessor ifdef"); string value; int4 truth = (slgh->getPreprocValue(varname,value)) ? 1 : 0; ifstack.push_back(truth); check_to_endofline(s); } else if (type=="ifndef") { string varname; varname = read_identifier(s); if (varname.size()==0) preproc_error("Error in preprocessor ifndef"); string value; int4 truth = (slgh->getPreprocValue(varname,value)) ? 0 : 1; // flipped from ifdef ifstack.push_back(truth); check_to_endofline(s); } else if (type=="if") { int4 truth = preprocess_if(s); if (!s.eof()) preproc_error("Unbalanced parentheses"); ifstack.push_back(truth); } else if (type=="elif") { if (ifstack.empty()) preproc_error("elif without preceding if"); if ((ifstack.back()&2)!=0) // We have already seen an else clause preproc_error("elif follows else"); if ((ifstack.back()&4)!=0) // We have already seen a true elif clause ifstack.back() = 4; // don't include any other elif clause else if ((ifstack.back()&1)!=0) // Last clause was a true if ifstack.back() = 4; // don't include this elif else { int4 truth = preprocess_if(s); if (!s.eof()) preproc_error("Unbalanced parentheses"); if (truth==0) ifstack.back() = 0; else ifstack.back() = 5; } } else if (type=="endif") { if (ifstack.empty()) preproc_error("preprocessing endif without matching if"); ifstack.pop_back(); check_to_endofline(s); } else if (type=="else") { if (ifstack.empty()) preproc_error("preprocessing else without matching if"); if ((ifstack.back()&2)!=0) preproc_error("second else for one if"); if ((ifstack.back()&4)!=0) // Seen a true elif clause before ifstack.back() = 6; else if (ifstack.back()==0) ifstack.back() = 3; else ifstack.back() = 2; check_to_endofline(s); } else preproc_error("Unknown preprocessing directive: "+type); if (negative_if >= 0) { // We were in a false state if (negative_if+1 < ifstack.size()) return blank_state; // false state is still deep in stack else // false state is popped off or is current and changed negative_if = -1; } if (ifstack.empty()) return last_preproc; if ((ifstack.back()&1)==0) { negative_if = ifstack.size()-1; return blank_state; } return last_preproc; } void preproc_macroexpand(void) { filebuffers.push_back(FileStreamState()); filebuffers.back().lastbuffer = YY_CURRENT_BUFFER; filebuffers.back().file = (FILE *)0; string macro(yytext); macro.erase(0,2); macro.erase(macro.size()-1,1); string value; if (!slgh->getPreprocValue(macro,value)) preproc_error("Unknown preprocessing macro "+macro); yy_switch_to_buffer( yy_scan_string( value.c_str() ) ); slgh->parsePreprocMacro(); } int4 find_symbol(void) { string * newstring = new string(yytext); SleighSymbol *sym = slgh->findSymbol(*newstring); if (sym == (SleighSymbol *)0) { yylval.str = newstring; return STRING; } delete newstring; switch(sym->getType()) { case SleighSymbol::section_symbol: yylval.sectionsym = (SectionSymbol *)sym; return SECTIONSYM; case SleighSymbol::space_symbol: yylval.spacesym = (SpaceSymbol *)sym; return SPACESYM; case SleighSymbol::token_symbol: yylval.tokensym = (TokenSymbol *)sym; return TOKENSYM; case SleighSymbol::userop_symbol: yylval.useropsym = (UserOpSymbol *)sym; return USEROPSYM; case SleighSymbol::value_symbol: yylval.valuesym = (ValueSymbol *)sym; return VALUESYM; case SleighSymbol::valuemap_symbol: yylval.valuemapsym = (ValueMapSymbol *)sym; return VALUEMAPSYM; case SleighSymbol::name_symbol: yylval.namesym = (NameSymbol *)sym; return NAMESYM; case SleighSymbol::varnode_symbol: yylval.varsym = (VarnodeSymbol *)sym; return VARSYM; case SleighSymbol::bitrange_symbol: yylval.bitsym = (BitrangeSymbol *)sym; return BITSYM; case SleighSymbol::varnodelist_symbol: yylval.varlistsym = (VarnodeListSymbol *)sym; return VARLISTSYM; case SleighSymbol::operand_symbol: yylval.operandsym = (OperandSymbol *)sym; return OPERANDSYM; case SleighSymbol::start_symbol: yylval.startsym = (StartSymbol *)sym; return STARTSYM; case SleighSymbol::end_symbol: yylval.endsym = (EndSymbol *)sym; return ENDSYM; case SleighSymbol::subtable_symbol: yylval.subtablesym = (SubtableSymbol *)sym; return SUBTABLESYM; case SleighSymbol::macro_symbol: yylval.macrosym = (MacroSymbol *)sym; return MACROSYM; case SleighSymbol::label_symbol: yylval.labelsym = (LabelSymbol *)sym; return LABELSYM; case SleighSymbol::epsilon_symbol: yylval.specsym = (SpecificSymbol *)sym; return SPECSYM; case SleighSymbol::context_symbol: yylval.contextsym = (ContextSymbol *)sym; return CONTEXTSYM; case SleighSymbol::dummy_symbol: break; } return -1; // Should never reach here } int4 scan_number(char *numtext,YYSTYPE *lval,bool signednum) { uintb val; if (numtext[0] == '0' && numtext[1] == 'b') { val = 0; numtext += 2; while ((*numtext) != 0) { val <<= 1; if (*numtext == '1') { val |= 1; } ++numtext; } } else { istringstream s(numtext); s.unsetf(ios::dec | ios::hex | ios::oct); s >> val; if (!s) return BADINTEGER; } if (signednum) { lval->big = new intb(val); return INTB; } lval->i = new uintb(val); return INTEGER; } #line 1321 "/mnt/c/Users/ding6/Code/starcross/bincraft/sleighcraft/cpp/build_test/flex/slghscan.cpp" #line 1323 "/mnt/c/Users/ding6/Code/starcross/bincraft/sleighcraft/cpp/build_test/flex/slghscan.cpp" #define INITIAL 0 #define defblock 1 #define macroblock 2 #define print 3 #define pattern 4 #define sem 5 #define preproc 6 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include <unistd.h> #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy ( void ); int yyget_debug ( void ); void yyset_debug ( int debug_flag ); YY_EXTRA_TYPE yyget_extra ( void ); void yyset_extra ( YY_EXTRA_TYPE user_defined ); FILE *yyget_in ( void ); void yyset_in ( FILE * _in_str ); FILE *yyget_out ( void ); void yyset_out ( FILE * _out_str ); int yyget_leng ( void ); char *yyget_text ( void ); int yyget_lineno ( void ); void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap ( void ); #else extern int yywrap ( void ); #endif #endif #ifndef YY_NO_UNPUT static void yyunput ( int c, char *buf_ptr ); #endif #ifndef yytext_ptr static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput ( void ); #else static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ if ( yyleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_load_buffer_state( ); } { #line 490 "./slghscan.l" #line 1552 "/mnt/c/Users/ding6/Code/starcross/bincraft/sleighcraft/cpp/build_test/flex/slghscan.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 527 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 926 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 492 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(INITIAL,preproc) ); } YY_BREAK case 2: YY_RULE_SETUP #line 493 "./slghscan.l" { preproc_macroexpand(); } YY_BREAK case 3: YY_RULE_SETUP #line 494 "./slghscan.l" { yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 4: YY_RULE_SETUP #line 495 "./slghscan.l" { BEGIN(print); slgh->calcContextLayout(); yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 5: YY_RULE_SETUP #line 496 "./slghscan.l" { BEGIN(sem); yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 6: YY_RULE_SETUP #line 497 "./slghscan.l" YY_BREAK case 7: YY_RULE_SETUP #line 498 "./slghscan.l" YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 499 "./slghscan.l" { slgh->nextLine(); } YY_BREAK case 9: YY_RULE_SETUP #line 500 "./slghscan.l" { BEGIN(macroblock); return MACRO_KEY; } YY_BREAK case 10: YY_RULE_SETUP #line 501 "./slghscan.l" { BEGIN(defblock); return DEFINE_KEY; } YY_BREAK case 11: YY_RULE_SETUP #line 502 "./slghscan.l" { BEGIN(defblock); slgh->calcContextLayout(); return ATTACH_KEY; } YY_BREAK case 12: YY_RULE_SETUP #line 503 "./slghscan.l" { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH_KEY; } YY_BREAK case 13: YY_RULE_SETUP #line 504 "./slghscan.l" { return find_symbol(); } YY_BREAK case 14: YY_RULE_SETUP #line 505 "./slghscan.l" { return yytext[0]; } YY_BREAK case 15: /* rule 15 can match eol */ YY_RULE_SETUP #line 507 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(macroblock,preproc) ); } YY_BREAK case 16: YY_RULE_SETUP #line 508 "./slghscan.l" { preproc_macroexpand(); } YY_BREAK case 17: YY_RULE_SETUP #line 509 "./slghscan.l" { yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 18: YY_RULE_SETUP #line 510 "./slghscan.l" { BEGIN(sem); return yytext[0]; } YY_BREAK case 19: YY_RULE_SETUP #line 511 "./slghscan.l" { yylval.str = new string(yytext); return STRING; } YY_BREAK case 20: YY_RULE_SETUP #line 512 "./slghscan.l" YY_BREAK case 21: /* rule 21 can match eol */ YY_RULE_SETUP #line 513 "./slghscan.l" { slgh->nextLine(); } YY_BREAK case 22: YY_RULE_SETUP #line 514 "./slghscan.l" { return yytext[0]; } YY_BREAK case 23: /* rule 23 can match eol */ YY_RULE_SETUP #line 516 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(defblock,preproc) ); } YY_BREAK case 24: YY_RULE_SETUP #line 517 "./slghscan.l" { preproc_macroexpand(); } YY_BREAK case 25: YY_RULE_SETUP #line 518 "./slghscan.l" { yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 26: YY_RULE_SETUP #line 519 "./slghscan.l" { BEGIN(INITIAL); yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 27: YY_RULE_SETUP #line 520 "./slghscan.l" { return SPACE_KEY; } YY_BREAK case 28: YY_RULE_SETUP #line 521 "./slghscan.l" { return TYPE_KEY; } YY_BREAK case 29: YY_RULE_SETUP #line 522 "./slghscan.l" { return RAM_KEY; } YY_BREAK case 30: YY_RULE_SETUP #line 523 "./slghscan.l" { return DEFAULT_KEY; } YY_BREAK case 31: YY_RULE_SETUP #line 524 "./slghscan.l" { return REGISTER_KEY; } YY_BREAK case 32: YY_RULE_SETUP #line 525 "./slghscan.l" { return TOKEN_KEY; } YY_BREAK case 33: YY_RULE_SETUP #line 526 "./slghscan.l" { return CONTEXT_KEY; } YY_BREAK case 34: YY_RULE_SETUP #line 527 "./slghscan.l" { return BITRANGE_KEY; } YY_BREAK case 35: YY_RULE_SETUP #line 528 "./slghscan.l" { return SIGNED_KEY; } YY_BREAK case 36: YY_RULE_SETUP #line 529 "./slghscan.l" { return NOFLOW_KEY; } YY_BREAK case 37: YY_RULE_SETUP #line 530 "./slghscan.l" { return HEX_KEY; } YY_BREAK case 38: YY_RULE_SETUP #line 531 "./slghscan.l" { return DEC_KEY; } YY_BREAK case 39: YY_RULE_SETUP #line 532 "./slghscan.l" { return ENDIAN_KEY; } YY_BREAK case 40: YY_RULE_SETUP #line 533 "./slghscan.l" { return ALIGN_KEY; } YY_BREAK case 41: YY_RULE_SETUP #line 534 "./slghscan.l" { return BIG_KEY; } YY_BREAK case 42: YY_RULE_SETUP #line 535 "./slghscan.l" { return LITTLE_KEY; } YY_BREAK case 43: YY_RULE_SETUP #line 536 "./slghscan.l" { return SIZE_KEY; } YY_BREAK case 44: YY_RULE_SETUP #line 537 "./slghscan.l" { return WORDSIZE_KEY; } YY_BREAK case 45: YY_RULE_SETUP #line 538 "./slghscan.l" { return OFFSET_KEY; } YY_BREAK case 46: YY_RULE_SETUP #line 539 "./slghscan.l" { return NAMES_KEY; } YY_BREAK case 47: YY_RULE_SETUP #line 540 "./slghscan.l" { return VALUES_KEY; } YY_BREAK case 48: YY_RULE_SETUP #line 541 "./slghscan.l" { return VARIABLES_KEY; } YY_BREAK case 49: YY_RULE_SETUP #line 542 "./slghscan.l" { return PCODEOP_KEY; } YY_BREAK case 50: YY_RULE_SETUP #line 543 "./slghscan.l" YY_BREAK case 51: YY_RULE_SETUP #line 544 "./slghscan.l" { return find_symbol(); } YY_BREAK case 52: YY_RULE_SETUP #line 545 "./slghscan.l" { return scan_number(yytext,&yylval,false); } YY_BREAK case 53: YY_RULE_SETUP #line 546 "./slghscan.l" { return scan_number(yytext,&yylval,false); } YY_BREAK case 54: YY_RULE_SETUP #line 547 "./slghscan.l" { return scan_number(yytext,&yylval,false); } YY_BREAK case 55: /* rule 55 can match eol */ YY_RULE_SETUP #line 548 "./slghscan.l" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; } YY_BREAK case 56: YY_RULE_SETUP #line 549 "./slghscan.l" YY_BREAK case 57: /* rule 57 can match eol */ YY_RULE_SETUP #line 550 "./slghscan.l" { slgh->nextLine(); } YY_BREAK case 58: YY_RULE_SETUP #line 551 "./slghscan.l" { return yytext[0]; } YY_BREAK case 59: /* rule 59 can match eol */ YY_RULE_SETUP #line 554 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(print,preproc) ); } YY_BREAK case 60: YY_RULE_SETUP #line 555 "./slghscan.l" { preproc_macroexpand(); } YY_BREAK case 61: YY_RULE_SETUP #line 556 "./slghscan.l" { yylval.ch = yytext[0]; return CHAR; } YY_BREAK case 62: YY_RULE_SETUP #line 557 "./slghscan.l" { yylval.ch = '^'; return '^'; } YY_BREAK case 63: YY_RULE_SETUP #line 558 "./slghscan.l" { BEGIN(pattern); actionon=0; return IS_KEY; } YY_BREAK case 64: YY_RULE_SETUP #line 559 "./slghscan.l" { yylval.str = new string(yytext); return SYMBOLSTRING; } YY_BREAK case 65: /* rule 65 can match eol */ YY_RULE_SETUP #line 560 "./slghscan.l" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; } YY_BREAK case 66: YY_RULE_SETUP #line 561 "./slghscan.l" { yylval.ch = ' '; return ' '; } YY_BREAK case 67: /* rule 67 can match eol */ YY_RULE_SETUP #line 562 "./slghscan.l" { slgh->nextLine(); return ' '; } YY_BREAK case 68: YY_RULE_SETUP #line 563 "./slghscan.l" { return yytext[0]; } YY_BREAK case 69: /* rule 69 can match eol */ YY_RULE_SETUP #line 565 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(pattern,preproc) ); } YY_BREAK case 70: YY_RULE_SETUP #line 566 "./slghscan.l" { preproc_macroexpand(); } YY_BREAK case 71: YY_RULE_SETUP #line 567 "./slghscan.l" { BEGIN((withsection==1) ? INITIAL:sem); withsection=0; yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 72: YY_RULE_SETUP #line 568 "./slghscan.l" { BEGIN(INITIAL); return OP_UNIMPL; } YY_BREAK case 73: YY_RULE_SETUP #line 569 "./slghscan.l" { return GLOBALSET_KEY; } YY_BREAK case 74: YY_RULE_SETUP #line 570 "./slghscan.l" { return OP_RIGHT; } YY_BREAK case 75: YY_RULE_SETUP #line 571 "./slghscan.l" { return OP_LEFT; } YY_BREAK case 76: YY_RULE_SETUP #line 572 "./slghscan.l" { return OP_NOTEQUAL; } YY_BREAK case 77: YY_RULE_SETUP #line 573 "./slghscan.l" { return OP_LESSEQUAL; } YY_BREAK case 78: YY_RULE_SETUP #line 574 "./slghscan.l" { return OP_GREATEQUAL; } YY_BREAK case 79: YY_RULE_SETUP #line 575 "./slghscan.l" { return OP_AND; } YY_BREAK case 80: YY_RULE_SETUP #line 576 "./slghscan.l" { return OP_OR; } YY_BREAK case 81: YY_RULE_SETUP #line 577 "./slghscan.l" { return OP_XOR; } YY_BREAK case 82: YY_RULE_SETUP #line 578 "./slghscan.l" { return ELLIPSIS_KEY; } YY_BREAK case 83: YY_RULE_SETUP #line 579 "./slghscan.l" { actionon = 1; yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 84: YY_RULE_SETUP #line 580 "./slghscan.l" { actionon = 0; yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 85: YY_RULE_SETUP #line 581 "./slghscan.l" { yylval.ch = yytext[0]; return (actionon==0) ? yytext[0] : OP_AND; } YY_BREAK case 86: YY_RULE_SETUP #line 582 "./slghscan.l" { yylval.ch = yytext[0]; return (actionon==0) ? yytext[0] : OP_OR; } YY_BREAK case 87: YY_RULE_SETUP #line 583 "./slghscan.l" { return OP_XOR; } YY_BREAK case 88: YY_RULE_SETUP #line 584 "./slghscan.l" { yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 89: YY_RULE_SETUP #line 585 "./slghscan.l" YY_BREAK case 90: YY_RULE_SETUP #line 586 "./slghscan.l" { return find_symbol(); } YY_BREAK case 91: YY_RULE_SETUP #line 587 "./slghscan.l" { return scan_number(yytext,&yylval,true); } YY_BREAK case 92: YY_RULE_SETUP #line 588 "./slghscan.l" { return scan_number(yytext,&yylval,true); } YY_BREAK case 93: YY_RULE_SETUP #line 589 "./slghscan.l" { return scan_number(yytext,&yylval,true); } YY_BREAK case 94: YY_RULE_SETUP #line 590 "./slghscan.l" YY_BREAK case 95: /* rule 95 can match eol */ YY_RULE_SETUP #line 591 "./slghscan.l" { slgh->nextLine(); } YY_BREAK case 96: YY_RULE_SETUP #line 592 "./slghscan.l" { return yytext[0]; } YY_BREAK case 97: /* rule 97 can match eol */ YY_RULE_SETUP #line 594 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(sem,preproc) ); } YY_BREAK case 98: YY_RULE_SETUP #line 595 "./slghscan.l" { preproc_macroexpand(); } YY_BREAK case 99: YY_RULE_SETUP #line 596 "./slghscan.l" { BEGIN(INITIAL); yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 100: YY_RULE_SETUP #line 597 "./slghscan.l" { return OP_BOOL_OR; } YY_BREAK case 101: YY_RULE_SETUP #line 598 "./slghscan.l" { return OP_BOOL_AND; } YY_BREAK case 102: YY_RULE_SETUP #line 599 "./slghscan.l" { return OP_BOOL_XOR; } YY_BREAK case 103: YY_RULE_SETUP #line 600 "./slghscan.l" { return OP_RIGHT; } YY_BREAK case 104: YY_RULE_SETUP #line 601 "./slghscan.l" { return OP_LEFT; } YY_BREAK case 105: YY_RULE_SETUP #line 602 "./slghscan.l" { return OP_EQUAL; } YY_BREAK case 106: YY_RULE_SETUP #line 603 "./slghscan.l" { return OP_NOTEQUAL; } YY_BREAK case 107: YY_RULE_SETUP #line 604 "./slghscan.l" { return OP_LESSEQUAL; } YY_BREAK case 108: YY_RULE_SETUP #line 605 "./slghscan.l" { return OP_GREATEQUAL; } YY_BREAK case 109: YY_RULE_SETUP #line 606 "./slghscan.l" { return OP_SDIV; } YY_BREAK case 110: YY_RULE_SETUP #line 607 "./slghscan.l" { return OP_SREM; } YY_BREAK case 111: YY_RULE_SETUP #line 608 "./slghscan.l" { return OP_SRIGHT; } YY_BREAK case 112: YY_RULE_SETUP #line 609 "./slghscan.l" { return OP_SLESS; } YY_BREAK case 113: YY_RULE_SETUP #line 610 "./slghscan.l" { return OP_SGREAT; } YY_BREAK case 114: YY_RULE_SETUP #line 611 "./slghscan.l" { return OP_SLESSEQUAL; } YY_BREAK case 115: YY_RULE_SETUP #line 612 "./slghscan.l" { return OP_SGREATEQUAL; } YY_BREAK case 116: YY_RULE_SETUP #line 613 "./slghscan.l" { return OP_FADD; } YY_BREAK case 117: YY_RULE_SETUP #line 614 "./slghscan.l" { return OP_FSUB; } YY_BREAK case 118: YY_RULE_SETUP #line 615 "./slghscan.l" { return OP_FMULT; } YY_BREAK case 119: YY_RULE_SETUP #line 616 "./slghscan.l" { return OP_FDIV; } YY_BREAK case 120: YY_RULE_SETUP #line 617 "./slghscan.l" { return OP_FEQUAL; } YY_BREAK case 121: YY_RULE_SETUP #line 618 "./slghscan.l" { return OP_FNOTEQUAL; } YY_BREAK case 122: YY_RULE_SETUP #line 619 "./slghscan.l" { return OP_FLESS; } YY_BREAK case 123: YY_RULE_SETUP #line 620 "./slghscan.l" { return OP_FGREAT; } YY_BREAK case 124: YY_RULE_SETUP #line 621 "./slghscan.l" { return OP_FLESSEQUAL; } YY_BREAK case 125: YY_RULE_SETUP #line 622 "./slghscan.l" { return OP_FGREATEQUAL; } YY_BREAK case 126: YY_RULE_SETUP #line 623 "./slghscan.l" { return OP_ZEXT; } YY_BREAK case 127: YY_RULE_SETUP #line 624 "./slghscan.l" { return OP_CARRY; } YY_BREAK case 128: YY_RULE_SETUP #line 625 "./slghscan.l" { return OP_BORROW; } YY_BREAK case 129: YY_RULE_SETUP #line 626 "./slghscan.l" { return OP_SEXT; } YY_BREAK case 130: YY_RULE_SETUP #line 627 "./slghscan.l" { return OP_SCARRY; } YY_BREAK case 131: YY_RULE_SETUP #line 628 "./slghscan.l" { return OP_SBORROW; } YY_BREAK case 132: YY_RULE_SETUP #line 629 "./slghscan.l" { return OP_NAN; } YY_BREAK case 133: YY_RULE_SETUP #line 630 "./slghscan.l" { return OP_ABS; } YY_BREAK case 134: YY_RULE_SETUP #line 631 "./slghscan.l" { return OP_SQRT; } YY_BREAK case 135: YY_RULE_SETUP #line 632 "./slghscan.l" { return OP_CEIL; } YY_BREAK case 136: YY_RULE_SETUP #line 633 "./slghscan.l" { return OP_FLOOR; } YY_BREAK case 137: YY_RULE_SETUP #line 634 "./slghscan.l" { return OP_ROUND; } YY_BREAK case 138: YY_RULE_SETUP #line 635 "./slghscan.l" { return OP_INT2FLOAT; } YY_BREAK case 139: YY_RULE_SETUP #line 636 "./slghscan.l" { return OP_FLOAT2FLOAT; } YY_BREAK case 140: YY_RULE_SETUP #line 637 "./slghscan.l" { return OP_TRUNC; } YY_BREAK case 141: YY_RULE_SETUP #line 638 "./slghscan.l" { return OP_CPOOLREF; } YY_BREAK case 142: YY_RULE_SETUP #line 639 "./slghscan.l" { return OP_NEW; } YY_BREAK case 143: YY_RULE_SETUP #line 640 "./slghscan.l" { return OP_POPCOUNT; } YY_BREAK case 144: YY_RULE_SETUP #line 641 "./slghscan.l" { return IF_KEY; } YY_BREAK case 145: YY_RULE_SETUP #line 642 "./slghscan.l" { return GOTO_KEY; } YY_BREAK case 146: YY_RULE_SETUP #line 643 "./slghscan.l" { return CALL_KEY; } YY_BREAK case 147: YY_RULE_SETUP #line 644 "./slghscan.l" { return RETURN_KEY; } YY_BREAK case 148: YY_RULE_SETUP #line 645 "./slghscan.l" { return DELAYSLOT_KEY; } YY_BREAK case 149: YY_RULE_SETUP #line 646 "./slghscan.l" { return CROSSBUILD_KEY; } YY_BREAK case 150: YY_RULE_SETUP #line 647 "./slghscan.l" { return EXPORT_KEY; } YY_BREAK case 151: YY_RULE_SETUP #line 648 "./slghscan.l" { return BUILD_KEY; } YY_BREAK case 152: YY_RULE_SETUP #line 649 "./slghscan.l" { return LOCAL_KEY; } YY_BREAK case 153: YY_RULE_SETUP #line 650 "./slghscan.l" { yylval.ch = yytext[0]; return yytext[0]; } YY_BREAK case 154: YY_RULE_SETUP #line 651 "./slghscan.l" YY_BREAK case 155: YY_RULE_SETUP #line 652 "./slghscan.l" { return find_symbol(); } YY_BREAK case 156: YY_RULE_SETUP #line 653 "./slghscan.l" { return scan_number(yytext,&yylval,false); } YY_BREAK case 157: YY_RULE_SETUP #line 654 "./slghscan.l" { return scan_number(yytext,&yylval,false); } YY_BREAK case 158: YY_RULE_SETUP #line 655 "./slghscan.l" { return scan_number(yytext,&yylval,false); } YY_BREAK case 159: YY_RULE_SETUP #line 656 "./slghscan.l" YY_BREAK case 160: /* rule 160 can match eol */ YY_RULE_SETUP #line 657 "./slghscan.l" { slgh->nextLine(); } YY_BREAK case 161: YY_RULE_SETUP #line 658 "./slghscan.l" { return yytext[0]; } YY_BREAK case 162: /* rule 162 can match eol */ YY_RULE_SETUP #line 660 "./slghscan.l" { slgh->nextLine(); BEGIN( preprocess(preproc,preproc) ); } YY_BREAK case 163: /* rule 163 can match eol */ YY_RULE_SETUP #line 661 "./slghscan.l" { slgh->nextLine(); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(defblock): case YY_STATE_EOF(macroblock): case YY_STATE_EOF(print): case YY_STATE_EOF(pattern): case YY_STATE_EOF(sem): case YY_STATE_EOF(preproc): #line 663 "./slghscan.l" { yy_delete_buffer( YY_CURRENT_BUFFER ); if (filebuffers.empty()) yyterminate(); yy_switch_to_buffer( filebuffers.back().lastbuffer ); FILE *curfile = filebuffers.back().file; if (curfile != (FILE *)0) fclose(curfile); filebuffers.pop_back(); slgh->parseFileFinished(); } YY_BREAK case 164: YY_RULE_SETUP #line 673 "./slghscan.l" ECHO; YY_BREAK #line 2465 "/mnt/c/Users/ding6/Code/starcross/bincraft/sleighcraft/cpp/build_test/flex/slghscan.cpp" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc( (void *) b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); /* "- 2" to take care of EOB's */ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 527 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 527 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 526); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT static void yyunput (int c, char * yy_bp ) { char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ int number_to_move = (yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_init_buffer( YY_CURRENT_BUFFER, input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree( (void *) b->yy_ch_buf ); yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return NULL; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (const char * yystr ) { return yy_scan_bytes( yystr, (int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yynoreturn yy_fatal_error (const char* msg ) { fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param _line_number line number * */ void yyset_lineno (int _line_number ) { yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str ) { yyin = _in_str ; } void yyset_out (FILE * _out_str ) { yyout = _out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int _bdebug ) { yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = NULL; yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return realloc(ptr, size); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 673 "./slghscan.l"
d79de4ac79f67992edd860dc87a7e8f51b91c5a0
9a1ab053f4058a52faebeb11170127e1f353cb83
/3rdParty/caffe/include/caffe/layers/cudnn_relu_layer.hpp
907ef53bae5a8722f98afb0d43bf874d35a1a26c
[]
no_license
shenh0854/save_docs_for_work
c71e477bbd7b9827ddcb59926b011af1b5f4c489
3263fbdfd2515451d420bf8f91c85abaf8117020
refs/heads/master
2020-04-16T02:47:19.696218
2019-01-11T08:40:24
2019-01-11T08:40:24
165,208,223
0
1
null
null
null
null
UTF-8
C++
false
false
129
hpp
version https://git-lfs.github.com/spec/v1 oid sha256:7376eae1bbcc0eec81a95b19724849dd11a63c388473059e2fe37789ebeba20b size 1331
b990ba51cc3447dfa0221d7c384dfce8f26ca1e3
db57b19e70315c4adb79020c64a1c9d2b4e3cc94
/system/StringBuilder.h
ea5e27758b611df453b7fefcc93d8f62d0928b70
[]
no_license
rock3125/gforce-x
da9d5d75769780939314bf03ac008f9d7362e675
3a349ea799dfe1f24fb04bb14b643175730c2d95
refs/heads/master
2021-12-25T06:27:14.101284
2017-02-20T09:32:44
2017-02-20T09:32:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
746
h
#pragma once /////////////////////////////////////////////////////////////////////// class StringBuilder { public: StringBuilder(); StringBuilder(int); ~StringBuilder(); // append to stringbuilder void Append(const std::string& str); void Append(int); void Append(float); void Append(char); // convert current internals to string std::string ToString(); // slightly unorthodox way of accessing the object const char* GetString(); // clear current stringbuilder obj void Clear(); // return the length of the string int Length(); private: // do the actual work void Add(const std::string& str); private: char* buffer; int initialSize; int bufferSize; int currentSize; };
05dda734a10df59aa7766e62041525f22273ca7f
b4d03ba7c959e770e50aa721ea71ff6c8a751893
/QT/NetThing(Windows Final)/debug/moc_qextserialport.cpp
f8ce05ef82fd8aa1670097a029798702e14bfcf7
[]
no_license
samsoniii/IoT_Farm_Project
cc41b6ea59ac3240d0b415f409c0c1e0c37fa8c2
1a032f83652e265315e515127952e55523241049
refs/heads/master
2021-09-08T08:20:45.762935
2018-03-08T16:16:28
2018-03-08T16:16:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,130
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'qextserialport.h' ** ** Created: Fri Apr 6 20:34:14 2012 ** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../qextserialport.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'qextserialport.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 62 #error "This file was generated using the moc from 4.6.2. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_QextSerialPort[] = { // content: 4, // revision 0, // classname 0, 0, // classinfo 0, 0, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount 0 // eod }; static const char qt_meta_stringdata_QextSerialPort[] = { "QextSerialPort\0" }; const QMetaObject QextSerialPort::staticMetaObject = { { &QextBaseType::staticMetaObject, qt_meta_stringdata_QextSerialPort, qt_meta_data_QextSerialPort, 0 } }; #ifdef Q_NO_DATA_RELOCATION const QMetaObject &QextSerialPort::getStaticMetaObject() { return staticMetaObject; } #endif //Q_NO_DATA_RELOCATION const QMetaObject *QextSerialPort::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; } void *QextSerialPort::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_QextSerialPort)) return static_cast<void*>(const_cast< QextSerialPort*>(this)); return QextBaseType::qt_metacast(_clname); } int QextSerialPort::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QextBaseType::qt_metacall(_c, _id, _a); if (_id < 0) return _id; return _id; } QT_END_MOC_NAMESPACE
3143508782223781bc090e1a2ee884c29b784df3
7157070441280e9624566084157b0a9f6edf0545
/logic.cpp
c3b7d55dda66ab7b4582b0834a8020d3497764e0
[]
no_license
semitro/Minesweeper
d2ffa65b314cc3c735c143ffa7fc0af3d7ba039a
09cbb297b12163c5c34eb680389973f7095a7231
refs/heads/master
2021-01-15T16:16:10.791447
2015-04-22T13:05:43
2015-04-22T13:05:43
34,114,974
0
0
null
null
null
null
UTF-8
C++
false
false
6,445
cpp
#include "logic.h" //Gamer bool Gamer::isAlive(){ return _alive; } bool Gamer::isWinner(){ return _winner; } void Gamer::kill(){ _alive = false; static sf::Music boom; boom.openFromFile("Sounds/explosion.ogg"); boom.play(); } void Gamer::lessFlag(int number){ _flag_number -= number; } void Gamer::youAreWin(){ _winner = true; } int Gamer::getFlagsNumber(){ return _flag_number; } //Block bool Block::isOpen(void){ return _open; } bool Block::Flag() { return _flag; } void Block::open(Gamer &gamer) { if(_flag) return; // Если поле с флагом - не откроем его никак _open = true; if(_type == MINE) gamer.kill(); } void Block::setType(Block_Type type){ _type = type; } void Block::setFlag(bool flag){ _flag = flag; } void Block::addMinesAround(int number){ _mine_around += number; } int Block::getMinesAround(){ return _mine_around; } Block::Block_Type Block::type() { return _type; } //Map Map::Map(int size):_minesIsInited(false){ _size = size; _number_blocks = size*size; _blocks = new Block[_number_blocks]; for(int i(0);i < size;i++) for(int j(0); j< size; j++) _blocks[i] = Block(i,j); } Map::~Map(){ delete[] _blocks; } Block& Map::getBlock(int number) { return _blocks[number]; } Block& Map::getBlock(int i, int j){ int elem = i*_size+j; // Массивушка-то одномерный! return _blocks[elem]; } int Map::getNumberBlocks() { return _number_blocks; } int Map::getSize(){ return _size; } void Map::init_mines(){ _minesIsInited = true; std::srand(std::time(NULL)); int number_mines = (_number_blocks*1.4)/10+1; // Количество мин for(int i(0);i<number_mines;i++) { int elem = std::rand()%_number_blocks; if(_blocks[elem].type() != Block::MINE || !_blocks[elem].isOpen()) { _blocks[elem].setType(Block::MINE); // А-алгоритм if(elem-_size>=0) _blocks[elem-_size].addMinesAround(); if(elem+1 < _number_blocks && (elem+1)%_size!=0) // Не справа _blocks[elem+1].addMinesAround(); if(elem-1 >= 0 && elem % _size !=0) // не слева _blocks[elem-1].addMinesAround(); if(elem-_size-1 >= 0 && elem % _size !=0) //не слева _blocks[elem - _size-1].addMinesAround(); if(elem + _size-1 < _number_blocks && elem % _size !=0) // Не слева _blocks[elem + _size-1].addMinesAround(); if(elem+_size < _number_blocks) _blocks[elem + _size].addMinesAround(); if(elem-_size+1 >=0 && (elem+1)%_size!=0) // Не справа _blocks[elem-_size+1].addMinesAround(); if(elem + _size+1 < _number_blocks && (elem+1)%_size!=0) // Не справа _blocks[elem+_size+1].addMinesAround(); } //else // _blocks[std::rand()%_number_blocks].setType(Block::MINE); } } void Map::openEmptyBlocksAround(int elem, Gamer &gamer){ if(_blocks[elem].isOpen() || _blocks[elem].Flag() || _blocks[elem].getMinesAround()!=0 || _blocks[elem].type() != Block::EMPTY_) return; else getBlock(elem).open(gamer); if(elem-1 >= 0 && elem % _size !=0 && _blocks[elem-1].getMinesAround() !=0) // Открываем краешки getBlock(elem-1).open(gamer); if(elem+1 < _number_blocks && (elem+1)%_size!=0 && _blocks[elem+1].getMinesAround() !=0) getBlock(elem+1).open(gamer); if(elem-_size >= 0 && _blocks[elem-_size].getMinesAround() !=0) getBlock(elem-_size).open(gamer); if(elem+_size < _number_blocks && _blocks[elem+_size].getMinesAround() !=0) getBlock(elem+_size).open(gamer); if(elem-1 >= 0 && elem % _size !=0) openEmptyBlocksAround(elem-1,gamer); // Рекурсивно открываем поле слева if(elem+1 < _number_blocks && (elem+1)%_size!=0 ) openEmptyBlocksAround(elem+1,gamer); // Рекурсивно открываем поле справа if(elem-_size >= 0 && _blocks[elem-_size].type() == Block::EMPTY_) openEmptyBlocksAround(elem-_size,gamer); if(elem+_size < _number_blocks && _blocks[elem+_size].type() == Block::EMPTY_) openEmptyBlocksAround(elem+_size,gamer); } void Map::openBlock(int i, int j, Gamer &gamer){ int elem = i*_size +j; // Перевод в одномерное матричное исчисление openEmptyBlocksAround(elem,gamer); getBlock(i,j).open(gamer); } void Map::left_mouse_click(sf::Vector2i pos,Gamer &gamer,sf::RenderWindow &w){ if(pos.y/BLOCK_RENDER_SIZE*_size + pos.x/BLOCK_RENDER_SIZE > _number_blocks) // Если клик за пределами поля return; //getBlock(pos.y/BLOCK_RENDER_SIZE,pos.x/BLOCK_RENDER_SIZE).open(gamer); static bool first_click = true; if(first_click){ first_click = false; Map::init_mines(); left_mouse_click(pos,gamer,w); } else openBlock(pos.y/BLOCK_RENDER_SIZE,pos.x/BLOCK_RENDER_SIZE,gamer); if(win(gamer)){ // Проверяем, не достиг ли игрок победы этим ходом? gamer.youAreWin(); // Если достиг, то он победитель } } void Map::right_mouse_click(sf::Vector2i pos, Gamer &gamer, sf::RenderWindow &w){ if(pos.y/BLOCK_RENDER_SIZE*_size + pos.x/BLOCK_RENDER_SIZE > _number_blocks) // Если клик за пределами поля return; if(getBlock(pos.y/BLOCK_RENDER_SIZE,pos.x/BLOCK_RENDER_SIZE).isOpen()) return; if( !getBlock(pos.y/BLOCK_RENDER_SIZE,pos.x/BLOCK_RENDER_SIZE).Flag() ){ // Если флага нет gamer.lessFlag(); getBlock(pos.y/BLOCK_RENDER_SIZE,pos.x/BLOCK_RENDER_SIZE).setFlag(true); } else{ // Если флаг есть gamer.lessFlag(-1); // Отнимем минус один флаг, т.е, увеличим их к-во на один getBlock(pos.y/BLOCK_RENDER_SIZE,pos.x/BLOCK_RENDER_SIZE).setFlag(false); } if(win(gamer)){ // Проверяем, не достиг ли игрок победы этим ходом? gamer.youAreWin(); // Если достиг, то он победитель } } bool Map::win(Gamer &gamer){ if(gamer.getFlagsNumber() < 0 || !_minesIsInited || !gamer.isAlive()) return false; for(int i(0);i<_number_blocks;i++) //Если остались первозданные поля if( _blocks[i].isOpen() == false && _blocks[i].Flag() == false ) return false; // Не победа то for(int i(0);i<_number_blocks;i++) if(_blocks[i].type() == Block::MINE && _blocks[i].Flag() == false ) // Если на поле с миной нет флага return false; // То не победа return true; }
64473d8ebc5fff33b1f69e721dcdc1028bceb987
c2445b8329c7d6e912cc29ca838f41e4c6df6988
/modules/cephes/bench/scalar/ellik.cpp
08d946335d7fc61e63233601b9e7d8f96f0b22a5
[ "BSL-1.0" ]
permissive
francescog/nt2
b88548a8fb26f905e8b237148effe7a41d00fca8
1930097285539d3a3a758ec44061ba3a2f7281d9
refs/heads/master
2021-01-18T05:54:29.136634
2011-06-18T14:59:32
2011-06-18T14:59:32
1,914,634
0
0
null
null
null
null
UTF-8
C++
false
false
1,688
cpp
////////////////////////////////////////////////////////////////////////////// /// Copyright 2003 and onward LASMEA UMR 6602 CNRS/U.B.P Clermont-Ferrand /// Copyright 2009 and onward LRI UMR 8623 CNRS/Univ Paris Sud XI /// /// Distributed under the Boost Software License, Version 1.0 /// See accompanying file LICENSE.txt or copy at /// http://www.boost.org/LICENSE_1_0.txt ////////////////////////////////////////////////////////////////////////////// #define NT2_BENCH_MODULE "nt2 cephes toolbox - ellik/scalar Mode" ////////////////////////////////////////////////////////////////////////////// // timing Test behavior of cephes components in scalar mode ////////////////////////////////////////////////////////////////////////////// #include <nt2/toolbox/cephes/include/ellik.hpp> #include <nt2/sdk/unit/benchmark.hpp> #include <nt2/sdk/unit/bench_includes.hpp> #include <cmath> ////////////////////////////////////////////////////////////////////////////// // scalar runtime benchmark for functor<ellik_> from cephes ////////////////////////////////////////////////////////////////////////////// using nt2::cephes::tag::ellik_; ////////////////////////////////////////////////////////////////////////////// // range macro ////////////////////////////////////////////////////////////////////////////// #define RS(T,V1,V2) (T, T(V1) ,T(V2)) namespace n1 { typedef float T; typedef nt2::meta::as_integer<T>::type iT; NT2_TIMING(ellik_,(RS(T,T(0),T(3)))(RS(T,T(0),T(1)))) } namespace n2 { typedef double T; typedef nt2::meta::as_integer<T>::type iT; NT2_TIMING(ellik_,(RS(T,T(0),T(3)))(RS(T,T(0),T(1)))) } #undef RS
07b7566d0a1fbff0ca323d5069363456e6ebf3cc
48c42f71392593441b67699d04f0f33de4f17afd
/zSources/GameServer/TMonsterSkillUnit.h
ee70683d52e93d1a5cf1841a075d4964781457f5
[]
no_license
zhouyanlt/IGCN-v9.5-MuServer-S9EP2
89d8f8e1505946c10e549a44cb69137b3911e062
7032265a88037c135f6e77fd0c1496fbfd1afdf2
refs/heads/master
2020-03-15T23:10:57.055767
2018-05-08T15:45:51
2018-05-08T15:45:51
132,388,553
0
0
null
2018-05-07T00:55:13
2018-05-07T00:55:13
null
UTF-8
C++
false
false
1,614
h
// TMonsterSkillUnit.h: interface for the TMonsterSkillUnit class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_TMONSTERSKILLUNIT_H__9F3D0706_317D_4E48_8A4A_439053F8F0B0__INCLUDED_) #define AFX_TMONSTERSKILLUNIT_H__9F3D0706_317D_4E48_8A4A_439053F8F0B0__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "TMonsterSkillElement.h" #define MAX_MONSTER_SKILL_UNIT_ARRAY (200) #define MAX_MONSTER_SKILL_ELEMENT_INFO (5) class TSkillUnit { public: private: }; class TMonsterSkillUnit : public TSkillUnit { public: TMonsterSkillUnit(); virtual ~TMonsterSkillUnit(); void RunSkill(int iIndex, int iTargetIndex); void Reset(); static int LoadData(char* lpszFileName); static int DelAllSkillUnit(); static class TMonsterSkillUnit* FindSkillUnit(int iUnitNumber); public: char m_szUnitName[20]; // 4 int m_iUnitNumber; // 18 int m_iUnitTargetType; // 1C int m_iUnitScopeType; // 20 int m_iUnitScopeValue; // 24 int m_iDelay; // 28 int m_iElementsCount; // 2C TMonsterSkillElement* m_lpElementsSlot[MAX_MONSTER_SKILL_ELEMENT_INFO]; // 30 static BOOL s_bDataLoad; static TMonsterSkillUnit s_MonsterSkillUnitArray[MAX_MONSTER_SKILL_UNIT_ARRAY]; }; #endif // !defined(AFX_TMONSTERSKILLUNIT_H__9F3D0706_317D_4E48_8A4A_439053F8F0B0__INCLUDED_) ////////////////////////////////////////////////////////////////////// // iDev.Games - MuOnline S9EP2 IGC9.5 - TRONG.WIN - DAO VAN TRONG //////////////////////////////////////////////////////////////////////
8f63b003288d96c43402adb0b86961cb32d8b8e1
65d2be9e7c838ffb2290e549bf9da0f9f8d9123a
/webrtc.cpp
88ef984a0a13a93160cffb3145a44799b4cac07b
[]
no_license
olebowle/sniffer
f87a476746c25b37817decfae122f479ff99f760
b47e0d2cd9af01ec029601a4b6dd13d76edd7b91
refs/heads/develop
2021-01-21T02:55:58.525210
2016-06-13T07:03:26
2016-06-13T07:03:26
59,817,460
0
0
null
2016-05-27T08:12:18
2016-05-27T08:12:18
null
UTF-8
C++
false
false
10,405
cpp
#include <iomanip> #include "webrtc.h" #include "sql_db.h" using namespace std; extern int opt_id_sensor; extern MySqlStore *sqlStore; extern int opt_mysqlstore_max_threads_webrtc; SqlDb *sqlDbSaveWebrtc = NULL; WebrtcData::WebrtcData() { this->counterProcessData = 0; } WebrtcData::~WebrtcData() { this->cache.clear(); } void WebrtcData::processData(u_int32_t ip_src, u_int32_t ip_dst, u_int16_t port_src, u_int16_t port_dst, TcpReassemblyData *data, u_char *ethHeader, u_int32_t ethHeaderLength, u_int16_t handle_index, int dlt, int sensor_id, u_int32_t sensor_ip, void *uData, TcpReassemblyLink *reassemblyLink, bool debugSave) { ++this->counterProcessData; if(debugSave) { cout << "### WebrtcData::processData " << this->counterProcessData << endl; } if(!sqlDbSaveWebrtc) { sqlDbSaveWebrtc = createSqlObject(); } for(size_t i_data = 0; i_data < data->data.size(); i_data++) { TcpReassemblyDataItem *dataItem = &data->data[i_data]; if(!dataItem->getData()) { continue; } if(debugSave) { cout << fixed << setw(15) << inet_ntostring(htonl(ip_src)) << " / " << setw(5) << port_src << (dataItem->getDirection() == TcpReassemblyDataItem::DIRECTION_TO_DEST ? " --> " : " <-- ") << setw(15) << inet_ntostring(htonl(ip_dst)) << " / " << setw(5) << port_dst << " len: " << setw(4) << dataItem->getDatalen(); u_int32_t ack = dataItem->getAck(); if(ack) { cout << " ack: " << setw(5) << ack; } cout << endl; } WebrtcDecodeData webrtcDD; if(dataItem->getDatalen() > 4 && (!strncmp((char*)dataItem->getData(), "POST", 4) || !strncmp((char*)dataItem->getData(), "GET", 3) || !strncmp((char*)dataItem->getData(), "HTTP", 4))) { if(debugSave) { cout << " HTTP DATA: " << dataItem->getData() << endl; } continue; } else { unsigned int rsltDecode = webrtcDD.decode(dataItem->getData(), dataItem->getDatalen()); if(rsltDecode) { if(webrtcDD.method == "hb") { if(debugSave) { cout << " method: hb - skip" << endl; } continue; } if(debugSave) { switch(webrtcDD.opcode) { case opcode_textData: cout << " WEBRTC " << webrtcDD.type << " DATA"; if(webrtcDD.data) { cout << ": (len: " << strlen((char*)webrtcDD.data) << " payload len: " << webrtcDD.payload_length << ") " << webrtcDD.data; } cout << endl; if(!webrtcDD.method.empty()) { cout << " method: " << webrtcDD.method << endl; } if(!webrtcDD.type.empty()) { cout << " type: " << webrtcDD.type << endl; } if(!webrtcDD.deviceId.empty()) { cout << " deviceId: " << webrtcDD.deviceId << endl; } if(!webrtcDD.commCorrelationId.empty()) { cout << " commCorrelationId: " << webrtcDD.commCorrelationId << endl; } break; case opcode_binaryData: cout << " WEBRTC BINARY DATA" << endl; break; case opcode_terminatesConnection: cout << " WEBRTC TERMINATES CONNECTION" << endl; break; default: cout << " WEBRTC OTHER OPCODE" << endl; break; } } if(rsltDecode != dataItem->getDatalen()) { if(debugSave) { cout << " WARNING - BAD LENGTH WEBRTC DATA" << endl; } } if(webrtcDD.opcode != opcode_textData) { continue; } } else { if(debugSave) { cout << " BAD WEBRTC DATA: " << endl; } continue; } } if((webrtcDD.opcode == opcode_textData && webrtcDD.data) && (webrtcDD.type == "req" || webrtcDD.type == "rsp") && ((webrtcDD.method == "login" && !webrtcDD.deviceId.empty()) || (webrtcDD.method == "msg" && !webrtcDD.commCorrelationId.empty()))) { uint32_t ip_ports[4] = { ip_src, ip_dst, port_src, port_dst }; string data_md5 = GetDataMD5(webrtcDD.data, webrtcDD.payload_length, (u_char*)ip_ports, sizeof(ip_ports)); u_int32_t _ip_src = dataItem->getDirection() == TcpReassemblyDataItem::DIRECTION_TO_DEST ? ip_src : ip_dst; u_int32_t _ip_dst = dataItem->getDirection() == TcpReassemblyDataItem::DIRECTION_TO_DEST ? ip_dst : ip_src; u_int16_t _port_src = dataItem->getDirection() == TcpReassemblyDataItem::DIRECTION_TO_DEST ? port_src : port_dst; u_int16_t _port_dst = dataItem->getDirection() == TcpReassemblyDataItem::DIRECTION_TO_DEST ? port_dst : port_src; WebrtcDataCache requestDataFromCache = this->cache.get(_ip_src, _ip_dst, _port_src, _port_dst, data_md5); if(requestDataFromCache.timestamp) { if(debugSave) { cout << "DUPL" << endl; } } else { SqlDb_row rowRequest; rowRequest.add(sqlDateTimeString(dataItem->getTime().tv_sec), "timestamp"); rowRequest.add(dataItem->getTime().tv_usec, "usec"); rowRequest.add(htonl(_ip_src), "srcip"); rowRequest.add(htonl(_ip_dst), "dstip"); rowRequest.add(_port_src, "srcport"); rowRequest.add(_port_dst, "dstport"); rowRequest.add(webrtcDD.type == "req" ? "websocket" : "websocket_resp", "type"); rowRequest.add(webrtcDD.method, "method"); rowRequest.add(sqlEscapeString((char*)webrtcDD.data).c_str(), "body"); rowRequest.add(sqlEscapeString(!webrtcDD.deviceId.empty() ? webrtcDD.deviceId : webrtcDD.commCorrelationId).c_str(), "external_transaction_id"); rowRequest.add(opt_id_sensor > 0 ? opt_id_sensor : 0, "id_sensor", opt_id_sensor <= 0); string queryInsert = sqlDbSaveWebrtc->insertQuery("webrtc", rowRequest); int storeId = STORE_PROC_ID_WEBRTC_1 + (opt_mysqlstore_max_threads_webrtc > 1 && sqlStore->getSize(STORE_PROC_ID_WEBRTC_1) > 1000 ? counterProcessData % opt_mysqlstore_max_threads_webrtc : 0); sqlStore->query_lock(queryInsert.c_str(), storeId); if(debugSave) { cout << "SAVE" << endl; } this->cache.add(_ip_src, _ip_dst, _port_src, _port_dst, data_md5, dataItem->getTime().tv_sec); } } else { if(debugSave) { cout << " UNCOMPLETE WEBRTC DATA: " << endl; } } } delete data; this->cache.cleanup(false); } void WebrtcData::printContentSummary() { cout << "WEBRTC CACHE: " << this->cache.getSize() << endl; this->cache.cleanup(true); } unsigned int WebrtcData::WebrtcDecodeData::decode(u_char *data, unsigned int data_length, bool checkOkOnly) { u_int16_t headerLength = 2; if(data_length <= headerLength) { return(0); } WebrtcHeader *header = (WebrtcHeader*)data; opcode = (eWebrtcOpcode)header->opcode; switch(opcode) { case opcode_continuePayload: case opcode_textData: case opcode_binaryData: case opcode_terminatesConnection: case opcode_ping: case opcode_pong: break; default: clear(); return(0); } if(header->payload_length >= 126) { headerLength += 2; if(data_length <= headerLength) { clear(); return(0); } payload_length = htons(*(u_int16_t*)(data + headerLength - 2)); } else { payload_length = header->payload_length; } if(header->mask) { headerLength += 4; if(data_length <= headerLength) { switch(opcode) { case opcode_terminatesConnection: case opcode_ping: case opcode_pong: return(headerLength - 4); break; default: clear(); return(0); } } masking_key = htonl(*(u_int32_t*)(data + headerLength - 4)); } if(data_length < headerLength + payload_length) { clear(); return(0); } if(payload_length && !checkOkOnly) { u_int32_t dataLength = payload_length / 4 * 4 + (payload_length % 4 ? 4 : 0); this->data = new FILE_LINE u_char[dataLength + 1]; memcpy_heapsafe(this->data, this->data, data + headerLength, data, payload_length, __FILE__, __LINE__); if(masking_key) { for(u_int32_t i = 0; i < dataLength; i += 4) { *(u_int32_t*)(this->data + i) = htonl(htonl(*(u_int32_t*)(this->data + i)) ^ masking_key); } } for(u_int32_t i = payload_length; i < dataLength + 1; i++) { this->data[i] = 0; } if(opcode == opcode_textData) { this->method = reg_replace((char*)this->data, "\"method\":\"([^\"]+)\"", "$1", __FILE__, __LINE__); this->type = reg_replace((char*)this->data, "\"type\":\"([^\"]+)\"", "$1", __FILE__, __LINE__); this->deviceId = reg_replace((char*)this->data, "\"deviceId\":\"([^\"]+)\"", "$1", __FILE__, __LINE__); this->commCorrelationId = reg_replace((char*)this->data, "\"Comm-Correlation-ID\":\"([^\"]+)\"", "$1", __FILE__, __LINE__); if(this->commCorrelationId.empty()) { this->commCorrelationId = reg_replace((char*)this->data, "\"comm-correlation-id\":\"([^\"]+)\"", "$1", __FILE__, __LINE__); } } } return(headerLength + payload_length); } WebrtcCache::WebrtcCache() { this->cleanupCounter = 0; this->lastAddTimestamp = 0; } WebrtcDataCache WebrtcCache::get(u_int32_t ip_src, u_int32_t ip_dst, u_int16_t port_src, u_int16_t port_dst, string data_md5) { WebrtcDataCache_id idc(ip_src, ip_dst, port_src, port_dst, data_md5); map<WebrtcDataCache_id, WebrtcDataCache>::iterator iter = this->cache.find(idc); if(iter == this->cache.end()) { return(WebrtcDataCache()); } else { return(iter->second); } } void WebrtcCache::add(u_int32_t ip_src, u_int32_t ip_dst, u_int16_t port_src, u_int16_t port_dst, string data_md5, u_int64_t timestamp) { WebrtcDataCache_id idc(ip_src, ip_dst, port_src, port_dst, data_md5); this->cache[idc] = WebrtcDataCache(timestamp); this->lastAddTimestamp = timestamp; } void WebrtcCache::cleanup(bool force) { ++this->cleanupCounter; if(force || !(this->cleanupCounter % 100)) { u_int64_t clock = getTimeMS()/1000; map<WebrtcDataCache_id, WebrtcDataCache>::iterator iter; for(iter = this->cache.begin(); iter != this->cache.end(); ) { if(iter->second.timestamp < this->lastAddTimestamp - 120 || iter->second.timestamp_clock < clock - 120) { this->cache.erase(iter++); } else { ++iter; } } } } void WebrtcCache::clear() { this->cache.clear(); } bool checkOkWebrtcHttpData(u_char *data, u_int32_t datalen) { return(data && datalen > 4 && (!strncmp((char*)data, "POST", 4) || !strncmp((char*)data, "GET", 3) || !strncmp((char*)data, "HTTP", 4))); } bool checkOkWebrtcData(u_char *data, u_int32_t datalen) { if(!data) { return(false); } WebrtcData::WebrtcDecodeData webrtcDD; return(webrtcDD.decode(data, datalen, true) > 0); }
7df1afe0a85da8568d3305118621eff11b661974
c1de958b3f43f09df8d241e2baa06d6305bce8ab
/game001/Classes/ScoreLayer.cpp
af9c1103bddd3a83626564e3e6d2269fa4bcc54f
[]
no_license
dciccale/games
0540cfb50992200b7b808463e79cb0fd14739786
753206c41a73328e3d988107d54f3cf7d4c18dcb
refs/heads/master
2016-08-06T19:51:28.124164
2014-11-18T17:15:39
2014-11-18T17:15:39
11,896,959
1
0
null
null
null
null
UTF-8
C++
false
false
639
cpp
#include "ScoreLayer.h" USING_NS_CC; ScoreLayer::ScoreLayer() { _score = 0; _interval = 1.0f; this->updateText(); _label = CCLabelTTF::create(_text, "arial", 32); } int ScoreLayer::getScore() { return _score; } void ScoreLayer::update(float dt) { _score++; if (_score == 0) { CCDirector::sharedDirector()->getScheduler()->pauseTarget(this); } this->updateText(); _label->setString(_text); } void ScoreLayer::updateText() { sprintf(_text, "SCORE: %d", _score); } float ScoreLayer::getInterval() { return _interval; } void ScoreLayer::setInterval(float i) { _interval = i; }
444bee593a7cd656662aa06b671599554f759b02
45c29ae02055eb6bc855afa44c7815a3c4956cc3
/Source/PATD_Server/Actors/Enemies/IATasks/PD_IA_TaskErrorBehaviour.h
94e77d3723e45510e60b212b4241e5d294692ab1
[]
no_license
KyTn/PartyAtTheDungeon_Server
f32cfd58a4b3837ebe547311a37d5f2c604735a7
e363e214b8a8b0e6cd3cdea9815562d91e87916c
refs/heads/master
2021-06-18T07:02:35.315239
2017-07-02T20:29:43
2017-07-02T20:29:43
80,008,035
0
0
null
null
null
null
UTF-8
C++
false
false
404
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "BehaviorTree/BTTaskNode.h" #include "PD_IA_TaskErrorBehaviour.generated.h" /** * */ UCLASS() class PATD_SERVER_API UPD_IA_TaskErrorBehaviour : public UBTTaskNode { GENERATED_BODY() virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override; };
4a32e4dd894a78ec2a966a25fac6978b6c72418b
de1defe41557b5748178d8f93b07c103efd72093
/1.DataStructure/LinkedList/LinkedList/LinkedList.h
79b40b18d2375d3886acb582976e2943763c9eee
[]
no_license
reach0908/Algorithm_Practice
ae84eeb284bfde32406842269010885461e60ab8
c282b15ffd586fe97fce7ca449d626007b2a7cbb
refs/heads/master
2022-12-28T04:32:18.844659
2020-10-07T17:35:07
2020-10-07T17:35:07
286,553,525
2
0
null
2020-08-12T01:55:17
2020-08-10T18:44:35
C++
UHC
C++
false
false
1,904
h
#pragma once #include <assert.h> typedef int ListElementType; class List { public: List(); void insert(const ListElementType& elem); void insertBetween(const ListElementType& elem); void delNode(const ListElementType& elem); bool first(ListElementType& elem); bool next(ListElementType& elem); struct Node; typedef Node* Link; struct Node { int data; Link next; }; Link head; Link tail; Link current; }; List::List() { head = 0; tail = 0; current = 0; } void List::insert(const ListElementType& elem) { Link addedNode = new Node; assert(addedNode); addedNode->data = elem; if (head == 0) { head = addedNode; } else { tail->next = addedNode; } tail = addedNode; addedNode->next = 0; } void List::insertBetween(const ListElementType& elem) { Link addedNode = new Node; assert(addedNode); addedNode->data = elem; addedNode->next = current->next; current->next = addedNode; } void List::delNode(const ListElementType & target) { //헤드삭제, 중간삭제, 테일삭제의 경우를 생각해야함 assert(head); Link pred, delNode; // pred starts out pointing at the dummy head pred = head; while (pred = pred->next) { if (pred->next->data == target) { break; } } // at this point, check to see if we've found target -- // if so, remove it // Have to check carefully to make sure we don't // dereference a null pointer! if (pred && (pred->next) && (pred->next->data == target)) { // remove the next node in the list delNode = pred->next; pred->next = delNode->next; delete delNode; // return node to memory } } bool List::first(ListElementType& elem) { if (head == 0) { return false; } else { elem = head->data; current = head; return true; } } bool List::next(ListElementType& elem) { if (current->next == 0) { return false; } else { current = current->next; elem = current->data; return true; } }
6d933d678b4354e5b18430040647759c15ced27b
91910977dd7ac6a05ce5339c23a7eca9434ee490
/StartUpAnimation.cpp
972b263661f6b7b8e6b61ce5d4e4cae6690d73b2
[]
no_license
bocai/Gobang
12b3830333f15dfab7058ed80aa7c11f31d0defd
252a0527f28d9524513d3fbf81e8ebe00f0bc041
refs/heads/master
2021-01-18T13:58:29.468517
2013-09-13T01:53:18
2013-09-13T01:53:18
null
0
0
null
null
null
null
GB18030
C++
false
false
15,651
cpp
// StartUpAnimation.cpp : implementation file // #include "stdafx.h" #include "gobang.h" #include "StartUpAnimation.h" #include "GobangAboutDlg.h" #include "ConfigDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // StartUpAnimation dialog StartUpAnimation::StartUpAnimation(CWnd* pParent /*=NULL*/) : CDialog(StartUpAnimation::IDD, pParent) { //{{AFX_DATA_INIT(StartUpAnimation) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT pCgobangDlg = pPgobangDlg = pNgobangDlg = NULL; lastForeground = MAIN_WINDOW; ipBytes[0] = 127; ipBytes[1] = 0; ipBytes[2] = 0; ipBytes[3] = 1; myPort = 5050; farPort = 5051; configData.difficulty = 1; configData.chessColor = 0; configData.headPortrait = 1; configData.timeOut = 15; nikeName = "bocaihuang"; singlePath = _T("./resource/buttons/theme_gray/p2p.bmp"); computerPath = _T("./resource/buttons/theme_gray/vsComputer.bmp"); networdPath = _T("./resource/buttons/theme_gray/vsNetword.bmp"); settingPath = _T("./resource/buttons/theme_gray/gameConfig.bmp"); exitPath = _T("./resource/buttons/theme_gray/exitGame.bmp"); } StartUpAnimation::~StartUpAnimation() { if (pCgobangDlg != NULL) { delete pCgobangDlg; } if (pNgobangDlg != NULL) { delete pNgobangDlg; } if (pPgobangDlg) { delete pPgobangDlg; } } void StartUpAnimation::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(StartUpAnimation) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP DDX_Control(pDX, IDCANCEL, cancelBtn); DDX_Control(pDX, IDC_MINWIN_BTN, minSizeBtn); DDX_Control(pDX, IDC_TOTRAY_BTN, toTrayBtn); DDX_Control(pDX, IDC_SINGLE_BTN, m_singleBtn); DDX_Control(pDX, IDC_VS_COMPUTER_BTN, m_computerBtn); DDX_Control(pDX, IDC_VS_NETWORD_BTN, m_networdBtn); DDX_Control(pDX, IDC_SET_BTN, m_settingBtn); DDX_Control(pDX, IDC_EXIT_BTN, m_exitBtn); DDX_Control(pDX, IDC_ABOUT, m_aboutBtn); } BEGIN_MESSAGE_MAP(StartUpAnimation, CDialog) //{{AFX_MSG_MAP(StartUpAnimation) ON_WM_SYSCOMMAND() ON_MESSAGE(WM_NOTIFY_GOBANG_TRAY, OnTrayIcon) ON_WM_LBUTTONDOWN() ON_WM_PAINT() ON_BN_CLICKED(IDC_SINGLE_BTN, OnSingleBtn) ON_BN_CLICKED(IDC_VS_COMPUTER_BTN, OnVsComputerBtn) ON_BN_CLICKED(IDC_VS_NETWORD_BTN, OnVsNetwordBtn) ON_BN_CLICKED(IDC_EXIT_BTN, OnExitBtn) ON_BN_CLICKED(IDC_MINSIZE_BTN, OnMinsizeBtn) ON_BN_CLICKED(IDC_TOTRAY_BTN, OnTotrayBtn) ON_COMMAND(IDM_GAME_EXIT, OnGameExit) ON_COMMAND(IDM_ABOUT, OnAbout) ON_WM_SETCURSOR() ON_COMMAND(IDM_RULE_HELP, OnRuleHelp) ON_BN_CLICKED(IDC_SET_BTN, OnSetBtn) ON_BN_CLICKED(IDC_ABOUT, OnAbout) ON_WM_TIMER() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // StartUpAnimation message handlers BOOL StartUpAnimation::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_hCursor = LoadCursorFromFile(_T("./resource/ani/normal.cur")); if (NULL == m_hCursor) { MessageBox("资源文件无法打开,请检查程序所在的路径是否正确?"); exit(-1); } m_selectBtnCur = LoadCursorFromFile(_T("./resource/ani/onSelectBtn.ani")); SetWindowPos(this, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, SWP_NOZORDER); CenterWindow(this); SetWindowEllispeFrame(this->GetSafeHwnd(), 20, 20); // 窗口边角圆弧 // minSizeBtn.SetWindowPos(NULL, 4, 0, 32, 32, SWP_SHOWWINDOW); cancelBtn.SetWindowPos(NULL, SCREEN_WIDTH-42, 0, 32, 32, SWP_SHOWWINDOW); m_aboutBtn.SetWindowPos(NULL, SCREEN_WIDTH - 74, 0, 32, 32, SWP_SHOWWINDOW); toTrayBtn.SetWindowPos(NULL, SCREEN_WIDTH - 108, 0, 32, 32, SWP_SHOWWINDOW); int width = 250; int hight = 70; int py = 180; m_computerBtn.SetWindowPos(NULL, 380, py, width, hight, SWP_SHOWWINDOW); py += 70; m_singleBtn.SetWindowPos(NULL, 380, py, width, hight, SWP_SHOWWINDOW); py += 70; m_networdBtn.SetWindowPos(NULL, 380, py, width, hight, SWP_SHOWWINDOW); py += 70; m_settingBtn.SetWindowPos(NULL, 380, py, width, hight, SWP_SHOWWINDOW); py += 70; m_exitBtn.SetWindowPos(NULL, 380, py, width, hight, SWP_SHOWWINDOW); m_aboutBtn.SetIcon(IDI_ICO_ABOUT, (int)BTNST_AUTO_GRAY); m_aboutBtn.DrawTransparent(FALSE); m_aboutBtn.SetWindowText(""); m_aboutBtn.SetTooltipText("关于"); // minSizeBtn.SetIcon(IDI_MIN_SIZE); // minSizeBtn.DrawTransparent(FALSE); // minSizeBtn.SetTooltipText("最小化"); // minSizeBtn.SetWindowText(""); minSizeBtn.ShowWindow(SW_HIDE); toTrayBtn.SetIcon(IDI_TOTRAY, IDI_ICON_XU); // toTrayBtn.DrawBorder(FALSE); toTrayBtn.DrawTransparent(FALSE); toTrayBtn.SetWindowText(""); toTrayBtn.SetTooltipText("最小化到托盘"); cancelBtn.SetIcon(IDI_ICON_EXIT, (int)BTNST_AUTO_GRAY); // cancelBtn.DrawBorder(FALSE); cancelBtn.DrawTransparent(FALSE); cancelBtn.SetTooltipText("退出"); cancelBtn.SetWindowText(""); cpicBg.loadBmpFromFile(_T("./resource/bg/theme_gray/select_mode_bg.bmp")); // 加载游戏模式选择界面上的按钮bmp HBITMAP hBmp, hBmpIn = NULL; COLORREF maskColor = RGB(90, 90, 90); hBmpIn = getBmpImg(CString("./resource/buttons/theme_gray/vsComputerLight.bmp")); hBmp = getBmpImg(computerPath); if (hBmp && hBmpIn) { m_computerBtn.SetBitmaps(hBmpIn, maskColor, hBmp, maskColor); m_computerBtn.SetWindowText(""); // m_computerBtn.DrawBorder(FALSE); m_computerBtn.DrawTransparent(FALSE); } hBmp = getBmpImg(singlePath); hBmpIn = getBmpImg(CString("./resource/buttons/theme_gray/p2pLight.bmp")); if (hBmp && hBmpIn) { m_singleBtn.SetBitmaps(hBmpIn, maskColor, hBmp, maskColor); m_singleBtn.SetWindowText(""); // m_singleBtn.DrawBorder(FALSE); m_singleBtn.DrawTransparent(FALSE); } hBmp = getBmpImg(networdPath); hBmpIn = getBmpImg(CString("./resource/buttons/theme_gray/vsNetwordLight.bmp")); if (hBmp && hBmpIn) { m_networdBtn.SetBitmaps(hBmpIn, maskColor, hBmp, maskColor); m_networdBtn.SetWindowText(""); // m_networdBtn.DrawBorder(FALSE); m_networdBtn.DrawTransparent(FALSE); } hBmp = getBmpImg(settingPath); hBmpIn = getBmpImg(CString("./resource/buttons/theme_gray/gameConfigLight.bmp")); if (hBmp) { m_settingBtn.SetBitmaps(hBmpIn, maskColor, hBmp, maskColor); m_settingBtn.SetWindowText(""); // m_settingBtn.DrawBorder(FALSE); m_settingBtn.DrawTransparent(FALSE); } hBmp = getBmpImg(exitPath); hBmpIn = getBmpImg(CString("./resource/buttons/theme_gray/exitGameLight.bmp")); if (hBmp) { m_exitBtn.SetBitmaps(hBmpIn, maskColor, hBmp, maskColor); m_exitBtn.SetWindowText(""); // m_exitBtn.DrawBorder(FALSE); m_exitBtn.DrawTransparent(FALSE); } m_singleBtn.SetPlaySound(true, "IDR_HVER"); m_computerBtn.SetPlaySound(true, "IDR_HVER"); m_networdBtn.SetPlaySound(true, "IDR_HVER"); m_settingBtn.SetPlaySound(true, "IDR_HVER"); m_exitBtn.SetPlaySound(true, "IDR_HVER"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void StartUpAnimation::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CGobangAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } void StartUpAnimation::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default //欺骗 Windows,发送拖动标题栏的消息 PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y)); CDialog::OnLButtonDown(nFlags, point); } void StartUpAnimation::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here // Do not call CDialog::OnPaint() for painting messages CRect rect; GetClientRect(&rect); cpicBg.Paint(dc, rect); } void StartUpAnimation::OnCancel() { // TODO: Add extra cleanup here if (NULL != pCgobangDlg) { delete pCgobangDlg; pCgobangDlg = NULL; // CString msg; // msg.Format("ok"); // MessageBox(msg); } if (nid.hWnd == this->m_hWnd) { DeleteTray(); } CDialog::OnCancel(); } void StartUpAnimation::OnSingleBtn() { // TODO: Add your control notification handler code here if (NULL == pPgobangDlg ) { pPgobangDlg = new CGobangDlg(this); pPgobangDlg->Create(IDD_GOBANG_DIALOG); } if (NULL != pPgobangDlg) { this->ShowWindow(SW_HIDE); pPgobangDlg->setGameMode(SINGLE_MODE); pPgobangDlg->ShowWindow(SW_SHOWNORMAL | SW_NORMAL); } } void StartUpAnimation::OnVsComputerBtn() { // TODO: Add your control notification handler code here int nResponse = 0; // CGobangDlg gobangDlg; if (NULL == pCgobangDlg ) { pCgobangDlg = new CGobangDlg(this); pCgobangDlg->setGameMode(COMPUTER_MODE); pCgobangDlg->Create(IDD_GOBANG_DIALOG); } if (NULL != pCgobangDlg) { this->ShowWindow(SW_HIDE); pCgobangDlg->setGameMode(COMPUTER_MODE); pCgobangDlg->ShowWindow(SW_SHOWNORMAL | SW_NORMAL); } } void StartUpAnimation::OnVsNetwordBtn() { if (NULL == pNgobangDlg ) { pNgobangDlg = new CGobangDlg(this); pNgobangDlg->setGameMode(ONLINE_MODE); pNgobangDlg->Create(IDD_GOBANG_DIALOG); } if (NULL != pNgobangDlg) { this->ShowWindow(SW_HIDE); pNgobangDlg->setGameMode(ONLINE_MODE); pNgobangDlg->ShowWindow(SW_SHOWNORMAL | SW_NORMAL); } } CGobangDlg * StartUpAnimation::getGobangDlg() { return NULL; return pCgobangDlg; } void StartUpAnimation::OnExitBtn() { // TODO: Add your control notification handler code here this->OnCancel(); // MessageBox("exit"); } void StartUpAnimation::ToTray(ForegroundWindow fw) { // if (LOCAL_SINGLE == fw) // { // lastForeground = fw; // } // else if (VS_COMPUTER == fw) // { // lastForeground = fw; // } // else if (VS_ONLINE == fw) // { // lastForeground = fw; // } lastForeground = fw; nid.cbSize=(DWORD)sizeof(NOTIFYICONDATA); nid.hWnd=this->m_hWnd; nid.uID=IDR_MAINFRAME; nid.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP ; nid.uCallbackMessage= WM_NOTIFY_GOBANG_TRAY;//自定义的消息名称 nid.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)); strcpy(nid.szTip,"五子棋游戏");//信息提示条为“计划任务提醒” // strcpy(nid.szInfo,_T("五子棋")); // 标题 // strcpy(nid.szInfoTitle,_T("隐藏到托盘")); // 显示内容 // nid.dwInfoFlags=NIIF_INFO; // nid.uTimeout=4000; Shell_NotifyIcon(NIM_ADD,&nid);//在托盘区添加图标 ShowWindow(SW_HIDE);//隐藏主窗口 } void StartUpAnimation::DeleteTray() { Shell_NotifyIcon(NIM_DELETE, &nid); } LRESULT StartUpAnimation::OnTrayIcon(WPARAM wParam, LPARAM lParam) { if (wParam != IDR_MAINFRAME) { return 1; } switch(lParam) { case WM_RBUTTONUP://右键起来时弹出快捷菜单 { //声明一个弹出式菜单 //增加菜单项“关闭”,点击则发送消息WM_CLOSE给主窗口(已 //隐藏),将程序结束。 // CMenu menu; // menu.CreatePopupMenu(); // CbmpPicture cpic; // cpic.loadBmpFromFile("resource") // menu.AppendMenu(MF_STRING, ID_APP_EXIT, _T("关闭")); // menu.AppendMenu(MF_STRING, ID_APP_ABOUT, _T("关于")); // // //得到鼠标位置 // LPPOINT lpoint= new tagPOINT; // ::GetCursorPos(lpoint); // // //确定弹出式菜单的位置 // menu.TrackPopupMenu(TPM_LEFTALIGN, lpoint->x, lpoint->y,this); // // //资源回收 // HMENU hmenu=menu.Detach(); // menu.DestroyMenu(); // // delete lpoint; // lpoint = NULL; CPoint pt; CMenu menu; //定义右键菜单对象 GetCursorPos(&pt); //获取当前鼠标位置 menu.LoadMenu(IDR_GOBANG_MENU); //载入右键快捷菜单 SetForegroundWindow();//放置在前面 CMenu* pmenu; //定义右键菜单指针 pmenu=menu.GetSubMenu(0); //该函数取得被指定菜单激活的下拉式菜单或子菜单的句柄 ASSERT(pmenu!=NULL); // CBitmap *pBitmap = NULL; // CbmpPicture cpic; // cpic.loadBmpFromFile("./resource/buttons/theme_gray/退出.bmp"); // // pBitmap = cpic.getBitmap(); // ASSERT(pBitmap != NULL); // pmenu->SetMenuItemBitmaps(0, MF_BYPOSITION, pBitmap, pBitmap); pmenu-> TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN,pt.x,pt.y,this); //在指定位置显示右键快捷菜单 HMENU hmenu=pmenu -> Detach(); pmenu ->DestroyMenu(); break; } case WM_LBUTTONDBLCLK: { //双击左键的处理 //显示界面 switch(lastForeground) { case LOCAL_SINGLE: {if (pPgobangDlg) { pPgobangDlg->ShowWindow(SW_SHOW | SW_NORMAL); } } break; case VS_COMPUTER: { if (pCgobangDlg) { pCgobangDlg->ShowWindow(SW_SHOW | SW_NORMAL); } } break; case VS_ONLINE: { if (pNgobangDlg) { pNgobangDlg->ShowWindow(SW_SHOW | SW_NORMAL); } } break; case MAIN_WINDOW: { ShowWindow(SW_SHOW | SW_NORMAL); SetForegroundWindow(); } break; } //界面置顶 //SetForegroundWindow(); break; } } return 0; } void StartUpAnimation::OnMinsizeBtn() { // TODO: Add your control notification handler code here if (!IsIconic()) { // WINDOWPLACEMENT lwndpl; // // GetWindowPlacement(&lwndpl); // lwndpl.showCmd=SW_SHOWMINIMIZED; // SetWindowPlacement(&lwndpl); // MessageBox("kkkkl"); SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); } } void StartUpAnimation::OnTotrayBtn() { // TODO: Add your control notification handler code here // bIsToTray = TRUE; // SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); ToTray(MAIN_WINDOW); // lastForeground = MAIN_WINDOW; } void StartUpAnimation::OnGameExit() { // TODO: Add your command handler code here OnCancel(); } void StartUpAnimation::OnAbout() { // TODO: Add your command handler code here CGobangAboutDlg dlg; dlg.DoModal(); } BOOL StartUpAnimation::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { // TODO: Add your message handler code here and/or call default switch (pWnd->GetDlgCtrlID()) { case IDC_VS_COMPUTER_BTN: case IDC_SINGLE_BTN: case IDC_VS_NETWORD_BTN: case IDC_SET_BTN: case IDC_EXIT_BTN: if (m_selectBtnCur) { SetCursor(m_selectBtnCur); return TRUE; } } if (m_hCursor != NULL) { SetCursor(m_hCursor); return TRUE; } return CDialog::OnSetCursor(pWnd, nHitTest, message); } void StartUpAnimation::OnSetBtn() { // TODO: Add your control notification handler code here CConfigDlg configDlg(this); configDlg.DoModal(); } void StartUpAnimation::OnRuleHelp() { // TODO: Add your command handler code here CGobangAboutDlg aDlg; aDlg.setBkImg(CGobangAboutDlg::HELP_IMG); aDlg.DoModal(); } void StartUpAnimation::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CDialog::OnTimer(nIDEvent); }
b087e18b6610bd3aebf8e9cf9a46505771f44b14
0c09f7d43b7870e004bbe7b6ba4fe666ba4d7824
/New Project/main.cpp
b6e44855abace9149cfe1fcde9da134db74cd685
[]
no_license
tkrauja/codingground
38041914214e25a1bbea469a0b6bba5823d1a716
69a028a008c2c6d96cc9af16f1750d86a90285c9
refs/heads/master
2021-01-10T02:44:54.805597
2015-12-20T02:34:09
2015-12-20T02:34:09
48,303,834
0
0
null
null
null
null
UTF-8
C++
false
false
405
cpp
#include<iostream> using namespace std; int main(){ int num; cout << "Enter a number to play the game of threes: "; cin >> num; while(num != 1){ if(num % 3 == 0){ num = num / 3; cout << num << " 0" << endl; } else if(num % 3 == 1){ num -= 1; cout << num << " -1" << endl; } else{ num += 1; cout << num << " +1" << endl; } } return 0; }
f4a83ac66b39c96fc294715382cb6e68a1f7d801
fe911a3efea8558ae122b570c2a8c2a5c3c48da6
/DFA_Matching/AutomatonMatcher.h
337a851b45cd9fa69393fee788119d1115e7bebb
[]
no_license
Ariello05/Algorithms
9bfdee3ae1a8734fe60f882905354c9e9146511d
8c504b8be9ac47f0142784dba7c2404143b8936a
refs/heads/master
2021-07-20T09:04:11.120943
2020-06-07T15:29:56
2020-06-07T15:29:56
176,267,157
0
0
null
null
null
null
UTF-8
C++
false
false
457
h
#pragma once #include "stdafx.h" #include "DFA.h" #include "Printer.h" class AutomatonMatcher { public: AutomatonMatcher(); AutomatonMatcher(shared_ptr<DFA> df); void setDFA(shared_ptr<DFA> d); void setPattern(string pt); void runMatcher(); void runMatcher(string pr, shared_ptr<DFA> d, int m); void runMatcher(string pr); void runMatcher(string text, string pattern, string alphabet); private: shared_ptr<DFA> dfa;//pointer string pattern; };
c863827ec7a48a236e5be239902e2575934fa90b
2b6808de2b45c1af9dbfa4febc8b0d8124dd5020
/abc143/ne.cpp
a92ea310b4a68f9a76e6c735f4afd0edc951b299
[]
no_license
aki0214/kyo-pro
360f819ea7b113cc6c9c20b9ede011b56a92b36d
1c73aa67e9fa34b99add751bc4670a104ca477fb
refs/heads/master
2022-11-03T19:03:57.993730
2022-10-29T14:42:09
2022-10-29T14:42:09
253,325,299
0
0
null
null
null
null
UTF-8
C++
false
false
307
cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0;i<n;i++) int main(){ int n,c; cin >> n; vector<int> v(n); rep(i,n)cin >> v[i]; sort(v.begin(), v.end()); rep(b,n)rep(a,b){ int l = b+1; int ab= v[a]+v[b]; int r = lower_bound(v.begin(), v.end(), ab)-v.begin(); } }
07846135cb4df45bec77fa47a5e93833a8c7c6ec
513e54bfd06cd72e65567ba5b92c8aae1d8729c7
/cppNodesAPI/nodeFactory.h
4e117771d321e1bd73d61d22674d557754bc9b0b
[ "MIT" ]
permissive
Daandelange/distantNodes
36aae20949591d841ac16c50e23b5844d055d5af
877116410129d2f2369fde6f30c5fa8772916441
refs/heads/master
2021-01-23T00:02:13.423000
2016-12-11T12:35:28
2016-12-11T12:35:28
68,731,218
1
0
null
null
null
null
UTF-8
C++
false
false
2,507
h
// // nodeFactory.h // karmaMapper // // Created by Daan de Lange on 18/09/2016. // // The node factory handles registration of all different node types // #pragma once // Standard libraries #include <map> #include <string> #include <utility> class baseNode; namespace node { namespace factory { typedef baseNode* (*CreateNodeFunc)(); typedef std::map<std::string, CreateNodeFunc> nodeRegistry; inline nodeRegistry& getAllNodeTypes(){ static nodeRegistry nodeTypes; return nodeTypes; } template<class T> baseNode* createNode() { return new T; } template<class T> struct NodeRegistryEntry { public: static NodeRegistryEntry<T>& Instance(const std::string& name){ static NodeRegistryEntry<T> inst(name); return inst; } private: NodeRegistryEntry(const std::string& name){ NodeRegistryEntry& reg = getAllNodeTypes(); CreateNodeFunc func = createNode<T>; std::pair<nodeRegistry::iterator, bool> ret = reg.insert(nodeRegistry::value_type(name, func)); if (ret.second == false) { // already registered } } NodeRegistryEntry(const NodeRegistryEntry<T>&) = delete; // C++11 feature NodeRegistryEntry& operator=(const NodeRegistryEntry<T>&) = delete; }; } // namespace factory } // namespace effect // allow node registration #define REGISTER_NODE(TYPE, NAME) \ namespace node { \ namespace factory { \ namespace \ { \ template<class T> \ class nodeRegistration; \ \ template<> \ class nodeRegistration<TYPE> \ { \ static const ::node::factory::NodeRegistryEntry<TYPE>& reg; \ }; \ \ const ::node::factory::NodeRegistryEntry<TYPE>& \ nodeRegistration<TYPE>::reg = \ ::node::factory ::NodeRegistryEntry<TYPE>::Instance(NAME); \ }}}
79e0bd51afbe2b86d83fa08f9a9fe733659baacb
4519e44d81ac49546de826d0e6d25288d7c5ddbd
/2019/2019-04-16 [Gabriel Aubut-Lussier] Automatisation de tests asynchrones/exemples/AsyncSystem/executors-impl-master/examples/async/async_3.cpp
baaa7f07391fc911310495287169f477d1a8d72b
[]
no_license
CppMtl/Meetups
cfec35e25fd2e2fb58534cd89f44a5c61b2d0ead
9a3fc491f4f2b79f6199cf1b781fb12687dc2b08
refs/heads/master
2023-01-24T22:14:01.799443
2023-01-10T21:45:24
2023-01-10T21:45:24
91,147,384
27
9
null
2023-01-10T21:45:26
2017-05-13T03:46:54
C++
UTF-8
C++
false
false
1,317
cpp
#include <experimental/thread_pool> #include <iostream> #include <tuple> namespace execution = std::experimental::execution; using std::experimental::static_thread_pool; template <class Executor, class Function, class Args, std::size_t... I> auto async_helper(Executor ex, Function f, Args args, std::index_sequence<I...>) { return execution::require(ex, execution::blocking_adaptation.allowed, execution::twoway).twoway_execute( [f = std::move(f), args = std::move(args)]() mutable { return f(std::move(std::get<I>(args))...); }); } template <class Executor, class Function, class... Args> auto async(Executor ex, Function f, Args&&... args) { return async_helper(std::move(ex), std::move(f), std::make_tuple(std::forward<Args>(args)...), std::make_index_sequence<sizeof...(Args)>()); } class inline_executor { public: friend bool operator==(const inline_executor&, const inline_executor&) noexcept { return true; } friend bool operator!=(const inline_executor&, const inline_executor&) noexcept { return false; } template <class Function> void execute(Function f) const noexcept { f(); } }; int main() { auto f = async(inline_executor(), [](int i, int j){ return i + j; }, 20, 22); std::cout << "result is " << f.get() << "\n"; }
926fcbf8436c8c95f54a9f36e1471a1696c2ad6f
0ef4f71c8ff2f233945ee4effdba893fed3b8fad
/misc_microsoft_gamedev_source_code/misc_microsoft_gamedev_source_code/tools/lightExporter/shared/x86/math/quat_x86.cpp
c009e3e6b3c41fe914d1f4ce82d348930222c7a6
[]
no_license
sgzwiz/misc_microsoft_gamedev_source_code
1f482b2259f413241392832effcbc64c4c3d79ca
39c200a1642102b484736b51892033cc575b341a
refs/heads/master
2022-12-22T11:03:53.930024
2020-09-28T20:39:56
2020-09-28T20:39:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,715
cpp
//----------------------------------------------------------------------------- // File: quat_x86.cpp // x86 optimized quaternion class. // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #include "quat_x86.h" #include "common/math/euler_angles.h" namespace gr { const Quat Quat::I(0.0f, 0.0f, 0.0f, 1.0f); const Quat Quat::Z(0.0f, 0.0f, 0.0f, 0.0f); Quat::Quat(const EulerAngles& eu) { eu.toQuat(*this); } Quat& Quat::operator= (const EulerAngles& eu) { return eu.toQuat(*this); } Quat& Quat::operator= (const Matrix44& m) { *this = makeFromMatrix(m); return *this; } Quat Quat::makeFromMatrix(const Matrix44& m) { Quat ret; if (!m.hasNoReflection3x3()) return Quat(0.0f, 0.0f, 0.0f, 0.0f); // See "Quaternion Calculus and Fast Animation", Ken Shoemake 1987 SIGGRAPH course notes. double trace = m[0][0] + m[1][1] + m[2][2]; if (trace > 0.0f) { double s = sqrt(trace + 1.0f); ret.vec[3] = s * .5f; s = 0.5f / s; ret.vec[0] = (m[2][1] - m[1][2]) * s; ret.vec[1] = (m[0][2] - m[2][0]) * s; ret.vec[2] = (m[1][0] - m[0][1]) * s; } else { int i = 0; if (m[1][1] > m[0][0]) i = 1; if (m[2][2] > m[i][i]) i = 2; const int j = Math::NextWrap(i, 3); const int k = Math::NextWrap(j, 3); double s = sqrt(1.0f + m[i][i] - m[j][j] - m[k][k]); ret.vec[i] = s * 0.5f; Assert(s > 0.0f); s = 0.5f / s; ret.vec[3] = (m[k][j] - m[j][k]) * s; ret.vec[j] = (m[j][i] + m[i][j]) * s; ret.vec[k] = (m[k][i] + m[i][k]) * s; } #if DEBUG Assert(ret.isUnit()); Matrix44 temp; ret.toMatrix(temp); Assert(Matrix44::equalTol3x3(m, temp, Math::fSmallEpsilon)); #endif return ret; } Quat Quat::slerp(const Quat& a, const Quat& b, float t) { float d = a.vec * b.vec; Vec4 bvec(b.vec); if (d < 0.0f) { d = -d; bvec = -bvec; } if (d > (1.0f - fQuatEpsilon)) return lerp(a, bvec, t); float omega = acos(d); float l = sin(omega * (1.0f - t)); float r = sin(omega * t); return (a.vec * l + bvec * r).normalize(); } Quat Quat::slerpExtraSpins(const Quat& a, const Quat& b, float t, int extraSpins) { float d = a.vec * b.vec; Vec4 bvec(b.vec); if (d < 0.0f) { d = -d; bvec = -bvec; } if (d > (1.0f - fQuatEpsilon)) return lerp(a, bvec, t); float omega = acos(d); float phase = Math::fPi * extraSpins * t; float l = sin(omega * (1.0f - t) - phase); float r = sin(omega * t + phase); return (a.vec * l + bvec * r).normalize(); } Quat Quat::slerpNoInvert(const Quat& a, const Quat& b, float t) { float d = a.vec * b.vec; if (d > (1.0f - fQuatEpsilon)) return lerp(a, b, t); // should probably check for d close to -1 here Vec4 bvec(b.vec); float omega = acos(d); float l = sin(omega * (1.0f - t)); float r = sin(omega * t); return (a.vec * l + bvec * r).normalize(); } Quat Quat::squad(const Quat& p0, const Quat& pa, const Quat& pb, const Quat& p1, float t) { return slerpNoInvert( slerpNoInvert(p0, p1, t), slerpNoInvert(pa, pb, t), 2.0f * t * (1.0f - t)); } void Quat::squadSetup(Quat& pa, Quat& pb, const Quat& p0, const Quat& p1, const Quat& p2) { Quat temp(0.25f * (unitLog(p0.unitInverse() * p1) - unitLog(p1.unitInverse() * p2))); pa = p1 * unitExp(temp); pb = p1 * unitExp(-temp); } // 3x-4x faster than slerp(), if you can tolerate less accuracy Quat Quat::slerpFast(const Quat& a, const Quat& b, float t) { float d = a.vec * b.vec; if (d > (1.0f - fQuatEpsilon)) return lerp(a, b, t); Vec4 bvec(b.vec); if (d < 0.0f) { d = -d; bvec = -bvec; } float omega = Math::fFastACos(d); float l = Math::fFastSin(omega * (1.0f - t)); float r = Math::fFastSin(omega * t); return (a.vec * l + bvec * r).normalize(); } Quat Quat::makeRotationArc(const Vec4& v0, const Vec4& v1) { Assert(v0.isVector()); Assert(v1.isVector()); Quat q; const Vec4 c(v0 % v1); const float d = v0 * v1; const float s = (float)sqrt((1 + d) * 2); // could multiply by 1/s instead q[0] = c[0] / s; q[1] = c[1] / s; q[2] = c[2] / s; q[3] = s * .5f; return q; } Quat Quat::unitLog(const Quat& q) { Assert(q.isUnit()); float scale = sqrt(Math::Sqr(q.vec[0]) + Math::Sqr(q.vec[1]) + Math::Sqr(q.vec[2])); float t = atan2(scale, q.vec[3]); if (scale > 0.0f) scale = t / scale; else scale = 1.0f; return Quat(scale * q.vec[0], scale * q.vec[1], scale * q.vec[2], 0.0f); } Quat Quat::unitExp(const Quat& q) { Assert(q.isPure()); float t = sqrt(Math::Sqr(q.vec[0]) + Math::Sqr(q.vec[1]) + Math::Sqr(q.vec[2])); float scale; if (t > Math::fSmallEpsilon) scale = sin(t) / t; else scale = 1.0f; Quat ret(scale * q.vec[0], scale * q.vec[1], scale * q.vec[2], cos(t)); #if DEBUG Quat temp(unitLog(ret)); Assert(Quat::equalTol(temp, q, Math::fLargeEpsilon)); #endif return ret; } // interpolates from identity Quat Quat::unitPow(const Quat& q, float p) { return unitExp(p * unitLog(q)); } Quat Quat::slerpLogForm(const Quat& a, const Quat& b, float t) { return a * unitPow(a.unitInverse() * b, t); } // same as pow(.5) Quat Quat::squareRoot(const Quat& q) { Assert(q.isUnit()); const float k = Math::ClampLow(0.5f * (q.scaler() + 1.0f), 0.0f); const float s = sqrt(k); const float d = 1.0f / (2.0f * s); Quat ret(q.vec[0] * d, q.vec[1] * d, q.vec[2] * d, s); #if DEBUG Assert(ret.isUnit()); Quat temp(ret * ret); Assert(Quat::equalTol(temp, q, Math::fLargeEpsilon)); #endif return ret; } Quat Quat::catmullRom(const Quat& q00, const Quat& q01, const Quat& q02, const Quat& q03, float t) { Quat q10(slerp(q00, q01, t + 1.0f)); Quat q11(slerp(q01, q02, t)); Quat q12(slerp(q02, q03, t - 1.0f)); Quat q20(slerp(q10, q11, (t + 1.0f) * .5f)); Quat q21(slerp(q11, q12, t * .5f)); return slerp(q20, q21, t); } Quat Quat::bezier(const Quat& q00, const Quat& q01, const Quat& q02, const Quat& q03, float t) { Quat q10(slerp(q00, q01, t)); Quat q11(slerp(q01, q02, t)); Quat q12(slerp(q02, q03, t)); Quat q20(slerp(q10, q11, t)); Quat q21(slerp(q11, q12, t)); return slerp(q20, q21, t); } Quat Quat::bSpline(const Quat& q00, const Quat& q01, const Quat& q02, const Quat& q03, float t) { Quat q10(slerp(q00, q01, (t + 2.0f) / 3.0f)); Quat q11(slerp(q01, q02, (t + 1.0f) / 3.0f)); Quat q12(slerp(q02, q03, t / 3.0f)); Quat q20(slerp(q10, q11, (t + 1.0f) * .5f)); Quat q21(slerp(q11, q12, t * .5f)); return slerp(q20, q21, t); } Quat Quat::makeRandom(float x1, float x2, float x3) { const float z = x1; const float o = Math::fTwoPi * x2; const float r = sqrt(1.0f - z * z); const float w = Math::fPi * x3; const float sw = sin(w); return Quat(sw * cos(o) * r, sw * sin(o) * r, sw * z, cos(w)); } Quat& Quat::setFromEuler(const Vec4& euler) { const float a = euler[0]; const float b = euler[1]; const float c = euler[2]; // not a particularly fast method const Quat qX(sin(a * .5f), 0, 0, cos(a * .5f)); // roll const Quat qY(0, sin(b * .5f), 0, cos(b * .5f)); // yaw const Quat qZ(0, 0, sin(c * .5f), cos(c * .5f)); // pitch *this = qX * qY * qZ; return *this; } Quat Quat::makeFromEuler(const Vec4& euler) { Quat ret; return ret.setFromEuler(euler); } } // namespace gr
6e8fb07e2f6c3fb376e1e03e63d02b0d4d5e0899
c1c30d822f7e00469ae6ceb9c8c7645e78974443
/kis_cimgconfig_widget.h
df3e5847e91c61519a1a51834714ceff5448c2b8
[]
no_license
KDE/krita-cimg
0105c1c4e96a80b59f5ed9d59e04ed415f02bf7f
1a56f0dc91655f046fe47dc11a03199984b5bd4b
refs/heads/master
2021-01-01T05:52:10.320304
2010-01-25T10:43:59
2010-01-25T10:43:59
42,732,940
2
1
null
null
null
null
UTF-8
C++
false
false
1,605
h
/* * This file is part of Krita * * Copyright (c) 2005 Boudewijn Rempt <[email protected]> * * 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. * * Ported from the CImg Gimp plugin by Victor Stinner and David Tschumperlé. */ #ifndef _KIS_CIMGCONFIG_WIDGET_ #define _KIS_CIMGCONFIG_WIDGET_ #include "ui_wdg_cimg.h" #include "filter/kis_filter.h" #include "kis_config_widget.h" class WdgCImg : public QWidget, public Ui::WdgCImg { Q_OBJECT public: WdgCImg(QWidget *parent) : QWidget(parent) { setupUi(this); } }; class KisCImgconfigWidget : public KisConfigWidget { Q_OBJECT public: KisCImgconfigWidget(QWidget * parent = 0, Qt::WFlags f = 0); virtual ~KisCImgconfigWidget() {} public: KisPropertiesConfiguration* configuration() const; void setConfiguration(const KisPropertiesConfiguration* config); private: WdgCImg * m_page; }; #endif // _KIS_CIMGCONFIG_WIDGET_
87335587cbf26346d3a1cdb39a92d04f799a344b
a7821483632b0235e9d2e61d1e67769fbf17b8db
/Engine/TestCameraScript.h
2e5a042d0d0f62580cb99301552b1b081f3c2875
[]
no_license
earthboom/DirectX12_Practice
e02b95c32c42f1cb3a5332aedc481c20f49b63bc
1827b752059225b3f3ad503a8efd4ba8c5d8f8a0
refs/heads/main
2023-08-14T10:35:38.815712
2021-10-11T06:53:26
2021-10-11T06:53:26
394,317,218
0
0
null
null
null
null
UTF-8
C++
false
false
225
h
#pragma once #include "MonoBehaviour.h" class TestCameraScript : public MonoBehaviour { public: TestCameraScript(); virtual ~TestCameraScript(); virtual void LateUpdate() override; private: float _speed = 100.0f; };
538e73339a2bd45ddb39706523f8c5144a8092df
c4b57f179e6e5d85c960a51cdb3cc8b0c36a92bb
/task1.cpp
a82e514ef2c67b79c1b7fb86fef68462f9ec79f1
[]
no_license
MikhailBekhovskiy/AVVS_tasks
c01d14d7486a518ce7fae64ac75377f5a6aa8148
aa10f0a9add52863b30c45284b1528217d3a4ed0
refs/heads/master
2020-12-02T07:10:06.530640
2019-12-30T19:41:02
2019-12-30T19:41:02
230,927,362
0
0
null
null
null
null
UTF-8
C++
false
false
2,182
cpp
#include <iostream> #include "aux.hpp" #include <chrono> using namespace std; int rows = 1000; int columns = 1000; double* minsInRows(double**A, int n, int m){ double* result = new double[n]; for (int i = 0;i<n;++i){ result[i] = A[i][0]; } for (int i = 0;i<n;++i){ for(int j=1;j<m;++j){ if (result[i] > A[i][j]){ result[i] = A[i][j]; } } } return result; } double maxInArray(double* b, int n){ double result = b[0]; for (int i = 1;i<n;++i){ if (b[i] > result){ result = b[i]; } } return result; } double maxFromMinsSeq(double** A, int n, int m){ double* rowMins = minsInRows(A, n, m); double result = maxInArray(rowMins, n); cout << "Max: " << result << endl; return result; } double maxFromMinsParallel(double** A, int n, int m) { int rows = n; int cols = m; int rowMin[rows]; int max = -1000; #pragma omp parallel shared(A, rows, cols, max, rowMin) default(none) { #pragma omp for for (int i = 0; i < rows; ++i) { rowMin[i] = A[i][0]; } #pragma omp for for (int i = 0; i < rows; ++i) { for (int j = 1; j < cols; ++j) { if (A[i][j] < rowMin[i]) { rowMin[i] = A[i][j]; } } } #pragma omp for reduction(max:max) for (int i = 0; i < rows; ++i) { if (max < rowMin[i]) { max = rowMin[i]; } } }; cout << "Max: " << max << endl; return max; } template <typename F> void printExecTime(F &function, double** A, int n, int m) { auto start = chrono::high_resolution_clock::now(); function(A, n, m); auto end = chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::nanoseconds> (end - start).count() / 1e9; cout << "Elapsed time: " << duration << endl; } int main(){ double** A = newMatrix(rows, columns); printExecTime(maxFromMinsSeq, A, rows, columns); printExecTime(maxFromMinsParallel, A, rows, columns); return 0; }
560779311de3c28096308c3b1ee8ddf904f650ae
23e8f7ef9a78f54dc1bfcb1ee51fde95326a6dc3
/code/company/tencent/product.cpp
bff49cfe12e5f7a18b4b6a89cc6e31366b706887
[]
no_license
longfloat/Job
45b6f94af09e5937c46f66d46fe32a5e3c546283
a817b42406b825585a29324c36068d447223ff7f
refs/heads/master
2021-01-01T19:39:07.478565
2013-11-05T03:40:36
2013-11-05T03:40:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
760
cpp
// 腾讯2012年实习生笔试加分题 //http://blog.csdn.net/morewindows/article/details/8742666 #include <iostream> using std::cout; using std::endl; void print_array(int a[], int n) { for (int i = 0; i < n; i++) cout << a[i] << "\t"; cout << endl; } int main() { const int MAXN = 5; int a[MAXN] = {1, 3, 5, 7, 9}; int b[MAXN]; cout << "a: "; print_array(a, MAXN); b[0] = 1; for (int i = 1; i < MAXN; i++) b[i] = b[i - 1] * a[i - 1]; //int temp = 1; for (int i = MAXN - 1; i >= 1; i--) { // temp *= a[i + 1]; // b[i] *= temp; b[i] *= b[0]; b[0] *= a[i]; } cout << "b: "; print_array(b, MAXN); return 0; }
d69e230a92c5ddf1854f0d2f775409bce9956d1c
a6e8b356488f2b79f5ac3717b45d979c0fcc48f4
/zombie_escape/components/cmp_sprite.cpp
85bb6596a17f07609958f14029f29cef0cb6b2ed
[ "Apache-2.0" ]
permissive
ChefSemiColon/Set091221
bb34cc4660b1763947b9eef79bf2acd9436502c2
99df026ebccb0ed4289119aee67ed1b82589fac0
refs/heads/main
2023-04-18T03:05:49.105363
2021-05-03T16:59:52
2021-05-03T16:59:52
338,377,023
0
0
Apache-2.0
2021-05-02T19:44:54
2021-02-12T16:49:03
C++
UTF-8
C++
false
false
956
cpp
#include "cmp_sprite.h" #include "system_renderer.h" using namespace std; void SpriteComponent::setTexure(std::shared_ptr<sf::Texture> tex) { _texture = tex; _sprite->setTexture(*_texture); } SpriteComponent::SpriteComponent(Entity* p) : Component(p), _sprite(make_shared<sf::Sprite>()) {} void SpriteComponent::update(double dt) { _sprite->setPosition(_parent->getPosition()); _sprite->setRotation(_parent->getRotation()); } void SpriteComponent::render() { Renderer::queue(_sprite.get()); } void ShapeComponent::update(double dt) { _shape->setPosition(_parent->getPosition()); _shape->setRotation(_parent->getRotation()); } void ShapeComponent::render() { Renderer::queue(_shape.get()); } sf::Shape& ShapeComponent::getShape() const { return *_shape; } ShapeComponent::ShapeComponent(Entity* p) : Component(p), _shape(make_shared<sf::CircleShape>()) {} sf::Sprite& SpriteComponent::getSprite() const { return *_sprite; }
8f7071e9c5998718f6d876a5f96c89123455132b
72b187a3fe6bf222725cd3030240735c7b16420c
/ParPalabras.h
fcfb1444352feb02a8c96907e0efad3ba10aab17
[]
no_license
SergioPerea99/Data-Structure
8cd008d5be830460bf902467e629f9620c8ab857
bce494dc65c6fa9d333335f37e920e138fce933f
refs/heads/master
2023-02-16T05:20:59.467602
2020-12-19T13:37:08
2020-12-19T13:37:27
299,949,570
0
0
null
null
null
null
UTF-8
C++
false
false
790
h
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: ParPalabras.h * Author: spdlc * * Created on 6 de octubre de 2020, 19:52 */ #ifndef PARPALABRAS_H #define PARPALABRAS_H #include <iostream> using namespace std; class ParPalabras { private: string pal1; string pal2; public: ParPalabras(); ParPalabras(string _pal1, string _pal2); ParPalabras(const ParPalabras& orig); virtual ~ParPalabras(); void SetPal2(string pal2); string GetPal2() const; void SetPal1(string pal1); string GetPal1() const; bool operator==(const ParPalabras& dato); }; #endif /* PARPALABRAS_H */
97a5e90ff8bcb303652eeaecc9940378e04eb947
544275d9f71b073e878dac64a178d1300761642f
/handler/MessageErrorHandler.h
e832858f5949389a32fb1f5f7692945096e6695c
[ "Apache-2.0" ]
permissive
406345/MelotonNode
4b980543a4ac28eab3a2d84f28ed5ea007a64383
179abf076ebcf0f758e71c8640e747b1e131aa7e
refs/heads/master
2021-05-31T12:21:10.434342
2016-04-18T06:01:13
2016-04-18T06:01:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,353
h
/*********************************************************************************** This file is part of Project for Meloton For the latest info, see https://github.com/Yhgenomics/MelotonNode.git Copyright 2016 Yhgenomics 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. ***********************************************************************************/ /*********************************************************************************** * Description : MessageError handler. * Creator : Shubo Yang([email protected]) * Date : 2016-03-22 * Modifed : 2016-03-22 | Shubo Yang | Create ***********************************************************************************/ #include <string> #include <MRT.h> #include <MessageError.pb.h> static int MessageErrorHandler( MRT::Session * session , uptr<MessageError> message ) { return 0; }
f872169cd2d09d3249c88c2a6326d833a3284e72
f4773601a403d7c94741a5b26055b98ebdd36d51
/gr-CyberRadio/lib/vita_multifile_iq_source_impl.h
001098b12886964f6281390654d6ac5a9930a70e
[]
no_license
blsmit5728/gr-cyberradio
b3ebd8136536a2e8a22c1af8ff529cf1ea21801a
3db07c4bdc9faecd4ef461ecda9bd7dedfdb72ba
refs/heads/master
2021-12-04T06:42:23.420053
2021-11-25T12:14:04
2021-11-25T12:14:04
97,597,729
0
0
null
2017-07-18T12:52:24
2017-07-18T12:52:24
null
UTF-8
C++
false
false
3,416
h
/* -*- c++ -*- */ /*************************************************************************** * \file vita_multifile_iq_source_impl.h * * \brief Implementation of vita_multifile_iq_source block. * * \author DA * \copyright Copyright (c) 2015 CyberRadio Solutions, Inc. * */ #ifndef INCLUDED_CYBERRADIO_VITA_MULTIFILE_IQ_SOURCE_IMPL_H #define INCLUDED_CYBERRADIO_VITA_MULTIFILE_IQ_SOURCE_IMPL_H #include <CyberRadio/api.h> #include <CyberRadio/vita_multifile_iq_source.h> #include <LibCyberRadio/Common/Vita49Packet.h> #include <boost/thread/mutex.hpp> #include <string> #include <vector> typedef LibCyberRadio::Vita49Packet Vita49Packet; namespace gr { namespace CyberRadio { class CYBERRADIO_API vita_multifile_iq_source_impl : virtual public vita_multifile_iq_source { public: vita_multifile_iq_source_impl( const std::vector<std::string>& filespecs, bool alphabetical, int vita_type, size_t payload_size, size_t vita_header_size, size_t vita_tail_size, bool byte_swapped, bool iq_swapped, float iq_scale_factor, bool repeat, bool terminate_at_end, bool tagged, bool debug); ~vita_multifile_iq_source_impl(); void open(const std::vector<std::string>& filespecs, bool alphabetical, bool repeat, bool terminate_at_end); void close(); void set_iq_scale_factor(float iq_scale_factor); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); float get_realtime_sample_rate(); protected: void open_immediate( const std::vector<std::string>& filespecs, bool alphabetical, bool repeat, bool terminate_at_end); void close_immediate(); void open_file_immediate(); void close_file_immediate(); void next_file_immediate(); int read_output_items_immediate(gr_complex *out); void generate_vita_tags(int output, const Vita49Packet& vp); int debug(const char *format, ...); protected: // From block configuration bool d_alphabetical; int d_vita_type; size_t d_payload_size; // maximum transmission unit (packet length) size_t d_vita_header_size; size_t d_vita_tail_size; bool d_byte_swapped; bool d_iq_swapped; float d_iq_scale_factor; bool d_repeat; bool d_terminate_at_end; bool d_tagged; bool d_debug; // Internal state data std::vector<std::string> d_filenames; size_t d_packet_size; int d_filename_index; FILE *d_fp; boost::mutex d_fp_mutex; unsigned char *d_buffer; int d_buffer_offset; bool d_packet_data_available; uint64_t d_absolute_packet_num; float d_realtime_sample_rate; long d_realtime_sample_count; time_t d_realtime_last_time; }; } /* namespace CyberRadio */ } /* namespace gr */ #endif /* INCLUDED_CYBERRADIO_VITA_MULTIFILE_IQ_SOURCE_IMPL_H */
baffd8e5801cc406b8e8db668e5b0cb2b158baf5
0efb71923c02367a1194a9b47779e8def49a7b9f
/Oblig1/les/1.45/U_0
4d006377f2a8184d1e9421f6bbde7184eee49e2c
[]
no_license
andergsv/blandet
bbff505e8663c7547b5412700f51e3f42f088d78
f648b164ea066c918e297001a8049dd5e6f786f9
refs/heads/master
2021-01-17T13:23:44.372215
2016-06-14T21:32:00
2016-06-14T21:32:00
41,495,450
0
0
null
null
null
null
UTF-8
C++
false
false
189,876
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "1.45"; object U_0; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 8800 ( (8.09747 0.382859 0) (5.57176 0.241491 0) (4.0116 0.0602975 0) (3.00847 -0.0231938 0) (2.91046 -0.0242666 0) (2.35335 0.00422874 0) (2.73195 -0.0235243 0) (2.1959 0.00748576 0) (2.57557 0.00842045 0) (2.06264 -0.0156309 0) (2.54295 0.00515004 0) (1.95253 0.00898446 0) (2.45888 -0.00927 0) (1.92309 0.00112795 0) (2.41267 0.00743657 0) (1.82063 -0.00344655 0) (2.39903 -0.00576631 0) (1.78125 0.00697466 0) (2.43163 0.0159868 0) (1.34623 -0.120865 0) (10.1701 0.80721 0) (9.69989 0.847059 0) (9.2844 0.579644 0) (7.77336 0.251794 0) (7.94235 0.133985 0) (6.28964 0.106568 0) (7.53674 -0.0172449 0) (5.65375 0.063058 0) (7.11361 0.0471352 0) (5.39648 -0.0240029 0) (6.83642 0.0364275 0) (5.10285 0.0383303 0) (6.73327 -0.0177964 0) (4.92432 0.0165142 0) (6.60014 0.0357837 0) (4.7548 -0.00369798 0) (6.53743 0.00165972 0) (4.5566 0.00755265 0) (6.6197 0.0543346 0) (4.20286 -0.114764 0) (10.5754 0.574764 0) (10.2956 0.796857 0) (11.7217 0.730432 0) (10.0676 0.34706 0) (11.4887 0.291705 0) (8.79152 0.216956 0) (11.3661 0.0278808 0) (8.09572 0.166719 0) (10.882 0.0915946 0) (7.88686 0.00607983 0) (10.4231 0.0921867 0) (7.49685 0.0702602 0) (10.328 -0.00993152 0) (7.20241 0.0435824 0) (10.1364 0.064115 0) (7.05769 0.00471317 0) (9.99601 0.0238602 0) (6.81615 0.0202281 0) (10.0386 0.0490613 0) (6.68036 -0.122621 0) (11.5991 0.386515 0) (9.6055 0.662277 0) (12.7665 0.674723 0) (9.91443 0.248653 0) (13.5497 0.393746 0) (9.4877 0.251475 0) (13.7723 0.0165083 0) (9.23097 0.266067 0) (13.6211 0.101681 0) (9.28272 0.0346982 0) (13.1636 0.159237 0) (9.16865 0.0994669 0) (13.0823 0.00293158 0) (8.92105 0.0836395 0) (12.8944 0.0898151 0) (9.01273 0.022921 0) (12.5964 0.0351272 0) (8.94042 0.0585744 0) (12.5139 0.0142553 0) (9.11583 -0.0825017 0) (12.7965 0.0616477 0) (8.98082 0.622614 0) (14.3444 0.74787 0) (8.35386 0.0635936 0) (14.5103 0.33913 0) (9.43466 0.276642 0) (14.4913 -0.0526507 0) (9.1394 0.321815 0) (14.8604 0.0750231 0) (9.49625 0.0673782 0) (14.1635 0.146972 0) (10.1492 0.141847 0) (14.2098 -0.00563981 0) (9.986 0.12166 0) (14.0399 0.0539962 0) (10.6888 0.0896321 0) (13.5897 -0.00580678 0) (10.7904 0.131519 0) (13.4212 -0.0612458 0) (11.2845 0.0272563 0) (12.5501 -0.156738 0) (7.71524 0.3243 0) (15.4955 0.8069 0) (8.0449 0.164278 0) (14.0614 0.0922011 0) (10.0397 0.321744 0) (13.735 -0.0406325 0) (9.11336 0.280315 0) (14.2951 -0.0256871 0) (9.84932 0.191121 0) (13.2317 0.0189578 0) (10.745 0.112089 0) (13.6464 -0.0121139 0) (10.7063 0.155619 0) (13.3307 -0.0834397 0) (11.7798 0.133787 0) (13.1183 -0.0326777 0) (11.8358 0.166751 0) (12.9703 -0.110555 0) (12.363 0.084323 0) (12.0862 -0.124828 0) (6.98618 0.00313823 0) (14.5522 0.722824 0) (9.15228 0.430309 0) (12.8251 -0.140813 0) (10.3828 0.376627 0) (12.7355 0.0577703 0) (9.51285 0.268198 0) (12.9902 -0.151543 0) (10.5171 0.325704 0) (12.369 -0.0711024 0) (11.2535 0.0404135 0) (12.9055 -0.0331372 0) (11.5435 0.211767 0) (12.6201 -0.206546 0) (12.3714 0.121639 0) (12.6843 -0.0376454 0) (12.3965 0.217365 0) (12.5963 -0.167923 0) (12.6841 0.216799 0) (11.4163 -0.0605749 0) (7.61922 -0.121831 0) (13.2295 0.37783 0) (10.2198 0.518782 0) (11.7544 -0.196655 0) (10.3177 0.404029 0) (11.8289 0.0739772 0) (10.2056 0.290604 0) (12.1486 -0.290477 0) (11.1196 0.310218 0) (12.2629 -0.130306 0) (11.9092 -0.0248452 0) (12.5169 -0.0922316 0) (12.2124 0.203059 0) (12.4064 -0.234247 0) (12.6685 0.0726157 0) (12.3958 -0.0161459 0) (12.6514 0.202804 0) (12.5244 -0.134887 0) (12.6158 0.152854 0) (10.8345 -0.0175461 0) (9.24619 -0.326729 0) (11.4469 0.106017 0) (10.6313 0.675783 0) (11.1555 -0.167352 0) (10.4674 0.396084 0) (11.5484 0.00889384 0) (11.3992 0.207697 0) (11.9314 -0.384057 0) (11.5586 0.22857 0) (12.5165 -0.193217 0) (12.2981 -0.0635028 0) (12.0572 -0.0813513 0) (12.4391 0.170704 0) (12.307 -0.21634 0) (12.5977 0.0235741 0) (11.9814 0.0359572 0) (12.6105 0.102937 0) (12.527 -0.0676107 0) (12.3251 -0.0611674 0) (11.3917 -0.177703 0) (9.24967 -0.111287 0) (8.9031 0.0545826 0) (11.3432 0.602865 0) (11.088 -0.0807146 0) (10.6693 0.38906 0) (12.0377 -0.181072 0) (12.1633 0.21556 0) (11.6495 -0.274667 0) (11.6843 0.111657 0) (12.5832 -0.216433 0) (11.9737 0.0566412 0) (11.4487 -0.0767241 0) (12.541 0.067843 0) (12.058 -0.155866 0) (12.146 0.0741567 0) (11.5348 0.0463856 0) (12.5394 -0.0106494 0) (12.4094 -0.0238531 0) (11.748 -0.0406446 0) (11.2502 -0.261653 0) (8.59715 0.382411 0) (8.7107 -0.474981 0) (11.7744 0.108051 0) (10.7543 0.00657419 0) (11.2444 0.178686 0) (12.2736 -0.390137 0) (11.9322 0.262656 0) (11.7524 -0.2259 0) (11.8858 -0.103338 0) (12.1734 -0.196711 0) (11.7869 0.157481 0) (11.3619 -0.183454 0) (12.5033 -0.067208 0) (11.6464 -0.0312494 0) (12.0492 0.0661755 0) (11.5139 -0.0271154 0) (12.4963 -0.156385 0) (12.2232 0.0745661 0) (11.4245 -0.00699399 0) (9.84702 -0.233717 0) (9.29243 0.542318 0) (10.1063 -0.724063 0) (11.7442 -0.00998405 0) (10.2668 0.0709662 0) (12.2058 -0.0252251 0) (11.7861 -0.372254 0) (11.5298 0.280443 0) (11.9677 -0.177666 0) (12.0178 -0.119791 0) (11.4897 -0.106109 0) (11.9343 0.195061 0) (11.7153 -0.204401 0) (12.2522 -0.0879862 0) (11.4101 0.0477235 0) (12.3721 0.034208 0) (11.7402 -0.0571302 0) (12.4209 -0.192318 0) (11.9975 0.141887 0) (11.7028 0.0146138 0) (8.77062 -0.13579 0) (10.6767 0.327732 0) (10.7798 -0.864732 0) (11.5058 0.0839539 0) (10.2558 -0.0420343 0) (12.8062 -0.183189 0) (11.0069 -0.204456 0) (11.4872 0.178518 0) (12.0607 -0.227669 0) (12.1057 -0.0761337 0) (11.0521 -0.0695352 0) (12.2935 0.0575988 0) (12.0938 -0.199386 0) (11.9855 -0.048458 0) (11.5156 0.0243299 0) (12.7249 -0.0530652 0) (12.002 -0.0568613 0) (12.4017 -0.178692 0) (11.9052 0.126945 0) (12.4231 -0.0979052 0) (9.21512 -0.160101 0) (11.0455 5.2607e-05 0) (10.771 -0.814697 0) (11.4443 0.100733 0) (10.6564 -0.206459 0) (12.6203 -0.241027 0) (10.9427 -0.0475951 0) (11.7409 -0.0578774 0) (12.0932 -0.255856 0) (12.2796 0.000964119 0) (11.1471 -0.06406 0) (12.7208 -0.119935 0) (12.1953 -0.105076 0) (12.01 -0.00857106 0) (11.9819 -0.0741277 0) (12.8961 -0.122676 0) (12.2631 -0.0241694 0) (12.3525 -0.143395 0) (12.375 0.0149014 0) (12.8433 -0.193246 0) (9.81103 -0.259111 0) (10.5945 -0.142996 0) (11.0754 -0.823181 0) (11.2392 0.0385275 0) (11.2705 -0.286424 0) (12.1581 -0.296607 0) (11.435 0.0261597 0) (11.825 -0.195733 0) (12.1902 -0.26897 0) (12.1127 0.0419744 0) (11.6183 -0.101514 0) (12.7214 -0.236411 0) (12.0905 -0.0109644 0) (12.1176 -0.0359653 0) (12.297 -0.157575 0) (12.7025 -0.138173 0) (12.1815 0.0282687 0) (12.2928 -0.17955 0) (12.6344 -0.105574 0) (12.4654 -0.195217 0) (9.64924 -0.333623 0) (10.8394 -0.370443 0) (11.085 -0.776225 0) (11.2368 -0.029211 0) (11.7334 -0.347862 0) (11.7294 -0.312361 0) (11.7609 0.0225814 0) (11.824 -0.263089 0) (12.0429 -0.24878 0) (11.8493 0.0450295 0) (11.8584 -0.151461 0) (12.1308 -0.236114 0) (11.8298 0.0269489 0) (11.8569 -0.0698862 0) (11.9718 -0.1845 0) (11.927 -0.0979063 0) (11.7573 0.0172422 0) (11.7683 -0.216022 0) (11.8838 -0.115636 0) (11.4489 -0.14507 0) (9.65073 -0.451517 0) (11.0423 -0.576417 0) (10.9347 -0.724106 0) (11.5259 -0.20832 0) (11.6845 -0.364433 0) (11.2927 -0.311194 0) (11.6398 -0.0545652 0) (11.2474 -0.240715 0) (11.2309 -0.215917 0) (11.1148 0.00657647 0) (11.038 -0.134956 0) (10.8201 -0.185478 0) (10.8327 0.0123836 0) (10.6587 -0.0701909 0) (10.6116 -0.14351 0) (10.4354 -0.073576 0) (10.4561 0.00503158 0) (10.1922 -0.173975 0) (10.2285 -0.0817494 0) (9.82745 -0.161123 0) (9.83389 -0.6315 0) (10.9935 -0.772671 0) (10.6321 -0.699568 0) (10.982 -0.322959 0) (10.4761 -0.302011 0) (9.91532 -0.255122 0) (10.0224 -0.061525 0) (9.38371 -0.143011 0) (9.25149 -0.148046 0) (9.09993 0.0123435 0) (8.91328 -0.0696578 0) (8.61959 -0.119632 0) (8.69139 0.0127276 0) (8.43427 -0.0296941 0) (8.37066 -0.0917505 0) (8.18275 -0.0456933 0) (8.22385 0.0120845 0) (7.9121 -0.107298 0) (7.94032 -0.0700655 0) (7.57908 -0.0891987 0) (9.97714 -0.838377 0) (9.84855 -0.82118 0) (8.76922 -0.560135 0) (8.2789 -0.254568 0) (7.44685 -0.143669 0) (6.89178 -0.120152 0) (6.77295 -0.00597261 0) (6.32824 -0.0374909 0) (6.18106 -0.0719344 0) (6.05238 0.0238266 0) (5.95401 -0.0167763 0) (5.72181 -0.0638502 0) (5.75415 0.0133839 0) (5.59487 -0.000450186 0) (5.5428 -0.0478048 0) (5.37488 -0.0245375 0) (5.4153 0.0162477 0) (5.19047 -0.0537906 0) (5.17977 -0.0414571 0) (4.8687 -0.0204027 0) (8.07354 -0.390345 0) (5.51937 -0.234017 0) (3.90777 -0.0590812 0) (3.18703 0.0163504 0) (2.76806 0.0260776 0) (2.53815 -0.00327598 0) (2.47004 0.0189044 0) (2.39583 0.00320271 0) (2.29431 -0.0150579 0) (2.24458 0.0142227 0) (2.26638 0.00289143 0) (2.14425 -0.014718 0) (2.12854 0.00817293 0) (2.11714 0.00756647 0) (2.08608 -0.00982384 0) (1.98055 -0.00380409 0) (2.01203 0.0104824 0) (1.93668 -0.010547 0) (1.87417 -0.00509234 0) (1.71347 0.0125276 0) (2.73543 -0.0957087 0) (2.27334 0.00737982 0) (2.90459 0.0154012 0) (2.35502 0.0395786 0) (3.0613 0.0131153 0) (2.49535 0.03414 0) (3.26727 -0.00702087 0) (2.65951 0.000297608 0) (3.44841 -0.0618357 0) (2.78405 -0.0646024 0) (3.58073 -0.120443 0) (2.85149 -0.0841658 0) (3.67401 -0.0782521 0) (2.89804 0.04177 0) (3.80514 0.131371 0) (3.0533 0.324436 0) (4.17757 0.4584 0) (3.45156 0.653248 0) (4.78642 0.72602 0) (4.02292 0.799156 0) (5.53668 0.704577 0) (4.71801 0.57506 0) (6.31721 0.238752 0) (5.47262 -0.102544 0) (7.04936 -0.55491 0) (6.15012 -0.959277 0) (7.54547 -1.48437 0) (6.53677 -1.88204 0) (7.67486 -2.20292 0) (6.72975 -2.21768 0) (7.63008 -2.23368 0) (6.72052 -2.0664 0) (7.31276 -1.85085 0) (6.43351 -1.4659 0) (6.4406 -1.30429 0) (5.3195 -0.954801 0) (5.28134 -0.593613 0) (4.60763 0.0681266 0) (4.94101 0.533899 0) (4.42778 1.26101 0) (5.3298 1.77034 0) (4.49423 2.48218 0) (5.88605 3.07743 0) (4.50402 3.70296 0) (6.35175 4.04323 0) (4.86916 4.0472 0) (6.87791 3.58072 0) (5.50266 2.91975 0) (7.23882 1.90126 0) (6.00282 0.856034 0) (7.58529 -0.376211 0) (6.40478 -1.39554 0) (7.95359 -2.31742 0) (6.91076 -2.83614 0) (8.31587 -3.43351 0) (7.01891 -4.03704 0) (8.02932 -4.52722 0) (7.23825 -4.24331 0) (8.26227 -3.72594 0) (7.13545 -3.32134 0) (7.35075 -2.83568 0) (6.81553 -1.97865 0) (7.20767 -1.21256 0) (6.48241 -0.598826 0) (6.52511 -0.145886 0) (5.96813 0.37897 0) (6.19987 0.745775 0) (5.90776 1.25348 0) (6.46534 1.66248 0) (6.30408 2.14551 0) (6.99211 2.35373 0) (6.51547 2.44109 0) (7.22845 2.22084 0) (6.23806 2.0434 0) (6.77712 1.93889 0) (5.2029 2.17777 0) (5.91969 2.45369 0) (4.22742 2.7202 0) (5.47961 2.66951 0) (3.89302 2.40292 0) (5.48798 1.78043 0) (3.9979 1.0893 0) (5.72667 0.201407 0) (4.32124 -0.563835 0) (6.16505 -1.38751 0) (4.77268 -1.85381 0) (6.55362 -2.35041 0) (5.13578 -2.48528 0) (6.81499 -2.68599 0) (5.56708 -2.48599 0) (7.19722 -2.26001 0) (6.14827 -1.67099 0) (7.26361 -1.37424 0) (5.87333 -1.0413 0) (6.56959 -0.883595 0) (5.40215 -0.344647 0) (6.41411 0.0399453 0) (5.30325 0.641183 0) (6.311 0.855178 0) (5.01312 1.36635 0) (6.40964 1.51488 0) (4.83427 2.00514 0) (6.90107 2.15945 0) (4.75597 2.45979 0) (7.42649 2.41979 0) (4.78127 2.59428 0) (7.71937 2.37658 0) (5.06057 2.4444 0) (7.82816 2.01934 0) (5.44502 1.97916 0) (8.05367 1.53607 0) (6.14383 1.43447 0) (8.53923 0.771042 0) (6.73805 0.493039 0) (9.19549 -0.0974992 0) (7.53395 -0.298059 0) (9.9754 -0.962932 0) (8.21971 -1.20154 0) (10.6632 -1.78842 0) (8.70656 -2.09022 0) (11.1573 -2.83853 0) (9.15321 -3.27033 0) (11.5333 -3.98692 0) (9.50165 -4.30575 0) (11.668 -4.78055 0) (9.63117 -4.70098 0) (11.2348 -4.72431 0) (9.52891 -4.38513 0) (10.5959 -4.2074 0) (9.22967 -3.67289 0) (9.71201 -3.45934 0) (8.93355 -3.09444 0) (9.05425 -2.92804 0) (8.52414 -2.44515 0) (8.33783 -2.34412 0) (7.90806 -2.08832 0) (7.61289 -1.83933 0) (7.60691 -1.57708 0) (7.43203 -1.34353 0) (7.31058 -0.996164 0) (6.73282 -0.812772 0) (6.24143 -0.698395 0) (5.47654 -0.666913 0) (4.69729 -0.459191 0) (3.75254 -0.388911 0) (2.72077 -0.279148 0) (2.41787 0.254449 0) (1.94595 0.910016 0) (2.04343 1.62184 0) (1.92027 2.43252 0) (1.92192 3.11603 0) (2.03849 4.21247 0) (2.56506 4.53607 0) (2.07842 5.42963 0) (3.60089 5.78518 0) (2.5997 5.77194 0) (3.93346 5.63614 0) (3.92072 5.34682 0) (4.48754 4.69569 0) (4.55198 4.77108 0) (5.348 4.02163 0) (5.06577 3.95514 0) (5.80733 3.13662 0) (5.09903 3.36909 0) (6.31042 2.36488 0) (5.17732 2.79983 0) (7.00819 1.25497 0) (5.83131 1.63439 0) (7.91161 -0.271643 0) (7.05304 0.237348 0) (8.74379 -1.47008 0) (7.93082 -0.532369 0) (8.98485 -1.92057 0) (8.0109 -0.745995 0) (8.89267 -2.09497 0) (7.79526 -0.939311 0) (8.75768 -2.4122 0) (7.91704 -1.34091 0) (8.92819 -2.83677 0) (8.4629 -1.84051 0) (9.55403 -3.27513 0) (9.42557 -2.48293 0) (10.4268 -3.71603 0) (10.5805 -3.01306 0) (11.2775 -3.97056 0) (11.6222 -3.32805 0) (11.9065 -3.86273 0) (12.321 -3.14974 0) (12.2325 -3.28241 0) (12.662 -2.46733 0) (12.301 -2.31742 0) (12.7397 -1.30928 0) (12.0604 -0.905566 0) (12.3895 0.422532 0) (11.5761 0.949144 0) (11.4022 2.39272 0) (11.0245 3.63312 0) (9.02225 4.68078 0) (11.1388 6.5237 0) (5.9289 11.6396 0) (6.07498 -0.0831835 0) (5.25063 0.00763215 0) (6.06747 0.0248136 0) (5.16004 0.0311643 0) (6.1217 -0.0103657 0) (5.20212 -0.0105346 0) (6.28553 -0.0597946 0) (5.29965 -0.0349512 0) (6.43645 -0.0796816 0) (5.35442 -0.0663571 0) (6.53499 -0.1018 0) (5.33487 -0.0620663 0) (6.5837 -0.0531114 0) (5.28164 0.038284 0) (6.62704 0.0836899 0) (5.2822 0.215787 0) (6.81678 0.279442 0) (5.51817 0.412751 0) (7.25263 0.435984 0) (6.03169 0.472915 0) (7.90784 0.370875 0) (6.76966 0.248813 0) (8.65471 -0.064383 0) (7.53401 -0.399906 0) (9.31762 -0.824735 0) (8.14709 -1.19546 0) (9.79806 -1.64052 0) (8.54195 -1.96001 0) (9.95582 -2.20619 0) (8.45222 -2.16492 0) (9.65091 -2.03296 0) (8.10507 -1.9322 0) (9.14151 -1.96334 0) (7.66148 -1.52212 0) (8.7081 -0.816387 0) (6.89099 -0.228377 0) (7.48951 -0.094655 0) (5.50584 0.165096 0) (6.75198 0.532503 0) (5.0466 1.16048 0) (6.75196 1.71516 0) (4.941 2.34288 0) (6.92298 2.89971 0) (5.22192 3.42374 0) (7.39049 3.66564 0) (6.08705 3.64861 0) (8.11105 3.20096 0) (7.0714 2.55485 0) (8.79231 1.61306 0) (7.79943 0.594707 0) (9.21157 -0.53656 0) (8.00513 -1.57364 0) (9.38053 -2.48769 0) (8.27598 -3.08092 0) (9.82109 -3.42726 0) (8.76908 -3.63471 0) (9.81784 -4.22244 0) (8.16111 -4.57435 0) (9.47464 -3.98675 0) (8.50856 -2.97187 0) (8.92547 -2.46667 0) (7.33706 -1.84509 0) (8.14085 -1.07768 0) (7.11964 -0.369985 0) (7.68514 -0.00037819 0) (6.58146 0.486491 0) (7.30614 0.884297 0) (6.27561 1.28402 0) (7.19905 1.50332 0) (6.23057 1.80217 0) (7.54517 2.03091 0) (6.57569 2.23801 0) (7.95324 2.24318 0) (6.57781 2.27869 0) (7.62048 2.32517 0) (5.79818 2.59233 0) (6.89773 2.79836 0) (5.20806 2.95452 0) (6.61333 2.76724 0) (5.22487 2.41104 0) (6.71733 1.73715 0) (5.46054 0.990881 0) (7.00961 0.0481156 0) (5.85549 -0.771439 0) (7.52935 -1.59151 0) (6.32283 -2.07879 0) (7.99183 -2.51418 0) (6.53619 -2.61062 0) (8.17392 -2.72314 0) (6.53139 -2.58819 0) (8.26714 -2.5596 0) (6.84929 -2.08464 0) (8.7482 -1.5008 0) (7.26241 -0.704776 0) (8.62843 -0.371923 0) (6.44784 -0.0960602 0) (7.96344 0.000608272 0) (5.91635 0.548484 0) (8.00351 0.910103 0) (5.78085 1.45218 0) (8.13126 1.643 0) (5.43008 1.97409 0) (8.16611 2.02137 0) (5.37642 2.32653 0) (8.26501 2.24199 0) (5.70937 2.43278 0) (8.29667 2.12556 0) (6.26915 2.2607 0) (8.50235 1.88812 0) (6.8673 1.74048 0) (8.81987 1.22369 0) (7.59643 1.10398 0) (9.56491 0.479668 0) (8.31984 0.222983 0) (10.3311 -0.42619 0) (9.0536 -0.612836 0) (11.0645 -1.27284 0) (9.54642 -1.48179 0) (11.6938 -2.08578 0) (9.92141 -2.32255 0) (12.2118 -3.04252 0) (10.2653 -3.43371 0) (12.6528 -4.17538 0) (10.4662 -4.37839 0) (12.7019 -4.78173 0) (10.1798 -4.51716 0) (12.1388 -4.55952 0) (9.65454 -4.0996 0) (11.276 -3.93733 0) (9.02522 -3.3748 0) (10.3765 -3.2988 0) (8.68093 -2.85676 0) (9.5145 -2.5856 0) (8.30018 -2.2481 0) (8.77298 -2.12524 0) (8.01864 -1.74414 0) (8.01905 -1.67911 0) (7.66854 -1.4106 0) (7.3415 -1.26067 0) (7.32933 -0.894071 0) (7.00758 -0.555214 0) (6.97807 -0.267869 0) (6.30854 -0.0625841 0) (5.8298 0.119925 0) (4.96558 0.281881 0) (4.19415 0.416947 0) (3.43866 0.621346 0) (2.76137 1.12386 0) (3.09359 1.76238 0) (2.39496 2.464 0) (3.40668 3.14483 0) (2.52023 3.7451 0) (3.85769 4.46822 0) (3.5315 4.83967 0) (3.96236 5.52643 0) (4.75844 5.64296 0) (4.54267 5.23312 0) (5.12311 5.07171 0) (5.79394 4.40907 0) (5.09504 4.63971 0) (6.84811 3.62071 0) (5.32002 4.10644 0) (7.63327 2.78237 0) (5.29353 3.53848 0) (8.25977 1.85016 0) (5.76947 2.85084 0) (8.98394 0.557231 0) (7.00658 1.43987 0) (9.9023 -0.992758 0) (8.05136 0.0486948 0) (10.4326 -1.9797 0) (7.9545 -0.386547 0) (10.1493 -2.16645 0) (7.31705 -0.345009 0) (9.76488 -2.29759 0) (6.98765 -0.697749 0) (9.94886 -2.78297 0) (7.42539 -1.4504 0) (10.5963 -3.33743 0) (8.50123 -2.26885 0) (11.5966 -3.90437 0) (9.83533 -2.99625 0) (12.531 -4.26368 0) (11.0974 -3.44696 0) (13.1743 -4.4003 0) (12.0513 -3.55012 0) (13.4907 -4.03532 0) (12.6665 -3.18889 0) (13.5839 -3.25036 0) (13.0041 -2.41407 0) (13.6485 -2.12224 0) (13.0805 -1.1909 0) (13.739 -0.576823 0) (12.6143 0.434867 0) (13.8281 1.53755 0) (11.3801 2.58493 0) (14.2334 3.67439 0) (9.66298 6.52418 0) (14.6073 4.84196 0) (10.3228 12.522 0) (9.00216 -0.0764909 0) (7.97429 -0.00354726 0) (8.9457 0.00427123 0) (7.85335 0.00539808 0) (8.93666 -0.0431435 0) (7.86992 -0.0478268 0) (9.08485 -0.101666 0) (7.95171 -0.0724005 0) (9.21802 -0.123759 0) (7.96549 -0.0951635 0) (9.26734 -0.137878 0) (7.9477 -0.0780455 0) (9.29873 -0.0794082 0) (7.94947 0.0236484 0) (9.35664 0.0572918 0) (7.99743 0.170532 0) (9.50332 0.192605 0) (8.1896 0.301033 0) (9.79921 0.268234 0) (8.5956 0.262672 0) (10.2595 0.106271 0) (9.16661 -0.00732434 0) (10.8483 -0.326547 0) (9.77922 -0.642305 0) (11.3291 -0.9946 0) (10.1764 -1.30865 0) (11.6347 -1.74864 0) (10.2374 -2.01794 0) (11.4711 -2.11173 0) (9.85129 -2.09279 0) (11.2099 -2.12101 0) (9.77492 -1.80624 0) (11.0495 -1.37948 0) (8.92122 -1.01486 0) (9.96841 -0.682587 0) (8.18407 -0.0546557 0) (9.61956 0.492263 0) (7.31698 0.841816 0) (8.38982 0.963693 0) (5.98519 1.24751 0) (7.75246 1.64701 0) (5.91021 2.22028 0) (7.95933 2.71926 0) (6.5663 3.20686 0) (8.53788 3.416 0) (7.64843 3.42012 0) (9.40566 2.97653 0) (8.81471 2.32956 0) (10.2791 1.44392 0) (9.75715 0.531329 0) (10.9201 -0.506438 0) (9.96896 -1.55707 0) (10.8438 -2.50564 0) (9.81948 -3.06898 0) (10.9122 -3.69922 0) (9.76044 -4.11283 0) (11.1803 -4.10939 0) (9.69871 -4.07334 0) (10.3957 -3.94137 0) (8.98438 -2.87544 0) (10.0958 -1.82691 0) (8.01467 -1.40427 0) (8.8634 -1.0619 0) (7.57447 -0.213956 0) (8.81832 0.372691 0) (7.21426 0.656152 0) (8.25844 0.801379 0) (6.86187 1.20948 0) (8.2037 1.58936 0) (6.80262 1.96676 0) (8.09799 2.10142 0) (6.65816 2.25978 0) (7.95829 2.26048 0) (6.45878 2.4139 0) (7.67019 2.52903 0) (6.13138 2.79643 0) (7.43266 2.91254 0) (6.14839 2.96054 0) (7.58621 2.71793 0) (6.54182 2.29435 0) (7.88989 1.6484 0) (6.93801 0.845119 0) (8.243 -0.109295 0) (7.41401 -1.0219 0) (8.8283 -1.80143 0) (7.86552 -2.26008 0) (9.26177 -2.55493 0) (7.81355 -2.66963 0) (9.33385 -2.83189 0) (7.6383 -2.72092 0) (9.46696 -2.54928 0) (7.56797 -2.08857 0) (9.63915 -1.69772 0) (7.85775 -0.992058 0) (10.2682 -0.380095 0) (8.13084 0.283723 0) (9.98835 0.485295 0) (7.08022 0.739332 0) (9.22801 0.859868 0) (6.61251 1.33855 0) (9.22026 1.57097 0) (6.8461 2.0731 0) (9.2392 2.11141 0) (7.12009 2.37504 0) (9.12392 2.25954 0) (7.53056 2.4293 0) (9.11337 2.05272 0) (7.94304 2.04581 0) (9.41048 1.70698 0) (8.61081 1.53159 0) (9.95102 0.970502 0) (9.21138 0.772335 0) (10.8053 0.140652 0) (9.82203 -0.0712816 0) (11.5405 -0.717417 0) (10.3665 -0.923815 0) (12.1684 -1.45846 0) (10.6462 -1.61884 0) (12.7093 -2.20156 0) (11.0242 -2.44249 0) (13.287 -3.18842 0) (11.3557 -3.45973 0) (13.7429 -4.21223 0) (11.346 -4.24318 0) (13.5587 -4.58845 0) (10.6461 -4.20376 0) (12.9286 -4.29158 0) (9.73473 -3.67683 0) (11.9642 -3.57217 0) (8.93235 -3.00968 0) (11.0623 -2.96382 0) (8.31547 -2.48571 0) (10.044 -2.54563 0) (8.04079 -1.99677 0) (9.33615 -1.97296 0) (7.94234 -1.55877 0) (8.65346 -1.42635 0) (7.67277 -1.12421 0) (7.78629 -0.979906 0) (7.38011 -0.645323 0) (7.14291 -0.569469 0) (7.27117 -0.115523 0) (6.70706 0.266064 0) (6.78808 0.646202 0) (5.66957 0.91038 0) (5.69724 1.04624 0) (4.19222 1.26965 0) (4.33223 1.34474 0) (3.19208 1.88869 0) (3.87115 2.31792 0) (3.20336 3.22178 0) (4.15379 3.56926 0) (3.44009 4.31851 0) (4.91503 4.62871 0) (4.14363 4.87141 0) (5.23865 5.4874 0) (6.11882 4.6424 0) (5.01766 5.09877 0) (7.78438 3.73997 0) (5.20029 4.7181 0) (8.84516 3.07411 0) (5.65675 4.2692 0) (9.35872 2.31263 0) (6.31942 3.73271 0) (9.5523 1.36936 0) (7.33333 2.74183 0) (10.1875 -0.0094783 0) (8.39927 1.18631 0) (10.6659 -1.50423 0) (8.32496 0.247426 0) (10.0783 -2.12402 0) (7.05442 0.301743 0) (9.40613 -2.37291 0) (6.27122 0.166783 0) (9.57987 -2.93245 0) (6.74389 -0.658413 0) (10.4955 -3.74462 0) (7.92369 -1.63523 0) (11.7719 -4.46887 0) (9.27211 -2.57176 0) (13.0792 -5.00357 0) (10.3672 -3.21341 0) (14.087 -5.28854 0) (11.1344 -3.57116 0) (14.717 -5.21488 0) (11.6382 -3.53057 0) (15.0533 -4.62465 0) (11.9652 -3.09532 0) (15.3109 -3.69332 0) (12.2615 -2.18522 0) (15.6803 -2.38865 0) (12.4293 -0.811832 0) (16.1359 -0.758513 0) (12.2151 1.21384 0) (16.5984 0.90597 0) (11.6321 4.13915 0) (16.7512 2.17419 0) (11.4801 7.91598 0) (16.0651 3.74457 0) (13.2005 11.4457 0) (11.2283 -0.0788627 0) (10.3439 -0.0289777 0) (11.1452 -0.0198026 0) (10.2231 -0.0366352 0) (11.1075 -0.0646424 0) (10.2291 -0.0660117 0) (11.2346 -0.124136 0) (10.3069 -0.0739711 0) (11.3415 -0.135599 0) (10.3214 -0.0799928 0) (11.3613 -0.14265 0) (10.3136 -0.0801823 0) (11.3841 -0.0951143 0) (10.318 0.00135851 0) (11.437 0.0176318 0) (10.3994 0.116224 0) (11.5996 0.112955 0) (10.6003 0.216439 0) (11.8569 0.140252 0) (10.931 0.104032 0) (12.1699 -0.0504519 0) (11.3287 -0.187066 0) (12.5789 -0.497615 0) (11.651 -0.757727 0) (12.7257 -1.08947 0) (11.7325 -1.40895 0) (12.736 -1.69253 0) (11.3451 -1.83672 0) (12.1917 -1.99463 0) (10.8071 -1.92712 0) (11.7273 -1.82343 0) (9.92235 -1.71024 0) (11.0401 -1.48583 0) (9.57319 -0.892993 0) (10.9186 -0.3469 0) (9.20906 0.108295 0) (10.5486 0.515757 0) (8.94779 1.0367 0) (10.1888 1.43388 0) (8.26896 1.72519 0) (9.19362 1.88451 0) (7.51726 2.15908 0) (8.78825 2.45125 0) (7.86309 2.82189 0) (9.35582 2.93744 0) (9.05238 2.87376 0) (10.3615 2.48159 0) (10.2082 1.92989 0) (11.2598 1.02614 0) (11.092 0.117876 0) (12.0136 -0.677146 0) (11.6814 -1.43921 0) (12.3346 -2.55568 0) (11.5805 -3.34094 0) (12.3416 -3.52561 0) (11.1724 -3.73807 0) (11.561 -4.2337 0) (10.4448 -4.01752 0) (11.1069 -3.54505 0) (9.34948 -2.83489 0) (10.4809 -1.77678 0) (9.04176 -0.791412 0) (9.60287 -0.639533 0) (7.83436 -0.403351 0) (9.28962 0.176279 0) (8.21218 0.990359 0) (9.26541 1.36326 0) (7.52903 1.53719 0) (8.60783 1.61195 0) (7.25714 1.91126 0) (8.65212 2.15316 0) (7.3719 2.42357 0) (8.63869 2.5067 0) (7.20875 2.60937 0) (8.3791 2.67692 0) (7.06503 2.81693 0) (8.34187 2.84938 0) (7.47034 2.78061 0) (8.68723 2.51605 0) (8.10455 2.1171 0) (8.96031 1.49635 0) (8.57415 0.695627 0) (9.29328 -0.333006 0) (9.15034 -1.29295 0) (9.89509 -2.0393 0) (9.54804 -2.41781 0) (10.2173 -2.61016 0) (9.36922 -2.58019 0) (10.1263 -2.6277 0) (8.89738 -2.57609 0) (10.0114 -2.62813 0) (8.66411 -2.28454 0) (10.2897 -1.92866 0) (8.84441 -1.15771 0) (10.703 -0.647044 0) (9.22945 0.167653 0) (11.033 0.665549 0) (9.12588 1.21021 0) (10.3725 1.25361 0) (8.25108 1.57683 0) (9.61229 1.5036 0) (8.13229 1.93547 0) (9.60314 2.00438 0) (8.63062 2.26668 0) (9.84796 2.1958 0) (9.22549 2.35767 0) (10.2813 2.06637 0) (9.695 1.95567 0) (10.7476 1.58408 0) (10.2796 1.34117 0) (11.3384 0.829411 0) (10.6991 0.523095 0) (12.067 -0.0795044 0) (11.0601 -0.274732 0) (12.5521 -0.866982 0) (11.3873 -1.06379 0) (13.0442 -1.61047 0) (11.6341 -1.76635 0) (13.6275 -2.37626 0) (12.1042 -2.68648 0) (14.302 -3.3694 0) (12.3338 -3.67689 0) (14.6284 -4.25065 0) (11.8836 -4.14991 0) (14.1287 -4.28545 0) (10.7958 -3.89574 0) (13.311 -3.85575 0) (9.61225 -3.25737 0) (12.5336 -3.3566 0) (8.79928 -2.62238 0) (11.838 -2.74156 0) (8.12405 -2.0255 0) (11.135 -2.19566 0) (7.61431 -1.67191 0) (10.3591 -1.91979 0) (7.29626 -1.27231 0) (9.46324 -1.42546 0) (7.31246 -0.770466 0) (8.70519 -0.931171 0) (7.30961 -0.417165 0) (7.96657 -0.387342 0) (7.10952 0.16852 0) (7.17056 0.287036 0) (7.14652 0.878157 0) (6.77844 1.15925 0) (6.89811 1.59271 0) (5.98129 1.68738 0) (5.90479 2.04137 0) (4.74803 2.0561 0) (4.91281 2.51552 0) (4.13516 2.76265 0) (4.79263 3.69368 0) (4.82719 3.67183 0) (4.77268 4.83694 0) (6.54781 4.20566 0) (4.53272 5.39717 0) (8.58872 3.93233 0) (4.94676 5.0459 0) (9.45934 3.1012 0) (5.72462 4.62163 0) (9.72818 2.52326 0) (6.82155 4.26159 0) (9.78357 1.95541 0) (7.87059 3.60701 0) (9.84734 1.03648 0) (8.84621 2.37507 0) (10.0688 -0.346442 0) (9.04581 1.11092 0) (9.49595 -1.38708 0) (8.03038 0.89046 0) (8.70641 -1.7662 0) (7.46385 0.826073 0) (8.70305 -2.38851 0) (8.09358 0.298485 0) (9.60241 -3.33445 0) (9.39883 -0.692326 0) (10.9382 -4.2813 0) (10.6402 -1.61506 0) (12.2522 -5.13477 0) (11.4672 -2.34234 0) (13.3229 -5.71872 0) (11.7568 -2.8071 0) (14.1185 -6.11829 0) (11.7025 -3.0069 0) (14.7831 -6.183 0) (11.4857 -2.91453 0) (15.3997 -5.83958 0) (11.4483 -2.5136 0) (16.1272 -5.09996 0) (11.8056 -1.66131 0) (16.8396 -3.95778 0) (12.248 -0.143887 0) (17.4955 -2.42434 0) (12.6539 2.13616 0) (17.9427 -0.643378 0) (13.0859 5.13573 0) (17.7819 1.54461 0) (13.6065 8.25941 0) (16.588 4.35534 0) (14.5231 10.1616 0) (12.4771 -0.0300993 0) (11.961 -0.0756466 0) (12.3356 -0.0659505 0) (11.7874 -0.113586 0) (12.2609 -0.116792 0) (11.7765 -0.108963 0) (12.3612 -0.144522 0) (11.8484 -0.0767595 0) (12.4413 -0.135883 0) (11.8409 -0.0817382 0) (12.4518 -0.140122 0) (11.8154 -0.101165 0) (12.4842 -0.11221 0) (11.8252 -0.0406017 0) (12.5421 -0.0307774 0) (11.9146 0.0327999 0) (12.7167 0.0277746 0) (12.1648 0.0943758 0) (12.9676 0.018628 0) (12.4479 0.000432353 0) (13.2083 -0.170837 0) (12.7573 -0.300203 0) (13.3997 -0.544616 0) (12.7769 -0.76861 0) (13.3014 -1.08804 0) (12.5533 -1.29393 0) (12.8609 -1.51768 0) (11.8625 -1.60367 0) (12.1474 -1.67964 0) (10.9173 -1.64943 0) (11.3248 -1.59054 0) (10.1836 -1.3595 0) (10.9087 -1.12406 0) (9.82996 -0.741218 0) (10.8441 -0.308024 0) (9.8268 0.212192 0) (10.8103 0.629831 0) (9.85107 1.10219 0) (10.8047 1.51749 0) (9.92923 1.92127 0) (10.6126 2.17017 0) (9.7422 2.36862 0) (10.2896 2.4536 0) (9.79363 2.54058 0) (10.6215 2.45685 0) (10.6102 2.39528 0) (11.4639 2.01993 0) (11.5813 1.36407 0) (12.3691 0.542425 0) (12.3355 -0.144531 0) (13.0064 -0.971401 0) (12.8524 -1.77392 0) (13.5348 -2.33632 0) (12.8362 -2.88737 0) (13.0518 -3.4687 0) (12.2498 -3.54781 0) (12.3166 -3.6299 0) (10.8253 -3.59406 0) (11.354 -3.02194 0) (9.90122 -2.15937 0) (10.2953 -1.49045 0) (9.06273 -0.66395 0) (10.0917 -0.116923 0) (8.60838 0.0880685 0) (9.45858 0.1315 0) (8.3681 0.565767 0) (9.82905 1.11675 0) (8.7444 1.60192 0) (9.70264 1.75959 0) (8.18911 1.90186 0) (9.1959 2.0101 0) (7.99221 2.23772 0) (9.17059 2.38592 0) (8.21244 2.59502 0) (9.25523 2.66839 0) (8.58943 2.78381 0) (9.39281 2.73308 0) (9.14035 2.67288 0) (9.6228 2.39832 0) (9.67106 2.06231 0) (9.82159 1.40891 0) (10.1725 0.525371 0) (10.3267 -0.568781 0) (10.8903 -1.57069 0) (10.9204 -2.24055 0) (11.1287 -2.5014 0) (10.9796 -2.52965 0) (10.8585 -2.47826 0) (10.899 -2.58527 0) (10.6277 -2.54525 0) (10.8409 -2.44517 0) (10.1481 -2.07512 0) (10.5812 -1.84031 0) (9.72928 -1.19405 0) (10.6068 -0.756359 0) (9.87519 0.00726817 0) (11.0268 0.580224 0) (10.2989 1.22537 0) (11.2299 1.46848 0) (10.2765 1.84985 0) (10.8241 1.75341 0) (9.85651 1.87573 0) (10.4291 1.876 0) (9.91087 1.95263 0) (10.5047 1.90363 0) (10.3112 1.9512 0) (11.0429 1.7428 0) (10.7814 1.6277 0) (11.58 1.25384 0) (11.3203 1.02218 0) (12.092 0.558459 0) (11.6832 0.281981 0) (12.6699 -0.276138 0) (11.9881 -0.470486 0) (13.1541 -1.02666 0) (12.3624 -1.23969 0) (13.8164 -1.81125 0) (12.8438 -2.01243 0) (14.4834 -2.61164 0) (13.3594 -2.93381 0) (15.0579 -3.54974 0) (13.373 -3.64832 0) (14.9524 -4.00862 0) (12.4689 -3.74493 0) (14.3208 -3.92331 0) (11.2063 -3.30948 0) (13.561 -3.46495 0) (9.91428 -2.76636 0) (12.8875 -2.92938 0) (8.74965 -2.25861 0) (12.4186 -2.55739 0) (7.89823 -1.78631 0) (12.008 -2.20664 0) (7.35049 -1.33393 0) (11.4152 -1.7147 0) (6.82002 -0.860697 0) (10.8511 -1.31713 0) (6.52383 -0.532623 0) (10.1891 -0.915629 0) (6.43172 -0.1034 0) (9.44575 -0.368855 0) (6.4339 0.457486 0) (8.95079 0.186439 0) (6.53028 1.10196 0) (8.57266 0.962533 0) (6.69975 1.89203 0) (8.36491 1.7159 0) (6.22482 2.66676 0) (7.99709 2.24452 0) (5.24029 3.19246 0) (7.59416 2.53599 0) (4.49672 3.77178 0) (8.15359 3.00936 0) (4.41265 4.64523 0) (9.40936 3.56433 0) (4.97364 5.22969 0) (10.0953 3.43638 0) (6.12539 4.92334 0) (9.88308 2.82437 0) (7.28468 4.42276 0) (9.56066 2.28594 0) (8.40907 3.90023 0) (9.46806 1.7528 0) (9.387 3.14466 0) (9.55646 0.831366 0) (10.0045 2.11161 0) (9.45632 -0.128554 0) (9.90605 1.40205 0) (8.99574 -0.812115 0) (9.72574 1.05195 0) (9.01503 -1.4878 0) (10.2845 0.419572 0) (9.80677 -2.38754 0) (11.5407 -0.514762 0) (10.9913 -3.48294 0) (12.7877 -1.47512 0) (12.0519 -4.46992 0) (13.5376 -2.19362 0) (12.7818 -5.26318 0) (13.7463 -2.60345 0) (13.2218 -5.80966 0) (13.4715 -2.75601 0) (13.5711 -6.22873 0) (13.0337 -2.65546 0) (13.9757 -6.42942 0) (12.4612 -2.40509 0) (14.6025 -6.27637 0) (12.2968 -1.99735 0) (15.4302 -5.84672 0) (12.4825 -1.16372 0) (16.0843 -4.93259 0) (12.7373 0.329443 0) (16.5335 -3.43632 0) (13.0374 2.38367 0) (17.0214 -1.35025 0) (13.7707 5.0178 0) (17.3575 1.52875 0) (14.8746 7.64147 0) (17.4401 5.17455 0) (15.3833 8.95451 0) (12.7527 0.0134821 0) (12.5781 -0.134592 0) (12.6097 -0.114366 0) (12.3683 -0.17969 0) (12.4867 -0.116502 0) (12.3128 -0.115144 0) (12.5259 -0.0857709 0) (12.3427 -0.0621422 0) (12.5513 -0.0787306 0) (12.295 -0.0700388 0) (12.5323 -0.104355 0) (12.2634 -0.103839 0) (12.5751 -0.112995 0) (12.2884 -0.0690339 0) (12.6354 -0.0690212 0) (12.3681 -0.0303817 0) (12.8014 -0.0627514 0) (12.6221 -0.000874211 0) (13.0279 -0.0768273 0) (12.8637 -0.0982144 0) (13.2505 -0.266112 0) (13.0772 -0.342194 0) (13.3273 -0.566247 0) (13.0216 -0.711687 0) (13.0967 -0.97232 0) (12.6313 -1.1114 0) (12.5893 -1.23457 0) (11.9278 -1.24715 0) (11.7738 -1.33108 0) (11.1432 -1.26518 0) (11.1589 -1.19048 0) (10.4668 -1.09654 0) (10.6181 -1.05146 0) (10.0669 -0.782505 0) (10.5593 -0.376705 0) (10.1861 0.196835 0) (10.7066 0.650811 0) (10.3025 1.11391 0) (10.7846 1.506 0) (10.5518 1.88149 0) (11.1299 2.17814 0) (10.9734 2.37892 0) (11.4835 2.46975 0) (11.4166 2.46651 0) (12.0037 2.33622 0) (12.0821 2.13051 0) (12.8801 1.75663 0) (13.1057 1.25208 0) (13.6617 0.507914 0) (13.5025 -0.363969 0) (14.0294 -1.09743 0) (13.712 -1.7993 0) (13.9829 -2.57825 0) (13.42 -2.95944 0) (13.3629 -2.98679 0) (12.1243 -3.00544 0) (12.1247 -3.16844 0) (10.8671 -3.19482 0) (11.0062 -2.85042 0) (9.93669 -1.97789 0) (10.4806 -1.16807 0) (9.27663 -0.584367 0) (10.1465 -0.237987 0) (9.22304 0.117901 0) (10.0768 0.353002 0) (8.90475 0.748711 0) (9.96785 1.15472 0) (9.15439 1.69764 0) (10.2495 2.03046 0) (9.32837 2.31693 0) (10.0221 2.33075 0) (9.10733 2.44031 0) (9.67815 2.36691 0) (9.19001 2.48788 0) (9.66363 2.41918 0) (9.6093 2.53759 0) (9.89245 2.40216 0) (10.1793 2.3564 0) (10.2718 2.10072 0) (10.7768 1.78368 0) (10.8184 1.14631 0) (11.5661 0.197552 0) (11.6782 -0.876254 0) (12.3748 -1.83526 0) (12.094 -2.26046 0) (12.3176 -2.42621 0) (11.7754 -2.3933 0) (11.9358 -2.44183 0) (11.6875 -2.43653 0) (11.818 -2.44653 0) (11.585 -2.3129 0) (11.4213 -2.06673 0) (11.2255 -1.70082 0) (10.7125 -1.15654 0) (10.8296 -0.753414 0) (10.3972 -0.162575 0) (10.9174 0.407518 0) (10.787 0.977702 0) (11.4034 1.40471 0) (11.2673 1.82794 0) (11.7247 1.93842 0) (11.3217 2.04827 0) (11.5805 1.99069 0) (11.3167 1.9716 0) (11.4819 1.84219 0) (11.4313 1.73931 0) (11.799 1.53596 0) (11.7414 1.34999 0) (12.2489 1.04164 0) (12.2296 0.763624 0) (12.7971 0.37412 0) (12.6342 0.0926984 0) (13.3871 -0.402766 0) (13.1772 -0.691582 0) (14.0148 -1.19306 0) (13.6976 -1.46 0) (14.7403 -2.06132 0) (14.189 -2.24477 0) (15.2927 -2.86098 0) (14.4678 -2.99766 0) (15.4298 -3.53257 0) (13.947 -3.43143 0) (14.9198 -3.72525 0) (12.8247 -3.35299 0) (14.1166 -3.50681 0) (11.4575 -2.9822 0) (13.558 -3.14746 0) (10.393 -2.4951 0) (13.1987 -2.79261 0) (9.52784 -2.03129 0) (12.8449 -2.28376 0) (8.49064 -1.43425 0) (12.4569 -1.8918 0) (7.40072 -1.01252 0) (12.0494 -1.59727 0) (6.60255 -0.658903 0) (11.704 -1.209 0) (5.94413 -0.218648 0) (11.3739 -0.857242 0) (5.46539 0.241489 0) (10.954 -0.503663 0) (5.37795 0.691923 0) (10.5828 0.0217438 0) (5.45616 1.34416 0) (10.4277 0.763024 0) (5.71609 2.1106 0) (10.4895 1.56935 0) (5.87378 2.92939 0) (10.5816 2.23381 0) (5.63275 3.65632 0) (10.3893 2.69933 0) (5.06716 4.11457 0) (10.0328 2.89771 0) (5.12452 4.53472 0) (9.85963 3.11909 0) (6.36563 4.95419 0) (9.59748 3.09476 0) (7.92479 4.70694 0) (9.18498 2.68552 0) (9.13105 4.22751 0) (8.97171 2.20052 0) (10.0493 3.56654 0) (9.10175 1.70375 0) (10.7826 2.85402 0) (9.43853 0.969754 0) (11.1519 2.02228 0) (9.60599 0.181827 0) (11.2773 1.26817 0) (9.73519 -0.574858 0) (11.7142 0.511726 0) (10.3311 -1.4989 0) (12.6184 -0.415446 0) (11.2954 -2.59953 0) (13.5814 -1.42079 0) (12.1337 -3.66435 0) (14.1997 -2.25642 0) (12.6112 -4.51018 0) (14.405 -2.75379 0) (12.8393 -5.16586 0) (14.3499 -2.96779 0) (12.9071 -5.61568 0) (14.2164 -3.01418 0) (13.1156 -6.01109 0) (14.045 -2.85341 0) (13.4061 -6.2304 0) (13.9165 -2.61324 0) (14.185 -6.23358 0) (14.0469 -2.25517 0) (14.9947 -5.86639 0) (13.9778 -1.19431 0) (15.3873 -4.76556 0) (13.6107 0.453512 0) (15.4961 -3.09994 0) (13.3064 2.42253 0) (15.6944 -1.02153 0) (13.6286 4.58545 0) (16.2858 1.91298 0) (14.6867 6.47985 0) (17.5935 5.51225 0) (15.9105 8.0592 0) (12.7442 -0.0157811 0) (12.7204 -0.294821 0) (12.6646 -0.273137 0) (12.5944 -0.334591 0) (12.5725 -0.175162 0) (12.5313 -0.167879 0) (12.5669 -0.0484121 0) (12.5091 -0.0716294 0) (12.5334 -0.0373124 0) (12.4218 -0.0888362 0) (12.4826 -0.0953255 0) (12.3867 -0.13908 0) (12.525 -0.143736 0) (12.4138 -0.133382 0) (12.5837 -0.136249 0) (12.4938 -0.124612 0) (12.7353 -0.15597 0) (12.6925 -0.111666 0) (12.9132 -0.174241 0) (12.8531 -0.193477 0) (13.0542 -0.352069 0) (13.0056 -0.391962 0) (13.0892 -0.526968 0) (12.893 -0.646072 0) (12.8928 -0.83011 0) (12.6419 -0.906081 0) (12.4519 -0.96298 0) (12.0894 -0.965012 0) (11.8879 -0.987755 0) (11.4877 -0.992794 0) (11.2837 -1.00731 0) (10.9081 -0.981409 0) (10.8649 -0.944639 0) (10.5931 -0.741073 0) (10.7496 -0.414342 0) (10.5895 0.0988907 0) (10.8464 0.601424 0) (10.6744 1.05113 0) (10.9894 1.43002 0) (10.9354 1.67703 0) (11.4156 1.97011 0) (11.4015 2.1503 0) (11.9152 2.25565 0) (11.9945 2.18082 0) (12.6899 2.06475 0) (12.9251 1.86312 0) (13.498 1.46975 0) (13.7475 0.868718 0) (14.4489 0.236005 0) (14.3372 -0.356593 0) (14.229 -1.11464 0) (13.958 -1.84283 0) (14.1623 -2.36256 0) (13.408 -2.55448 0) (13.0357 -2.58976 0) (12.1611 -2.52952 0) (12.0768 -2.68466 0) (11.2856 -2.61662 0) (11.217 -2.29585 0) (10.0945 -1.5558 0) (10.217 -0.87624 0) (9.30035 -0.322743 0) (9.86973 -0.130359 0) (9.30972 0.151915 0) (10.2171 0.312442 0) (9.69274 0.686055 0) (10.4086 0.89413 0) (9.89709 1.36755 0) (10.5706 1.65269 0) (10.2428 2.10372 0) (10.6898 2.20387 0) (10.4243 2.44835 0) (10.6175 2.35637 0) (10.5311 2.48561 0) (10.6086 2.36313 0) (10.7497 2.46289 0) (10.7965 2.33107 0) (11.1684 2.26517 0) (11.363 1.98305 0) (11.9629 1.56437 0) (12.2874 0.881475 0) (12.9902 -0.13523 0) (13.1985 -1.1165 0) (13.5434 -1.9127 0) (13.163 -2.11598 0) (13.0949 -2.19177 0) (12.531 -2.09452 0) (12.5534 -2.3339 0) (12.3286 -2.4104 0) (12.5724 -2.47889 0) (12.4074 -2.11678 0) (12.2989 -1.75587 0) (11.7946 -1.26294 0) (11.2702 -0.854543 0) (10.9604 -0.483468 0) (10.5287 -0.106051 0) (10.723 0.323258 0) (10.7931 0.730466 0) (11.2541 1.16461 0) (11.5728 1.57161 0) (12.0651 1.82447 0) (12.2013 2.01054 0) (12.4985 2.04833 0) (12.5694 2.01171 0) (12.6688 1.90478 0) (12.758 1.72408 0) (12.9391 1.50484 0) (13.0618 1.22954 0) (13.2799 0.951373 0) (13.5288 0.588108 0) (13.8109 0.186382 0) (13.9536 -0.115483 0) (14.4012 -0.638926 0) (14.504 -0.914714 0) (14.9664 -1.48709 0) (14.9383 -1.68521 0) (15.4364 -2.27273 0) (15.1578 -2.40166 0) (15.6134 -2.95035 0) (14.8923 -2.93733 0) (15.2876 -3.32444 0) (14.1004 -3.11571 0) (14.5554 -3.30624 0) (13.0774 -2.93533 0) (14.0254 -3.11685 0) (12.2547 -2.62774 0) (13.6611 -2.8117 0) (11.3148 -2.18816 0) (13.2734 -2.38324 0) (10.102 -1.66979 0) (12.7456 -1.98312 0) (9.0137 -1.2042 0) (12.4224 -1.57016 0) (7.91323 -0.690345 0) (12.0637 -1.30938 0) (6.76722 -0.300297 0) (11.7355 -1.11164 0) (5.98464 0.0702445 0) (11.5285 -0.799089 0) (5.35738 0.535625 0) (11.3316 -0.492126 0) (4.89368 0.99783 0) (11.096 -0.0637635 0) (4.75232 1.5075 0) (10.9876 0.50299 0) (5.00602 2.2038 0) (11.1298 1.27426 0) (5.53489 2.93408 0) (11.2247 1.99499 0) (6.248 3.64996 0) (11.0887 2.6013 0) (6.79016 4.24198 0) (10.4435 2.90644 0) (7.35731 4.59862 0) (9.45885 2.93788 0) (8.40414 4.71755 0) (8.88721 2.96301 0) (9.59828 4.36296 0) (8.81195 2.68581 0) (10.4061 3.82627 0) (9.08024 2.25632 0) (11.0225 3.17403 0) (9.48872 1.7843 0) (11.6348 2.49474 0) (9.88839 1.1174 0) (12.0841 1.67332 0) (10.2579 0.299389 0) (12.5184 0.809441 0) (10.7661 -0.603788 0) (13.1826 -0.118362 0) (11.4762 -1.58243 0) (13.9541 -1.11249 0) (12.1801 -2.64038 0) (14.4816 -1.97291 0) (12.7033 -3.60526 0) (14.643 -2.59901 0) (12.9537 -4.31155 0) (14.6527 -3.02155 0) (13.0766 -4.89808 0) (14.4271 -3.15938 0) (13.1427 -5.33118 0) (14.3547 -3.30936 0) (13.1515 -5.71781 0) (14.2546 -3.19453 0) (13.351 -6.04268 0) (14.6122 -3.23796 0) (14.0497 -6.23631 0) (14.8513 -2.85214 0) (14.4528 -5.67798 0) (14.4219 -1.49432 0) (14.6092 -4.36746 0) (13.7357 0.181137 0) (14.7414 -2.54881 0) (13.2327 2.06242 0) (14.9579 -0.441198 0) (13.2339 3.80692 0) (15.4294 2.21372 0) (13.8531 5.1547 0) (16.8228 5.06321 0) (15.9019 7.13159 0) (12.5658 -0.00071327 0) (12.6081 -0.242565 0) (12.6941 -0.225767 0) (12.6813 -0.288856 0) (12.679 -0.127451 0) (12.6235 -0.130217 0) (12.6351 0.0160792 0) (12.5528 -0.0388512 0) (12.5527 0.020821 0) (12.4583 -0.0609863 0) (12.5277 -0.0537386 0) (12.4646 -0.128483 0) (12.5859 -0.142015 0) (12.4978 -0.14991 0) (12.6357 -0.155081 0) (12.5509 -0.165043 0) (12.7295 -0.183964 0) (12.6367 -0.162344 0) (12.7666 -0.212385 0) (12.6785 -0.245036 0) (12.8084 -0.349209 0) (12.6952 -0.396966 0) (12.7568 -0.46837 0) (12.6091 -0.571663 0) (12.5891 -0.668749 0) (12.363 -0.746381 0) (12.2728 -0.707923 0) (12.0257 -0.745264 0) (11.8766 -0.797086 0) (11.583 -0.856627 0) (11.4676 -0.827362 0) (11.1893 -0.805923 0) (11.1046 -0.783076 0) (10.8323 -0.663127 0) (10.8955 -0.365743 0) (10.7069 0.0778063 0) (10.9043 0.578363 0) (10.8036 0.969826 0) (11.1604 1.29686 0) (11.1548 1.51128 0) (11.5509 1.7801 0) (11.4977 1.94179 0) (11.9814 1.95388 0) (12.2263 1.7726 0) (12.8279 1.60732 0) (12.9901 1.38076 0) (13.4949 0.96647 0) (13.9013 0.471477 0) (14.2977 0.0440512 0) (14.203 -0.344692 0) (14.1729 -1.06705 0) (13.9609 -1.73491 0) (13.761 -2.0991 0) (13.2055 -2.01883 0) (12.882 -2.04063 0) (12.4696 -2.08776 0) (12.1181 -2.34789 0) (11.3017 -2.2573 0) (10.8154 -1.92228 0) (10.1501 -1.14978 0) (10.0671 -0.637689 0) (9.61579 -0.241828 0) (9.78927 -0.305657 0) (9.60091 -0.0917302 0) (10.094 0.066425 0) (10.0762 0.670119 0) (10.4876 1.06777 0) (10.3743 1.66629 0) (10.621 1.87201 0) (10.5948 2.28746 0) (10.8176 2.32086 0) (10.9016 2.56514 0) (11.082 2.4555 0) (11.2242 2.5449 0) (11.3607 2.43308 0) (11.551 2.44333 0) (11.7911 2.23989 0) (12.2056 2.01164 0) (12.6362 1.63718 0) (13.1807 1.13761 0) (13.6547 0.4145 0) (14.1319 -0.527683 0) (14.2935 -1.34452 0) (14.2974 -1.87162 0) (13.9191 -1.90935 0) (13.6265 -1.91927 0) (13.1905 -1.94005 0) (13.0738 -2.2845 0) (12.8741 -2.44526 0) (12.8662 -2.50279 0) (12.7001 -2.04368 0) (12.5469 -1.50154 0) (12.0983 -0.821317 0) (11.5183 -0.409203 0) (10.9774 -0.116148 0) (10.4196 0.0734079 0) (10.3152 0.307776 0) (10.3253 0.51079 0) (10.6786 0.845897 0) (11.1049 1.18078 0) (11.706 1.45135 0) (12.1628 1.70427 0) (12.6531 1.85733 0) (13.0821 1.84112 0) (13.3297 1.84449 0) (13.6559 1.62355 0) (13.8555 1.46016 0) (14.1323 1.11753 0) (14.2857 0.827312 0) (14.5874 0.424747 0) (14.7397 0.00355874 0) (15.0246 -0.315031 0) (15.1535 -0.817698 0) (15.3829 -1.0958 0) (15.4913 -1.64273 0) (15.4824 -1.7973 0) (15.591 -2.32021 0) (15.3487 -2.38734 0) (15.3439 -2.79258 0) (14.8618 -2.69439 0) (14.829 -2.99258 0) (14.2443 -2.76487 0) (14.3807 -2.99007 0) (13.6845 -2.70653 0) (14.0707 -2.85952 0) (12.977 -2.46379 0) (13.565 -2.52391 0) (12.022 -1.98382 0) (13.0755 -2.05245 0) (10.9402 -1.36694 0) (12.6292 -1.61679 0) (9.72008 -0.854866 0) (12.0983 -1.28128 0) (8.57918 -0.388818 0) (11.7506 -1.02051 0) (7.56843 0.0361149 0) (11.3603 -0.865571 0) (6.58993 0.368844 0) (10.9859 -0.653498 0) (5.86719 0.755507 0) (10.7251 -0.366377 0) (5.29085 1.21697 0) (10.4168 -0.0436966 0) (4.9103 1.69404 0) (10.1311 0.392707 0) (4.99732 2.301 0) (9.97433 1.00606 0) (5.68474 3.0324 0) (9.86202 1.7484 0) (6.74039 3.66111 0) (9.72474 2.40216 0) (8.01973 4.23357 0) (9.49662 2.89706 0) (9.15822 4.56732 0) (9.19773 3.11765 0) (10.0455 4.48944 0) (9.19568 3.14361 0) (10.8022 4.03376 0) (9.43 2.82931 0) (11.3491 3.42224 0) (9.79882 2.36378 0) (11.8315 2.75501 0) (10.2507 1.79512 0) (12.3523 2.04043 0) (10.7048 1.10227 0) (12.9331 1.18027 0) (11.1438 0.311468 0) (13.5914 0.287193 0) (11.7071 -0.640872 0) (14.3012 -0.633635 0) (12.3016 -1.65656 0) (14.9325 -1.59596 0) (12.6652 -2.55628 0) (15.3395 -2.38131 0) (12.8853 -3.42273 0) (15.3402 -2.8831 0) (13.0417 -4.09943 0) (15.1444 -3.26675 0) (12.935 -4.54601 0) (14.6879 -3.3678 0) (13.0776 -5.07202 0) (14.2538 -3.50538 0) (13.038 -5.34869 0) (14.0754 -3.55028 0) (13.4748 -5.91179 0) (14.4116 -3.73316 0) (13.7353 -5.93341 0) (13.9977 -2.91631 0) (13.3893 -5.02548 0) (13.1502 -1.44003 0) (13.3405 -3.64187 0) (12.6207 -0.0642478 0) (13.7042 -1.95232 0) (12.4187 1.54694 0) (14.1196 0.0696214 0) (12.5923 3.09614 0) (14.55 2.47038 0) (12.9619 4.2791 0) (15.3624 4.30501 0) (15.1202 6.0311 0) (12.3042 0.0077667 0) (12.2673 -0.0862345 0) (12.4487 -0.0659991 0) (12.4008 -0.13102 0) (12.4944 -0.0427743 0) (12.4055 -0.0768253 0) (12.5 0.0334746 0) (12.4028 -0.0336876 0) (12.4796 0.00915334 0) (12.401 -0.0805894 0) (12.5183 -0.0797067 0) (12.4631 -0.148308 0) (12.595 -0.170051 0) (12.4933 -0.193889 0) (12.6266 -0.199905 0) (12.5079 -0.193077 0) (12.6169 -0.193615 0) (12.4637 -0.183346 0) (12.5289 -0.211055 0) (12.3659 -0.236642 0) (12.4084 -0.291667 0) (12.2518 -0.355468 0) (12.2717 -0.392386 0) (12.085 -0.51487 0) (12.1145 -0.550543 0) (11.9339 -0.641814 0) (11.9255 -0.613971 0) (11.7527 -0.69217 0) (11.7883 -0.661762 0) (11.6286 -0.68669 0) (11.6354 -0.640879 0) (11.4026 -0.659138 0) (11.2976 -0.66517 0) (10.954 -0.609793 0) (10.9061 -0.342649 0) (10.6849 0.0317834 0) (10.8502 0.485454 0) (10.7783 0.821627 0) (11.0734 1.08586 0) (11.0283 1.36057 0) (11.3235 1.63119 0) (11.4086 1.74799 0) (11.9454 1.58838 0) (12.2187 1.37893 0) (12.5837 1.30078 0) (12.8231 1.16748 0) (13.3385 0.637901 0) (13.6794 0.145835 0) (13.8357 -0.0927775 0) (13.8402 -0.222238 0) (13.9527 -0.926377 0) (13.9881 -1.57658 0) (13.8477 -1.84285 0) (13.4119 -1.65839 0) (12.8843 -1.76162 0) (12.5513 -1.86333 0) (12.2141 -1.92697 0) (11.718 -1.64197 0) (10.8914 -1.33552 0) (10.2748 -0.756989 0) (9.84749 -0.413938 0) (9.80747 -0.105152 0) (9.80194 -0.197059 0) (9.95735 -0.130691 0) (10.0717 -0.179024 0) (10.3728 0.20359 0) (10.6735 0.556451 0) (10.9929 1.1711 0) (11.1869 1.48519 0) (11.4333 1.9436 0) (11.558 2.04745 0) (11.8125 2.26374 0) (11.9317 2.21293 0) (12.181 2.27144 0) (12.2867 2.19276 0) (12.6166 2.10183 0) (12.9197 1.80324 0) (13.462 1.43298 0) (13.813 1.0604 0) (14.2479 0.645099 0) (14.5961 0.0606963 0) (15.0082 -0.706562 0) (15.1476 -1.35237 0) (14.9289 -1.63899 0) (14.4758 -1.6235 0) (14.0197 -1.57996 0) (13.6964 -1.71741 0) (13.3941 -2.07642 0) (13.1416 -2.33709 0) (12.8027 -2.37223 0) (12.6517 -1.96486 0) (12.4276 -1.27483 0) (12.3065 -0.490247 0) (11.9111 0.120246 0) (11.5906 0.415142 0) (10.9264 0.481674 0) (10.6761 0.461242 0) (10.2835 0.42321 0) (10.4228 0.549777 0) (10.5744 0.735637 0) (11.116 0.973162 0) (11.5218 1.1912 0) (12.1932 1.41503 0) (12.6502 1.43122 0) (13.1775 1.48677 0) (13.5813 1.34098 0) (13.9469 1.17728 0) (14.3064 0.884594 0) (14.5057 0.575567 0) (14.8248 0.248595 0) (14.9687 -0.173073 0) (15.2069 -0.482168 0) (15.2038 -0.936351 0) (15.3877 -1.22335 0) (15.2438 -1.66875 0) (15.309 -1.82395 0) (15.1091 -2.22718 0) (15.0526 -2.24897 0) (14.867 -2.57409 0) (14.7498 -2.5272 0) (14.6635 -2.75852 0) (14.5636 -2.70612 0) (14.4658 -2.85685 0) (14.2129 -2.65291 0) (14.0851 -2.6659 0) (13.5696 -2.24321 0) (13.5385 -2.18635 0) (12.6969 -1.64523 0) (12.884 -1.66104 0) (11.6631 -1.0293 0) (12.2493 -1.26155 0) (10.5418 -0.524153 0) (11.7177 -0.952886 0) (9.534 -0.0826896 0) (11.3309 -0.737089 0) (8.64795 0.296711 0) (10.9367 -0.581095 0) (7.8592 0.59904 0) (10.4737 -0.389853 0) (7.12265 0.922508 0) (10.0373 -0.146324 0) (6.52525 1.38177 0) (9.57519 0.139461 0) (6.16941 1.90377 0) (8.96005 0.486978 0) (6.08533 2.35125 0) (8.39405 0.932844 0) (6.55343 2.93681 0) (8.0548 1.53612 0) (7.54025 3.54008 0) (7.9928 2.24112 0) (8.70123 3.97473 0) (8.36784 2.89111 0) (9.86016 4.23307 0) (8.94818 3.25192 0) (10.7556 4.09357 0) (9.62679 3.2647 0) (11.4109 3.63454 0) (10.1954 2.89948 0) (11.9523 3.03537 0) (10.6802 2.36538 0) (12.4692 2.35716 0) (11.1661 1.74154 0) (13.0209 1.61555 0) (11.7474 1.00546 0) (13.5923 0.789933 0) (12.3473 0.194037 0) (14.2422 -0.140151 0) (12.8255 -0.685129 0) (14.8816 -1.03825 0) (13.1862 -1.70177 0) (15.3533 -1.88534 0) (13.2615 -2.49934 0) (15.6436 -2.64176 0) (13.0335 -3.14675 0) (15.6517 -3.09566 0) (12.8677 -3.78961 0) (15.3475 -3.30674 0) (12.4953 -4.10192 0) (15.0981 -3.59662 0) (12.6206 -4.6652 0) (14.493 -3.60995 0) (12.7305 -5.03666 0) (14.3674 -4.03915 0) (13.2178 -5.69716 0) (13.6916 -3.75521 0) (12.5761 -5.23027 0) (12.1579 -2.53305 0) (12.1313 -4.38089 0) (11.6234 -1.5831 0) (12.5581 -3.27275 0) (11.6166 -0.61136 0) (13.1184 -1.6921 0) (11.8153 0.863071 0) (13.4979 0.290669 0) (12.1353 2.61309 0) (13.6931 2.59317 0) (12.3971 3.89643 0) (13.8552 3.6757 0) (13.8086 4.82204 0) (11.8067 0.0402264 0) (11.7355 0.0131734 0) (12.0227 0.00777685 0) (12.0027 -0.0599912 0) (12.2537 -0.0554154 0) (12.224 -0.0939636 0) (12.4464 -0.0479908 0) (12.3649 -0.0887995 0) (12.4919 -0.0820356 0) (12.4187 -0.129423 0) (12.5195 -0.129906 0) (12.4522 -0.151997 0) (12.4925 -0.170523 0) (12.3621 -0.181262 0) (12.374 -0.172622 0) (12.226 -0.134816 0) (12.2285 -0.113751 0) (12.0956 -0.12467 0) (12.065 -0.141934 0) (11.9644 -0.172409 0) (11.9505 -0.194237 0) (11.8997 -0.295551 0) (11.8782 -0.338016 0) (11.8424 -0.468806 0) (11.8622 -0.493567 0) (11.7833 -0.611487 0) (11.8046 -0.602557 0) (11.7727 -0.670314 0) (11.8596 -0.618481 0) (11.7563 -0.64395 0) (11.685 -0.555195 0) (11.4224 -0.488899 0) (11.1337 -0.385616 0) (10.6689 -0.306178 0) (10.3909 -0.0974987 0) (10.1299 0.165035 0) (10.1972 0.529072 0) (10.201 0.790931 0) (10.4358 1.05613 0) (10.4826 1.29652 0) (10.8765 1.41504 0) (11.1611 1.39294 0) (11.6582 1.23704 0) (11.8456 1.19961 0) (12.2238 1.10105 0) (12.6477 0.807196 0) (13.1877 0.330362 0) (13.3094 0.1521 0) (13.469 -0.0804236 0) (13.8101 -0.449678 0) (14.28 -1.14289 0) (14.1021 -1.439 0) (13.6076 -1.50784 0) (13.171 -1.35627 0) (12.9483 -1.50476 0) (12.6746 -1.57023 0) (12.122 -1.47382 0) (11.6334 -1.06441 0) (10.9216 -0.721204 0) (10.6722 -0.369369 0) (10.3452 -0.25136 0) (10.6798 -0.168487 0) (10.547 -0.310028 0) (10.8007 -0.278442 0) (10.3514 -0.205168 0) (10.4841 0.173044 0) (10.1528 0.542189 0) (10.5527 1.05844 0) (10.4476 1.42103 0) (11.0371 1.82444 0) (11.0456 2.00292 0) (11.7037 2.16815 0) (11.7688 2.20076 0) (12.4041 2.2001 0) (12.5273 2.1193 0) (13.2458 1.87323 0) (13.475 1.61274 0) (14.0689 1.33219 0) (14.1905 1.07045 0) (14.7813 0.562852 0) (15.1898 -0.153005 0) (15.5984 -0.888213 0) (15.3505 -1.29926 0) (14.8403 -1.30901 0) (14.2741 -1.25058 0) (13.903 -1.27941 0) (13.7448 -1.53881 0) (13.4569 -1.82073 0) (13.2626 -2.07869 0) (12.7561 -2.05496 0) (12.5699 -1.79107 0) (12.1812 -1.16233 0) (12.3098 -0.508073 0) (12.1476 0.195534 0) (12.4002 0.608327 0) (12.0448 0.853369 0) (11.9782 0.825297 0) (11.3504 0.692599 0) (11.2144 0.559355 0) (10.8125 0.524171 0) (11.0899 0.595938 0) (11.1012 0.685149 0) (11.6698 0.858447 0) (11.9747 0.92473 0) (12.5794 0.950223 0) (12.8993 0.926932 0) (13.4482 0.762716 0) (13.7009 0.599209 0) (14.0824 0.285518 0) (14.2982 0.0762169 0) (14.5234 -0.331265 0) (14.6493 -0.607671 0) (14.657 -0.997099 0) (14.7906 -1.24428 0) (14.6834 -1.57672 0) (14.8062 -1.78293 0) (14.6717 -2.03539 0) (14.8601 -2.21204 0) (14.7528 -2.43971 0) (14.9414 -2.5477 0) (14.8192 -2.72876 0) (14.8652 -2.69299 0) (14.6455 -2.68391 0) (14.5162 -2.45204 0) (14.1335 -2.3402 0) (13.8818 -1.93394 0) (13.4195 -1.84001 0) (13.0079 -1.31625 0) (12.6091 -1.36326 0) (12.0779 -0.749308 0) (11.9352 -0.90382 0) (11.2791 -0.216222 0) (11.3343 -0.609159 0) (10.4625 0.101601 0) (10.8349 -0.475241 0) (9.78221 0.408572 0) (10.5163 -0.27816 0) (9.20595 0.742059 0) (10.1266 -0.0676269 0) (8.6712 1.06845 0) (9.60044 0.142602 0) (8.17672 1.46469 0) (9.09243 0.419867 0) (7.85646 1.92971 0) (8.53262 0.783036 0) (7.79795 2.35035 0) (7.90966 1.19259 0) (7.98645 2.72509 0) (7.57102 1.65565 0) (8.4789 3.10501 0) (7.73352 2.20128 0) (9.19455 3.36027 0) (8.3261 2.71682 0) (10.0163 3.49882 0) (9.27283 3.04884 0) (10.8117 3.45239 0) (10.226 3.03912 0) (11.5917 3.15564 0) (11.0006 2.72728 0) (12.2458 2.67903 0) (11.7329 2.24618 0) (12.7945 2.01555 0) (12.4024 1.67981 0) (13.3565 1.30123 0) (13.0517 0.90655 0) (13.9139 0.520429 0) (13.6134 0.0369028 0) (14.4575 -0.384545 0) (13.9734 -0.805595 0) (14.8563 -1.25291 0) (14.0598 -1.65949 0) (15.0953 -2.01938 0) (13.943 -2.46564 0) (15.2067 -2.6201 0) (13.4196 -2.93992 0) (15.2831 -3.13797 0) (12.958 -3.40052 0) (15.0464 -3.26349 0) (12.5648 -3.89225 0) (15.1934 -3.74626 0) (12.1813 -4.22362 0) (14.6482 -3.83247 0) (12.3696 -4.94083 0) (14.3895 -4.33393 0) (11.7091 -4.99186 0) (12.2398 -3.32159 0) (10.5017 -4.39002 0) (11.112 -2.80778 0) (11.2191 -4.34314 0) (11.3064 -2.50797 0) (12.081 -3.41751 0) (11.3387 -1.3766 0) (12.5094 -1.71145 0) (11.4631 0.27654 0) (12.7713 0.21023 0) (11.8437 2.22339 0) (12.891 2.46863 0) (12.1829 3.72582 0) (12.9107 3.34763 0) (12.6326 3.70971 0) (11.805 -0.0480701 0) (11.6891 -0.0412411 0) (12.0863 -0.0856141 0) (12.0309 -0.101138 0) (12.3843 -0.146532 0) (12.2819 -0.136171 0) (12.5485 -0.141771 0) (12.3546 -0.129595 0) (12.4875 -0.148106 0) (12.3039 -0.137793 0) (12.3999 -0.134063 0) (12.2703 -0.107081 0) (12.2998 -0.108194 0) (12.1523 -0.11127 0) (12.1423 -0.0877682 0) (12.045 -0.0667428 0) (12.0652 -0.0442054 0) (12.0016 -0.0964014 0) (11.9818 -0.102928 0) (11.9612 -0.157325 0) (11.9889 -0.184276 0) (12.0586 -0.301956 0) (12.0224 -0.371809 0) (12.0346 -0.481181 0) (12.0225 -0.510375 0) (12.049 -0.588822 0) (12.0087 -0.61624 0) (11.9378 -0.705568 0) (11.8755 -0.645663 0) (11.7602 -0.587845 0) (11.5974 -0.412066 0) (11.4212 -0.2456 0) (11.1382 -0.0804575 0) (10.8116 0.0223222 0) (10.4977 0.132043 0) (10.2097 0.239824 0) (10.1034 0.452443 0) (10.0175 0.627376 0) (10.2116 0.850141 0) (10.3722 1.01321 0) (10.8474 1.07088 0) (11.1223 1.08264 0) (11.507 1.0015 0) (11.742 0.924443 0) (12.2378 0.686637 0) (12.6344 0.439862 0) (13.0227 0.112592 0) (13.2061 -0.115988 0) (13.6141 -0.514493 0) (13.8928 -0.804595 0) (13.979 -1.12075 0) (13.6569 -1.17517 0) (13.3546 -1.22137 0) (13.1339 -1.14263 0) (12.9707 -1.23052 0) (12.7696 -1.27059 0) (12.4056 -1.22088 0) (12.3314 -0.850233 0) (12.1117 -0.481092 0) (12.2555 -0.241607 0) (11.9521 -0.311296 0) (12.1668 -0.338227 0) (11.7469 -0.336922 0) (11.8758 -0.119292 0) (11.0943 0.10405 0) (11.0077 0.473292 0) (10.0494 0.785648 0) (10.132 1.08951 0) (9.47551 1.30605 0) (10.0323 1.45199 0) (9.76449 1.55533 0) (10.634 1.60178 0) (10.6327 1.65232 0) (11.5845 1.58419 0) (11.7401 1.54823 0) (12.6635 1.3441 0) (12.7837 1.21676 0) (13.5593 0.899448 0) (13.7682 0.507624 0) (14.6165 -0.120138 0) (14.5996 -0.638823 0) (14.6217 -0.892575 0) (13.9555 -0.881589 0) (13.7633 -0.820243 0) (13.4677 -0.933104 0) (13.6702 -1.111 0) (13.6943 -1.37665 0) (13.7404 -1.56854 0) (13.4875 -1.74101 0) (13.0406 -1.71097 0) (12.6736 -1.53204 0) (12.2313 -1.02144 0) (12.182 -0.526962 0) (12.0387 0.0812945 0) (12.3271 0.453056 0) (12.3177 0.791562 0) (12.5684 0.968421 0) (12.329 1.00466 0) (12.2511 0.955226 0) (11.7805 0.827857 0) (11.6914 0.71018 0) (11.3726 0.646698 0) (11.6081 0.615291 0) (11.6108 0.640202 0) (12.0474 0.565525 0) (12.2426 0.609198 0) (12.6899 0.377073 0) (12.9271 0.360712 0) (13.3001 0.0274157 0) (13.4527 -0.114886 0) (13.7586 -0.481208 0) (13.8381 -0.736059 0) (14.0702 -1.0334 0) (14.1763 -1.31567 0) (14.3571 -1.60615 0) (14.5342 -1.8757 0) (14.6691 -2.12735 0) (14.8668 -2.39319 0) (14.9131 -2.54733 0) (15.0701 -2.67504 0) (14.8946 -2.70047 0) (14.911 -2.6139 0) (14.5757 -2.50846 0) (14.3852 -2.24435 0) (13.9323 -2.07673 0) (13.6386 -1.69057 0) (13.1079 -1.50785 0) (12.8275 -0.994283 0) (12.2345 -0.969815 0) (11.984 -0.41852 0) (11.4397 -0.568876 0) (11.2526 -0.0331216 0) (10.8167 -0.300519 0) (10.6873 0.282152 0) (10.3347 -0.129913 0) (10.1774 0.51471 0) (9.93709 -0.0176826 0) (9.76085 0.762172 0) (9.70313 0.208319 0) (9.49962 1.09092 0) (9.44346 0.477233 0) (9.2915 1.47509 0) (9.09517 0.753966 0) (9.06822 1.82867 0) (8.76435 1.10955 0) (8.96235 2.14192 0) (8.4411 1.49173 0) (8.98581 2.41654 0) (8.28043 1.86247 0) (9.10224 2.63308 0) (8.49804 2.24009 0) (9.36516 2.76505 0) (9.03458 2.54224 0) (9.92138 2.87248 0) (9.83808 2.72445 0) (10.6652 2.87497 0) (10.8025 2.72094 0) (11.4608 2.66335 0) (11.7097 2.45072 0) (12.2264 2.31752 0) (12.4972 1.99421 0) (12.9158 1.74793 0) (13.2287 1.42315 0) (13.4829 1.04372 0) (13.8449 0.707429 0) (13.9723 0.247973 0) (14.332 -0.11706 0) (14.3332 -0.509399 0) (14.5739 -1.00454 0) (14.6057 -1.32629 0) (14.4175 -1.63813 0) (14.6809 -2.05306 0) (14.3552 -2.35083 0) (14.5827 -2.49959 0) (13.9348 -2.8627 0) (14.7323 -2.99606 0) (13.2969 -3.10824 0) (14.6935 -3.33727 0) (13.0897 -3.78388 0) (14.6687 -3.58091 0) (12.0713 -3.87018 0) (14.5009 -3.99129 0) (11.8507 -4.65174 0) (13.0846 -3.65551 0) (9.34465 -3.83688 0) (10.9187 -3.02681 0) (9.19765 -4.27421 0) (10.8669 -3.53116 0) (10.1922 -4.43862 0) (10.8673 -2.91476 0) (10.6884 -3.17055 0) (10.4 -1.43895 0) (10.8595 -1.48112 0) (10.3329 0.196775 0) (11.122 0.235292 0) (10.87 2.13357 0) (11.5144 2.31013 0) (11.5273 3.58147 0) (12.1301 3.29258 0) (11.7462 2.95884 0) (12.1286 -0.143254 0) (12.0287 -0.0966897 0) (12.4012 -0.161382 0) (12.305 -0.0974323 0) (12.6162 -0.158985 0) (12.417 -0.0985957 0) (12.6341 -0.145397 0) (12.325 -0.103966 0) (12.4423 -0.134772 0) (12.1681 -0.105851 0) (12.3077 -0.105027 0) (12.1343 -0.0823837 0) (12.2574 -0.0551067 0) (12.1117 -0.0605401 0) (12.2227 -0.0294246 0) (12.1329 -0.0576505 0) (12.2818 -0.0335964 0) (12.2196 -0.0941674 0) (12.3163 -0.108077 0) (12.2722 -0.188766 0) (12.4029 -0.23552 0) (12.4282 -0.306862 0) (12.4595 -0.380522 0) (12.4085 -0.459332 0) (12.421 -0.498924 0) (12.39 -0.536476 0) (12.3244 -0.541875 0) (12.1634 -0.581959 0) (12.0385 -0.521245 0) (11.8465 -0.437485 0) (11.6885 -0.251084 0) (11.5371 -0.0924119 0) (11.3776 0.0749163 0) (11.1919 0.217351 0) (11.0492 0.345346 0) (10.8616 0.44399 0) (10.7612 0.556754 0) (10.6177 0.648201 0) (10.7453 0.717603 0) (10.8684 0.801518 0) (11.2507 0.806514 0) (11.5151 0.837728 0) (11.8986 0.732093 0) (12.2244 0.59458 0) (12.6268 0.359578 0) (12.9061 0.145926 0) (13.1738 -0.115202 0) (13.3953 -0.358643 0) (13.5844 -0.69132 0) (13.585 -0.88012 0) (13.4292 -0.97784 0) (13.2258 -0.877705 0) (13.0578 -0.924148 0) (13.0114 -1.0631 0) (13.0219 -1.22863 0) (13.0679 -1.13957 0) (12.8835 -0.989514 0) (12.8422 -0.8048 0) (12.7265 -0.655498 0) (13.0141 -0.390169 0) (12.8559 -0.215431 0) (12.9044 -0.0818765 0) (12.3675 -0.0273191 0) (12.3026 0.197996 0) (11.6094 0.495421 0) (11.5189 0.862154 0) (10.76 1.14484 0) (10.7916 1.32726 0) (10.1951 1.44199 0) (10.4481 1.417 0) (10.046 1.41427 0) (10.5199 1.31462 0) (10.3554 1.2677 0) (11.0105 1.12796 0) (11.0671 1.04338 0) (11.8092 0.826784 0) (11.9847 0.643623 0) (12.7831 0.329551 0) (12.9366 0.083386 0) (13.4457 -0.180125 0) (13.1782 -0.340021 0) (13.3874 -0.471696 0) (13.1375 -0.609019 0) (13.583 -0.814983 0) (13.6178 -1.08386 0) (14.1312 -1.32921 0) (14.0234 -1.50806 0) (14.1521 -1.54351 0) (13.6677 -1.47486 0) (13.3438 -1.29521 0) (12.6604 -1.05885 0) (12.2683 -0.690037 0) (11.8603 -0.306755 0) (11.7373 0.107082 0) (11.6845 0.427548 0) (11.7778 0.651277 0) (11.8576 0.860315 0) (11.998 0.927706 0) (12.0273 1.02306 0) (12.0494 0.960796 0) (11.973 0.896034 0) (11.9306 0.792616 0) (11.8437 0.630204 0) (11.9388 0.608891 0) (11.9847 0.406353 0) (12.2028 0.406718 0) (12.3935 0.184321 0) (12.6629 0.100805 0) (12.9134 -0.175157 0) (13.1499 -0.334051 0) (13.4483 -0.65094 0) (13.6676 -0.892897 0) (13.9894 -1.18171 0) (14.1447 -1.51585 0) (14.4829 -1.78202 0) (14.6051 -2.07912 0) (14.83 -2.30525 0) (14.8885 -2.48184 0) (14.9344 -2.57134 0) (14.8415 -2.61759 0) (14.6804 -2.54567 0) (14.4635 -2.43115 0) (14.0986 -2.28895 0) (13.8275 -1.99116 0) (13.37 -1.74288 0) (13.0612 -1.33356 0) (12.5324 -1.08381 0) (12.2046 -0.664368 0) (11.6989 -0.527022 0) (11.4406 -0.142635 0) (10.9182 -0.207201 0) (10.7902 0.172007 0) (10.3503 0.00209375 0) (10.3297 0.39649 0) (9.95515 0.143403 0) (9.9721 0.566599 0) (9.67852 0.24808 0) (9.72624 0.771719 0) (9.48979 0.404288 0) (9.55929 0.988084 0) (9.38706 0.686958 0) (9.4809 1.29728 0) (9.3128 1.00972 0) (9.42472 1.67528 0) (9.24318 1.3553 0) (9.37974 1.96071 0) (9.14645 1.70505 0) (9.34902 2.15723 0) (9.1705 1.98718 0) (9.35348 2.33696 0) (9.37424 2.22631 0) (9.54636 2.43968 0) (9.77315 2.405 0) (9.99039 2.51292 0) (10.3909 2.4746 0) (10.6752 2.49353 0) (11.1618 2.39396 0) (11.4723 2.29487 0) (11.9664 2.12714 0) (12.262 1.93189 0) (12.7525 1.66903 0) (12.9076 1.43699 0) (13.476 1.07946 0) (13.5122 0.760917 0) (13.9549 0.457123 0) (14.0624 0.0572947 0) (14.3681 -0.305265 0) (14.248 -0.601639 0) (14.658 -1.06982 0) (14.4009 -1.33378 0) (14.5709 -1.68959 0) (14.5385 -1.95959 0) (14.4016 -2.1676 0) (14.4155 -2.45987 0) (14.3268 -2.77005 0) (14.2838 -2.80609 0) (13.7646 -3.04345 0) (14.4881 -3.38967 0) (13.2448 -3.4665 0) (13.7814 -3.23983 0) (12.2649 -3.72523 0) (13.7091 -3.86294 0) (10.163 -3.50352 0) (10.9483 -2.53986 0) (7.67369 -3.29805 0) (10.105 -3.26098 0) (8.00041 -4.43353 0) (9.96153 -3.62861 0) (8.52987 -4.181 0) (9.56769 -2.62168 0) (8.69261 -2.79932 0) (8.91332 -1.22559 0) (8.78391 -1.37975 0) (8.86264 0.153719 0) (9.1276 0.0993204 0) (9.45922 1.99459 0) (9.75832 1.98613 0) (10.2878 3.21743 0) (11.0609 3.12648 0) (10.8309 2.46995 0) (12.4208 -0.196515 0) (12.4672 -0.119288 0) (12.6173 -0.153618 0) (12.6215 -0.0524123 0) (12.7159 -0.0875835 0) (12.5846 -0.0177794 0) (12.6312 -0.0714315 0) (12.3888 -0.0544923 0) (12.4197 -0.0921497 0) (12.2203 -0.0852381 0) (12.3378 -0.0976402 0) (12.218 -0.0972237 0) (12.374 -0.0849975 0) (12.2911 -0.0901602 0) (12.4709 -0.0617605 0) (12.4204 -0.0895913 0) (12.6318 -0.0750528 0) (12.5807 -0.145366 0) (12.7539 -0.152772 0) (12.7079 -0.226441 0) (12.8621 -0.264895 0) (12.8178 -0.33287 0) (12.8641 -0.403717 0) (12.7568 -0.416526 0) (12.7477 -0.451232 0) (12.6289 -0.462944 0) (12.5573 -0.479691 0) (12.3485 -0.454915 0) (12.2504 -0.383692 0) (12.0083 -0.306092 0) (11.8972 -0.135924 0) (11.7522 0.000764383 0) (11.6804 0.167453 0) (11.5593 0.31426 0) (11.5318 0.423336 0) (11.4672 0.545446 0) (11.5103 0.588731 0) (11.4665 0.65056 0) (11.6163 0.61941 0) (11.7342 0.628554 0) (12.036 0.58621 0) (12.2546 0.543519 0) (12.5415 0.411324 0) (12.7776 0.288996 0) (13.0007 0.144078 0) (13.1492 -0.0146008 0) (13.2467 -0.252574 0) (13.2707 -0.472688 0) (13.2123 -0.609698 0) (13.0864 -0.633459 0) (12.9424 -0.756087 0) (12.9511 -0.908555 0) (13.0715 -1.08374 0) (13.2196 -1.1096 0) (13.2257 -1.17576 0) (13.1868 -1.18395 0) (13.159 -1.10482 0) (13.1968 -0.844174 0) (13.0812 -0.585859 0) (13.0349 -0.330679 0) (12.8343 -0.153881 0) (12.7236 0.0288416 0) (12.3139 0.170341 0) (12.0846 0.414169 0) (11.6438 0.734396 0) (11.5401 1.09127 0) (11.2122 1.38507 0) (11.2084 1.53014 0) (10.9768 1.60187 0) (11.0492 1.53784 0) (10.9228 1.48727 0) (11.1108 1.33015 0) (11.1345 1.19692 0) (11.4465 0.996039 0) (11.6545 0.80582 0) (12.06 0.588044 0) (12.3554 0.369845 0) (12.7255 0.151165 0) (12.89 -0.0634401 0) (13.143 -0.271661 0) (13.2129 -0.479069 0) (13.524 -0.700529 0) (13.6686 -0.948267 0) (14.0782 -1.18588 0) (14.1659 -1.39967 0) (14.4274 -1.5005 0) (14.2424 -1.49047 0) (14.2284 -1.3406 0) (13.7522 -1.14009 0) (13.4723 -0.920207 0) (12.814 -0.673526 0) (12.4924 -0.389529 0) (11.9643 -0.0618413 0) (11.8339 0.208959 0) (11.5692 0.491983 0) (11.6201 0.619436 0) (11.5386 0.818923 0) (11.7441 0.852811 0) (11.7086 0.94311 0) (11.9796 0.893332 0) (11.9264 0.856159 0) (12.1485 0.757991 0) (12.0906 0.637125 0) (12.3122 0.548302 0) (12.261 0.368824 0) (12.5597 0.28849 0) (12.5582 0.0600333 0) (12.9067 -0.0734421 0) (13.0052 -0.33312 0) (13.3304 -0.568543 0) (13.5218 -0.812306 0) (13.7961 -1.14554 0) (13.9972 -1.41488 0) (14.1946 -1.72196 0) (14.3807 -1.96741 0) (14.4342 -2.222 0) (14.4984 -2.3632 0) (14.4111 -2.48243 0) (14.2817 -2.53232 0) (14.0512 -2.47773 0) (13.7756 -2.41129 0) (13.4256 -2.19967 0) (13.0655 -1.99614 0) (12.6638 -1.66492 0) (12.25 -1.39739 0) (11.8589 -1.00492 0) (11.4446 -0.759046 0) (11.1136 -0.376759 0) (10.7227 -0.19508 0) (10.4896 0.0598565 0) (10.1338 0.133608 0) (9.98709 0.308476 0) (9.68132 0.261435 0) (9.63351 0.442355 0) (9.44013 0.321914 0) (9.46819 0.56722 0) (9.33538 0.415445 0) (9.35614 0.700179 0) (9.28659 0.574815 0) (9.29181 0.904985 0) (9.2616 0.828567 0) (9.27251 1.19717 0) (9.26789 1.14765 0) (9.27155 1.52514 0) (9.33715 1.4983 0) (9.31958 1.81124 0) (9.412 1.80588 0) (9.42784 2.0425 0) (9.57187 2.03627 0) (9.5556 2.18812 0) (9.83567 2.21572 0) (9.83952 2.26858 0) (10.197 2.25743 0) (10.3068 2.32272 0) (10.6978 2.2237 0) (10.9555 2.20369 0) (11.3558 2.12072 0) (11.6742 1.96359 0) (12.0814 1.80465 0) (12.4151 1.64019 0) (12.7741 1.35529 0) (13.0984 1.13483 0) (13.4303 0.880198 0) (13.6271 0.537313 0) (14.0262 0.258723 0) (14.0526 -0.0126574 0) (14.3113 -0.404429 0) (14.4632 -0.734266 0) (14.4659 -0.969201 0) (14.4469 -1.3116 0) (14.7138 -1.75807 0) (14.4139 -1.85269 0) (14.4359 -2.09603 0) (14.4551 -2.47549 0) (14.2419 -2.6189 0) (14.0185 -2.69273 0) (14.1099 -3.13329 0) (13.7646 -3.12078 0) (12.8064 -2.91057 0) (13.1038 -3.18379 0) (11.9504 -3.418 0) (11.4396 -2.73167 0) (8.40531 -2.06234 0) (9.06391 -2.04264 0) (6.44882 -2.96186 0) (8.94418 -3.36809 0) (6.38755 -4.25987 0) (8.97091 -3.67861 0) (6.73842 -4.15396 0) (8.44117 -2.72909 0) (6.8594 -2.88116 0) (7.66631 -1.33581 0) (6.97885 -1.54028 0) (7.54341 -0.0249414 0) (7.32359 -0.156886 0) (8.06805 1.66553 0) (8.11048 1.4954 0) (8.88744 2.65575 0) (9.75251 2.67641 0) (9.66444 2.09862 0) (12.4262 -0.176231 0) (12.562 -0.0818293 0) (12.5154 -0.0573804 0) (12.6753 0.0301732 0) (12.5973 0.0320972 0) (12.6553 0.0628466 0) (12.5694 0.0178174 0) (12.5436 -0.0158376 0) (12.483 -0.0635109 0) (12.4793 -0.0912876 0) (12.5022 -0.121633 0) (12.5346 -0.124637 0) (12.6047 -0.13502 0) (12.6311 -0.130972 0) (12.7237 -0.124762 0) (12.7463 -0.145241 0) (12.8608 -0.136085 0) (12.8498 -0.212204 0) (12.9177 -0.205623 0) (12.8948 -0.289962 0) (12.9342 -0.290931 0) (12.8993 -0.33825 0) (12.8302 -0.37223 0) (12.7412 -0.352888 0) (12.6491 -0.379208 0) (12.5762 -0.343566 0) (12.4757 -0.369859 0) (12.3366 -0.319687 0) (12.2353 -0.259589 0) (12.0715 -0.179791 0) (11.9712 -0.0148132 0) (11.8826 0.0850538 0) (11.8331 0.223076 0) (11.8081 0.339493 0) (11.8306 0.415416 0) (11.9006 0.524597 0) (11.9983 0.510444 0) (12.0706 0.55116 0) (12.1994 0.503403 0) (12.3048 0.490198 0) (12.4607 0.438642 0) (12.5597 0.360212 0) (12.6532 0.290576 0) (12.7012 0.214183 0) (12.7271 0.103786 0) (12.7662 -0.0358569 0) (12.7781 -0.206664 0) (12.7688 -0.367625 0) (12.6952 -0.524282 0) (12.6944 -0.652716 0) (12.7574 -0.795598 0) (12.9331 -0.928159 0) (13.0638 -1.15279 0) (13.2122 -1.28304 0) (13.27 -1.31642 0) (13.2191 -1.15344 0) (13.0453 -0.960431 0) (12.8664 -0.728815 0) (12.7044 -0.486372 0) (12.5576 -0.200097 0) (12.319 0.0576099 0) (12.0384 0.288457 0) (11.6924 0.512135 0) (11.3994 0.760701 0) (11.1188 1.04308 0) (10.9836 1.29326 0) (10.8985 1.49882 0) (10.9285 1.57568 0) (11.0007 1.61176 0) (11.1328 1.52624 0) (11.2896 1.43204 0) (11.508 1.24655 0) (11.7554 1.06088 0) (12.0325 0.846225 0) (12.3385 0.618545 0) (12.5957 0.40635 0) (12.8514 0.173404 0) (13.0263 -0.0235081 0) (13.2387 -0.223022 0) (13.3997 -0.413074 0) (13.6061 -0.6436 0) (13.799 -0.881917 0) (13.9818 -1.12282 0) (14.1262 -1.3176 0) (14.1516 -1.44765 0) (14.1048 -1.46166 0) (13.9115 -1.38728 0) (13.6925 -1.15487 0) (13.3812 -0.898917 0) (13.0586 -0.567438 0) (12.6963 -0.28034 0) (12.3648 -0.0185098 0) (12.0478 0.21963 0) (11.8387 0.399564 0) (11.6907 0.580995 0) (11.6237 0.668699 0) (11.6026 0.789477 0) (11.6443 0.798601 0) (11.7002 0.842405 0) (11.8238 0.819267 0) (11.8922 0.744648 0) (12.0552 0.702602 0) (12.0886 0.552035 0) (12.2833 0.451948 0) (12.3344 0.303253 0) (12.536 0.127347 0) (12.6325 -0.0505678 0) (12.8802 -0.255176 0) (12.9959 -0.496193 0) (13.2552 -0.737708 0) (13.387 -1.00768 0) (13.5804 -1.3064 0) (13.7071 -1.5439 0) (13.7734 -1.80673 0) (13.7788 -2.00412 0) (13.7275 -2.17799 0) (13.5475 -2.26078 0) (13.333 -2.3445 0) (13.0036 -2.28261 0) (12.6692 -2.20673 0) (12.1911 -2.05345 0) (11.824 -1.8105 0) (11.2762 -1.615 0) (10.8986 -1.29788 0) (10.437 -1.05847 0) (10.1131 -0.685262 0) (9.76531 -0.436985 0) (9.49149 -0.130914 0) (9.27433 0.0519632 0) (9.10524 0.265919 0) (8.92486 0.305425 0) (8.86684 0.42665 0) (8.7455 0.384588 0) (8.76057 0.480654 0) (8.71201 0.4442 0) (8.73103 0.506458 0) (8.76851 0.496084 0) (8.81229 0.618807 0) (8.86347 0.635263 0) (8.92498 0.824741 0) (8.98813 0.881387 0) (9.01475 1.09349 0) (9.10817 1.18645 0) (9.13619 1.42166 0) (9.22446 1.51006 0) (9.28095 1.71362 0) (9.39651 1.82505 0) (9.47154 1.94018 0) (9.62501 2.03212 0) (9.75453 2.0926 0) (9.92388 2.13507 0) (10.1131 2.14427 0) (10.3472 2.11474 0) (10.6154 2.10362 0) (10.7947 2.01839 0) (11.2535 1.95046 0) (11.4497 1.82048 0) (11.846 1.68513 0) (12.1862 1.54115 0) (12.5366 1.31709 0) (12.7882 1.14271 0) (13.2537 0.878856 0) (13.3958 0.650133 0) (13.7076 0.38698 0) (14.039 0.0480821 0) (14.062 -0.201892 0) (14.3084 -0.447005 0) (14.4692 -0.848695 0) (14.3791 -1.01281 0) (14.4946 -1.3267 0) (14.4755 -1.68529 0) (14.3461 -1.86966 0) (14.491 -2.20564 0) (14.124 -2.31407 0) (13.9237 -2.40089 0) (13.978 -2.77252 0) (13.532 -2.80865 0) (12.7172 -2.50849 0) (12.5298 -2.78795 0) (11.8875 -2.77807 0) (10.4482 -2.24525 0) (8.93616 -1.35567 0) (7.12975 -1.10548 0) (6.99366 -1.54173 0) (5.75217 -2.7083 0) (7.29495 -3.56125 0) (5.14977 -4.16181 0) (7.58104 -3.75883 0) (4.67477 -3.86093 0) (7.02332 -2.49808 0) (4.5201 -2.56329 0) (6.30868 -1.18178 0) (4.7896 -1.53242 0) (6.119 -0.092458 0) (5.3824 -0.372421 0) (6.59616 1.29566 0) (6.40188 1.00801 0) (7.34395 2.12638 0) (8.1238 2.10348 0) (8.06321 1.8389 0) (12.0672 -0.102905 0) (12.1963 0.0115426 0) (12.1697 0.058483 0) (12.3699 0.0991551 0) (12.3276 0.0983846 0) (12.4702 0.0695025 0) (12.4126 0.0112767 0) (12.484 -0.0597977 0) (12.4263 -0.114336 0) (12.4871 -0.146852 0) (12.456 -0.180697 0) (12.5042 -0.169066 0) (12.4828 -0.190847 0) (12.4907 -0.159467 0) (12.4874 -0.161175 0) (12.4705 -0.151098 0) (12.4888 -0.153907 0) (12.4332 -0.198185 0) (12.4204 -0.186884 0) (12.3642 -0.239787 0) (12.3287 -0.225277 0) (12.3004 -0.27626 0) (12.202 -0.295539 0) (12.1845 -0.294617 0) (12.0823 -0.313501 0) (12.0925 -0.286271 0) (11.9788 -0.301984 0) (11.9192 -0.242559 0) (11.8099 -0.179532 0) (11.7227 -0.103547 0) (11.6409 0.0249513 0) (11.6255 0.105378 0) (11.5936 0.215187 0) (11.638 0.298647 0) (11.646 0.374339 0) (11.7601 0.44998 0) (11.7952 0.4427 0) (11.8844 0.468575 0) (11.9145 0.4459 0) (11.9792 0.439042 0) (12.015 0.407378 0) (12.0437 0.351663 0) (12.0535 0.307624 0) (12.0846 0.210042 0) (12.1008 0.0921954 0) (12.1706 -0.0638386 0) (12.186 -0.220544 0) (12.2852 -0.369162 0) (12.3275 -0.513729 0) (12.4673 -0.708085 0) (12.5152 -0.990129 0) (12.6751 -1.21463 0) (12.7024 -1.30156 0) (12.6671 -1.19895 0) (12.3931 -1.09507 0) (12.1233 -0.959326 0) (11.8515 -0.826047 0) (11.6579 -0.611407 0) (11.4877 -0.33933 0) (11.3249 -0.0368698 0) (11.1306 0.269291 0) (10.9267 0.545954 0) (10.6873 0.787155 0) (10.4658 0.980317 0) (10.3093 1.16711 0) (10.2725 1.32774 0) (10.3447 1.45203 0) (10.5167 1.49854 0) (10.7608 1.49009 0) (11.0486 1.37124 0) (11.3546 1.22478 0) (11.6952 1.01206 0) (11.9957 0.790539 0) (12.3016 0.573394 0) (12.5332 0.354662 0) (12.738 0.169267 0) (12.8894 -0.0067363 0) (13.0335 -0.166049 0) (13.1632 -0.353448 0) (13.3012 -0.576593 0) (13.4372 -0.814896 0) (13.5581 -1.04096 0) (13.5894 -1.21414 0) (13.5511 -1.3245 0) (13.3552 -1.34934 0) (13.1209 -1.29606 0) (12.7795 -1.1541 0) (12.4824 -0.937107 0) (12.1995 -0.670577 0) (11.9704 -0.373869 0) (11.7891 -0.101609 0) (11.6064 0.133552 0) (11.503 0.340811 0) (11.3846 0.498658 0) (11.3742 0.642292 0) (11.3131 0.720176 0) (11.354 0.778001 0) (11.3709 0.812262 0) (11.441 0.786594 0) (11.5119 0.761003 0) (11.6337 0.687235 0) (11.7233 0.592002 0) (11.8519 0.459679 0) (12.0026 0.354007 0) (12.101 0.160774 0) (12.277 0.0157588 0) (12.4011 -0.179926 0) (12.5527 -0.401438 0) (12.6801 -0.611638 0) (12.797 -0.861179 0) (12.8513 -1.10843 0) (12.8879 -1.33798 0) (12.8539 -1.56455 0) (12.6865 -1.7694 0) (12.5345 -1.89766 0) (12.1798 -2.00073 0) (11.8252 -2.03307 0) (11.3633 -1.97587 0) (10.8656 -1.90288 0) (10.3412 -1.7777 0) (9.82194 -1.5966 0) (9.38724 -1.41023 0) (8.87175 -1.20347 0) (8.58862 -0.936149 0) (8.17645 -0.692388 0) (7.97328 -0.428224 0) (7.68381 -0.200384 0) (7.5803 0.0263545 0) (7.43613 0.196754 0) (7.41842 0.305476 0) (7.33496 0.379954 0) (7.42358 0.440154 0) (7.38067 0.406024 0) (7.52657 0.449719 0) (7.53249 0.388508 0) (7.68848 0.450278 0) (7.76823 0.446753 0) (7.89606 0.532763 0) (8.01055 0.591669 0) (8.12542 0.71151 0) (8.27532 0.827607 0) (8.37736 0.988934 0) (8.52743 1.12038 0) (8.6796 1.33234 0) (8.80844 1.45141 0) (8.96636 1.61209 0) (9.1251 1.74563 0) (9.32666 1.85412 0) (9.45736 1.9158 0) (9.72509 1.96914 0) (9.90835 2.01611 0) (10.1459 1.9622 0) (10.411 1.94702 0) (10.73 1.93824 0) (10.9091 1.76391 0) (11.3357 1.73262 0) (11.5981 1.6321 0) (11.9143 1.37919 0) (12.2868 1.31822 0) (12.5812 1.12105 0) (12.8971 0.819987 0) (13.2111 0.726847 0) (13.4773 0.443618 0) (13.7111 0.0881026 0) (13.9228 0.0346222 0) (14.1437 -0.41281 0) (14.291 -0.638651 0) (14.2232 -0.700078 0) (14.4826 -1.20792 0) (14.2881 -1.352 0) (14.0643 -1.39567 0) (14.3273 -1.99629 0) (14.0113 -2.0458 0) (13.644 -2.05407 0) (13.5724 -2.40551 0) (13.0372 -2.37401 0) (12.3155 -2.17645 0) (11.8119 -2.34501 0) (11.1923 -2.30839 0) (9.69423 -1.61634 0) (8.03593 -0.82927 0) (6.58736 -0.18473 0) (5.96345 -0.477 0) (5.52173 -1.30166 0) (5.17652 -2.74323 0) (5.3968 -3.416 0) (4.22852 -3.82215 0) (5.68299 -3.53682 0) (3.124 -3.42727 0) (5.42902 -2.41578 0) (2.74695 -2.43653 0) (4.89012 -1.1664 0) (2.71753 -1.57653 0) (4.74221 -0.260913 0) (3.10601 -0.612913 0) (5.05535 0.959573 0) (4.25502 0.527766 0) (5.54964 1.72986 0) (5.95055 1.52173 0) (5.9778 1.77068 0) (11.3094 -0.0655063 0) (11.4273 0.0382044 0) (11.4602 0.0814558 0) (11.6382 0.091553 0) (11.6314 0.0832375 0) (11.7317 0.024929 0) (11.6618 -0.0232954 0) (11.6927 -0.0914787 0) (11.5923 -0.116944 0) (11.6024 -0.145989 0) (11.5028 -0.149144 0) (11.524 -0.1444 0) (11.4324 -0.142953 0) (11.4369 -0.121118 0) (11.3793 -0.116402 0) (11.3719 -0.104121 0) (11.366 -0.129461 0) (11.3158 -0.15809 0) (11.3291 -0.183114 0) (11.2662 -0.205227 0) (11.2622 -0.220516 0) (11.2008 -0.250882 0) (11.1275 -0.268206 0) (11.1004 -0.268795 0) (10.9927 -0.26172 0) (10.9882 -0.246114 0) (10.8513 -0.226675 0) (10.8091 -0.173104 0) (10.6981 -0.107506 0) (10.6429 -0.0315828 0) (10.5894 0.0621021 0) (10.5847 0.146548 0) (10.5818 0.209502 0) (10.6402 0.28314 0) (10.6673 0.334326 0) (10.7629 0.381076 0) (10.7874 0.394413 0) (10.862 0.415907 0) (10.8764 0.428326 0) (10.9404 0.434113 0) (10.9775 0.400819 0) (11.0291 0.33468 0) (11.0988 0.255862 0) (11.1725 0.163762 0) (11.2809 0.0615181 0) (11.3792 -0.0870904 0) (11.4583 -0.270975 0) (11.5326 -0.482685 0) (11.5769 -0.659975 0) (11.6313 -0.800412 0) (11.5089 -0.949565 0) (11.3437 -1.08645 0) (11.0347 -1.15445 0) (10.8383 -1.06728 0) (10.5576 -0.893873 0) (10.3499 -0.696775 0) (10.0684 -0.533317 0) (9.84449 -0.366443 0) (9.62671 -0.14913 0) (9.47934 0.100951 0) (9.37554 0.389806 0) (9.33194 0.636508 0) (9.30077 0.849596 0) (9.3414 1.01245 0) (9.41082 1.15434 0) (9.57807 1.2489 0) (9.79124 1.28859 0) (10.0777 1.26271 0) (10.405 1.17994 0) (10.7458 1.03856 0) (11.0732 0.879778 0) (11.3774 0.703977 0) (11.6134 0.531435 0) (11.8253 0.378247 0) (11.9585 0.225584 0) (12.0906 0.0865866 0) (12.1818 -0.0647219 0) (12.29 -0.242584 0) (12.3754 -0.450334 0) (12.4456 -0.657837 0) (12.4555 -0.853793 0) (12.3879 -1.01268 0) (12.2404 -1.12439 0) (12.0427 -1.1581 0) (11.7837 -1.11991 0) (11.506 -1.01108 0) (11.1778 -0.849427 0) (10.8956 -0.638463 0) (10.6022 -0.408534 0) (10.3914 -0.181148 0) (10.229 0.0431399 0) (10.1399 0.23286 0) (10.1087 0.415967 0) (10.1106 0.541588 0) (10.1536 0.644659 0) (10.2152 0.700001 0) (10.3103 0.74348 0) (10.4128 0.73629 0) (10.5422 0.715517 0) (10.6804 0.669665 0) (10.8147 0.57365 0) (10.9854 0.495082 0) (11.1134 0.360708 0) (11.2724 0.210912 0) (11.3959 0.0777135 0) (11.5191 -0.107436 0) (11.603 -0.285733 0) (11.6826 -0.469832 0) (11.6643 -0.696183 0) (11.6535 -0.899711 0) (11.5276 -1.07694 0) (11.3572 -1.28214 0) (11.0815 -1.41197 0) (10.746 -1.51906 0) (10.3108 -1.60424 0) (9.84229 -1.5899 0) (9.31661 -1.56441 0) (8.76886 -1.51021 0) (8.28013 -1.40743 0) (7.75504 -1.29914 0) (7.33446 -1.17709 0) (6.92579 -1.00207 0) (6.54374 -0.846667 0) (6.25032 -0.666221 0) (5.97904 -0.47552 0) (5.81426 -0.261027 0) (5.63294 -0.100976 0) (5.59462 0.0721895 0) (5.60298 0.210185 0) (5.62925 0.301532 0) (5.66714 0.337894 0) (5.78158 0.348894 0) (5.86372 0.336372 0) (6.04222 0.338406 0) (6.1333 0.320784 0) (6.30714 0.328532 0) (6.43601 0.349622 0) (6.58884 0.398152 0) (6.73622 0.484721 0) (6.90644 0.58628 0) (7.05459 0.705571 0) (7.2623 0.851025 0) (7.42091 0.985192 0) (7.68474 1.15402 0) (7.87441 1.29132 0) (8.14077 1.43393 0) (8.38388 1.53503 0) (8.67494 1.65429 0) (8.93242 1.7012 0) (9.24218 1.73805 0) (9.55407 1.78057 0) (9.83146 1.72669 0) (10.203 1.68132 0) (10.5367 1.69614 0) (10.8112 1.51697 0) (11.2183 1.44746 0) (11.5751 1.3799 0) (11.8051 1.14667 0) (12.2666 1.0115 0) (12.5257 0.88351 0) (12.7892 0.6128 0) (13.166 0.421721 0) (13.3829 0.239718 0) (13.4821 -0.0286477 0) (13.9333 -0.243858 0) (13.8142 -0.402635 0) (14.0074 -0.670259 0) (14.1296 -0.910776 0) (13.8624 -1.02084 0) (13.8395 -1.30888 0) (13.7322 -1.57749 0) (13.259 -1.53499 0) (13.1698 -1.78958 0) (12.845 -2.1034 0) (12.0329 -1.86527 0) (11.4096 -1.772 0) (10.8336 -1.8981 0) (9.89175 -1.72419 0) (8.36173 -0.946805 0) (7.05613 -0.252107 0) (6.14091 0.28295 0) (5.55912 0.311585 0) (5.06092 -0.0961634 0) (4.70376 -1.09015 0) (4.37978 -2.40378 0) (4.00973 -3.20859 0) (3.63979 -3.86352 0) (3.79599 -3.34471 0) (2.03948 -3.01005 0) (3.61077 -2.45766 0) (1.05536 -2.08389 0) (3.33794 -1.21106 0) (0.90577 -1.43278 0) (2.98392 -0.315126 0) (0.967916 -0.759962 0) (3.26146 0.648043 0) (1.74459 0.12639 0) (3.58197 1.38164 0) (3.27293 0.930886 0) (3.63821 1.73621 0) (9.78544 -0.0290553 0) (9.84214 0.0828124 0) (9.87393 0.126558 0) (9.95156 0.141409 0) (9.94911 0.110421 0) (9.97237 0.0526384 0) (9.93783 -0.00178882 0) (9.92437 -0.053287 0) (9.86265 -0.0899443 0) (9.845 -0.110921 0) (9.78753 -0.115191 0) (9.79774 -0.118024 0) (9.73344 -0.118387 0) (9.75456 -0.118396 0) (9.69511 -0.104905 0) (9.7083 -0.112283 0) (9.63779 -0.11546 0) (9.6039 -0.138866 0) (9.54729 -0.1423 0) (9.48771 -0.159091 0) (9.44732 -0.18049 0) (9.37529 -0.193428 0) (9.3176 -0.21231 0) (9.24278 -0.192676 0) (9.15583 -0.192973 0) (9.11491 -0.167568 0) (9.00959 -0.147874 0) (8.98246 -0.111488 0) (8.89824 -0.0528176 0) (8.8828 -0.0112795 0) (8.85227 0.0689286 0) (8.87371 0.127117 0) (8.88296 0.186126 0) (8.93686 0.257022 0) (8.96793 0.29882 0) (9.05457 0.355705 0) (9.09785 0.371892 0) (9.20287 0.385708 0) (9.26892 0.394643 0) (9.40164 0.365247 0) (9.503 0.325283 0) (9.62867 0.247894 0) (9.73214 0.156877 0) (9.84157 0.0605401 0) (9.93812 -0.0697474 0) (10.0064 -0.21327 0) (10.0209 -0.358987 0) (9.95654 -0.488639 0) (9.8047 -0.592473 0) (9.61412 -0.667675 0) (9.36074 -0.741363 0) (9.09684 -0.805136 0) (8.76294 -0.834592 0) (8.48222 -0.778124 0) (8.18367 -0.66353 0) (7.98133 -0.521006 0) (7.75323 -0.379319 0) (7.59004 -0.219045 0) (7.43858 -0.0231141 0) (7.36068 0.195158 0) (7.35756 0.429044 0) (7.42883 0.627723 0) (7.56474 0.795978 0) (7.75948 0.914542 0) (7.99097 0.991041 0) (8.28145 1.02004 0) (8.58789 1.01519 0) (8.93718 0.964985 0) (9.27132 0.888808 0) (9.59488 0.780158 0) (9.87974 0.660598 0) (10.1257 0.536942 0) (10.3231 0.400993 0) (10.4953 0.27078 0) (10.6283 0.132385 0) (10.761 -0.0173889 0) (10.8513 -0.177043 0) (10.927 -0.345772 0) (10.9423 -0.509501 0) (10.8949 -0.662597 0) (10.7622 -0.782592 0) (10.5498 -0.863327 0) (10.2539 -0.89583 0) (9.91418 -0.88408 0) (9.54306 -0.821454 0) (9.1967 -0.712093 0) (8.87135 -0.571294 0) (8.61423 -0.410947 0) (8.39885 -0.238884 0) (8.2708 -0.0597179 0) (8.18999 0.116806 0) (8.18382 0.264939 0) (8.22335 0.397133 0) (8.30983 0.489154 0) (8.42556 0.558539 0) (8.57403 0.600998 0) (8.74079 0.612885 0) (8.92394 0.608361 0) (9.10861 0.569501 0) (9.30233 0.513724 0) (9.48042 0.431235 0) (9.65403 0.332383 0) (9.80369 0.21344 0) (9.93835 0.101389 0) (10.0395 -0.0303212 0) (10.0993 -0.166606 0) (10.0895 -0.326505 0) (10.0317 -0.495819 0) (9.91842 -0.64392 0) (9.7261 -0.783784 0) (9.45735 -0.910069 0) (9.11268 -1.00959 0) (8.68843 -1.07442 0) (8.22963 -1.11146 0) (7.7223 -1.11921 0) (7.2295 -1.12424 0) (6.74411 -1.10635 0) (6.28365 -1.08141 0) (5.84488 -1.02576 0) (5.4265 -0.961959 0) (5.04539 -0.873533 0) (4.702 -0.744217 0) (4.39567 -0.618439 0) (4.15364 -0.473623 0) (3.95763 -0.319588 0) (3.83538 -0.159234 0) (3.74611 -0.0257684 0) (3.76 0.0664384 0) (3.80442 0.159104 0) (3.88867 0.229075 0) (3.97719 0.243165 0) (4.09904 0.230435 0) (4.20747 0.196222 0) (4.3475 0.18896 0) (4.45324 0.186657 0) (4.60152 0.200284 0) (4.71383 0.228709 0) (4.84203 0.29307 0) (4.99912 0.377611 0) (5.1432 0.471128 0) (5.32843 0.587053 0) (5.54318 0.722965 0) (5.77678 0.833556 0) (6.05403 0.98023 0) (6.35789 1.11221 0) (6.66112 1.22549 0) (7.04527 1.31749 0) (7.37644 1.40919 0) (7.78179 1.44507 0) (8.16661 1.47651 0) (8.59778 1.50016 0) (8.95184 1.4403 0) (9.40578 1.4024 0) (9.84747 1.39231 0) (10.1603 1.2469 0) (10.6264 1.13601 0) (11.0245 1.11517 0) (11.3251 0.86479 0) (11.7064 0.722762 0) (12.0647 0.666138 0) (12.3017 0.361665 0) (12.5866 0.207588 0) (12.8671 0.0989708 0) (12.9488 -0.230232 0) (13.1834 -0.295458 0) (13.247 -0.443255 0) (13.1789 -0.731739 0) (13.1461 -0.716073 0) (13.013 -0.96594 0) (12.6002 -1.19719 0) (12.3592 -1.25325 0) (12.0071 -1.44878 0) (11.3479 -1.42386 0) (10.6798 -1.25663 0) (10.1232 -1.479 0) (9.29406 -1.39946 0) (7.97951 -0.809341 0) (6.63496 -0.18452 0) (5.82949 0.134638 0) (5.43178 0.295608 0) (5.11649 0.533276 0) (4.89387 0.564152 0) (4.71295 0.173313 0) (4.43626 -0.848338 0) (3.69729 -1.90019 0) (3.09959 -2.91543 0) (2.40035 -3.26464 0) (2.1047 -2.81343 0) (1.37891 -2.75606 0) (1.50484 -2.02869 0) (-0.337246 -1.85294 0) (1.51585 -1.25564 0) (-1.06074 -1.15531 0) (1.19413 -0.347181 0) (-0.993731 -0.723524 0) (1.09706 0.431575 0) (-0.615153 -0.128638 0) (1.44622 1.14909 0) (0.542824 0.559233 0) (1.36322 1.71465 0) (7.57181 0.0168313 0) (7.56101 0.0799977 0) (7.55188 0.12175 0) (7.59495 0.128634 0) (7.62112 0.0970199 0) (7.66513 0.0447552 0) (7.68157 0.00100974 0) (7.68822 -0.0434985 0) (7.657 -0.0771069 0) (7.6352 -0.0937239 0) (7.59559 -0.101185 0) (7.56382 -0.094496 0) (7.49976 -0.0883341 0) (7.46309 -0.0691257 0) (7.40767 -0.0582957 0) (7.37891 -0.0612248 0) (7.3281 -0.0667317 0) (7.30106 -0.0860119 0) (7.25161 -0.10015 0) (7.20927 -0.125418 0) (7.15075 -0.138032 0) (7.0911 -0.144105 0) (7.01713 -0.145213 0) (6.9415 -0.134941 0) (6.85697 -0.12598 0) (6.79328 -0.106453 0) (6.70368 -0.090069 0) (6.65756 -0.0586843 0) (6.59605 -0.0205401 0) (6.58637 0.023121 0) (6.5792 0.0755369 0) (6.61107 0.120477 0) (6.65645 0.167266 0) (6.73895 0.205612 0) (6.81528 0.233692 0) (6.93968 0.257147 0) (7.04206 0.261281 0) (7.18864 0.265077 0) (7.31024 0.254594 0) (7.45893 0.229451 0) (7.58118 0.191767 0) (7.70031 0.134109 0) (7.77629 0.073492 0) (7.83699 -0.00878454 0) (7.83905 -0.103305 0) (7.80645 -0.197645 0) (7.70474 -0.281418 0) (7.55918 -0.348294 0) (7.35535 -0.406355 0) (7.11251 -0.453083 0) (6.81868 -0.499189 0) (6.50784 -0.537665 0) (6.15756 -0.54673 0) (5.84788 -0.500854 0) (5.55178 -0.417161 0) (5.34802 -0.313533 0) (5.16516 -0.20635 0) (5.06752 -0.0921409 0) (4.99605 0.047775 0) (5.01584 0.196095 0) (5.10403 0.349731 0) (5.27048 0.480426 0) (5.49615 0.586326 0) (5.7823 0.658575 0) (6.09802 0.699128 0) (6.45402 0.715196 0) (6.81336 0.700343 0) (7.18792 0.658821 0) (7.53679 0.597475 0) (7.86902 0.513199 0) (8.15877 0.41829 0) (8.41645 0.31509 0) (8.62759 0.207995 0) (8.80674 0.105776 0) (8.92775 -0.00578643 0) (9.00285 -0.121061 0) (9.00647 -0.234417 0) (8.94391 -0.338849 0) (8.79417 -0.424072 0) (8.57257 -0.488303 0) (8.28002 -0.532418 0) (7.951 -0.554573 0) (7.59841 -0.560139 0) (7.2494 -0.543233 0) (6.91479 -0.501999 0) (6.61684 -0.436044 0) (6.36238 -0.347283 0) (6.16822 -0.237143 0) (6.02866 -0.119278 0) (5.96037 0.000778923 0) (5.95294 0.11942 0) (6.00412 0.2178 0) (6.10838 0.302491 0) (6.25282 0.36242 0) (6.42917 0.404847 0) (6.63227 0.422288 0) (6.84645 0.42426 0) (7.07127 0.406132 0) (7.28986 0.370764 0) (7.5047 0.323483 0) (7.68913 0.256546 0) (7.857 0.185574 0) (7.97608 0.105509 0) (8.05735 0.0117447 0) (8.08032 -0.0859825 0) (8.05773 -0.184679 0) (7.95958 -0.269596 0) (7.78923 -0.349999 0) (7.52613 -0.43457 0) (7.20854 -0.510352 0) (6.83624 -0.572613 0) (6.44892 -0.630777 0) (6.03931 -0.683905 0) (5.6387 -0.729077 0) (5.22513 -0.765274 0) (4.81867 -0.775224 0) (4.3992 -0.767779 0) (3.99004 -0.73948 0) (3.597 -0.695027 0) (3.22539 -0.639635 0) (2.88853 -0.572666 0) (2.59574 -0.493913 0) (2.34625 -0.41025 0) (2.15458 -0.318054 0) (2.00867 -0.220954 0) (1.92659 -0.122689 0) (1.89014 -0.0509375 0) (1.90326 0.0128248 0) (1.93489 0.083187 0) (1.98365 0.136408 0) (2.04465 0.162075 0) (2.11154 0.15954 0) (2.16786 0.144812 0) (2.25159 0.13445 0) (2.32099 0.123338 0) (2.42531 0.124888 0) (2.51656 0.149715 0) (2.64673 0.193235 0) (2.78549 0.256225 0) (2.94803 0.330411 0) (3.15045 0.411006 0) (3.38804 0.501629 0) (3.65665 0.595124 0) (3.97223 0.70566 0) (4.31739 0.801151 0) (4.70025 0.881718 0) (5.12396 0.953162 0) (5.55741 1.01798 0) (6.02076 1.05177 0) (6.51885 1.06708 0) (6.97446 1.08688 0) (7.4786 1.03803 0) (7.97093 0.985603 0) (8.44199 0.988541 0) (8.89234 0.860087 0) (9.36725 0.754051 0) (9.77862 0.733825 0) (10.1657 0.54558 0) (10.5643 0.390648 0) (10.8585 0.343925 0) (11.1644 0.151375 0) (11.3969 -0.0400402 0) (11.6014 -0.106092 0) (11.7037 -0.285215 0) (11.8018 -0.463633 0) (11.7908 -0.484757 0) (11.6358 -0.571284 0) (11.4403 -0.654635 0) (11.0689 -0.627121 0) (10.5429 -0.780342 0) (9.98602 -0.994798 0) (9.61219 -1.03216 0) (8.85202 -0.960765 0) (7.87814 -0.711447 0) (6.70574 -0.320332 0) (5.80204 0.0181545 0) (5.21039 0.188043 0) (4.98717 0.18563 0) (4.97344 0.135081 0) (4.85052 0.378144 0) (4.8599 0.593397 0) (4.88774 0.682008 0) (4.8797 0.286795 0) (4.49687 -0.345408 0) (3.83809 -1.36202 0) (2.84876 -2.26916 0) (1.8057 -2.54785 0) (1.06083 -2.56825 0) (0.421307 -2.17726 0) (-0.157061 -1.44432 0) (-0.889631 -1.77248 0) (-0.579739 -0.82623 0) (-2.43814 -1.04905 0) (-0.389356 -0.500254 0) (-2.95385 -0.525803 0) (-0.732895 0.189835 0) (-2.56671 -0.235442 0) (-0.614666 0.794163 0) (-1.7923 0.261681 0) (-0.652654 1.27334 0) (4.89916 -0.000912261 0) (4.89421 0.00680304 0) (4.89854 0.0259207 0) (4.93943 0.0278807 0) (4.99205 0.0188688 0) (5.04279 0.00376909 0) (5.0584 -0.0190377 0) (5.04757 -0.0426715 0) (5.01269 -0.0532996 0) (4.97182 -0.0571638 0) (4.92265 -0.0569064 0) (4.87895 -0.050987 0) (4.8298 -0.0471238 0) (4.79688 -0.0478745 0) (4.75844 -0.0481496 0) (4.7298 -0.0471003 0) (4.68667 -0.0497334 0) (4.64431 -0.0600653 0) (4.5873 -0.067028 0) (4.52591 -0.0735486 0) (4.45201 -0.0767536 0) (4.37673 -0.0769851 0) (4.29782 -0.07343 0) (4.22343 -0.0651716 0) (4.15262 -0.0604861 0) (4.09669 -0.0499556 0) (4.03959 -0.039602 0) (4.00801 -0.024865 0) (3.97828 -0.0058513 0) (3.98524 0.0155091 0) (4.00347 0.0478228 0) (4.052 0.0746222 0) (4.11756 0.0952962 0) (4.21003 0.115943 0) (4.3158 0.130682 0) (4.44746 0.145084 0) (4.57469 0.147531 0) (4.7189 0.14275 0) (4.8487 0.135646 0) (4.98133 0.118646 0) (5.08619 0.0968504 0) (5.1721 0.0663513 0) (5.21289 0.0305731 0) (5.22375 -0.0056219 0) (5.18026 -0.0491316 0) (5.09147 -0.0952533 0) (4.94791 -0.138271 0) (4.77267 -0.177024 0) (4.56113 -0.206568 0) (4.33828 -0.230013 0) (4.08995 -0.257602 0) (3.83244 -0.284026 0) (3.55406 -0.29868 0) (3.29363 -0.284928 0) (3.05043 -0.245553 0) (2.87021 -0.189332 0) (2.72755 -0.126036 0) (2.66131 -0.0545764 0) (2.64238 0.0296698 0) (2.70833 0.116955 0) (2.83763 0.204479 0) (3.04432 0.277408 0) (3.30823 0.333477 0) (3.62783 0.370092 0) (3.97407 0.388466 0) (4.34866 0.389616 0) (4.7194 0.372365 0) (5.08727 0.340292 0) (5.4236 0.296987 0) (5.72943 0.242539 0) (5.98355 0.184857 0) (6.18789 0.126777 0) (6.32754 0.0685671 0) (6.41272 0.0166175 0) (6.43181 -0.0349206 0) (6.39398 -0.0851214 0) (6.28838 -0.131735 0) (6.13143 -0.174936 0) (5.92096 -0.213404 0) (5.67961 -0.248189 0) (5.40501 -0.276804 0) (5.12069 -0.297649 0) (4.82235 -0.307307 0) (4.53321 -0.302451 0) (4.25481 -0.280578 0) (4.01116 -0.242334 0) (3.80452 -0.190864 0) (3.65674 -0.129387 0) (3.56388 -0.0636829 0) (3.53619 0.00519542 0) (3.565 0.0712674 0) (3.64967 0.125974 0) (3.77995 0.171164 0) (3.9481 0.202645 0) (4.14366 0.221254 0) (4.35723 0.228955 0) (4.57683 0.226121 0) (4.79426 0.214295 0) (4.99729 0.192391 0) (5.17962 0.164325 0) (5.32757 0.128833 0) (5.43785 0.0899026 0) (5.50076 0.0496217 0) (5.51543 0.0117971 0) (5.4802 -0.0265412 0) (5.396 -0.0670808 0) (5.26511 -0.109384 0) (5.0935 -0.153179 0) (4.88494 -0.198741 0) (4.64036 -0.249008 0) (4.36105 -0.302268 0) (4.05061 -0.35316 0) (3.70655 -0.393723 0) (3.34198 -0.423211 0) (2.95792 -0.439208 0) (2.57215 -0.444602 0) (2.17951 -0.438986 0) (1.80194 -0.428102 0) (1.4329 -0.405587 0) (1.09114 -0.376388 0) (0.771537 -0.338235 0) (0.491968 -0.289321 0) (0.247524 -0.23756 0) (0.0555862 -0.179238 0) (-0.0930956 -0.11796 0) (-0.180718 -0.0582338 0) (-0.230463 -0.00490442 0) (-0.236517 0.0431132 0) (-0.207649 0.0853305 0) (-0.145437 0.109204 0) (-0.0698037 0.111006 0) (0.0115388 0.0985113 0) (0.0835761 0.0774423 0) (0.152359 0.0622366 0) (0.209485 0.0529368 0) (0.277868 0.0535865 0) (0.340884 0.0687224 0) (0.438716 0.09904 0) (0.548984 0.143226 0) (0.703357 0.191448 0) (0.885346 0.24632 0) (1.12072 0.309411 0) (1.38894 0.373407 0) (1.71834 0.440972 0) (2.08257 0.498248 0) (2.5059 0.550271 0) (2.95602 0.595186 0) (3.44207 0.633014 0) (3.95503 0.646231 0) (4.48674 0.659075 0) (5.02511 0.659562 0) (5.5756 0.616573 0) (6.1082 0.589915 0) (6.62436 0.565884 0) (7.13564 0.47421 0) (7.59678 0.406913 0) (8.03625 0.369821 0) (8.41276 0.246246 0) (8.74905 0.145946 0) (9.00902 0.0808804 0) (9.23519 -0.0491545 0) (9.35832 -0.156775 0) (9.39042 -0.241914 0) (9.38393 -0.37962 0) (9.27313 -0.445294 0) (9.08475 -0.476239 0) (8.83518 -0.529323 0) (8.4488 -0.435807 0) (7.79665 -0.259966 0) (7.07507 -0.176721 0) (6.29502 -0.195547 0) (5.65207 -0.132129 0) (5.0946 0.051668 0) (4.77721 0.147868 0) (4.58477 0.095341 0) (4.56801 -0.0301392 0) (4.55838 -0.0204317 0) (4.6139 0.0190946 0) (4.56819 0.203863 0) (4.66462 0.359196 0) (4.86568 0.575607 0) (5.2401 0.584764 0) (5.51764 0.506555 0) (5.42317 0.105837 0) (4.84527 -0.567138 0) (3.47697 -1.18194 0) (2.10072 -1.75039 0) (0.806481 -1.62352 0) (-0.339543 -1.42509 0) (-1.0437 -1.17133 0) (-1.80593 -0.941411 0) (-2.34826 -0.59278 0) (-2.80382 -0.815774 0) (-2.71493 -0.138854 0) (-3.9769 -0.46093 0) (-2.25294 0.0632535 0) (-4.2975 -0.0856713 0) (-2.01374 0.566922 0) (-3.69338 0.0756978 0) (-2.17773 0.876871 0) (1.79471 0.0712685 0) (1.80708 0.0350635 0) (1.82919 0.029093 0) (1.87023 0.0346474 0) (1.91086 0.0286187 0) (1.93457 0.0134754 0) (1.93638 0.00154093 0) (1.91945 -0.00906139 0) (1.88516 -0.0172929 0) (1.84194 -0.019587 0) (1.79426 -0.0168083 0) (1.75114 -0.0116496 0) (1.71214 -0.00815661 0) (1.67916 -0.00483929 0) (1.64777 -0.00221231 0) (1.62112 -0.00192814 0) (1.59192 -0.0033019 0) (1.56064 -0.00617043 0) (1.52104 -0.008224 0) (1.47709 -0.010769 0) (1.42594 -0.0124746 0) (1.37236 -0.0139027 0) (1.31666 -0.0146482 0) (1.2644 -0.0140246 0) (1.21462 -0.0134232 0) (1.17172 -0.0112057 0) (1.13421 -0.00875126 0) (1.10925 -0.00473966 0) (1.09496 -0.000354746 0) (1.0991 0.00540138 0) (1.11859 0.0119544 0) (1.16054 0.0174603 0) (1.21865 0.0230156 0) (1.29557 0.0280317 0) (1.38519 0.0313354 0) (1.48967 0.0343439 0) (1.59864 0.0353073 0) (1.71235 0.0363387 0) (1.82105 0.0370141 0) (1.92628 0.0365832 0) (2.01779 0.0350696 0) (2.0943 0.0322549 0) (2.14642 0.0290167 0) (2.17439 0.0233961 0) (2.17144 0.0129275 0) (2.14061 -0.00106384 0) (2.07467 -0.0165198 0) (1.97864 -0.0318596 0) (1.84971 -0.0465408 0) (1.69471 -0.0589986 0) (1.50832 -0.0703207 0) (1.29629 -0.0795982 0) (1.06101 -0.0838014 0) (0.827316 -0.0802293 0) (0.60964 -0.0707758 0) (0.432412 -0.0572588 0) (0.296926 -0.0418464 0) (0.22033 -0.0248704 0) (0.198381 -0.0054354 0) (0.242028 0.01534 0) (0.345661 0.0359926 0) (0.514151 0.0527429 0) (0.732331 0.0654517 0) (0.991249 0.0734999 0) (1.27212 0.0765462 0) (1.56474 0.0754719 0) (1.85072 0.0707991 0) (2.12163 0.0637348 0) (2.36357 0.0553489 0) (2.57167 0.0460905 0) (2.73829 0.0376089 0) (2.86448 0.0301329 0) (2.94801 0.0236344 0) (2.99299 0.0181892 0) (3.00036 0.0105553 0) (2.97569 -0.000450559 0) (2.91706 -0.0130679 0) (2.8261 -0.0265844 0) (2.69979 -0.0395484 0) (2.5423 -0.0511777 0) (2.35307 -0.0614336 0) (2.14091 -0.0696946 0) (1.91025 -0.0750883 0) (1.67555 -0.0767857 0) (1.44541 -0.0738407 0) (1.23755 -0.0660242 0) (1.06034 -0.0540013 0) (0.928724 -0.0386846 0) (0.845575 -0.0217365 0) (0.818062 -0.00426902 0) (0.838061 0.0135195 0) (0.903307 0.0280514 0) (1.007 0.0395444 0) (1.14408 0.0474766 0) (1.30279 0.0528476 0) (1.4756 0.055432 0) (1.65163 0.0560595 0) (1.82567 0.0548366 0) (1.98803 0.0521313 0) (2.13524 0.048675 0) (2.25965 0.0442648 0) (2.36009 0.039808 0) (2.43186 0.0343973 0) (2.47584 0.027621 0) (2.48928 0.0198414 0) (2.47555 0.00754394 0) (2.43194 -0.00512962 0) (2.35779 -0.0195935 0) (2.2478 -0.036305 0) (2.10047 -0.0538135 0) (1.91042 -0.0712671 0) (1.67863 -0.0887841 0) (1.40735 -0.103927 0) (1.10397 -0.115187 0) (0.775405 -0.121681 0) (0.434131 -0.121947 0) (0.0872321 -0.118302 0) (-0.250124 -0.111625 0) (-0.573343 -0.102644 0) (-0.874394 -0.092606 0) (-1.14947 -0.0819774 0) (-1.39009 -0.0706736 0) (-1.59545 -0.0587673 0) (-1.75837 -0.0463656 0) (-1.87972 -0.0320119 0) (-1.94964 -0.0188557 0) (-1.98021 -0.00803227 0) (-1.96942 0.00575999 0) (-1.93128 0.0196456 0) (-1.86486 0.0294571 0) (-1.78703 0.0328498 0) (-1.70655 0.0306148 0) (-1.64064 0.0259408 0) (-1.58348 0.0208299 0) (-1.54177 0.0151604 0) (-1.50184 0.0123379 0) (-1.46121 0.0122427 0) (-1.40137 0.0170907 0) (-1.32281 0.0259433 0) (-1.20977 0.0366528 0) (-1.06442 0.0495534 0) (-0.874082 0.0639227 0) (-0.645787 0.0775177 0) (-0.364829 0.0899464 0) (-0.037581 0.0977064 0) (0.338967 0.104368 0) (0.74087 0.107184 0) (1.17769 0.106719 0) (1.62928 0.100358 0) (2.09367 0.0922097 0) (2.55759 0.0789437 0) (3.00531 0.0582247 0) (3.42075 0.0401488 0) (3.81396 0.0228413 0) (4.15836 -0.00626543 0) (4.43892 -0.0294888 0) (4.6723 -0.0438643 0) (4.84269 -0.0723625 0) (4.92929 -0.0913693 0) (4.94344 -0.102222 0) (4.89283 -0.13215 0) (4.75572 -0.141426 0) (4.55241 -0.126308 0) (4.28063 -0.107905 0) (3.96468 -0.0642168 0) (3.64123 0.0316 0) (3.37314 0.151966 0) (3.2083 0.274975 0) (3.18637 0.328074 0) (3.25623 0.246505 0) (3.27853 0.0578197 0) (3.19491 -0.107321 0) (3.08938 -0.177996 0) (3.03074 -0.155136 0) (3.03301 -0.068814 0) (3.03468 0.0374086 0) (3.0756 0.091323 0) (3.14742 0.146765 0) (3.30781 0.159491 0) (3.55584 0.179179 0) (3.91686 0.161302 0) (4.36146 0.17272 0) (4.76463 0.214367 0) (5.1916 0.210684 0) (5.17541 0.142404 0) (4.61414 -0.204703 0) (3.3054 -0.445406 0) (1.7722 -0.629461 0) (0.435162 -0.585816 0) (-0.782605 -0.439691 0) (-1.63332 -0.426468 0) (-2.40986 -0.295545 0) (-3.04107 -0.249103 0) (-3.3962 -0.134141 0) (-3.87933 -0.295993 0) (-3.84127 0.0510068 0) (-4.30389 -0.137516 0) (-3.52079 0.0626343 0) (-4.29595 -0.0501454 0) (-3.15464 0.150928 0) (-0.0376505 0.0209412 0) (-0.0558063 -0.0195733 0) (0.0727614 -0.0490156 0) (0.196698 -0.0434084 0) (0.300001 -0.0261569 0) (0.361727 -0.00707219 0) (0.380191 0.00784247 0) (0.367941 0.0151134 0) (0.345115 0.00989928 0) (0.332807 -2.27954e-05 0) (0.3432 -0.00811923 0) (0.370253 -0.0138784 0) (0.413693 -0.0161231 0) (0.463944 -0.0120924 0) (0.507338 -0.00351502 0) (0.531465 0.00941778 0) (0.523934 0.026489 0) (0.478748 0.0462199 0) (0.386661 0.0723224 0) (0.236145 0.0933276 0) (0.0233505 0.114815 0) (-0.242835 0.086055 0) (-0.461038 -0.00858182 0) (-0.548254 -0.0276753 0) (-0.579574 -0.00292361 0) (-0.587096 0.00505387 0) (-0.573703 -0.00449153 0) (-0.502197 -0.0304871 0) (-0.409497 -0.0425389 0) (-0.247701 -0.0735339 0) (-0.0445701 -0.0877539 0) (0.169907 -0.074865 0) (0.341055 -0.0578023 0) (0.467067 -0.0159345 0) (0.529223 0.0249474 0) (0.460251 0.0572206 0) (0.276667 0.0800659 0) (0.111571 0.0159533 0) (0.054497 -0.0199347 0) (0.145421 -0.0988313 0) (0.242287 -0.136122 0) (0.240151 -0.0673364 0) (0.152604 0.0531677 0) (0.149126 0.0929787 0) (0.273223 0.0166039 0) (0.375471 0.00538049 0) (0.3799 0.0479307 0) (0.270823 0.10268 0) (0.0285495 0.156035 0) (-0.31757 0.181935 0) (-0.69336 0.158162 0) (-1.01434 0.101499 0) (-1.20817 0.0374244 0) (-1.25679 -0.0347861 0) (-1.16338 -0.100179 0) (-0.956783 -0.138135 0) (-0.635306 -0.170575 0) (-0.214021 -0.19835 0) (0.291384 -0.226725 0) (0.845308 -0.22902 0) (1.38698 -0.196102 0) (1.82826 -0.143687 0) (2.16363 -0.0780153 0) (2.3681 -0.0133355 0) (2.44987 0.0423971 0) (2.41795 0.0797308 0) (2.32092 0.112132 0) (2.1885 0.119737 0) (2.02723 0.100397 0) (1.82324 0.067884 0) (1.57742 0.0639237 0) (1.27738 0.110189 0) (0.919144 0.158795 0) (0.530484 0.16728 0) (0.142535 0.137339 0) (-0.196382 0.0630855 0) (-0.357245 -0.0505334 0) (-0.247566 -0.154829 0) (-0.00348693 -0.17765 0) (0.123221 -0.148501 0) (-9.1095e-05 -0.137819 0) (-0.348263 -0.00742118 0) (-0.803919 0.254195 0) (-1.21495 0.25142 0) (-1.30124 0.0514247 0) (-1.11824 -0.0144673 0) (-0.922674 0.00109364 0) (-0.701937 -0.0495173 0) (-0.353858 -0.131939 0) (0.0786089 -0.163788 0) (0.49965 -0.141588 0) (0.879611 -0.110834 0) (1.19649 -0.102845 0) (1.4698 -0.0877714 0) (1.70797 -0.0626711 0) (1.89955 -0.0304528 0) (2.00372 0.00214988 0) (2.0014 0.0462817 0) (1.86477 0.077622 0) (1.63831 0.104825 0) (1.32457 0.13954 0) (1.00918 0.126493 0) (0.781041 0.0653093 0) (0.702347 -0.0360378 0) (0.767853 -0.141765 0) (0.824594 -0.165955 0) (0.742172 -0.0700162 0) (0.461114 0.094242 0) (0.057187 0.188719 0) (-0.358386 0.199136 0) (-0.747222 0.184068 0) (-1.1263 0.174947 0) (-1.50572 0.175864 0) (-1.87983 0.166512 0) (-2.25866 0.157628 0) (-2.62872 0.168625 0) (-2.9802 0.179547 0) (-3.31913 0.171394 0) (-3.62897 0.160101 0) (-3.90416 0.146781 0) (-4.14967 0.129554 0) (-4.38164 0.1184 0) (-4.5577 0.101966 0) (-4.68336 0.10003 0) (-4.72431 0.0621768 0) (-4.65693 0.0226034 0) (-4.57451 0.0344618 0) (-4.43143 0.0229663 0) (-4.20225 -0.0284337 0) (-3.8862 -0.0746089 0) (-3.41056 -0.109906 0) (-2.88692 -0.154653 0) (-2.21363 -0.170742 0) (-1.4786 -0.211819 0) (-0.589499 -0.252898 0) (0.43054 -0.270511 0) (1.52938 -0.324331 0) (2.80261 -0.376578 0) (4.20999 -0.344632 0) (5.59523 -0.177857 0) (6.67809 0.121237 0) (7.02499 0.571059 0) (6.29117 0.915966 0) (4.85372 0.554134 0) (3.60127 -0.140561 0) (2.85622 -0.395895 0) (2.48179 -0.0515863 0) (2.08031 0.319508 0) (1.4689 0.365439 0) (0.894553 0.235822 0) (0.586513 0.0852895 0) (0.559585 -0.0127872 0) (0.710673 -0.0574757 0) (1.09297 -0.0762907 0) (1.68604 -0.0299968 0) (2.15413 0.128495 0) (1.96836 0.21869 0) (1.46136 0.163175 0) (1.44417 -0.114374 0) (2.00089 -0.293106 0) (2.70581 -0.195643 0) (3.39172 -0.232788 0) (3.98544 -0.643141 0) (4.60286 -0.979323 0) (4.70837 -0.51019 0) (3.69751 0.258936 0) (2.16594 0.571908 0) (0.789188 0.576087 0) (-0.428156 0.517718 0) (-1.50907 0.459085 0) (-2.44871 0.407195 0) (-3.27653 0.37668 0) (-3.99188 0.350568 0) (-4.61823 0.323449 0) (-5.14788 0.308928 0) (-5.56462 0.272941 0) (-5.86424 0.227758 0) (-6.00525 0.188099 0) (-5.97682 0.0932112 0) (-5.73228 -0.00578825 0) (-5.24351 -0.098345 0) (-4.58798 -0.253083 0) (-3.8872 -0.280235 0) (-3.3611 -0.201195 0) (-3.18724 -0.125696 0) (-3.54895 0.0761432 0) (-4.24265 0.32505 0) (-5.06703 0.559943 0) (-5.76764 0.207946 0) (-4.91154 -0.154245 0) (-4.78389 -0.144749 0) (-3.96019 -0.264764 0) (-2.94846 -0.312064 0) (-2.3548 -0.41068 0) (-1.4362 -0.201246 0) (-1.07535 -0.0106145 0) (-0.664173 0.00515881 0) (-0.50646 -0.0323988 0) (-0.33949 -0.0850256 0) (-0.181891 -0.209193 0) (-0.0313696 0.0520793 0) (0.0653398 -0.0674335 0) (0.232933 -0.159217 0) (0.360257 -0.149969 0) (0.458397 -0.105691 0) (0.517432 -0.0533864 0) (0.540649 -0.00667604 0) (0.53736 0.0153637 0) (0.52942 0.0166916 0) (0.514214 0.000953807 0) (0.527669 -0.0244694 0) (0.55067 -0.0487306 0) (0.591538 -0.0671372 0) (0.64428 -0.0721409 0) (0.702169 -0.0541284 0) (0.744282 -0.0226928 0) (0.770104 0.021002 0) (0.767662 0.0759631 0) (0.730382 0.136611 0) (0.647616 0.204183 0) (0.518529 0.266039 0) (0.330445 0.294619 0) (0.113731 0.258996 0) (-0.139663 0.145122 0) (-0.341672 0.0333355 0) (-0.414471 -0.0169499 0) (-0.418452 -0.0588708 0) (-0.328079 -0.123781 0) (-0.251379 -0.169288 0) (-0.0785964 -0.244813 0) (0.0955024 -0.280507 0) (0.269336 -0.258296 0) (0.43317 -0.195679 0) (0.538891 -0.137221 0) (0.643823 -0.00599582 0) (0.634447 0.149436 0) (0.554326 0.189507 0) (0.392832 0.159419 0) (0.340269 -0.00285488 0) (0.278181 -0.0625188 0) (-0.0515632 0.0619853 0) (-0.306708 0.158775 0) (-0.230103 0.0178011 0) (0.0318363 -0.193825 0) (0.165281 -0.200764 0) (0.237879 -0.0960879 0) (0.215672 0.0322092 0) (0.11007 0.193124 0) (-0.0771125 0.325211 0) (-0.354649 0.401096 0) (-0.667259 0.401685 0) (-0.955251 0.319417 0) (-1.15039 0.178187 0) (-1.24084 0.0203768 0) (-1.24458 -0.127996 0) (-1.11414 -0.288637 0) (-0.808587 -0.453032 0) (-0.403315 -0.569139 0) (0.124288 -0.685353 0) (0.698359 -0.720752 0) (1.31285 -0.636094 0) (1.7884 -0.509317 0) (2.19755 -0.360918 0) (2.45201 -0.208619 0) (2.63625 -0.0682892 0) (2.68366 0.0245778 0) (2.68538 0.0604424 0) (2.63301 0.093675 0) (2.48834 0.198679 0) (2.26096 0.312708 0) (2.01412 0.397766 0) (1.76463 0.445119 0) (1.44329 0.467866 0) (1.05877 0.479811 0) (0.653221 0.463921 0) (0.252186 0.359887 0) (-0.0636109 0.118335 0) (-0.232329 -0.152253 0) (-0.428269 -0.181132 0) (-0.822126 0.16434 0) (-1.47445 0.558523 0) (-2.02587 0.626214 0) (-2.11463 0.415602 0) (-2.06867 0.164339 0) (-1.8853 -0.117782 0) (-1.51172 -0.289044 0) (-1.22967 -0.309933 0) (-0.970904 -0.411068 0) (-0.662746 -0.560957 0) (-0.35201 -0.60199 0) (0.00613605 -0.543705 0) (0.410551 -0.469449 0) (0.772632 -0.418283 0) (1.10192 -0.373439 0) (1.40145 -0.321724 0) (1.63707 -0.223762 0) (1.76944 -0.0766919 0) (1.81385 0.0853149 0) (1.74292 0.231217 0) (1.53427 0.334241 0) (1.27539 0.359037 0) (0.993705 0.317317 0) (0.776618 0.204904 0) (0.563883 0.0550596 0) (0.171491 0.0237415 0) (-0.467788 0.213909 0) (-1.01563 0.417687 0) (-1.41752 0.471455 0) (-1.81885 0.478988 0) (-2.25674 0.482501 0) (-2.6846 0.491785 0) (-3.14803 0.495806 0) (-3.59426 0.491207 0) (-4.02393 0.502139 0) (-4.41655 0.491858 0) (-4.75201 0.444336 0) (-5.05457 0.413187 0) (-5.35296 0.391247 0) (-5.60308 0.333953 0) (-5.81237 0.290941 0) (-6.01275 0.290924 0) (-6.20193 0.245602 0) (-6.24954 0.163467 0) (-6.32486 0.064813 0) (-6.19387 -0.0673795 0) (-6.05414 -0.130498 0) (-5.94842 -0.215515 0) (-5.67212 -0.27061 0) (-5.34758 -0.373085 0) (-4.95674 -0.5407 0) (-4.40411 -0.652394 0) (-3.87672 -0.813336 0) (-3.07386 -0.912103 0) (-2.31315 -1.06658 0) (-1.39929 -1.25794 0) (-0.273885 -1.35176 0) (0.871198 -1.5737 0) (2.23416 -1.83602 0) (3.83207 -1.95295 0) (5.4775 -1.81583 0) (7.18215 -1.13921 0) (8.51332 -0.18449 0) (9.13104 0.608721 0) (9.51853 1.45461 0) (9.37117 1.9337 0) (7.76679 1.40254 0) (5.5325 0.728498 0) (3.91686 0.61143 0) (2.97799 0.605233 0) (2.47428 0.47384 0) (2.19646 0.181612 0) (2.20979 -0.127299 0) (2.38896 -0.380573 0) (2.89826 -0.78424 0) (3.58368 -1.0246 0) (4.33192 -0.511935 0) (3.88958 0.349941 0) (3.36295 0.488605 0) (3.77174 -0.401846 0) (4.48768 -1.06158 0) (5.29837 -1.24703 0) (5.66207 -0.986461 0) (4.26782 -0.246755 0) (1.82922 0.706596 0) (-0.0832377 1.35109 0) (-1.66336 1.63304 0) (-2.92761 1.65989 0) (-3.98885 1.49182 0) (-4.88117 1.30095 0) (-5.66215 1.15714 0) (-6.31513 1.01476 0) (-6.87862 0.865882 0) (-7.31572 0.718577 0) (-7.68913 0.587567 0) (-7.9453 0.477937 0) (-8.08995 0.314371 0) (-8.10999 0.139907 0) (-8.02189 -0.0265241 0) (-7.80657 -0.313728 0) (-7.44151 -0.534395 0) (-6.97028 -0.742922 0) (-6.34985 -1.02117 0) (-5.67049 -0.930146 0) (-5.08308 -0.456131 0) (-4.95611 0.202076 0) (-5.36687 0.905891 0) (-5.72316 0.897213 0) (-6.30932 0.374089 0) (-5.70466 -0.36011 0) (-4.54001 -0.618354 0) (-4.54122 -0.673796 0) (-3.75371 -1.27261 0) (-2.71801 -1.16496 0) (-2.36524 -1.1253 0) (-1.64619 -0.933761 0) (-1.23392 -0.61398 0) (-0.599497 -0.444681 0) (-0.237214 -0.287507 0) (0.0396542 -0.154629 0) (-0.019804 -0.238576 0) (-0.0407985 -0.000280086 0) (0.220832 -0.242981 0) (0.356464 -0.296794 0) (0.459131 -0.249011 0) (0.528141 -0.164765 0) (0.558792 -0.0764078 0) (0.569842 -0.00524393 0) (0.553464 0.024667 0) (0.543513 0.0268066 0) (0.527986 0.00167014 0) (0.541521 -0.0368474 0) (0.554206 -0.0664484 0) (0.584745 -0.0963913 0) (0.627387 -0.109897 0) (0.671448 -0.0915181 0) (0.720161 -0.0518916 0) (0.755608 0.00623168 0) (0.775521 0.0825815 0) (0.777147 0.17686 0) (0.733769 0.271077 0) (0.675674 0.362411 0) (0.568925 0.41893 0) (0.433268 0.410875 0) (0.259106 0.332671 0) (0.0799423 0.212449 0) (-0.0388937 0.0688015 0) (-0.115066 -0.0673066 0) (-0.0749297 -0.179381 0) (-0.0363827 -0.251652 0) (0.0930612 -0.360072 0) (0.206314 -0.397414 0) (0.303488 -0.364654 0) (0.412703 -0.295471 0) (0.505374 -0.195174 0) (0.555272 -0.0524802 0) (0.602711 0.142322 0) (0.545647 0.283138 0) (0.446092 0.220782 0) (0.299327 0.0987843 0) (-0.0891317 0.235297 0) (-0.468062 0.325206 0) (-0.48389 0.100813 0) (-0.247253 -0.215548 0) (-0.220842 -0.262648 0) (-0.24229 -0.192007 0) (-0.281261 -0.0540463 0) (-0.394376 0.147182 0) (-0.490008 0.349326 0) (-0.675649 0.552407 0) (-0.890781 0.670897 0) (-1.09803 0.632228 0) (-1.31395 0.488821 0) (-1.49465 0.288344 0) (-1.58646 0.0741702 0) (-1.53134 -0.179022 0) (-1.34302 -0.488666 0) (-1.07886 -0.748333 0) (-0.658803 -0.957292 0) (-0.11958 -1.15278 0) (0.467038 -1.22933 0) (1.11809 -1.10299 0) (1.61093 -0.869431 0) (1.99419 -0.596461 0) (2.22532 -0.336673 0) (2.36707 -0.121819 0) (2.39549 0.0487489 0) (2.39813 0.157198 0) (2.32844 0.257243 0) (2.26688 0.358205 0) (2.16824 0.401534 0) (2.02979 0.471119 0) (1.8673 0.615015 0) (1.62444 0.748866 0) (1.26142 0.813759 0) (0.836474 0.794402 0) (0.346427 0.687081 0) (-0.157485 0.411387 0) (-0.656653 0.143163 0) (-1.26401 0.319197 0) (-1.74566 0.779618 0) (-2.0661 0.926072 0) (-2.43894 0.690973 0) (-2.52726 0.382227 0) (-2.35021 0.00220826 0) (-1.98052 -0.446727 0) (-1.64382 -0.576452 0) (-1.38638 -0.482495 0) (-1.10626 -0.532796 0) (-0.917451 -0.692078 0) (-0.783527 -0.753778 0) (-0.510809 -0.756457 0) (-0.127733 -0.765813 0) (0.22852 -0.72537 0) (0.530715 -0.638788 0) (0.795463 -0.517742 0) (1.03267 -0.348572 0) (1.18284 -0.146194 0) (1.23388 0.0903185 0) (1.20371 0.32433 0) (1.04869 0.500535 0) (0.800912 0.573834 0) (0.463856 0.536956 0) (0.0808934 0.441341 0) (-0.477149 0.491289 0) (-1.18042 0.666204 0) (-1.85714 0.761584 0) (-2.40963 0.805172 0) (-2.96629 0.867821 0) (-3.49924 0.909603 0) (-4.03999 0.930256 0) (-4.52306 0.939159 0) (-4.99694 0.929951 0) (-5.42586 0.907498 0) (-5.7464 0.843257 0) (-6.03534 0.740062 0) (-6.33248 0.682486 0) (-6.61197 0.663796 0) (-6.85903 0.606333 0) (-7.03703 0.525506 0) (-7.20168 0.483295 0) (-7.30338 0.422071 0) (-7.36212 0.288076 0) (-7.36451 0.149846 0) (-7.34821 0.0182168 0) (-7.131 -0.102373 0) (-7.02693 -0.281126 0) (-6.76134 -0.400862 0) (-6.37496 -0.459508 0) (-5.96544 -0.683952 0) (-5.48211 -0.939834 0) (-4.96906 -1.10818 0) (-4.34234 -1.37401 0) (-3.61453 -1.53652 0) (-2.89037 -1.75976 0) (-2.04838 -2.07507 0) (-1.0388 -2.2641 0) (0.0380576 -2.66053 0) (1.25926 -3.16991 0) (2.75327 -3.31926 0) (4.32581 -3.1429 0) (5.98747 -2.40201 0) (7.68535 -1.12352 0) (8.80185 0.250785 0) (9.45424 1.13959 0) (9.80464 1.5169 0) (9.65981 1.90502 0) (8.91397 2.40237 0) (7.72931 2.30206 0) (6.2772 1.6301 0) (5.28037 0.968388 0) (4.55125 0.264638 0) (4.19091 -0.305902 0) (4.14504 -0.680216 0) (4.66925 -1.08469 0) (4.73518 -1.41295 0) (4.31263 -0.320561 0) (3.62346 1.07159 0) (4.30057 0.628083 0) (5.53571 -1.07905 0) (5.37056 -1.66712 0) (4.03598 -0.568571 0) (1.75106 0.998246 0) (-0.241116 2.08875 0) (-2.0629 2.36989 0) (-3.37783 2.49587 0) (-4.32326 2.55281 0) (-5.10334 2.36381 0) (-5.73022 2.13622 0) (-6.27374 1.88983 0) (-6.79755 1.61844 0) (-7.2082 1.39561 0) (-7.53181 1.17926 0) (-7.81826 0.975794 0) (-8.00306 0.808195 0) (-8.17626 0.612722 0) (-8.26808 0.366594 0) (-8.28792 0.113215 0) (-8.3181 -0.124578 0) (-8.20595 -0.458963 0) (-8.01166 -0.815477 0) (-7.84534 -1.08883 0) (-7.50693 -1.43005 0) (-7.02413 -1.44991 0) (-6.50456 -0.834086 0) (-5.78513 0.0303799 0) (-5.48241 1.06352 0) (-5.00803 1.31955 0) (-5.6806 0.173822 0) (-4.81185 -1.18691 0) (-3.83748 -1.2903 0) (-2.94574 -0.759646 0) (-3.14811 -1.49948 0) (-2.16877 -1.47028 0) (-1.80961 -1.36814 0) (-1.41676 -1.12146 0) (-1.28106 -0.879017 0) (-0.862288 -0.796596 0) (-0.427422 -0.597649 0) (-0.0754293 -0.229566 0) (-0.0798776 -0.215875 0) (0.072445 -0.0987309 0) (0.282606 -0.381431 0) (0.38436 -0.391243 0) (0.439067 -0.301926 0) (0.460932 -0.189697 0) (0.462592 -0.0784737 0) (0.451189 0.0023468 0) (0.429421 0.0366716 0) (0.41469 0.0351966 0) (0.410008 0.000494882 0) (0.416337 -0.0457347 0) (0.43169 -0.0889385 0) (0.467801 -0.127134 0) (0.507788 -0.140526 0) (0.568382 -0.129545 0) (0.630319 -0.0912618 0) (0.681578 -0.022251 0) (0.715746 0.0702744 0) (0.729155 0.189163 0) (0.710537 0.301997 0) (0.672541 0.40712 0) (0.619166 0.479635 0) (0.539821 0.496893 0) (0.447702 0.441362 0) (0.319384 0.318155 0) (0.224837 0.154824 0) (0.137647 -0.0172 0) (0.122271 -0.18159 0) (0.116268 -0.296999 0) (0.191845 -0.427923 0) (0.227696 -0.460051 0) (0.273273 -0.416406 0) (0.321721 -0.348068 0) (0.390527 -0.244629 0) (0.419782 -0.0695599 0) (0.456916 0.163091 0) (0.434904 0.310856 0) (0.312315 0.329533 0) (-0.0381085 0.407517 0) (-0.450354 0.548987 0) (-0.679936 0.418287 0) (-0.611831 -0.00892676 0) (-0.662205 -0.209716 0) (-0.846543 -0.207849 0) (-0.937684 -0.129257 0) (-1.13113 0.0552199 0) (-1.20679 0.200309 0) (-1.37737 0.479921 0) (-1.49939 0.684313 0) (-1.64187 0.767041 0) (-1.82496 0.770477 0) (-1.9162 0.6427 0) (-1.9503 0.374343 0) (-1.88408 0.0249416 0) (-1.77342 -0.324155 0) (-1.64339 -0.649018 0) (-1.31208 -1.02979 0) (-0.838295 -1.38614 0) (-0.320943 -1.66636 0) (0.243433 -1.80781 0) (0.859103 -1.63636 0) (1.35232 -1.2604 0) (1.73153 -0.862065 0) (1.96568 -0.492449 0) (2.09794 -0.206613 0) (2.11943 -0.0189212 0) (2.08027 0.105493 0) (2.00789 0.225647 0) (1.91997 0.386077 0) (1.80413 0.543264 0) (1.7396 0.644288 0) (1.6249 0.76943 0) (1.43856 0.96987 0) (1.13134 1.10162 0) (0.721297 1.17274 0) (0.264078 1.09851 0) (-0.244982 0.903525 0) (-0.94405 0.708035 0) (-1.85169 0.702666 0) (-2.47102 0.932174 0) (-2.48542 1.11778 0) (-2.52041 0.877648 0) (-2.60213 0.328254 0) (-2.3645 -0.295876 0) (-1.97273 -0.766368 0) (-1.70454 -0.834876 0) (-1.38489 -0.770884 0) (-1.10939 -0.769933 0) (-0.956259 -0.845889 0) (-0.855558 -0.930812 0) (-0.656248 -1.03889 0) (-0.427371 -1.07515 0) (-0.188278 -0.973399 0) (0.0588922 -0.853218 0) (0.267429 -0.738091 0) (0.438685 -0.502888 0) (0.554152 -0.210013 0) (0.595666 0.0939962 0) (0.56636 0.403494 0) (0.420101 0.666315 0) (0.140067 0.81305 0) (-0.213908 0.855108 0) (-0.746078 0.924181 0) (-1.53891 1.07941 0) (-2.30426 1.22122 0) (-3.01167 1.2697 0) (-3.64275 1.28789 0) (-4.25816 1.29051 0) (-4.80229 1.3129 0) (-5.3214 1.32814 0) (-5.82689 1.31802 0) (-6.21277 1.25533 0) (-6.50783 1.13454 0) (-6.77951 1.04161 0) (-7.02781 0.956953 0) (-7.28595 0.865424 0) (-7.46759 0.809104 0) (-7.61747 0.738634 0) (-7.69158 0.623868 0) (-7.71678 0.524933 0) (-7.71142 0.438201 0) (-7.68082 0.303137 0) (-7.58604 0.101973 0) (-7.41271 -0.0750976 0) (-7.12726 -0.266225 0) (-6.89034 -0.55148 0) (-6.5366 -0.731344 0) (-6.07882 -0.891026 0) (-5.56674 -1.10116 0) (-5.02803 -1.38071 0) (-4.50219 -1.65971 0) (-3.87189 -1.94708 0) (-3.24509 -2.19206 0) (-2.57473 -2.47654 0) (-1.81404 -2.88558 0) (-1.07039 -3.19662 0) (-0.080651 -3.67476 0) (0.904167 -4.29999 0) (2.08262 -4.69915 0) (3.60895 -4.54147 0) (4.91212 -3.65086 0) (6.52918 -2.15733 0) (7.78341 -0.696013 0) (8.7539 0.35596 0) (9.06468 1.18967 0) (9.53233 2.02089 0) (9.5695 2.8475 0) (9.26386 3.17081 0) (8.68325 2.68935 0) (7.90457 2.03995 0) (7.23549 1.09976 0) (6.77781 0.270898 0) (6.35377 -0.52825 0) (6.12731 -1.02471 0) (5.5824 -0.8194 0) (4.42056 0.549589 0) (4.83107 0.908004 0) (6.09621 -0.668828 0) (5.99082 -1.20224 0) (3.35783 -0.0851111 0) (0.834998 1.70226 0) (-1.32567 2.65584 0) (-2.89135 3.00539 0) (-3.87588 3.24328 0) (-4.47063 3.17694 0) (-5.18313 2.93171 0) (-5.60032 2.81189 0) (-5.98574 2.54995 0) (-6.45288 2.24345 0) (-6.75526 2.00187 0) (-7.00038 1.69915 0) (-7.19357 1.41884 0) (-7.35491 1.20504 0) (-7.49247 0.976343 0) (-7.61347 0.723082 0) (-7.66793 0.540449 0) (-7.65705 0.251542 0) (-7.70839 -0.10988 0) (-7.75768 -0.383471 0) (-7.61246 -0.807208 0) (-7.61751 -1.14831 0) (-7.60238 -1.49595 0) (-7.38359 -1.90903 0) (-7.32004 -1.53951 0) (-6.31742 -0.70009 0) (-5.60287 0.399001 0) (-4.12281 1.14815 0) (-4.08915 0.300612 0) (-4.00165 -1.53302 0) (-3.75987 -2.18262 0) (-2.74937 -1.29375 0) (-2.59563 -1.59719 0) (-2.1238 -2.06604 0) (-1.57268 -1.78467 0) (-1.15681 -1.35522 0) (-1.00093 -0.99588 0) (-0.790627 -1.08581 0) (-0.405757 -0.948038 0) (-0.159649 -0.423823 0) (-0.0496273 -0.357084 0) (0.139709 -0.307202 0) (0.249782 -0.488351 0) (0.303904 -0.437195 0) (0.304157 -0.311571 0) (0.283501 -0.176466 0) (0.261559 -0.0552222 0) (0.232731 0.022646 0) (0.20949 0.0533268 0) (0.196001 0.0393596 0) (0.195751 -0.00278259 0) (0.212514 -0.0559673 0) (0.248415 -0.114389 0) (0.299581 -0.163605 0) (0.355983 -0.19663 0) (0.432491 -0.193958 0) (0.497189 -0.149055 0) (0.564262 -0.0659248 0) (0.603066 0.0485491 0) (0.618974 0.188424 0) (0.612053 0.324505 0) (0.578357 0.43901 0) (0.545726 0.524409 0) (0.495873 0.549201 0) (0.450687 0.5082 0) (0.384778 0.391111 0) (0.314313 0.224429 0) (0.256756 0.0301791 0) (0.21448 -0.151415 0) (0.207559 -0.302259 0) (0.228261 -0.445313 0) (0.218966 -0.474464 0) (0.266214 -0.448339 0) (0.329317 -0.398748 0) (0.351623 -0.285518 0) (0.331389 -0.103081 0) (0.30405 0.175008 0) (0.20109 0.424412 0) (0.0215762 0.59365 0) (-0.382704 0.71889 0) (-0.760316 0.75449 0) (-0.819498 0.479763 0) (-0.876689 0.0862238 0) (-1.15864 -0.0519905 0) (-1.3315 -0.0748571 0) (-1.61405 0.0707401 0) (-1.82546 0.173296 0) (-2.02774 0.385004 0) (-2.21834 0.661564 0) (-2.27305 0.860911 0) (-2.41253 1.01557 0) (-2.39229 0.826711 0) (-2.30236 0.56264 0) (-2.17791 0.239426 0) (-2.10309 -0.0715877 0) (-2.02239 -0.363846 0) (-1.71718 -0.900824 0) (-1.29129 -1.47873 0) (-0.970393 -1.82826 0) (-0.545117 -2.16058 0) (-0.122384 -2.32967 0) (0.400755 -2.14097 0) (0.870414 -1.64295 0) (1.2214 -1.11493 0) (1.45952 -0.631856 0) (1.6146 -0.236748 0) (1.68978 0.0480422 0) (1.67235 0.199685 0) (1.63237 0.345987 0) (1.64677 0.434356 0) (1.62995 0.488811 0) (1.51173 0.679674 0) (1.28815 0.93662 0) (1.03857 1.19032 0) (0.720073 1.40408 0) (0.347514 1.48446 0) (-0.0593313 1.49505 0) (-0.517371 1.40576 0) (-1.03874 1.36509 0) (-1.77669 1.37881 0) (-2.50882 1.22128 0) (-2.69174 1.00127 0) (-2.43139 0.747188 0) (-2.20486 0.238406 0) (-1.87506 -0.476182 0) (-1.47463 -0.98741 0) (-1.18799 -1.11127 0) (-0.928552 -1.02556 0) (-0.824511 -0.912533 0) (-0.79674 -0.910591 0) (-0.788212 -1.01014 0) (-0.736431 -1.13046 0) (-0.647278 -1.19755 0) (-0.500253 -1.13703 0) (-0.324758 -1.0058 0) (-0.189668 -0.868808 0) (-0.0433206 -0.630646 0) (0.0339913 -0.287232 0) (0.00887339 0.0964503 0) (-0.100067 0.499859 0) (-0.254577 0.84864 0) (-0.52292 1.08074 0) (-1.02412 1.28889 0) (-1.68234 1.52275 0) (-2.47877 1.6995 0) (-3.22401 1.79226 0) (-3.94355 1.78742 0) (-4.59707 1.79426 0) (-5.21 1.79612 0) (-5.78784 1.75727 0) (-6.23718 1.73583 0) (-6.63927 1.63685 0) (-6.90736 1.48512 0) (-7.12234 1.36406 0) (-7.37471 1.24516 0) (-7.53778 1.12053 0) (-7.67643 0.994801 0) (-7.74724 0.893028 0) (-7.75548 0.790066 0) (-7.6958 0.636755 0) (-7.62501 0.492813 0) (-7.51363 0.362469 0) (-7.3552 0.170872 0) (-7.11405 -0.0783688 0) (-6.81338 -0.298191 0) (-6.45027 -0.561262 0) (-6.10678 -0.860533 0) (-5.7387 -1.09408 0) (-5.25084 -1.33372 0) (-4.7521 -1.593 0) (-4.13285 -1.88862 0) (-3.59568 -2.16006 0) (-3.06314 -2.44155 0) (-2.43329 -2.72691 0) (-1.92003 -3.05375 0) (-1.27954 -3.42367 0) (-0.819232 -3.85625 0) (-0.0411452 -4.44228 0) (0.613762 -5.15097 0) (1.49398 -5.80822 0) (2.61134 -5.76524 0) (3.87768 -4.95923 0) (5.63912 -3.60857 0) (6.61975 -1.74693 0) (7.26837 0.164432 0) (7.7351 1.0405 0) (8.56815 1.69892 0) (8.67118 2.66614 0) (9.18217 3.08034 0) (9.23153 2.89535 0) (8.76554 2.69805 0) (8.49128 1.4774 0) (8.02456 0.350271 0) (7.36899 -0.077481 0) (6.53687 -0.397209 0) (6.2474 -0.339186 0) (5.78927 0.0424965 0) (6.9756 -0.0604624 0) (6.21837 -0.317946 0) (3.9597 0.76985 0) (0.950634 2.27503 0) (-1.51906 3.28561 0) (-2.92823 3.90477 0) (-3.6874 4.08367 0) (-4.31387 3.85787 0) (-4.92769 3.64303 0) (-5.30902 3.57931 0) (-5.63158 3.21846 0) (-6.1095 2.82147 0) (-6.30675 2.54762 0) (-6.51985 2.15837 0) (-6.68921 1.72737 0) (-6.75718 1.47609 0) (-6.8626 1.24129 0) (-7.00334 0.974361 0) (-7.00257 0.713853 0) (-7.03079 0.410119 0) (-7.07994 0.194918 0) (-6.9346 -0.155037 0) (-6.95056 -0.443315 0) (-6.89788 -0.786894 0) (-6.80893 -1.18591 0) (-7.00706 -1.30221 0) (-6.75406 -1.655 0) (-7.34338 -1.82601 0) (-6.7822 -1.4501 0) (-6.07367 -0.666956 0) (-4.53485 0.0804502 0) (-3.40872 -0.0255835 0) (-3.29243 -1.16746 0) (-3.65118 -2.03252 0) (-3.48387 -1.95331 0) (-2.56902 -1.96093 0) (-2.27658 -2.37445 0) (-1.71706 -2.17137 0) (-1.35351 -1.6771 0) (-0.979547 -1.23095 0) (-0.663792 -1.31132 0) (-0.291357 -1.14812 0) (-0.202515 -0.520489 0) (0.00974015 -0.397792 0) (0.0883482 -0.449281 0) (0.15264 -0.541621 0) (0.163953 -0.433241 0) (0.119296 -0.280546 0) (0.0671439 -0.141257 0) (0.0180042 -0.0274243 0) (-0.0280966 0.0485358 0) (-0.0535067 0.0712632 0) (-0.0536932 0.0454536 0) (-0.0220106 -0.0178836 0) (0.0251023 -0.0957045 0) (0.0729277 -0.162747 0) (0.126531 -0.214006 0) (0.186658 -0.252849 0) (0.262111 -0.255804 0) (0.332507 -0.21067 0) (0.391463 -0.1119 0) (0.418341 0.0307229 0) (0.428877 0.192719 0) (0.426115 0.344707 0) (0.400645 0.464437 0) (0.376144 0.550357 0) (0.343553 0.574369 0) (0.321561 0.53408 0) (0.293197 0.425983 0) (0.255223 0.266149 0) (0.229417 0.0669821 0) (0.191931 -0.129356 0) (0.194846 -0.310192 0) (0.193108 -0.442024 0) (0.169232 -0.507767 0) (0.214129 -0.518802 0) (0.257759 -0.432216 0) (0.258442 -0.26052 0) (0.198439 -0.0400875 0) (0.13456 0.254655 0) (-0.028344 0.540808 0) (-0.312319 0.817722 0) (-0.659558 1.00735 0) (-0.959013 0.887057 0) (-1.01151 0.515791 0) (-1.18551 0.270452 0) (-1.49139 0.136453 0) (-1.75912 0.15104 0) (-2.10884 0.305782 0) (-2.32615 0.361139 0) (-2.61159 0.559227 0) (-2.71641 0.709865 0) (-2.76551 0.898141 0) (-2.74216 0.937975 0) (-2.60954 0.656928 0) (-2.46636 0.448055 0) (-2.29452 0.187041 0) (-2.20718 -0.153029 0) (-1.95105 -0.631402 0) (-1.53494 -1.26244 0) (-1.35419 -1.68009 0) (-1.10323 -2.06607 0) (-0.79375 -2.46006 0) (-0.508216 -2.65654 0) (-0.134734 -2.48154 0) (0.258682 -1.88861 0) (0.562667 -1.2791 0) (0.809773 -0.774041 0) (0.946295 -0.403711 0) (1.11304 -0.0756073 0) (1.23063 0.13732 0) (1.29062 0.249404 0) (1.28161 0.413277 0) (1.13341 0.642124 0) (0.975335 0.883814 0) (0.734578 1.18776 0) (0.44161 1.48778 0) (0.0855645 1.70102 0) (-0.339095 1.8254 0) (-0.736934 1.7863 0) (-1.10885 1.67897 0) (-1.41783 1.72814 0) (-1.65239 1.86867 0) (-2.07722 1.6338 0) (-2.24557 1.0622 0) (-2.01617 0.495968 0) (-1.6631 -0.111079 0) (-1.25873 -0.801944 0) (-0.877111 -1.2679 0) (-0.659501 -1.29255 0) (-0.490896 -1.0647 0) (-0.509276 -0.816133 0) (-0.683542 -0.780421 0) (-0.840617 -0.953401 0) (-0.84804 -1.15257 0) (-0.910495 -1.24147 0) (-0.941202 -1.19499 0) (-0.806223 -1.0982 0) (-0.717304 -0.950681 0) (-0.640691 -0.656357 0) (-0.593812 -0.252884 0) (-0.610987 0.182376 0) (-0.693255 0.626805 0) (-0.926842 1.07432 0) (-1.28825 1.48071 0) (-1.84341 1.80692 0) (-2.51815 2.12791 0) (-3.27893 2.29852 0) (-4.02135 2.33921 0) (-4.69383 2.33909 0) (-5.3305 2.30747 0) (-5.87209 2.24497 0) (-6.31571 2.13391 0) (-6.6293 2.007 0) (-6.84848 1.85357 0) (-6.99622 1.6754 0) (-7.08374 1.5218 0) (-7.17918 1.36678 0) (-7.22744 1.17513 0) (-7.24168 0.982554 0) (-7.19197 0.83724 0) (-7.08722 0.711049 0) (-6.9315 0.54837 0) (-6.78829 0.373017 0) (-6.59465 0.177496 0) (-6.35943 -0.0682018 0) (-6.02229 -0.35083 0) (-5.64784 -0.6214 0) (-5.25502 -0.917048 0) (-4.86209 -1.18993 0) (-4.46227 -1.42809 0) (-3.9307 -1.73521 0) (-3.45105 -2.05245 0) (-2.92891 -2.3467 0) (-2.42808 -2.60011 0) (-1.91263 -2.89187 0) (-1.37186 -3.1714 0) (-0.930905 -3.44968 0) (-0.53293 -3.78559 0) (-0.173773 -4.30419 0) (0.244832 -4.86194 0) (0.706926 -5.77296 0) (1.23786 -6.5249 0) (1.77118 -6.77277 0) (2.96443 -5.78901 0) (4.07073 -3.84939 0) (4.76573 -1.87334 0) (6.02188 -0.580706 0) (6.74481 0.0254766 0) (7.04745 1.26849 0) (7.31831 2.2393 0) (8.27256 2.56319 0) (8.43014 2.94051 0) (8.30179 2.69061 0) (8.5752 1.63307 0) (7.75459 0.98875 0) (7.32313 0.652493 0) (6.72416 -0.0863669 0) (6.94266 -0.241799 0) (6.32988 -0.0174035 0) (6.12622 0.667058 0) (3.91805 1.41109 0) (1.10856 2.79417 0) (-1.16306 4.22986 0) (-2.64302 4.688 0) (-3.50006 4.58306 0) (-4.07794 4.32746 0) (-4.55485 4.25161 0) (-4.89748 4.09085 0) (-5.26868 3.62974 0) (-5.65847 3.27053 0) (-5.68904 3.04698 0) (-5.80047 2.60307 0) (-6.01632 2.18373 0) (-5.92836 1.91356 0) (-6.03022 1.57862 0) (-6.14082 1.32498 0) (-6.06999 1.14026 0) (-6.20559 0.810454 0) (-6.23117 0.452824 0) (-6.20293 0.260233 0) (-6.13365 -0.17522 0) (-6.11718 -0.670661 0) (-6.14208 -0.778306 0) (-5.72553 -1.16379 0) (-6.2008 -1.53003 0) (-5.74647 -1.59067 0) (-6.06754 -1.67629 0) (-6.1338 -1.73899 0) (-5.95515 -1.47031 0) (-5.14534 -1.14444 0) (-4.03028 -1.08976 0) (-3.49509 -1.51081 0) (-3.39796 -1.97799 0) (-3.15929 -2.28701 0) (-2.75691 -2.68095 0) (-2.37767 -2.90969 0) (-2.02178 -2.59367 0) (-1.55862 -1.9837 0) (-1.18217 -1.55734 0) (-0.744223 -1.65746 0) (-0.211072 -1.34702 0) (-0.111454 -0.690774 0) (0.0678934 -0.505126 0) (0.0565226 -0.515914 0) (0.0589322 -0.543092 0) (0.0227809 -0.396185 0) (-0.0591303 -0.223827 0) (-0.146193 -0.0823277 0) (-0.221538 0.0264702 0) (-0.267643 0.0866709 0) (-0.272288 0.0728654 0) (-0.244777 0.0078839 0) (-0.200365 -0.0668957 0) (-0.165127 -0.131111 0) (-0.120657 -0.197791 0) (-0.0649449 -0.26598 0) (-0.00503825 -0.322101 0) (0.0487109 -0.326907 0) (0.098111 -0.264076 0) (0.127423 -0.140756 0) (0.140685 0.0200576 0) (0.148616 0.191364 0) (0.147098 0.354701 0) (0.131514 0.484256 0) (0.120801 0.573851 0) (0.107644 0.590597 0) (0.107541 0.545104 0) (0.108689 0.426957 0) (0.112422 0.266774 0) (0.10185 0.0835279 0) (0.107224 -0.118323 0) (0.131924 -0.305286 0) (0.137517 -0.427556 0) (0.104962 -0.49146 0) (0.113176 -0.516164 0) (0.100118 -0.421439 0) (0.0862805 -0.232951 0) (0.0313839 0.0145108 0) (-0.0502025 0.384163 0) (-0.150869 0.797749 0) (-0.438275 1.09822 0) (-0.781745 1.25161 0) (-0.979575 1.04903 0) (-1.0932 0.669174 0) (-1.37163 0.482487 0) (-1.59792 0.361597 0) (-1.90792 0.425996 0) (-2.24812 0.534897 0) (-2.44885 0.575727 0) (-2.76481 0.736291 0) (-2.808 0.780273 0) (-2.82464 0.934343 0) (-2.7448 0.890918 0) (-2.61533 0.541814 0) (-2.48067 0.296968 0) (-2.25253 0.00142392 0) (-2.03991 -0.390248 0) (-1.73189 -0.876957 0) (-1.43636 -1.40482 0) (-1.24183 -1.85322 0) (-1.0082 -2.31643 0) (-0.875045 -2.66972 0) (-0.753109 -2.93028 0) (-0.602466 -2.78656 0) (-0.291447 -2.18871 0) (-0.0574753 -1.49161 0) (0.191223 -0.865732 0) (0.295602 -0.474058 0) (0.443839 -0.228962 0) (0.569094 0.0159787 0) (0.610045 0.282177 0) (0.587582 0.537616 0) (0.474869 0.759118 0) (0.297658 1.05109 0) (0.0940618 1.38473 0) (-0.161287 1.73751 0) (-0.450312 2.04415 0) (-0.825301 2.15405 0) (-1.15204 2.10824 0) (-1.44651 1.93202 0) (-1.59179 1.87387 0) (-1.57868 1.95107 0) (-1.62002 1.71931 0) (-1.59746 1.04056 0) (-1.3345 0.304238 0) (-1.01215 -0.393964 0) (-0.657518 -1.05613 0) (-0.376686 -1.46502 0) (-0.299217 -1.44765 0) (-0.226142 -1.17939 0) (-0.189191 -0.772902 0) (-0.287927 -0.600278 0) (-0.577453 -0.824117 0) (-0.835157 -1.02913 0) (-1.08027 -1.12189 0) (-1.21374 -1.19753 0) (-1.16857 -1.17164 0) (-1.16697 -1.00998 0) (-1.14308 -0.69953 0) (-1.11418 -0.278893 0) (-1.1823 0.232488 0) (-1.30635 0.831708 0) (-1.56822 1.37992 0) (-1.96893 1.89916 0) (-2.52026 2.35092 0) (-3.1855 2.68924 0) (-3.84318 2.87029 0) (-4.52905 2.85333 0) (-5.1029 2.79679 0) (-5.60724 2.69217 0) (-5.97123 2.52912 0) (-6.18393 2.33707 0) (-6.31731 2.14249 0) (-6.37534 1.91865 0) (-6.37353 1.7051 0) (-6.32665 1.53505 0) (-6.25874 1.35326 0) (-6.19792 1.16141 0) (-6.12995 0.937711 0) (-6.02031 0.745281 0) (-5.88672 0.599226 0) (-5.7033 0.422366 0) (-5.53893 0.221249 0) (-5.32386 -0.0182835 0) (-5.05436 -0.322223 0) (-4.7281 -0.614744 0) (-4.35467 -0.902302 0) (-4.00423 -1.20305 0) (-3.60365 -1.50081 0) (-3.1701 -1.80055 0) (-2.69239 -2.11148 0) (-2.22102 -2.37014 0) (-1.79274 -2.65365 0) (-1.329 -2.96395 0) (-0.881022 -3.27299 0) (-0.416383 -3.5416 0) (-0.0387051 -3.72358 0) (0.235949 -4.05933 0) (0.456645 -4.45613 0) (0.54151 -5.12469 0) (0.814689 -5.91931 0) (0.851567 -6.71219 0) (1.03085 -7.36523 0) (2.06024 -6.56645 0) (2.96986 -5.0465 0) (3.83146 -3.31021 0) (4.51373 -1.3972 0) (4.94404 0.138972 0) (5.39778 1.02321 0) (6.47102 1.42027 0) (6.77071 2.04203 0) (7.20554 2.65643 0) (7.42298 2.27794 0) (7.76883 1.86653 0) (6.82206 1.42611 0) (7.07492 0.853934 0) (6.55474 0.012497 0) (6.525 0.209335 0) (5.12773 0.768777 0) (3.74099 2.02153 0) (1.57997 3.59806 0) (-1.03492 4.7215 0) (-2.63597 5.30709 0) (-3.28157 5.34164 0) (-3.67251 5.16398 0) (-4.00088 4.92784 0) (-4.4476 4.59374 0) (-4.76754 4.24382 0) (-4.97607 3.95972 0) (-4.98353 3.63312 0) (-5.06293 3.06046 0) (-5.14944 2.70988 0) (-5.01722 2.43216 0) (-5.14117 1.90153 0) (-5.25387 1.61094 0) (-5.13999 1.46416 0) (-5.25906 1.0183 0) (-5.34475 0.853385 0) (-5.232 0.585653 0) (-5.30132 0.0160229 0) (-5.37182 -0.0677954 0) (-4.92612 -0.453391 0) (-5.47664 -0.967694 0) (-4.99539 -1.09461 0) (-5.19024 -1.35574 0) (-5.12018 -1.64186 0) (-5.06181 -1.64887 0) (-4.83009 -1.59313 0) (-4.62315 -1.47039 0) (-4.24459 -1.51797 0) (-3.82576 -1.73769 0) (-3.40123 -2.05605 0) (-2.93075 -2.33435 0) (-2.60399 -2.48764 0) (-2.51885 -2.85415 0) (-2.53702 -3.0781 0) (-2.2921 -2.93693 0) (-1.72966 -2.31098 0) (-1.30728 -1.91091 0) (-0.89765 -2.13105 0) (-0.344981 -1.64481 0) (-0.131156 -0.736594 0) (0.0478007 -0.416575 0) (0.0158143 -0.534644 0) (-0.0380809 -0.501215 0) (-0.117088 -0.31664 0) (-0.23344 -0.134565 0) (-0.331478 -0.00139664 0) (-0.403768 0.0795882 0) (-0.429195 0.0921905 0) (-0.422163 0.0522328 0) (-0.410829 -0.0170952 0) (-0.385777 -0.0900057 0) (-0.353508 -0.167866 0) (-0.309759 -0.243335 0) (-0.269548 -0.311356 0) (-0.253001 -0.347089 0) (-0.237752 -0.342094 0) (-0.213797 -0.272837 0) (-0.207389 -0.142764 0) (-0.203783 0.0175324 0) (-0.204444 0.19988 0) (-0.207222 0.370774 0) (-0.210702 0.493098 0) (-0.205442 0.579085 0) (-0.200019 0.590159 0) (-0.178269 0.543405 0) (-0.144832 0.417143 0) (-0.121875 0.267663 0) (-0.0737907 0.0644817 0) (-0.0433975 -0.14636 0) (0.0175847 -0.328823 0) (0.0150912 -0.424442 0) (0.0389049 -0.497564 0) (0.0576034 -0.516892 0) (0.0168098 -0.403037 0) (-0.0157076 -0.196919 0) (-0.0705185 0.0777355 0) (-0.194396 0.447624 0) (-0.340209 0.932711 0) (-0.549941 1.31152 0) (-0.777167 1.40619 0) (-0.871298 1.18511 0) (-1.04778 0.870259 0) (-1.38008 0.684955 0) (-1.58518 0.583845 0) (-1.90083 0.678172 0) (-2.16894 0.75109 0) (-2.33816 0.77567 0) (-2.65111 0.847971 0) (-2.70163 0.772158 0) (-2.70163 0.852326 0) (-2.56591 0.755622 0) (-2.48561 0.4123 0) (-2.36521 0.114159 0) (-2.0467 -0.185666 0) (-1.75726 -0.591803 0) (-1.53594 -1.09092 0) (-1.26485 -1.57721 0) (-1.07195 -1.96611 0) (-1.01735 -2.29163 0) (-0.963798 -2.62694 0) (-1.02472 -2.8923 0) (-1.06638 -2.81366 0) (-0.85998 -2.34261 0) (-0.654637 -1.76255 0) (-0.387653 -1.12052 0) (-0.236858 -0.649641 0) (-0.180986 -0.311017 0) (-0.165711 -0.00176572 0) (-0.146268 0.270531 0) (-0.196978 0.557352 0) (-0.249839 0.923772 0) (-0.450701 1.23246 0) (-0.598656 1.62476 0) (-0.79641 1.99947 0) (-0.912565 2.33741 0) (-1.1167 2.47478 0) (-1.32439 2.35997 0) (-1.46099 2.12383 0) (-1.49536 1.95448 0) (-1.38277 1.9178 0) (-1.18604 1.64114 0) (-0.97131 0.947249 0) (-0.710508 0.132692 0) (-0.43303 -0.59186 0) (-0.248474 -1.20638 0) (-0.230018 -1.51859 0) (-0.314937 -1.46394 0) (-0.337918 -1.23686 0) (-0.311448 -0.876794 0) (-0.249287 -0.526193 0) (-0.428316 -0.543583 0) (-0.804342 -0.761737 0) (-1.10555 -0.94213 0) (-1.31329 -1.10743 0) (-1.38925 -1.13161 0) (-1.4795 -0.954646 0) (-1.55396 -0.677498 0) (-1.56297 -0.208866 0) (-1.65589 0.377124 0) (-1.77872 1.04592 0) (-2.03507 1.71308 0) (-2.41048 2.32657 0) (-2.88199 2.8525 0) (-3.42508 3.20269 0) (-3.93154 3.34765 0) (-4.40185 3.31968 0) (-4.7861 3.1957 0) (-5.04486 3.00873 0) (-5.21379 2.7461 0) (-5.24303 2.48097 0) (-5.21904 2.21936 0) (-5.16616 1.95688 0) (-5.08988 1.72572 0) (-5.00527 1.51052 0) (-4.90576 1.29216 0) (-4.83988 1.09082 0) (-4.78039 0.858102 0) (-4.71609 0.629198 0) (-4.60989 0.454038 0) (-4.43286 0.288359 0) (-4.23522 0.0701004 0) (-4.04253 -0.212857 0) (-3.74886 -0.546655 0) (-3.44812 -0.874546 0) (-3.08685 -1.19646 0) (-2.73673 -1.51862 0) (-2.33654 -1.87217 0) (-1.90628 -2.20858 0) (-1.51629 -2.52479 0) (-1.136 -2.82063 0) (-0.731508 -3.11123 0) (-0.339585 -3.38541 0) (0.0336321 -3.6676 0) (0.408125 -3.857 0) (0.697813 -3.99094 0) (0.973806 -4.13276 0) (1.00097 -4.47014 0) (1.02674 -5.18188 0) (0.937487 -5.91738 0) (0.871368 -6.93097 0) (0.761291 -7.76355 0) (1.02024 -6.9411 0) (1.73567 -5.03747 0) (2.54807 -3.1354 0) (2.96077 -1.75919 0) (3.95255 -0.778414 0) (4.21367 0.0900606 0) (4.99989 1.20369 0) (4.91136 1.84537 0) (6.05011 2.14468 0) (6.13634 2.05886 0) (6.25049 2.07744 0) (5.90483 1.47724 0) (6.35419 0.778411 0) (5.69738 0.401351 0) (4.90679 1.07513 0) (3.33122 2.30939 0) (1.02456 3.64266 0) (-0.747268 5.2491 0) (-2.29867 6.2288 0) (-3.0735 6.28093 0) (-3.43091 5.7771 0) (-3.77283 5.30958 0) (-3.95373 5.06841 0) (-4.18116 4.85306 0) (-4.28476 4.50724 0) (-4.44145 3.9277 0) (-4.43856 3.41128 0) (-4.34707 3.11144 0) (-4.2276 2.66966 0) (-4.31059 2.17369 0) (-4.303 2.01798 0) (-4.20418 1.63159 0) (-4.4276 1.2723 0) (-4.30775 1.24626 0) (-4.2425 0.748283 0) (-4.51242 0.493429 0) (-4.0119 0.20526 0) (-4.45867 -0.323948 0) (-4.01811 -0.627323 0) (-4.20504 -0.926169 0) (-4.06138 -1.27655 0) (-4.0594 -1.52289 0) (-3.96751 -1.73479 0) (-3.94346 -1.9068 0) (-3.82832 -2.00395 0) (-3.62249 -1.89859 0) (-3.1786 -1.80248 0) (-2.74756 -1.88299 0) (-2.43263 -2.1612 0) (-2.28777 -2.50073 0) (-2.21101 -2.66267 0) (-1.93768 -2.73896 0) (-2.02019 -3.04871 0) (-2.03889 -3.24174 0) (-1.74496 -2.82714 0) (-1.10411 -2.23685 0) (-0.819159 -2.43603 0) (-0.396268 -2.05119 0) (0.040591 -0.965989 0) (0.0513691 -0.602731 0) (-0.0141967 -0.492962 0) (-0.109314 -0.429528 0) (-0.208584 -0.229387 0) (-0.332463 -0.0483576 0) (-0.435739 0.0668244 0) (-0.515297 0.112889 0) (-0.548827 0.104362 0) (-0.563159 0.054835 0) (-0.581424 -0.0266916 0) (-0.568058 -0.114413 0) (-0.545975 -0.190268 0) (-0.515474 -0.261906 0) (-0.499062 -0.321578 0) (-0.508748 -0.360625 0) (-0.501595 -0.361465 0) (-0.523463 -0.277351 0) (-0.536328 -0.136034 0) (-0.557327 0.0242375 0) (-0.566498 0.205596 0) (-0.565399 0.371527 0) (-0.573516 0.495643 0) (-0.55988 0.570366 0) (-0.533826 0.562595 0) (-0.494622 0.503796 0) (-0.439848 0.379748 0) (-0.380599 0.216859 0) (-0.280973 0.0154252 0) (-0.211051 -0.198836 0) (-0.159952 -0.355974 0) (-0.148388 -0.44262 0) (-0.0716189 -0.531875 0) (-0.0664585 -0.503715 0) (-0.0725577 -0.37305 0) (-0.07246 -0.165601 0) (-0.108663 0.154916 0) (-0.194591 0.581964 0) (-0.320937 1.06015 0) (-0.498537 1.45046 0) (-0.652775 1.53781 0) (-0.698001 1.31288 0) (-0.861407 1.08499 0) (-1.21454 0.924126 0) (-1.41657 0.812764 0) (-1.76029 0.887532 0) (-1.97104 0.932339 0) (-2.07047 0.978401 0) (-2.29432 1.02567 0) (-2.37236 0.877628 0) (-2.45422 0.824324 0) (-2.29821 0.677668 0) (-2.1424 0.390323 0) (-2.03436 -0.0109391 0) (-1.90635 -0.495658 0) (-1.68161 -0.894614 0) (-1.41305 -1.27028 0) (-1.22805 -1.67421 0) (-1.15218 -2.02736 0) (-1.0172 -2.32911 0) (-1.00764 -2.605 0) (-1.14869 -2.81812 0) (-1.35034 -2.79103 0) (-1.34263 -2.34156 0) (-1.29595 -1.78682 0) (-1.15296 -1.18165 0) (-0.944023 -0.657764 0) (-0.837582 -0.292561 0) (-0.762383 0.00194187 0) (-0.713825 0.302675 0) (-0.829213 0.62711 0) (-0.952521 0.976254 0) (-1.15528 1.34915 0) (-1.36783 1.71446 0) (-1.46649 2.09259 0) (-1.55857 2.36928 0) (-1.51235 2.53251 0) (-1.57846 2.37874 0) (-1.54812 2.06423 0) (-1.47428 1.85484 0) (-1.20204 1.71495 0) (-0.928503 1.3496 0) (-0.605082 0.670825 0) (-0.347108 -0.0923249 0) (-0.23167 -0.736612 0) (-0.333302 -1.19758 0) (-0.609094 -1.38743 0) (-0.874952 -1.34912 0) (-0.872847 -1.17431 0) (-0.794709 -0.838757 0) (-0.66522 -0.482143 0) (-0.709014 -0.384777 0) (-0.910224 -0.527434 0) (-1.11873 -0.764307 0) (-1.32444 -1.00271 0) (-1.48488 -1.07871 0) (-1.57489 -0.909949 0) (-1.65412 -0.636383 0) (-1.73718 -0.185756 0) (-1.84777 0.458581 0) (-1.97906 1.20382 0) (-2.18226 1.95455 0) (-2.49524 2.62646 0) (-2.83908 3.19189 0) (-3.20479 3.55393 0) (-3.5063 3.67346 0) (-3.72651 3.61208 0) (-3.8807 3.4344 0) (-3.94827 3.17285 0) (-3.94204 2.84889 0) (-3.89391 2.52484 0) (-3.85026 2.23214 0) (-3.77087 1.94896 0) (-3.71449 1.67579 0) (-3.67437 1.46043 0) (-3.6065 1.27898 0) (-3.56263 1.06475 0) (-3.53355 0.842959 0) (-3.47782 0.633249 0) (-3.37657 0.403467 0) (-3.22961 0.163481 0) (-2.98419 -0.0981523 0) (-2.75 -0.419722 0) (-2.44317 -0.797867 0) (-2.09873 -1.16779 0) (-1.74872 -1.53946 0) (-1.38602 -1.87419 0) (-0.973008 -2.23102 0) (-0.629872 -2.52468 0) (-0.238174 -2.7975 0) (0.103824 -3.04834 0) (0.453514 -3.30079 0) (0.732245 -3.55948 0) (0.996303 -3.81847 0) (1.19693 -4.03638 0) (1.42801 -4.10298 0) (1.50989 -4.10954 0) (1.55203 -4.38917 0) (1.35511 -4.86033 0) (1.08292 -5.65523 0) (0.795328 -6.6035 0) (0.451603 -7.37738 0) (0.216409 -7.40526 0) (1.11721 -5.9437 0) (1.72847 -4.00222 0) (2.03505 -2.35633 0) (2.57555 -0.816685 0) (2.79323 0.152626 0) (3.72604 0.849947 0) (4.25639 1.10992 0) (4.79226 1.63786 0) (4.78731 2.08038 0) (4.86565 1.96101 0) (5.32629 1.31374 0) (5.06928 0.892838 0) (4.32826 1.33488 0) (2.59543 2.26751 0) (1.29921 3.9855 0) (-0.70198 5.41849 0) (-2.39949 6.47103 0) (-3.21003 6.71362 0) (-3.32781 6.38944 0) (-3.34051 6.01314 0) (-3.46917 5.70192 0) (-3.6323 5.28172 0) (-3.82575 4.84946 0) (-3.79185 4.44586 0) (-3.68599 4.0917 0) (-3.58741 3.51346 0) (-3.53051 2.94926 0) (-3.43783 2.73173 0) (-3.26318 2.35068 0) (-3.36429 1.91588 0) (-3.34432 1.76733 0) (-3.13295 1.38052 0) (-3.43734 1.13241 0) (-3.00084 0.853527 0) (-3.34975 0.456949 0) (-2.88849 0.0821779 0) (-3.12754 -0.236327 0) (-2.86614 -0.577549 0) (-2.8503 -0.922962 0) (-2.78474 -1.18624 0) (-2.65738 -1.42776 0) (-2.6678 -1.69677 0) (-2.61492 -1.85126 0) (-2.4975 -1.92116 0) (-2.48985 -1.97042 0) (-2.24527 -2.09559 0) (-2.05812 -2.29007 0) (-1.86913 -2.41696 0) (-1.53739 -2.47203 0) (-1.34364 -2.63849 0) (-1.28588 -2.8342 0) (-1.00965 -2.88332 0) (-1.27163 -3.07636 0) (-1.45342 -3.18378 0) (-1.01438 -2.67886 0) (-0.710256 -2.67885 0) (-0.447803 -2.32007 0) (-0.100637 -1.15341 0) (0.0637462 -0.320303 0) (-0.0332938 -0.434573 0) (-0.155954 -0.341922 0) (-0.273367 -0.129394 0) (-0.401606 0.0473513 0) (-0.496029 0.155981 0) (-0.588489 0.173637 0) (-0.670715 0.134099 0) (-0.711906 0.0843559 0) (-0.748893 -0.0184226 0) (-0.749338 -0.126476 0) (-0.733852 -0.208456 0) (-0.701598 -0.278308 0) (-0.702176 -0.324677 0) (-0.725796 -0.350908 0) (-0.762419 -0.335777 0) (-0.814114 -0.244243 0) (-0.830706 -0.116136 0) (-0.888873 0.0482907 0) (-0.902195 0.225551 0) (-0.911566 0.382343 0) (-0.925465 0.499776 0) (-0.902065 0.561186 0) (-0.86354 0.544427 0) (-0.807238 0.470631 0) (-0.720777 0.319806 0) (-0.624623 0.125116 0) (-0.503486 -0.0753421 0) (-0.419973 -0.244833 0) (-0.356608 -0.373433 0) (-0.255316 -0.502472 0) (-0.1859 -0.565316 0) (-0.184277 -0.509035 0) (-0.142679 -0.391895 0) (-0.100519 -0.168118 0) (-0.0763393 0.18309 0) (-0.119553 0.640936 0) (-0.202426 1.15123 0) (-0.297916 1.54086 0) (-0.384499 1.62834 0) (-0.427092 1.43375 0) (-0.596941 1.28706 0) (-0.93651 1.1701 0) (-1.18913 1.05945 0) (-1.55514 1.09865 0) (-1.78481 1.06174 0) (-1.90235 1.07159 0) (-2.0356 1.11122 0) (-2.0581 0.976076 0) (-2.13895 0.825418 0) (-2.10564 0.520945 0) (-2.06914 0.177261 0) (-1.93263 -0.0929543 0) (-1.7489 -0.446917 0) (-1.59473 -0.917683 0) (-1.45972 -1.41923 0) (-1.37919 -1.81686 0) (-1.22501 -2.1292 0) (-1.12957 -2.38561 0) (-1.08536 -2.52288 0) (-1.15883 -2.69482 0) (-1.40202 -2.70954 0) (-1.51639 -2.33034 0) (-1.64186 -1.75056 0) (-1.74517 -1.24722 0) (-1.6775 -0.85324 0) (-1.56173 -0.501569 0) (-1.43834 -0.13666 0) (-1.35339 0.274963 0) (-1.31921 0.744807 0) (-1.33011 1.19873 0) (-1.50981 1.60137 0) (-1.64483 1.93881 0) (-1.74518 2.20912 0) (-1.75254 2.40837 0) (-1.63323 2.4676 0) (-1.48681 2.31745 0) (-1.39462 1.99654 0) (-1.22371 1.68502 0) (-0.941021 1.42693 0) (-0.633457 1.08434 0) (-0.478544 0.444375 0) (-0.405307 -0.132723 0) (-0.489329 -0.591435 0) (-0.904044 -0.898134 0) (-1.29331 -1.09382 0) (-1.52272 -1.22458 0) (-1.40746 -1.21515 0) (-1.25119 -0.939884 0) (-0.961929 -0.545172 0) (-0.833748 -0.360241 0) (-0.829222 -0.461708 0) (-0.907612 -0.617062 0) (-1.05346 -0.796862 0) (-1.28702 -0.903765 0) (-1.50989 -0.792512 0) (-1.68349 -0.512653 0) (-1.84907 -0.0483313 0) (-1.93894 0.614076 0) (-2.06801 1.35265 0) (-2.15446 2.15638 0) (-2.32079 2.87198 0) (-2.50504 3.40945 0) (-2.68606 3.73795 0) (-2.81392 3.81567 0) (-2.83017 3.69567 0) (-2.82515 3.4835 0) (-2.75512 3.17745 0) (-2.69911 2.79773 0) (-2.61513 2.4632 0) (-2.58365 2.16594 0) (-2.53395 1.90384 0) (-2.4887 1.67428 0) (-2.46627 1.43728 0) (-2.42694 1.21497 0) (-2.38822 1.01221 0) (-2.31768 0.759049 0) (-2.22771 0.475653 0) (-2.10495 0.221618 0) (-1.89215 -0.0572296 0) (-1.6482 -0.374388 0) (-1.34258 -0.73255 0) (-1.02983 -1.1151 0) (-0.679135 -1.47014 0) (-0.315784 -1.83575 0) (0.0143018 -2.17125 0) (0.420278 -2.49176 0) (0.702585 -2.76238 0) (1.03964 -3.06096 0) (1.31546 -3.32607 0) (1.57144 -3.52815 0) (1.81885 -3.70277 0) (1.93257 -3.94335 0) (2.00039 -4.15758 0) (2.00073 -4.14592 0) (1.96372 -4.17478 0) (1.91644 -4.24112 0) (1.72194 -4.68728 0) (1.43155 -5.50093 0) (0.913205 -6.37534 0) (0.405395 -7.2804 0) (-0.0762927 -7.51864 0) (0.424261 -5.90729 0) (0.763482 -4.07254 0) (1.59597 -2.64389 0) (1.64057 -1.67478 0) (2.61928 -0.780606 0) (2.71046 -0.036932 0) (3.2141 0.999106 0) (3.08113 1.65712 0) (3.75799 1.89215 0) (3.94048 1.46532 0) (4.45882 1.37613 0) (3.53091 1.52031 0) (2.61417 2.49935 0) (0.821515 3.69911 0) (-0.830914 5.22685 0) (-2.04514 6.65826 0) (-2.89456 7.3579 0) (-3.14922 7.14361 0) (-3.21524 6.51381 0) (-3.26998 5.96455 0) (-3.2698 5.5756 0) (-3.19658 5.33133 0) (-3.10978 5.05618 0) (-3.0892 4.43478 0) (-2.96004 3.77136 0) (-2.77581 3.45696 0) (-2.51313 2.97451 0) (-2.55515 2.4427 0) (-2.45942 2.29869 0) (-2.17196 1.87436 0) (-2.48901 1.58736 0) (-1.93462 1.34867 0) (-2.33515 1.03633 0) (-1.82999 0.751487 0) (-2.05184 0.40633 0) (-1.74043 0.0429284 0) (-1.77096 -0.355934 0) (-1.63885 -0.688614 0) (-1.46336 -1.02043 0) (-1.4449 -1.34978 0) (-1.29622 -1.57891 0) (-1.16071 -1.76458 0) (-1.13665 -1.93411 0) (-0.949078 -2.0711 0) (-0.94995 -2.17778 0) (-0.81345 -2.288 0) (-0.619627 -2.36622 0) (-0.635011 -2.51302 0) (-0.62074 -2.80858 0) (-0.639467 -2.93305 0) (-0.535118 -3.02937 0) (-0.491354 -2.93111 0) (-0.448679 -2.87291 0) (-0.71243 -3.12596 0) (-0.799408 -2.91665 0) (-0.458658 -2.81291 0) (-0.465462 -2.83296 0) (0.321622 -1.2142 0) (-0.267239 -0.646303 0) (-0.0507396 -0.339521 0) (-0.188651 -0.230963 0) (-0.309481 -0.0176745 0) (-0.44754 0.141235 0) (-0.551289 0.226529 0) (-0.634667 0.256053 0) (-0.770563 0.203997 0) (-0.854454 0.124689 0) (-0.883517 0.00143209 0) (-0.89979 -0.133323 0) (-0.891114 -0.224646 0) (-0.864209 -0.288342 0) (-0.870018 -0.307581 0) (-0.88964 -0.328099 0) (-0.959142 -0.301239 0) (-1.01354 -0.208881 0) (-1.07361 -0.0671677 0) (-1.13263 0.086331 0) (-1.16462 0.244023 0) (-1.19129 0.39873 0) (-1.20554 0.487018 0) (-1.18658 0.516398 0) (-1.15694 0.47728 0) (-1.08649 0.387624 0) (-0.994475 0.222756 0) (-0.887825 0.0294037 0) (-0.760632 -0.149015 0) (-0.645925 -0.327463 0) (-0.519169 -0.489362 0) (-0.411666 -0.585841 0) (-0.329751 -0.594377 0) (-0.250054 -0.546029 0) (-0.169632 -0.438161 0) (-0.117517 -0.215821 0) (-0.0207798 0.178292 0) (0.0168604 0.681088 0) (-0.00473299 1.20139 0) (-0.0509737 1.57196 0) (-0.0703521 1.65922 0) (-0.0766318 1.53051 0) (-0.276199 1.47166 0) (-0.618105 1.4143 0) (-0.895299 1.32074 0) (-1.26325 1.33318 0) (-1.50738 1.2592 0) (-1.71958 1.20195 0) (-1.91316 1.13798 0) (-2.00461 0.974955 0) (-2.08221 0.846682 0) (-2.0689 0.6125 0) (-2.05874 0.241743 0) (-2.02674 -0.243597 0) (-1.93364 -0.752731 0) (-1.80417 -1.18616 0) (-1.64642 -1.53105 0) (-1.48366 -1.85992 0) (-1.33797 -2.22656 0) (-1.27541 -2.48311 0) (-1.10536 -2.58113 0) (-1.09663 -2.58265 0) (-1.25375 -2.48648 0) (-1.36577 -2.14658 0) (-1.49717 -1.6344 0) (-1.65454 -1.15319 0) (-1.6906 -0.749235 0) (-1.82482 -0.538739 0) (-1.89956 -0.175668 0) (-1.90636 0.211955 0) (-1.8928 0.623712 0) (-1.81974 1.14346 0) (-1.84846 1.58995 0) (-1.78671 1.93597 0) (-1.78448 2.16839 0) (-1.69135 2.28498 0) (-1.51074 2.30337 0) (-1.26183 2.20033 0) (-1.16475 1.92565 0) (-1.00708 1.5335 0) (-0.867273 1.22075 0) (-0.751013 1.01319 0) (-0.663271 0.46204 0) (-0.947092 -0.0177758 0) (-1.05016 -0.376275 0) (-1.53265 -0.636909 0) (-1.68998 -0.991822 0) (-1.75391 -1.28119 0) (-1.62931 -1.33211 0) (-1.50265 -1.15116 0) (-1.11204 -0.784858 0) (-0.870797 -0.484358 0) (-0.786171 -0.464359 0) (-0.784705 -0.537323 0) (-0.853302 -0.636517 0) (-1.12928 -0.725875 0) (-1.3766 -0.637566 0) (-1.48187 -0.363898 0) (-1.63031 0.0398613 0) (-1.70865 0.662737 0) (-1.75746 1.40935 0) (-1.89107 2.15744 0) (-1.92533 2.90102 0) (-2.00577 3.42597 0) (-2.01181 3.73053 0) (-2.02484 3.80047 0) (-1.9079 3.65738 0) (-1.84577 3.38483 0) (-1.72716 3.0845 0) (-1.63591 2.73484 0) (-1.57572 2.39543 0) (-1.53743 2.10794 0) (-1.50586 1.837 0) (-1.46021 1.59316 0) (-1.41027 1.37651 0) (-1.3165 1.15996 0) (-1.22014 0.927533 0) (-1.1004 0.69899 0) (-0.922119 0.424454 0) (-0.783261 0.141221 0) (-0.542594 -0.172588 0) (-0.350087 -0.506375 0) (-0.019645 -0.876898 0) (0.24889 -1.27505 0) (0.556121 -1.66047 0) (0.912138 -2.01593 0) (1.17354 -2.36244 0) (1.54821 -2.70503 0) (1.78715 -2.93805 0) (2.07683 -3.20781 0) (2.25815 -3.47053 0) (2.43521 -3.65026 0) (2.53579 -3.76988 0) (2.60689 -3.97098 0) (2.58392 -4.0722 0) (2.47106 -4.09143 0) (2.39956 -4.01948 0) (2.25572 -4.04052 0) (2.09661 -4.36423 0) (1.65762 -4.81372 0) (1.12981 -5.68436 0) (0.602584 -6.83673 0) (-0.0880557 -7.4683 0) (-0.224172 -6.66796 0) (0.453059 -4.81938 0) (1.12933 -2.9586 0) (0.959072 -1.7796 0) (1.42136 -0.535572 0) (1.31141 0.239287 0) (1.73602 0.901411 0) (2.40036 1.22726 0) (3.01992 1.31144 0) (3.23257 1.33981 0) (2.81357 1.67497 0) (2.07258 2.47876 0) (0.585969 3.51917 0) (-0.497755 5.09925 0) (-1.92559 6.33608 0) (-2.95333 7.17237 0) (-3.26145 7.32677 0) (-2.97866 6.91054 0) (-2.80456 6.51752 0) (-2.71157 6.13844 0) (-2.78274 5.67729 0) (-2.69307 5.1897 0) (-2.53105 4.73577 0) (-2.2373 4.41156 0) (-1.98926 3.80814 0) (-1.9504 3.13935 0) (-1.74259 2.89803 0) (-1.39089 2.47601 0) (-1.66451 2.13538 0) (-1.05484 1.89105 0) (-1.43171 1.55407 0) (-0.863548 1.28325 0) (-1.07371 1.01663 0) (-0.703582 0.671855 0) (-0.730617 0.312008 0) (-0.516821 -0.0356204 0) (-0.381723 -0.397528 0) (-0.323266 -0.781371 0) (-0.099013 -1.09271 0) (-0.0353815 -1.39238 0) (0.0643235 -1.64529 0) (0.256202 -1.82526 0) (0.26541 -1.99248 0) (0.488785 -2.1032 0) (0.534901 -2.11482 0) (0.722544 -2.1659 0) (0.78907 -2.3034 0) (0.638162 -2.46419 0) (0.716215 -2.55614 0) (0.497428 -2.665 0) (0.383273 -2.92219 0) (0.119244 -2.97308 0) (0.191374 -2.82967 0) (0.130632 -2.85588 0) (-0.352598 -2.91567 0) (-0.285772 -2.9716 0) (-0.157214 -2.695 0) (-0.322025 -1.61302 0) (0.338139 -0.258823 0) (-0.0550642 -0.244451 0) (-0.18903 -0.132372 0) (-0.293445 0.0794511 0) (-0.4167 0.233246 0) (-0.534148 0.320065 0) (-0.655499 0.357332 0) (-0.803061 0.305176 0) (-0.925572 0.183084 0) (-0.958778 0.0211101 0) (-0.984474 -0.124847 0) (-0.985811 -0.247265 0) (-0.96854 -0.307304 0) (-0.962722 -0.307411 0) (-0.983437 -0.2914 0) (-1.05256 -0.249991 0) (-1.13996 -0.161212 0) (-1.2132 -0.0214568 0) (-1.28706 0.133385 0) (-1.35816 0.29365 0) (-1.38461 0.422422 0) (-1.42268 0.502647 0) (-1.40239 0.521308 0) (-1.39244 0.450637 0) (-1.32782 0.330874 0) (-1.24323 0.140684 0) (-1.14353 -0.0800367 0) (-0.99335 -0.26824 0) (-0.882301 -0.441864 0) (-0.744624 -0.566117 0) (-0.625656 -0.658405 0) (-0.489297 -0.700361 0) (-0.328122 -0.64363 0) (-0.167909 -0.508786 0) (-0.0339922 -0.293089 0) (0.0979685 0.0887782 0) (0.19069 0.634108 0) (0.253686 1.19683 0) (0.265485 1.58578 0) (0.306075 1.68322 0) (0.318625 1.63539 0) (0.125438 1.67289 0) (-0.222808 1.65252 0) (-0.520235 1.57415 0) (-0.872434 1.56199 0) (-1.12982 1.47168 0) (-1.37991 1.4099 0) (-1.61396 1.34561 0) (-1.80305 1.14947 0) (-1.99589 0.86148 0) (-2.11585 0.491782 0) (-2.14509 0.10387 0) (-2.09837 -0.293018 0) (-1.9556 -0.722133 0) (-1.81436 -1.19987 0) (-1.58743 -1.68297 0) (-1.42614 -2.10375 0) (-1.24784 -2.39239 0) (-1.07394 -2.59387 0) (-0.954166 -2.72662 0) (-0.817791 -2.60638 0) (-0.825614 -2.50017 0) (-0.937197 -2.15879 0) (-1.03195 -1.55894 0) (-1.24286 -1.08467 0) (-1.43769 -0.731925 0) (-1.5366 -0.370799 0) (-1.74619 -0.0420896 0) (-1.93917 0.262222 0) (-2.08915 0.690667 0) (-2.11155 1.21551 0) (-2.12755 1.62304 0) (-2.04446 1.89265 0) (-1.92953 2.11791 0) (-1.8142 2.13091 0) (-1.63762 2.02696 0) (-1.43056 1.90837 0) (-1.2946 1.67519 0) (-1.13488 1.35379 0) (-1.10367 1.06504 0) (-1.21001 0.864347 0) (-0.982568 0.488164 0) (-1.29754 0.107187 0) (-1.27749 -0.185064 0) (-1.54082 -0.473962 0) (-1.46162 -0.952747 0) (-1.65413 -1.30505 0) (-1.68938 -1.43558 0) (-1.6384 -1.38709 0) (-1.22281 -1.09924 0) (-0.87286 -0.672172 0) (-0.61778 -0.53817 0) (-0.51471 -0.580509 0) (-0.477797 -0.539065 0) (-0.580663 -0.471884 0) (-0.83489 -0.465421 0) (-1.09656 -0.278731 0) (-1.28578 0.164442 0) (-1.37968 0.717208 0) (-1.336 1.45793 0) (-1.2959 2.21503 0) (-1.23255 2.90457 0) (-1.17264 3.44328 0) (-1.09935 3.71003 0) (-1.02685 3.75359 0) (-0.931389 3.60205 0) (-0.790725 3.33048 0) (-0.715857 3.02818 0) (-0.630738 2.69994 0) (-0.568858 2.3656 0) (-0.539073 2.08792 0) (-0.487093 1.81602 0) (-0.425521 1.56518 0) (-0.346504 1.31179 0) (-0.251247 1.07216 0) (-0.0939659 0.812869 0) (-0.0206756 0.54972 0) (0.177186 0.232243 0) (0.255812 -0.0775769 0) (0.506184 -0.401104 0) (0.616162 -0.757193 0) (0.911022 -1.15222 0) (1.12917 -1.54354 0) (1.37097 -1.93822 0) (1.67269 -2.30266 0) (1.91904 -2.62574 0) (2.2497 -2.9568 0) (2.46329 -3.18157 0) (2.69723 -3.39371 0) (2.81995 -3.61861 0) (2.89995 -3.76121 0) (2.94646 -3.8016 0) (2.99146 -3.87856 0) (2.79755 -4.03681 0) (2.70907 -3.98616 0) (2.50733 -3.85984 0) (2.47315 -3.97862 0) (2.36422 -4.18218 0) (2.06875 -4.6732 0) (1.59059 -5.43041 0) (0.874271 -6.11781 0) (-0.086856 -6.73368 0) (-0.525645 -6.71752 0) (0.0312485 -5.04873 0) (0.39203 -3.17202 0) (0.960613 -1.69616 0) (0.834882 -0.924622 0) (1.62846 -0.174543 0) (1.66434 0.0983466 0) (2.50416 0.703021 0) (2.4409 1.03117 0) (2.27024 1.71274 0) (1.32285 2.38751 0) (0.511959 3.47984 0) (-0.592434 4.61594 0) (-1.84868 5.84849 0) (-2.47312 7.14742 0) (-2.84751 7.69199 0) (-2.84701 7.47553 0) (-2.67657 6.85889 0) (-2.58815 6.27276 0) (-2.32187 5.84415 0) (-2.17378 5.58702 0) (-1.90331 5.23768 0) (-1.73412 4.58604 0) (-1.55558 4.02389 0) (-1.24706 3.70564 0) (-0.892496 3.07575 0) (-1.10987 2.66959 0) (-0.400373 2.37607 0) (-0.803719 1.9928 0) (-0.139297 1.73233 0) (-0.329862 1.45241 0) (0.122912 1.09059 0) (0.0641027 0.843933 0) (0.446671 0.549335 0) (0.554247 0.201613 0) (0.671013 -0.171844 0) (0.935593 -0.53055 0) (0.971572 -0.887413 0) (1.1311 -1.19524 0) (1.22685 -1.4946 0) (1.25927 -1.72264 0) (1.44842 -1.89627 0) (1.48239 -2.08054 0) (1.68961 -2.20192 0) (1.76696 -2.34447 0) (1.93956 -2.42494 0) (2.11668 -2.41838 0) (2.05605 -2.39573 0) (2.08583 -2.49679 0) (1.68722 -2.68277 0) (1.7381 -2.6651 0) (1.27859 -2.79862 0) (1.02205 -2.77346 0) (0.981335 -2.67806 0) (0.492182 -2.7209 0) (0.372377 -2.76484 0) (-0.233901 -2.94081 0) (0.235262 -1.27705 0) (-0.454893 -0.621177 0) (-0.0565405 -0.13515 0) (-0.188004 -0.0285147 0) (-0.290611 0.186629 0) (-0.412721 0.337654 0) (-0.523881 0.417489 0) (-0.61724 0.459868 0) (-0.768915 0.402029 0) (-0.868148 0.25581 0) (-0.924301 0.0623152 0) (-0.965586 -0.113493 0) (-0.9872 -0.241443 0) (-0.992057 -0.312351 0) (-1.00485 -0.309195 0) (-1.01087 -0.258661 0) (-1.07243 -0.178788 0) (-1.16775 -0.0822993 0) (-1.25926 0.0588798 0) (-1.35118 0.207354 0) (-1.43266 0.338308 0) (-1.49289 0.463403 0) (-1.54541 0.505258 0) (-1.55929 0.495465 0) (-1.58108 0.413368 0) (-1.56754 0.272737 0) (-1.50836 0.0639306 0) (-1.45472 -0.173446 0) (-1.2956 -0.347804 0) (-1.16857 -0.538721 0) (-0.986464 -0.702437 0) (-0.792793 -0.788354 0) (-0.620797 -0.838228 0) (-0.412961 -0.806733 0) (-0.211701 -0.680477 0) (0.036695 -0.436697 0) (0.241016 -0.0262567 0) (0.41573 0.535895 0) (0.578567 1.13072 0) (0.670267 1.5436 0) (0.748925 1.65604 0) (0.783414 1.69052 0) (0.647004 1.86143 0) (0.330211 1.94508 0) (0.0245293 1.87301 0) (-0.312152 1.82944 0) (-0.581319 1.73264 0) (-0.892922 1.6303 0) (-1.21833 1.52136 0) (-1.50955 1.34558 0) (-1.77301 1.10542 0) (-1.97499 0.756236 0) (-2.0424 0.25455 0) (-2.05501 -0.317153 0) (-1.86918 -0.898511 0) (-1.7018 -1.44904 0) (-1.36502 -1.87495 0) (-1.10954 -2.16056 0) (-0.781931 -2.42553 0) (-0.612509 -2.6774 0) (-0.519806 -2.80129 0) (-0.476696 -2.70764 0) (-0.346462 -2.44479 0) (-0.422753 -2.08391 0) (-0.361483 -1.45114 0) (-0.591121 -0.920046 0) (-0.767592 -0.44219 0) (-1.12652 -0.222236 0) (-1.40714 0.101304 0) (-1.72919 0.457754 0) (-1.93253 0.790208 0) (-2.20026 1.17115 0) (-2.22613 1.5519 0) (-2.13826 1.82759 0) (-2.07595 1.97035 0) (-1.90059 1.96212 0) (-1.69817 1.91252 0) (-1.43736 1.80548 0) (-1.27192 1.57136 0) (-1.09025 1.38067 0) (-0.904164 1.21468 0) (-1.09064 0.951783 0) (-0.799621 0.549734 0) (-0.955232 0.208947 0) (-0.940566 -0.0937644 0) (-1.15462 -0.423973 0) (-1.16141 -0.798869 0) (-1.43619 -1.12538 0) (-1.53504 -1.38975 0) (-1.55096 -1.56213 0) (-1.30664 -1.44391 0) (-0.925729 -1.02181 0) (-0.423574 -0.732971 0) (-0.218795 -0.638594 0) (-0.159029 -0.556846 0) (-0.144628 -0.448142 0) (-0.175429 -0.26642 0) (-0.32367 -0.0115191 0) (-0.554353 0.297248 0) (-0.694501 0.748549 0) (-0.796922 1.37507 0) (-0.745273 2.09423 0) (-0.646507 2.72364 0) (-0.460333 3.24901 0) (-0.261526 3.55045 0) (-0.112974 3.59099 0) (0.0454033 3.45974 0) (0.181278 3.22594 0) (0.263908 2.92856 0) (0.354886 2.62606 0) (0.446945 2.34637 0) (0.506382 2.07263 0) (0.590472 1.77665 0) (0.647957 1.51907 0) (0.790112 1.25475 0) (0.812094 0.995364 0) (1.03248 0.709129 0) (1.01698 0.465707 0) (1.24612 0.17229 0) (1.18452 -0.132033 0) (1.41388 -0.502273 0) (1.41686 -0.868556 0) (1.65237 -1.30031 0) (1.78536 -1.71329 0) (2.00813 -2.1246 0) (2.24026 -2.52211 0) (2.49973 -2.87 0) (2.79789 -3.17682 0) (3.01377 -3.35255 0) (3.25111 -3.51751 0) (3.38359 -3.6333 0) (3.4017 -3.75024 0) (3.42063 -3.7334 0) (3.33483 -3.81651 0) (3.24652 -3.89563 0) (2.93476 -3.83538 0) (2.86556 -3.86914 0) (2.76984 -3.9038 0) (2.70143 -3.98103 0) (2.52245 -4.231 0) (2.00318 -4.69448 0) (1.23104 -5.47294 0) (0.349904 -6.35695 0) (-0.333066 -6.58192 0) (-0.457349 -5.72659 0) (0.339146 -3.97848 0) (0.922804 -2.35779 0) (1.55498 -1.31584 0) (1.7982 -0.629352 0) (2.02325 -0.0863861 0) (1.77249 0.621059 0) (1.67496 1.51383 0) (0.885625 2.16261 0) (0.333214 3.16376 0) (-0.764308 4.12452 0) (-1.5106 5.53156 0) (-2.20057 6.65525 0) (-2.83926 7.26749 0) (-2.7781 7.43836 0) (-2.3415 7.13573 0) (-1.99113 6.71603 0) (-1.94249 6.34093 0) (-1.81749 5.8239 0) (-1.62808 5.2075 0) (-1.34705 4.88771 0) (-0.9447 4.52671 0) (-0.684395 3.80575 0) (-0.772084 3.41509 0) (-0.0391713 2.98207 0) (-0.492479 2.47024 0) (0.336563 2.18975 0) (0.0740458 1.91225 0) (0.59663 1.49385 0) (0.605266 1.2838 0) (1.11667 0.995333 0) (1.13639 0.704659 0) (1.44307 0.360164 0) (1.73099 0.015161 0) (1.80595 -0.248595 0) (2.09555 -0.60544 0) (2.15382 -0.967083 0) (2.24825 -1.23626 0) (2.39432 -1.538 0) (2.40416 -1.80428 0) (2.47839 -2.01712 0) (2.59523 -2.20053 0) (2.67012 -2.3163 0) (2.84778 -2.51986 0) (2.94227 -2.47087 0) (3.1315 -2.31716 0) (3.06552 -2.38364 0) (3.09074 -2.28608 0) (3.17917 -2.43025 0) (2.84728 -2.38776 0) (2.63936 -2.476 0) (2.03773 -2.44701 0) (1.71057 -2.38516 0) (1.44419 -2.32642 0) (0.763207 -2.5189 0) (0.791975 -2.61251 0) (-0.0594078 -1.82076 0) (0.622334 -0.294086 0) (-0.0585085 -0.0563442 0) (-0.172053 0.0651126 0) (-0.223813 0.252976 0) (-0.318737 0.419312 0) (-0.402037 0.484482 0) (-0.484334 0.548189 0) (-0.575424 0.503331 0) (-0.671799 0.325753 0) (-0.71367 0.122303 0) (-0.765615 -0.0632718 0) (-0.819648 -0.221435 0) (-0.85986 -0.296395 0) (-0.911376 -0.300324 0) (-0.959633 -0.234118 0) (-1.00394 -0.128627 0) (-1.10734 -0.0163665 0) (-1.22516 0.126874 0) (-1.31449 0.287568 0) (-1.43669 0.41893 0) (-1.52607 0.524174 0) (-1.62202 0.572087 0) (-1.72674 0.55847 0) (-1.80603 0.458293 0) (-1.87425 0.28547 0) (-1.85194 0.0391334 0) (-1.83711 -0.256584 0) (-1.68333 -0.486759 0) (-1.49195 -0.686637 0) (-1.28515 -0.868961 0) (-0.997514 -0.96024 0) (-0.719321 -1.02333 0) (-0.421383 -0.991343 0) (-0.147159 -0.869813 0) (0.14309 -0.64291 0) (0.431911 -0.208291 0) (0.665574 0.352595 0) (0.857198 0.951179 0) (1.05621 1.43632 0) (1.16297 1.61612 0) (1.1956 1.73276 0) (1.08217 2.00966 0) (0.846251 2.18505 0) (0.59409 2.14623 0) (0.33702 2.06903 0) (0.0920491 1.99767 0) (-0.258995 1.97791 0) (-0.736463 1.89587 0) (-1.24657 1.68404 0) (-1.66266 1.28196 0) (-1.97104 0.775633 0) (-1.98727 0.165518 0) (-2.0397 -0.472091 0) (-1.79602 -1.067 0) (-1.64446 -1.63886 0) (-1.22432 -2.13128 0) (-0.908769 -2.52117 0) (-0.439983 -2.81059 0) (-0.136632 -2.85121 0) (0.143051 -2.77782 0) (0.0598568 -2.76298 0) (0.187298 -2.47025 0) (0.216227 -2.10477 0) (0.242654 -1.50204 0) (0.262449 -0.775794 0) (0.135148 -0.294118 0) (-0.0535513 0.121626 0) (-0.438973 0.458793 0) (-0.973406 0.701831 0) (-1.29638 0.989728 0) (-1.59901 1.35741 0) (-1.79741 1.61233 0) (-1.79366 1.76957 0) (-1.74589 1.87768 0) (-1.58052 1.82918 0) (-1.39618 1.64577 0) (-1.12637 1.52068 0) (-0.873502 1.33047 0) (-0.823397 1.13134 0) (-0.582309 1.01386 0) (-0.720901 0.833348 0) (-0.489009 0.487554 0) (-0.765139 0.23029 0) (-0.683082 0.0441701 0) (-0.872927 -0.213302 0) (-0.829788 -0.627162 0) (-0.935275 -0.969568 0) (-0.993162 -1.2742 0) (-1.09085 -1.55909 0) (-1.09693 -1.65872 0) (-0.912462 -1.4979 0) (-0.286778 -1.13886 0) (0.116244 -0.788841 0) (0.294597 -0.576457 0) (0.313963 -0.425543 0) (0.23065 -0.263603 0) (0.144552 -0.00884217 0) (0.13091 0.391063 0) (0.0993543 0.829801 0) (0.112633 1.37358 0) (0.17072 1.98062 0) (0.340186 2.61049 0) (0.475667 3.08585 0) (0.724744 3.40371 0) (0.92865 3.51155 0) (1.08623 3.37103 0) (1.23272 3.14549 0) (1.35813 2.90019 0) (1.43526 2.58816 0) (1.50604 2.26144 0) (1.54879 1.98155 0) (1.67172 1.70045 0) (1.64649 1.45647 0) (1.83088 1.16 0) (1.71976 0.931179 0) (1.96457 0.650211 0) (1.76857 0.411714 0) (2.04202 0.0717888 0) (1.81742 -0.18175 0) (2.07284 -0.554676 0) (1.93261 -0.912296 0) (2.19549 -1.37858 0) (2.26264 -1.81774 0) (2.57069 -2.27555 0) (2.78057 -2.68973 0) (3.1103 -3.07366 0) (3.41538 -3.37108 0) (3.68569 -3.54561 0) (3.95418 -3.63599 0) (4.15974 -3.75633 0) (4.20612 -3.78031 0) (4.21279 -3.73794 0) (4.23565 -3.74833 0) (4.07494 -3.75982 0) (3.78808 -3.76047 0) (3.67479 -3.78145 0) (3.44655 -3.83788 0) (3.35283 -4.0523 0) (3.12688 -4.06832 0) (2.60949 -4.26515 0) (1.92325 -4.80268 0) (1.02091 -5.39207 0) (-0.10652 -5.84307 0) (-0.605892 -5.57166 0) (-0.239159 -4.30123 0) (0.346609 -2.88982 0) (0.966878 -1.58266 0) (1.09785 -0.652564 0) (1.10717 0.214332 0) (0.735756 0.96995 0) (0.46236 1.94732 0) (-0.0234112 2.84952 0) (-0.660906 3.74702 0) (-1.08594 4.89678 0) (-1.97796 5.82273 0) (-2.26028 6.94218 0) (-2.24104 7.58556 0) (-2.13569 7.41318 0) (-1.94782 6.8997 0) (-1.65396 6.39474 0) (-1.29307 6.02283 0) (-1.09364 5.78669 0) (-0.817989 5.1977 0) (-0.699028 4.5066 0) (-0.476496 4.21133 0) (0.0815315 3.6895 0) (-0.237463 3.18059 0) (0.553639 2.83104 0) (0.21306 2.3319 0) (0.765633 1.91973 0) (0.817651 1.74443 0) (1.3763 1.28544 0) (1.3249 1.03627 0) (1.91074 0.708708 0) (2.08495 0.441812 0) (2.39981 0.203956 0) (2.69319 -0.166221 0) (2.90078 -0.434438 0) (3.08241 -0.784601 0) (3.2394 -1.05907 0) (3.29998 -1.31832 0) (3.41561 -1.64057 0) (3.62267 -1.82224 0) (3.54509 -2.06993 0) (3.8587 -2.20118 0) (3.77095 -2.42426 0) (4.00596 -2.5512 0) (4.04197 -2.55123 0) (3.93537 -2.56745 0) (4.39187 -2.37925 0) (4.02753 -2.4866 0) (4.40562 -2.45136 0) (3.8028 -2.42824 0) (3.91258 -2.09898 0) (3.09497 -2.07583 0) (2.81855 -2.04423 0) (2.12096 -2.0754 0) (1.90921 -1.87429 0) (0.759261 -2.10263 0) (0.390186 -0.899452 0) (-0.221662 -0.32011 0) (-0.0074082 0.0688189 0) (-0.114022 0.116107 0) (-0.186489 0.321065 0) (-0.210072 0.479176 0) (-0.260162 0.552823 0) (-0.313635 0.587301 0) (-0.317999 0.549321 0) (-0.361251 0.385426 0) (-0.400479 0.161503 0) (-0.454806 -0.0189476 0) (-0.509514 -0.154244 0) (-0.568662 -0.226634 0) (-0.643625 -0.244078 0) (-0.764473 -0.187634 0) (-0.848998 -0.0586806 0) (-0.952193 0.0936817 0) (-1.11035 0.233937 0) (-1.24335 0.38908 0) (-1.39745 0.522259 0) (-1.57079 0.627747 0) (-1.71978 0.677132 0) (-1.90295 0.655943 0) (-2.03205 0.537969 0) (-2.1549 0.326318 0) (-2.18914 0.0261467 0) (-2.21281 -0.316967 0) (-2.11559 -0.627393 0) (-1.87471 -0.868803 0) (-1.58416 -1.09231 0) (-1.22324 -1.23722 0) (-0.834957 -1.2996 0) (-0.464119 -1.28604 0) (-0.0673623 -1.13879 0) (0.269428 -0.915231 0) (0.661113 -0.478628 0) (1.01729 0.144328 0) (1.23136 0.789929 0) (1.41757 1.3067 0) (1.52785 1.59386 0) (1.52605 1.7803 0) (1.45873 2.1097 0) (1.33543 2.35368 0) (1.25317 2.334 0) (1.10813 2.27583 0) (0.798807 2.26015 0) (0.252928 2.33865 0) (-0.379159 2.32598 0) (-0.956027 2.12761 0) (-1.32887 1.63198 0) (-1.66285 1.01044 0) (-1.57086 0.250848 0) (-1.7059 -0.55771 0) (-1.36128 -1.30886 0) (-1.259 -2.00965 0) (-0.8007 -2.56969 0) (-0.543377 -2.9322 0) (-0.0691415 -3.09397 0) (0.223098 -3.13464 0) (0.5717 -3.03167 0) (0.878799 -2.72381 0) (0.872836 -2.55783 0) (0.955966 -2.13336 0) (0.965141 -1.56195 0) (1.07896 -0.80184 0) (1.10152 -0.178947 0) (0.931485 0.344817 0) (0.652318 0.757262 0) (0.273537 1.07993 0) (-0.10483 1.31709 0) (-0.510436 1.55254 0) (-0.730033 1.74087 0) (-0.801615 1.83834 0) (-0.781772 1.79362 0) (-0.691048 1.70872 0) (-0.362474 1.50984 0) (-0.250141 1.36293 0) (0.109185 1.29316 0) (0.0428846 1.23609 0) (0.13963 1.13435 0) (-0.160485 0.906893 0) (-0.245446 0.59381 0) (-0.714233 0.317828 0) (-0.80023 -0.0345069 0) (-0.97835 -0.375381 0) (-0.824277 -0.728181 0) (-0.793379 -0.978265 0) (-0.575981 -1.20576 0) (-0.499628 -1.43022 0) (-0.462864 -1.60031 0) (-0.490693 -1.74449 0) (-0.179894 -1.64184 0) (0.224994 -1.18248 0) (0.719375 -0.723065 0) (0.990794 -0.415364 0) (1.09436 -0.112838 0) (0.963485 0.136131 0) (0.818871 0.438472 0) (0.770641 0.858232 0) (0.792063 1.33165 0) (0.943706 1.89856 0) (1.08776 2.43434 0) (1.40609 2.89296 0) (1.61907 3.17944 0) (1.894 3.32222 0) (2.10423 3.25445 0) (2.22882 3.04202 0) (2.33167 2.77528 0) (2.41283 2.50483 0) (2.52596 2.232 0) (2.48065 1.9862 0) (2.65871 1.65406 0) (2.47755 1.43188 0) (2.73611 1.12527 0) (2.40105 0.94041 0) (2.74541 0.62318 0) (2.2802 0.431757 0) (2.70911 0.062174 0) (2.21311 -0.184955 0) (2.67742 -0.661426 0) (2.32309 -1.00994 0) (2.79965 -1.58397 0) (2.73923 -2.05815 0) (3.26641 -2.59031 0) (3.44115 -3.01791 0) (3.87664 -3.4164 0) (4.18812 -3.71139 0) (4.50946 -3.81863 0) (4.7998 -3.91012 0) (5.08522 -3.89942 0) (5.17647 -3.79984 0) (5.16934 -3.80096 0) (5.1943 -3.72242 0) (5.07034 -3.61732 0) (4.95322 -3.5733 0) (4.73561 -3.50668 0) (4.50965 -3.64759 0) (4.25444 -3.72052 0) (3.71652 -3.59651 0) (3.25413 -3.7667 0) (2.64211 -4.14339 0) (1.65492 -4.68239 0) (0.66258 -5.22915 0) (-0.283698 -5.19934 0) (-0.606822 -4.48077 0) (-0.276562 -3.08574 0) (-0.0537194 -1.83839 0) (0.258723 -0.642857 0) (0.0106891 0.290539 0) (0.00238443 1.35717 0) (-0.435982 2.25397 0) (-0.672171 3.27134 0) (-1.00133 4.20684 0) (-1.67716 5.23448 0) (-1.69727 6.41944 0) (-2.14987 6.93257 0) (-2.00244 7.16186 0) (-1.38341 7.12421 0) (-1.11601 6.81365 0) (-0.952352 6.3719 0) (-0.764372 5.77166 0) (-0.571584 5.32267 0) (-0.207843 5.03979 0) (0.187432 4.3745 0) (0.02297 3.95254 0) (0.702331 3.54663 0) (0.374122 2.9811 0) (0.897273 2.63015 0) (1.01501 2.20335 0) (1.2279 1.698 0) (1.40596 1.45399 0) (1.99339 0.940961 0) (2.04147 0.805664 0) (2.57749 0.475373 0) (2.84143 0.12831 0) (3.24527 -0.0727434 0) (3.48631 -0.398633 0) (3.83105 -0.552134 0) (4.06008 -0.892574 0) (4.19436 -1.14823 0) (4.36735 -1.39495 0) (4.48855 -1.73191 0) (4.63223 -1.93818 0) (4.75928 -2.20891 0) (4.84968 -2.2649 0) (5.07588 -2.50539 0) (5.06159 -2.63668 0) (5.12241 -2.71303 0) (5.20332 -2.51855 0) (5.31922 -2.47602 0) (5.23899 -2.4046 0) (5.24639 -2.20069 0) (5.06819 -2.07507 0) (4.68339 -1.79829 0) (4.67261 -1.57922 0) (3.88162 -1.52586 0) (3.6607 -1.60971 0) (2.5129 -1.48934 0) (2.35155 -1.25196 0) (0.297573 -1.26546 0) (1.07868 0.0834314 0) (-0.0782333 0.0303372 0) (-0.104768 0.213284 0) (-0.0776439 0.312213 0) (-0.0656909 0.485 0) (-0.0571389 0.565681 0) (-0.0340659 0.599756 0) (0.00706915 0.554498 0) (0.0282016 0.433441 0) (0.00276726 0.234582 0) (-0.0657588 0.0474876 0) (-0.130457 -0.107425 0) (-0.20757 -0.184797 0) (-0.26328 -0.151124 0) (-0.406457 -0.0678156 0) (-0.591203 0.0137599 0) (-0.713529 0.205201 0) (-0.850542 0.378252 0) (-1.05846 0.531461 0) (-1.23358 0.695267 0) (-1.46508 0.79932 0) (-1.66203 0.847169 0) (-1.8831 0.815742 0) (-2.05115 0.652787 0) (-2.21462 0.412185 0) (-2.27885 0.0502856 0) (-2.33863 -0.365685 0) (-2.2294 -0.813593 0) (-2.08661 -1.18946 0) (-1.70872 -1.44899 0) (-1.32833 -1.6224 0) (-0.817843 -1.66213 0) (-0.351626 -1.62713 0) (0.120321 -1.45529 0) (0.523315 -1.21589 0) (0.900953 -0.828088 0) (1.31513 -0.178821 0) (1.69751 0.575358 0) (1.92332 1.21241 0) (2.05442 1.60167 0) (2.09515 1.86709 0) (2.03374 2.17217 0) (2.06108 2.42959 0) (2.04387 2.45206 0) (1.81628 2.45844 0) (1.35165 2.62434 0) (0.667006 2.80666 0) (0.035705 2.72795 0) (-0.483958 2.46898 0) (-0.617164 1.77642 0) (-0.981418 1.0531 0) (-0.620127 0.180326 0) (-0.867463 -0.652078 0) (-0.367223 -1.46784 0) (-0.364095 -2.16627 0) (0.115185 -2.73542 0) (0.327961 -3.13367 0) (0.747312 -3.38992 0) (1.05491 -3.3597 0) (1.37695 -3.2476 0) (1.53464 -3.04118 0) (1.80458 -2.61872 0) (1.85667 -2.12063 0) (1.78334 -1.66044 0) (1.91011 -0.978875 0) (2.01529 -0.154589 0) (1.9848 0.473704 0) (1.86105 0.959299 0) (1.60131 1.35305 0) (1.34712 1.62354 0) (1.02485 1.84576 0) (0.735524 1.91763 0) (0.570865 1.92857 0) (0.619092 1.8029 0) (0.518818 1.59617 0) (0.838187 1.35368 0) (0.790211 1.18827 0) (1.04737 1.14471 0) (0.822919 1.15792 0) (0.877575 1.18735 0) (0.47141 1.16112 0) (0.304728 0.999716 0) (-0.237432 0.720398 0) (-0.417499 0.247439 0) (-0.746303 -0.233268 0) (-0.696857 -0.766408 0) (-0.826372 -1.25217 0) (-0.511428 -1.58647 0) (-0.280277 -1.70516 0) (0.180486 -1.67359 0) (0.375153 -1.68254 0) (0.451853 -1.76492 0) (0.485934 -1.5224 0) (0.88675 -1.19371 0) (1.40514 -0.704475 0) (1.61988 -0.261016 0) (1.92035 0.185376 0) (1.83104 0.513787 0) (1.77697 0.886968 0) (1.71685 1.30731 0) (1.73928 1.7737 0) (1.8704 2.24867 0) (2.10954 2.6656 0) (2.37929 2.97223 0) (2.63482 3.067 0) (2.89787 3.0556 0) (3.06456 2.92818 0) (3.22533 2.71369 0) (3.24245 2.46749 0) (3.45022 2.1228 0) (3.27569 1.92099 0) (3.59113 1.60326 0) (3.16069 1.45359 0) (3.61563 1.11524 0) (2.88915 0.982451 0) (3.55211 0.654347 0) (2.67747 0.514709 0) (3.52515 0.048445 0) (2.70093 -0.185872 0) (3.60826 -0.745685 0) (3.04602 -1.08312 0) (3.86554 -1.71869 0) (3.65406 -2.25279 0) (4.36763 -2.83472 0) (4.53907 -3.2584 0) (4.98035 -3.67921 0) (5.39355 -3.97107 0) (5.57825 -4.04221 0) (6.03963 -4.11348 0) (6.14296 -4.03436 0) (6.3314 -3.90751 0) (6.3892 -3.6814 0) (6.22794 -3.64406 0) (6.0942 -3.5859 0) (5.90907 -3.42924 0) (5.63984 -3.33513 0) (5.48126 -3.37599 0) (5.05124 -3.39518 0) (4.43763 -3.34369 0) (4.06881 -3.33352 0) (3.35615 -3.49486 0) (2.48177 -3.89799 0) (1.55357 -4.30137 0) (0.36766 -4.57969 0) (-0.275975 -4.17623 0) (-0.62878 -3.21843 0) (-0.429353 -1.89606 0) (-0.542167 -0.670791 0) (-0.435392 0.501271 0) (-0.658673 1.41083 0) (-0.695637 2.45287 0) (-0.877132 3.36785 0) (-1.20191 4.58609 0) (-1.26778 5.57055 0) (-1.80225 6.28953 0) (-1.22962 7.14289 0) (-1.09735 7.17082 0) (-0.950108 6.72476 0) (-0.510604 6.42149 0) (-0.131173 6.11841 0) (0.0584033 5.79919 0) (0.263182 5.14278 0) (0.319239 4.66413 0) (0.940276 4.22136 0) (0.689683 3.82402 0) (1.23673 3.42615 0) (1.23585 2.8885 0) (1.26826 2.47491 0) (1.80776 1.94627 0) (1.73675 1.46659 0) (2.07948 1.27076 0) (2.49666 0.675945 0) (2.74499 0.430196 0) (3.20183 0.0925344 0) (3.57763 -0.110861 0) (3.88231 -0.375891 0) (4.37152 -0.646067 0) (4.59013 -0.828221 0) (4.92035 -1.08842 0) (5.28699 -1.3015 0) (5.28056 -1.56417 0) (5.75013 -1.81902 0) (5.66104 -2.12961 0) (6.00749 -2.25862 0) (5.89767 -2.435 0) (6.22393 -2.609 0) (6.1869 -2.72159 0) (6.41266 -2.60571 0) (6.25717 -2.61017 0) (6.51467 -2.4437 0) (6.38392 -2.35541 0) (6.45512 -2.18759 0) (6.22661 -2.01364 0) (6.1354 -1.64489 0) (5.57155 -1.3631 0) (5.47821 -1.04654 0) (4.42831 -1.16917 0) (4.11658 -0.662162 0) (2.48721 -0.652665 0) (2.0718 0.340976 0) (-0.667443 0.479327 0) (-0.0558957 0.2491 0) (-0.0714219 0.139319 0) (-0.0851861 0.303179 0) (0.00985352 0.464177 0) (0.0793959 0.534153 0) (0.177 0.54909 0) (0.26567 0.503963 0) (0.328138 0.398984 0) (0.368132 0.242131 0) (0.351714 0.0873504 0) (0.330769 -0.0416906 0) (0.245287 -0.109724 0) (0.169287 -0.0966157 0) (0.060925 0.0567766 0) (-0.0709215 0.211028 0) (-0.337222 0.305201 0) (-0.520759 0.482147 0) (-0.728705 0.693217 0) (-0.93403 0.832064 0) (-1.14968 0.972159 0) (-1.33616 0.997585 0) (-1.53497 0.964465 0) (-1.62346 0.786917 0) (-1.77513 0.51945 0) (-1.69843 0.114397 0) (-1.78216 -0.372338 0) (-1.57659 -0.904684 0) (-1.57242 -1.41007 0) (-1.28186 -1.80625 0) (-1.05743 -2.07612 0) (-0.639671 -2.16634 0) (-0.179891 -2.12004 0) (0.347126 -1.90524 0) (0.875881 -1.56554 0) (1.2605 -1.16694 0) (1.68476 -0.572509 0) (2.09668 0.205004 0) (2.52618 0.982781 0) (2.70398 1.50187 0) (2.84958 1.80493 0) (2.84581 2.09537 0) (2.85452 2.33622 0) (2.85075 2.5203 0) (2.46727 2.73927 0) (1.9271 3.04638 0) (1.30035 3.35648 0) (0.849822 3.14758 0) (0.357871 2.75984 0) (0.610023 1.95416 0) (0.0291304 1.11593 0) (0.68246 0.12993 0) (0.145102 -0.713594 0) (0.8251 -1.62929 0) (0.586042 -2.34594 0) (1.14352 -3.03024 0) (1.30501 -3.46272 0) (1.7948 -3.70322 0) (2.0657 -3.73441 0) (2.44647 -3.49348 0) (2.64863 -3.08374 0) (2.72076 -2.67366 0) (2.6689 -2.20008 0) (2.81081 -1.59565 0) (2.7089 -1.06573 0) (2.78286 -0.266076 0) (2.95548 0.542295 0) (2.94451 1.12775 0) (2.82345 1.56948 0) (2.61379 1.84755 0) (2.38678 2.06731 0) (2.2514 2.13118 0) (1.96112 2.06691 0) (2.06218 1.87294 0) (1.81408 1.57302 0) (2.07607 1.28733 0) (1.89855 1.14354 0) (2.01758 1.19154 0) (1.60838 1.37521 0) (1.46375 1.44478 0) (0.783573 1.42435 0) (0.570539 1.20133 0) (0.0123079 0.917306 0) (0.117366 0.394083 0) (-0.217749 -0.164094 0) (0.0845203 -0.735553 0) (-0.0688482 -1.20407 0) (0.271056 -1.63575 0) (0.17051 -1.95412 0) (0.535691 -2.10679 0) (0.760841 -2.00209 0) (1.28076 -1.80219 0) (1.23802 -1.59122 0) (1.55419 -1.44456 0) (1.64506 -1.0368 0) (2.07256 -0.520156 0) (2.30497 -0.0411139 0) (2.69989 0.455255 0) (2.69236 0.890365 0) (2.86342 1.28548 0) (2.77965 1.69127 0) (2.95085 2.12331 0) (3.04706 2.44123 0) (3.29368 2.76019 0) (3.53832 2.91224 0) (3.75663 2.90934 0) (3.90483 2.82993 0) (4.14544 2.55886 0) (4.04757 2.42307 0) (4.40199 2.09496 0) (3.91904 1.96822 0) (4.48734 1.60842 0) (3.52 1.53657 0) (4.43932 1.19781 0) (3.16931 1.11666 0) (4.41232 0.686787 0) (3.14867 0.548003 0) (4.55981 -0.0233955 0) (3.43329 -0.283664 0) (4.80118 -0.950384 0) (3.99171 -1.27389 0) (5.23457 -1.98718 0) (4.73492 -2.49424 0) (5.65163 -3.20856 0) (5.5355 -3.53521 0) (6.25258 -4.05835 0) (6.35996 -4.26218 0) (6.7349 -4.35614 0) (7.03864 -4.31645 0) (7.13309 -4.19166 0) (7.37272 -3.9825 0) (7.30995 -3.66569 0) (7.42963 -3.50241 0) (7.23907 -3.35824 0) (6.96017 -3.19183 0) (6.68932 -3.14455 0) (6.33358 -3.1615 0) (5.73811 -3.02559 0) (5.17601 -2.85197 0) (4.67569 -2.84381 0) (4.08286 -2.96576 0) (3.43694 -3.2552 0) (2.44007 -3.57042 0) (1.3708 -3.78711 0) (0.339334 -3.70318 0) (-0.2308 -2.90671 0) (-0.607436 -1.85496 0) (-0.505278 -0.661599 0) (-0.608318 0.442962 0) (-0.678605 1.59323 0) (-0.737413 2.55226 0) (-0.893954 3.67577 0) (-0.928007 4.48936 0) (-1.05758 5.5883 0) (-0.657505 6.34908 0) (-0.97545 6.47487 0) (-0.23582 6.79111 0) (0.150675 6.77375 0) (0.144569 6.20403 0) (0.540962 5.70993 0) (0.750563 5.59335 0) (1.11621 5.04784 0) (1.10894 4.50824 0) (1.69661 4.04028 0) (1.48099 3.63173 0) (1.82855 3.28651 0) (2.18206 2.72729 0) (1.85381 2.33794 0) (2.54986 1.8006 0) (2.42544 1.30213 0) (2.74913 0.903719 0) (3.07302 0.361722 0) (3.56572 0.167619 0) (3.74116 -0.242467 0) (4.42454 -0.413468 0) (4.65947 -0.73646 0) (5.02593 -0.906994 0) (5.52885 -1.15319 0) (5.68648 -1.3136 0) (6.12957 -1.57106 0) (6.35596 -1.74257 0) (6.55774 -2.02128 0) (6.85228 -2.2417 0) (6.84972 -2.31908 0) (7.11975 -2.55631 0) (7.17643 -2.60681 0) (7.39917 -2.79191 0) (7.26111 -2.69597 0) (7.5522 -2.69916 0) (7.47511 -2.48475 0) (7.74501 -2.42778 0) (7.57359 -2.12173 0) (7.64161 -1.84258 0) (7.12598 -1.37703 0) (7.11354 -1.03417 0) (6.35016 -0.599583 0) (6.06671 -0.273526 0) (4.22876 -0.0798169 0) (4.18629 0.700698 0) (1.46192 0.707661 0) (2.1472 2.16502 0) (0.0604886 0.0917734 0) (-0.0422832 0.230337 0) (0.0199168 0.234813 0) (0.0981731 0.360832 0) (0.263347 0.429556 0) (0.399391 0.45373 0) (0.566256 0.423692 0) (0.673891 0.363584 0) (0.774589 0.234177 0) (0.811218 0.110359 0) (0.835586 -0.00390992 0) (0.768391 -0.05004 0) (0.686924 -0.0105847 0) (0.530699 0.12306 0) (0.463719 0.302808 0) (0.323946 0.530264 0) (0.153702 0.707555 0) (-0.0577672 0.88524 0) (-0.208863 1.01501 0) (-0.395591 1.13051 0) (-0.444899 1.12308 0) (-0.588632 1.05423 0) (-0.447743 0.814269 0) (-0.555424 0.496303 0) (-0.225512 0.0294717 0) (-0.316419 -0.472917 0) (0.0985698 -1.01935 0) (0.0674664 -1.47415 0) (0.367346 -1.89646 0) (0.340471 -2.20514 0) (0.477832 -2.40994 0) (0.595975 -2.46651 0) (0.883301 -2.31839 0) (1.26466 -1.98604 0) (1.73539 -1.51002 0) (2.04362 -0.95441 0) (2.54639 -0.219032 0) (2.94741 0.58243 0) (3.50724 1.28514 0) (3.62905 1.67001 0) (3.82426 2.03515 0) (3.69793 2.3313 0) (3.56026 2.65264 0) (3.19921 3.09134 0) (2.62464 3.44748 0) (2.11937 3.73092 0) (2.09244 3.45117 0) (1.38744 2.89274 0) (2.15733 1.99444 0) (1.18333 1.12551 0) (2.27097 0.0540782 0) (1.40323 -0.809796 0) (2.42007 -1.82347 0) (1.82388 -2.5472 0) (2.51602 -3.34675 0) (2.3574 -3.78901 0) (2.86506 -4.03671 0) (3.20779 -3.88093 0) (3.48427 -3.63065 0) (3.75335 -3.24001 0) (3.79051 -2.76637 0) (3.80943 -2.18967 0) (3.77034 -1.67212 0) (3.74136 -1.07236 0) (3.65724 -0.431962 0) (3.8044 0.326823 0) (3.99399 1.03846 0) (4.02646 1.61031 0) (4.00985 1.97689 0) (3.70742 2.2006 0) (3.72222 2.28997 0) (3.33579 2.21849 0) (3.46836 1.98971 0) (3.1797 1.64336 0) (3.36642 1.2932 0) (2.99618 1.20333 0) (2.92866 1.35983 0) (2.24606 1.62548 0) (2.07361 1.773 0) (1.3013 1.81493 0) (1.30469 1.51779 0) (0.684202 1.07845 0) (1.12638 0.409493 0) (0.641323 -0.218957 0) (1.24939 -0.883426 0) (0.964293 -1.38256 0) (1.55118 -1.82491 0) (1.36891 -2.04355 0) (1.83757 -2.18536 0) (1.63495 -2.24727 0) (2.06634 -2.15093 0) (2.09937 -1.78341 0) (2.52827 -1.49026 0) (2.44083 -1.15012 0) (2.65253 -0.746079 0) (2.81879 -0.299701 0) (3.09508 0.205631 0) (3.35367 0.735383 0) (3.60644 1.21989 0) (3.76001 1.60966 0) (3.85112 1.95801 0) (4.09777 2.30556 0) (4.15379 2.54311 0) (4.42279 2.71006 0) (4.59363 2.64584 0) (4.61021 2.70748 0) (4.99436 2.42346 0) (4.49045 2.37605 0) (5.22517 2.00263 0) (4.06495 1.98997 0) (5.31551 1.67192 0) (3.6457 1.63375 0) (5.34784 1.18667 0) (3.53502 1.10274 0) (5.46474 0.555979 0) (3.82099 0.435049 0) (5.86158 -0.180778 0) (4.43185 -0.431574 0) (6.30744 -1.15291 0) (5.00897 -1.49252 0) (6.77337 -2.20486 0) (5.81205 -2.67723 0) (7.16092 -3.39544 0) (6.47953 -3.82246 0) (7.57847 -4.31443 0) (7.25836 -4.49843 0) (7.8498 -4.63719 0) (7.80499 -4.46713 0) (7.97468 -4.33157 0) (8.04283 -4.06477 0) (7.96082 -3.80623 0) (8.10893 -3.56591 0) (7.91936 -3.27842 0) (7.85384 -2.97057 0) (7.64667 -2.73317 0) (7.25247 -2.70694 0) (6.70773 -2.5555 0) (6.01575 -2.42224 0) (5.52704 -2.37483 0) (4.92421 -2.48611 0) (4.35747 -2.55561 0) (3.45488 -2.70122 0) (2.41264 -2.94793 0) (1.39601 -2.93481 0) (0.397429 -2.50559 0) (0.0641704 -1.67402 0) (-0.222465 -0.59419 0) (-0.46968 0.560158 0) (-0.446622 1.58204 0) (-0.486252 2.5817 0) (-0.518659 3.51362 0) (-0.310482 4.71302 0) (-0.346811 5.354 0) (-0.280893 6.19212 0) (0.458397 6.63945 0) (0.235886 6.35596 0) (0.711248 6.34573 0) (1.23741 6.16086 0) (1.44638 5.63801 0) (1.39802 5.31118 0) (2.13424 4.74442 0) (1.86516 4.3463 0) (2.58038 3.8821 0) (2.36251 3.51085 0) (2.65161 3.16289 0) (2.95585 2.61966 0) (2.96205 2.22533 0) (3.13484 1.67641 0) (3.3335 1.1288 0) (3.62733 0.686649 0) (3.844 0.0699631 0) (4.27679 -0.238303 0) (4.77946 -0.613464 0) (5.00676 -0.775578 0) (5.67006 -1.05845 0) (5.85278 -1.20567 0) (6.28719 -1.45545 0) (6.59728 -1.59597 0) (6.84675 -1.74209 0) (7.20389 -2.01732 0) (7.32529 -2.17006 0) (7.65229 -2.38611 0) (7.56456 -2.50136 0) (8.02505 -2.70858 0) (7.97257 -2.83055 0) (8.29137 -2.92745 0) (8.33839 -2.83966 0) (8.59406 -2.76052 0) (8.7403 -2.62538 0) (8.88104 -2.38183 0) (8.86707 -2.05892 0) (8.70334 -1.66586 0) (8.60145 -1.14486 0) (8.22568 -0.685577 0) (7.80075 -0.108884 0) (7.00171 0.431036 0) (6.24197 1.09352 0) (4.34181 1.46632 0) (3.65337 2.88912 0) (-0.756983 2.91943 0) (-0.186345 0.289372 0) (-0.110903 0.188122 0) (-0.116408 0.187718 0) (0.0231931 0.248184 0) (0.17978 0.254546 0) (0.389204 0.290963 0) (0.549481 0.253045 0) (0.720693 0.228655 0) (0.860675 0.136248 0) (0.919883 0.0647259 0) (1.0008 0.00429428 0) (0.95648 0.0125262 0) (0.973439 0.0790037 0) (0.904954 0.22111 0) (0.951375 0.379049 0) (0.911858 0.588367 0) (0.971508 0.762475 0) (0.895182 0.953986 0) (1.00875 1.06508 0) (0.896914 1.16417 0) (1.18612 1.12457 0) (1.04636 1.02012 0) (1.58153 0.744148 0) (1.40852 0.396972 0) (2.08476 -0.0926366 0) (1.91378 -0.568633 0) (2.57496 -1.12786 0) (2.44044 -1.54501 0) (2.89625 -1.92181 0) (2.74772 -2.11579 0) (2.80107 -2.30936 0) (2.55741 -2.40816 0) (2.36497 -2.40865 0) (2.33191 -2.18783 0) (2.40177 -1.72623 0) (2.60673 -1.1935 0) (2.83826 -0.511268 0) (3.18514 0.242723 0) (3.64649 0.983633 0) (4.09254 1.54848 0) (4.09678 1.94663 0) (4.33683 2.44135 0) (4.00802 2.85174 0) (3.85183 3.49513 0) (3.63097 3.85876 0) (2.92513 4.04247 0) (3.68936 3.6459 0) (2.52051 2.9914 0) (3.92749 2.01829 0) (2.58198 1.09075 0) (4.13374 -0.0566174 0) (3.05369 -0.963069 0) (4.52356 -1.91798 0) (3.65338 -2.57953 0) (4.64632 -3.35828 0) (3.9805 -3.85256 0) (4.48723 -4.32491 0) (4.29194 -4.30679 0) (4.6185 -3.96225 0) (4.94669 -3.31362 0) (4.94773 -2.68959 0) (4.9494 -2.09728 0) (4.73475 -1.57743 0) (4.59233 -0.963504 0) (4.54111 -0.324924 0) (4.39476 0.285092 0) (4.69004 0.964675 0) (4.68703 1.58524 0) (5.04499 2.08137 0) (4.79967 2.37234 0) (5.01515 2.48136 0) (4.66129 2.42212 0) (4.8608 2.13206 0) (4.52103 1.73329 0) (4.62021 1.39351 0) (3.98194 1.40689 0) (3.82006 1.64601 0) (2.96662 2.02648 0) (2.94073 2.1506 0) (2.03146 2.12297 0) (2.52949 1.70578 0) (1.66085 1.16488 0) (2.61741 0.406443 0) (1.80991 -0.212059 0) (2.92397 -0.953797 0) (2.32015 -1.42534 0) (3.33732 -1.8774 0) (2.86449 -2.08385 0) (3.54779 -2.27957 0) (3.21711 -2.22197 0) (3.50481 -2.22689 0) (3.21715 -1.97803 0) (3.47385 -1.66858 0) (3.55007 -1.19253 0) (3.54368 -0.770744 0) (3.7246 -0.376578 0) (3.61232 0.0326116 0) (3.8837 0.582138 0) (3.9527 1.02517 0) (4.34382 1.51869 0) (4.35514 1.81271 0) (4.65816 2.20232 0) (4.80804 2.34136 0) (4.86473 2.66317 0) (5.35002 2.52224 0) (4.79624 2.66993 0) (5.83519 2.38093 0) (4.45151 2.43939 0) (6.1227 2.12303 0) (4.0621 2.08622 0) (6.23409 1.691 0) (3.95213 1.67017 0) (6.39691 1.17487 0) (4.31355 1.07509 0) (6.79032 0.463243 0) (4.79482 0.198972 0) (7.26428 -0.420383 0) (5.55757 -0.65391 0) (7.8845 -1.31108 0) (6.22356 -1.70658 0) (8.24244 -2.48619 0) (6.93225 -2.94136 0) (8.54495 -3.65541 0) (7.6369 -4.02192 0) (8.83945 -4.56917 0) (8.27001 -4.63056 0) (8.96486 -4.73135 0) (8.54386 -4.56705 0) (8.849 -4.37935 0) (8.62029 -4.01773 0) (8.63489 -3.75152 0) (8.47953 -3.47991 0) (8.24424 -3.258 0) (8.2364 -2.96267 0) (8.01714 -2.68104 0) (7.99548 -2.40794 0) (7.45408 -2.06874 0) (7.13336 -1.8309 0) (6.58344 -1.84582 0) (6.04796 -2.00077 0) (5.36192 -2.03152 0) (4.50974 -2.03498 0) (3.69709 -2.08575 0) (2.46789 -2.17143 0) (1.55128 -1.94476 0) (0.928231 -1.32006 0) (0.385349 -0.362447 0) (0.284401 0.6543 0) (0.230894 1.51091 0) (-0.0256309 2.5744 0) (0.40354 3.45093 0) (0.0497024 4.3122 0) (0.806761 5.41828 0) (0.806827 5.66711 0) (1.08282 6.2817 0) (1.83779 6.45564 0) (1.56326 6.00322 0) (2.08872 5.76767 0) (2.50016 5.34602 0) (2.29249 5.22935 0) (3.36822 4.59014 0) (2.45139 4.20321 0) (3.74814 3.67388 0) (3.25331 3.37942 0) (3.71694 2.96401 0) (3.83817 2.57675 0) (3.98034 1.93924 0) (3.95 1.70528 0) (4.54286 0.761495 0) (4.4012 0.562755 0) (5.24382 -0.319342 0) (5.25477 -0.497606 0) (5.94976 -1.07518 0) (6.1052 -1.05485 0) (6.57283 -1.40631 0) (6.80031 -1.48928 0) (7.01025 -1.67516 0) (7.39482 -1.80991 0) (7.36495 -1.96982 0) (7.93116 -2.15812 0) (7.73301 -2.32487 0) (8.28983 -2.48594 0) (8.17412 -2.62842 0) (8.83734 -2.85998 0) (8.69925 -2.97998 0) (9.40073 -3.01295 0) (9.30708 -3.06323 0) (9.88656 -2.96034 0) (9.9021 -2.76975 0) (10.1296 -2.49107 0) (10.0783 -2.0266 0) (10.0414 -1.56396 0) (9.87741 -0.899635 0) (9.60896 -0.430093 0) (9.15111 0.426329 0) (8.51788 1.03824 0) (7.41817 2.09067 0) (6.54343 2.96777 0) (3.9198 3.55019 0) (3.39459 6.19259 0) (0.363299 0.252078 0) (0.211111 0.180553 0) (0.604463 0.111605 0) (0.424904 0.131834 0) (0.843261 0.110171 0) (0.685668 0.141571 0) (1.12774 0.103265 0) (0.977959 0.0977442 0) (1.41819 0.0353301 0) (1.22464 0.0126135 0) (1.6238 -0.0358874 0) (1.39199 -0.00600359 0) (1.7478 0.0325995 0) (1.54093 0.175397 0) (1.93666 0.31853 0) (1.79627 0.542699 0) (2.2926 0.715925 0) (2.1332 0.921956 0) (2.74792 1.01735 0) (2.47732 1.08795 0) (3.30755 1.00319 0) (2.93643 0.869719 0) (3.96226 0.544 0) (3.53311 0.192209 0) (4.62393 -0.299439 0) (4.16054 -0.741983 0) (5.13878 -1.28808 0) (4.71262 -1.65015 0) (5.48815 -1.9798 0) (5.12109 -2.05974 0) (5.47267 -2.14574 0) (5.07502 -2.08209 0) (4.8823 -2.12596 0) (4.44692 -1.99223 0) (3.92291 -1.78669 0) (3.96599 -1.2304 0) (3.55487 -0.758505 0) (4.02297 -0.0136642 0) (3.83955 0.585585 0) (4.60339 1.42161 0) (4.54758 1.88857 0) (4.73131 2.58058 0) (4.84049 3.02214 0) (4.16155 3.66457 0) (4.97361 3.98817 0) (3.6838 4.03737 0) (5.35949 3.59414 0) (3.86864 2.90878 0) (5.65938 1.93429 0) (4.20308 0.930118 0) (5.94936 -0.200731 0) (4.77218 -1.14366 0) (6.4576 -2.01833 0) (5.36444 -2.68623 0) (6.68244 -3.35856 0) (5.61618 -3.8475 0) (6.64442 -4.15272 0) (5.9603 -4.18623 0) (6.30999 -4.085 0) (5.86691 -3.59664 0) (6.21964 -2.7724 0) (6.06926 -1.98055 0) (6.00376 -1.38928 0) (5.54189 -0.903546 0) (5.60732 -0.358936 0) (5.30492 0.176476 0) (5.58102 0.726313 0) (5.4629 1.30521 0) (5.91287 1.79219 0) (5.80334 2.17215 0) (6.13133 2.34815 0) (5.86277 2.37761 0) (6.18404 2.12842 0) (5.68357 1.83172 0) (5.81588 1.5905 0) (4.78672 1.76785 0) (4.85424 2.05337 0) (3.60944 2.42787 0) (4.15703 2.46434 0) (2.86143 2.32203 0) (4.04781 1.76579 0) (2.74571 1.15546 0) (4.23946 0.314174 0) (2.9975 -0.398695 0) (4.67553 -1.16523 0) (3.52042 -1.66416 0) (5.10566 -2.17176 0) (4.14517 -2.27868 0) (5.45241 -2.39747 0) (4.67018 -2.20574 0) (5.5889 -2.093 0) (4.75896 -1.83831 0) (5.12563 -1.70604 0) (4.53532 -1.28427 0) (4.86798 -0.865802 0) (4.66267 -0.304368 0) (4.87035 -0.0127836 0) (4.58216 0.50695 0) (4.84642 0.837873 0) (4.7323 1.42071 0) (5.1952 1.64259 0) (4.85701 2.17005 0) (5.65982 2.20095 0) (4.80122 2.53639 0) (6.2734 2.43747 0) (4.56947 2.61454 0) (6.76894 2.38238 0) (4.38222 2.40779 0) (7.0108 2.1041 0) (4.44951 2.12599 0) (7.19514 1.67584 0) (4.79678 1.55669 0) (7.41701 0.94251 0) (5.35928 0.787439 0) (8.03197 0.238963 0) (6.11462 -0.0321856 0) (8.6173 -0.764961 0) (6.80607 -0.999955 0) (9.28258 -1.62963 0) (7.47015 -1.92057 0) (9.81785 -2.67668 0) (8.05859 -3.09876 0) (10.1437 -3.83799 0) (8.58448 -4.19066 0) (10.3327 -4.73623 0) (9.03481 -4.7528 0) (10.155 -4.79972 0) (9.2044 -4.50546 0) (9.69657 -4.32163 0) (9.05709 -3.94283 0) (9.17501 -3.67298 0) (8.78023 -3.2985 0) (8.66806 -3.06006 0) (8.33537 -2.82482 0) (8.02267 -2.66399 0) (7.98035 -2.38322 0) (7.72569 -1.98342 0) (7.70321 -1.6295 0) (7.42861 -1.45821 0) (7.04796 -1.47674 0) (6.20567 -1.41716 0) (5.4581 -1.35346 0) (4.71077 -1.27009 0) (3.62887 -1.36909 0) (2.72859 -1.21134 0) (1.8876 -0.840389 0) (1.35776 -0.0348641 0) (1.24959 0.677736 0) (0.743355 1.69313 0) (1.22075 2.34786 0) (0.708739 3.4282 0) (1.53769 4.10848 0) (0.985161 4.94255 0) (2.26787 5.69667 0) (1.80506 5.65757 0) (2.21632 6.22136 0) (3.05516 5.93277 0) (2.43166 5.45649 0) (3.76269 5.19927 0) (2.9263 4.99163 0) (4.38788 4.35954 0) (3.85075 4.13934 0) (4.47807 3.35178 0) (4.45632 3.31538 0) (4.88546 2.5932 0) (4.52106 2.68201 0) (5.3794 1.62382 0) (4.76417 1.68574 0) (5.98459 0.326773 0) (5.69938 0.423305 0) (6.78769 -0.861612 0) (6.69207 -0.570045 0) (7.4116 -1.50573 0) (7.28673 -0.984293 0) (7.68743 -1.80829 0) (7.60578 -1.32867 0) (7.80742 -2.03672 0) (7.80974 -1.70347 0) (8.06987 -2.2987 0) (8.14837 -2.10505 0) (8.41355 -2.61419 0) (8.72444 -2.51684 0) (9.08427 -2.98565 0) (9.50998 -3.04429 0) (9.88495 -3.25914 0) (10.3641 -3.37675 0) (10.6457 -3.31888 0) (11.0846 -3.31087 0) (11.1518 -2.90478 0) (11.4212 -2.68532 0) (11.3148 -2.05166 0) (11.424 -1.56421 0) (11.0593 -0.791359 0) (11.0654 -0.0581555 0) (10.3151 0.715668 0) (10.1983 1.94523 0) (8.82717 2.45509 0) (8.17927 4.34188 0) (6.7333 5.64638 0) (0.802394 7.76134 0) (9.69153 2.01379 0) (-4.29172 0.146697 0) (1.39537 0.0277122 0) (-3.22846 0.183033 0) (-2.62451 0.148737 0) (-3.57903 -0.115052 0) (-1.57681 -0.118829 0) (-0.638777 -0.112505 0) (0.813067 -0.0933469 0) (1.47173 -0.0171206 0) (1.73122 0.0043276 0) (1.862 -0.00371824 0) (1.95112 -0.00317214 0) (1.90462 0.0117342 0) (1.84822 0.00303563 0) (1.81381 -0.00445199 0) (1.80074 0.00533688 0) (1.74813 0.00103405 0) (1.6895 0.00841868 0) (1.67196 0.00598661 0) (14.5811 2.49938 0) (-2.2546 1.18958 0) (2.11076 -0.0204544 0) (-4.00575 0.605441 0) (-1.04424 0.172023 0) (-2.47876 -0.326726 0) (0.228308 -0.597803 0) (1.40083 -0.512778 0) (2.9902 -0.442927 0) (3.93118 -0.173618 0) (4.43808 -0.0694445 0) (4.70904 -0.0565841 0) (4.87229 -0.020438 0) (4.81774 0.042074 0) (4.81194 0.0184328 0) (4.69054 -0.00169123 0) (4.67676 0.0271125 0) (4.60164 0.0154741 0) (4.46513 0.0197968 0) (4.53108 0.00828183 0) (17.5193 4.55044 0) (1.77192 2.4837 0) (3.39293 0.504873 0) (-2.2628 0.821563 0) (1.13902 -0.0670239 0) (0.432916 -0.535369 0) (2.75082 -1.00341 0) (4.11979 -0.891179 0) (5.31095 -0.752723 0) (6.20244 -0.337274 0) (6.79142 -0.162464 0) (7.07436 -0.121945 0) (7.26053 -0.046284 0) (7.19753 0.0598928 0) (7.28216 0.0307595 0) (7.09812 0.0109597 0) (7.06123 0.0454355 0) (7.03792 0.0387146 0) (6.80326 0.0339129 0) (6.89402 -0.000607038 0) (19.3778 6.06593 0) (5.96367 3.84927 0) (5.82131 1.19807 0) (0.718091 1.02012 0) (3.50427 -0.411508 0) (3.74412 -0.881747 0) (5.51638 -1.3744 0) (6.98997 -1.26443 0) (7.79673 -1.00843 0) (8.4409 -0.492696 0) (8.97763 -0.263332 0) (9.18905 -0.186203 0) (9.35822 -0.0683255 0) (9.2847 0.0742294 0) (9.42375 0.0331362 0) (9.25553 0.031775 0) (9.15633 0.060985 0) (9.20508 0.0605779 0) (8.93421 0.0666412 0) (8.94882 -0.00244171 0) (20.4938 7.05752 0) (9.72629 5.12185 0) (8.65402 2.04482 0) (4.40948 1.22522 0) (6.27218 -0.590538 0) (7.09774 -1.2566 0) (8.29903 -1.67403 0) (9.50227 -1.60744 0) (10.0238 -1.20486 0) (10.5069 -0.58562 0) (10.8855 -0.343747 0) (10.9649 -0.246309 0) (11.0594 -0.0945134 0) (11.0329 0.0896576 0) (11.194 0.0317172 0) (11.0801 0.0570715 0) (10.9731 0.0860953 0) (11.0583 0.0732117 0) (10.8506 0.111304 0) (10.7459 0.0122679 0) (20.9957 7.66307 0) (12.8417 6.19705 0) (11.3157 2.88345 0) (8.13061 1.44412 0) (9.23473 -0.682348 0) (10.1317 -1.59743 0) (10.8851 -1.85466 0) (11.4612 -1.82094 0) (11.5006 -1.36989 0) (12.0362 -0.646832 0) (12.3045 -0.366903 0) (12.2181 -0.257234 0) (12.1511 -0.115741 0) (12.2035 0.0858011 0) (12.3944 0.00640059 0) (12.3338 0.0602274 0) (12.3076 0.102452 0) (12.4462 0.0689003 0) (12.4361 0.163693 0) (12.2642 0.0470179 0) (20.9316 7.91604 0) (15.2425 6.99591 0) (13.5504 3.62757 0) (11.3462 1.64748 0) (12.1036 -0.707298 0) (12.6223 -1.83984 0) (12.7982 -1.93034 0) (12.8105 -1.83114 0) (12.2264 -1.42089 0) (12.7043 -0.705085 0) (12.9848 -0.372812 0) (12.893 -0.216242 0) (12.6368 -0.117276 0) (12.8037 0.0829952 0) (13.0111 -0.013671 0) (12.8827 0.0499438 0) (12.914 0.0959596 0) (13.0471 0.00651767 0) (13.3034 0.167338 0) (13.2942 0.0794216 0) (20.2719 7.8011 0) (16.8624 7.4871 0) (15.2653 4.2203 0) (13.8567 1.80892 0) (14.5051 -0.684267 0) (14.428 -1.90986 0) (13.8252 -1.89122 0) (13.5306 -1.72744 0) (12.7392 -1.36946 0) (12.9583 -0.727289 0) (13.1082 -0.386324 0) (13.2337 -0.163044 0) (12.8874 -0.114314 0) (13.164 0.0467857 0) (13.4119 -0.0262375 0) (13.1344 0.0550417 0) (13.1397 0.102865 0) (13.22 -0.061251 0) (13.457 0.107243 0) (13.6473 0.0700286 0) (18.951 7.36947 0) (17.6911 7.66727 0) (16.3718 4.6298 0) (15.6922 1.94853 0) (16.0701 -0.603685 0) (15.4027 -1.80408 0) (14.3259 -1.73419 0) (13.819 -1.61535 0) (13.237 -1.31194 0) (13.2754 -0.710402 0) (13.1322 -0.417279 0) (13.418 -0.159116 0) (13.1017 -0.129906 0) (13.497 0.00381099 0) (13.6211 -0.00989144 0) (13.3115 0.0864096 0) (13.3726 0.110303 0) (13.4417 -0.0983624 0) (13.4874 0.0590636 0) (13.694 0.0465022 0) (17.2319 6.6652 0) (17.6773 7.51769 0) (16.8207 4.80845 0) (16.85 2.04359 0) (16.7442 -0.45129 0) (15.6458 -1.61155 0) (14.6153 -1.53909 0) (14.0351 -1.52276 0) (13.6618 -1.27357 0) (13.5367 -0.641286 0) (13.135 -0.408888 0) (13.459 -0.153917 0) (13.2527 -0.16553 0) (13.6932 -0.0382129 0) (13.5517 0.0113472 0) (13.466 0.0828103 0) (13.7678 0.105106 0) (13.7716 -0.104516 0) (13.5651 0.0439585 0) (13.7815 0.0305341 0) (15.4409 5.91258 0) (16.8576 7.14053 0) (16.7188 4.72397 0) (17.1736 2.08555 0) (16.7549 -0.201859 0) (15.6226 -1.3722 0) (14.7561 -1.37755 0) (14.2461 -1.44959 0) (13.9671 -1.22728 0) (13.6531 -0.544236 0) (13.2031 -0.394144 0) (13.5302 -0.187525 0) (13.4988 -0.218811 0) (13.7661 -0.0267688 0) (13.3305 0.0431813 0) (13.576 0.00672784 0) (14.1629 0.0695018 0) (14.0837 -0.0576049 0) (13.7623 0.0576128 0) (14.0313 0.00414365 0) (13.7743 5.28301 0) (15.4195 6.53987 0) (16.0359 4.48965 0) (16.657 2.16181 0) (16.3562 0.0567981 0) (15.5763 -1.14881 0) (14.8677 -1.24648 0) (14.4434 -1.39649 0) (14.0956 -1.15767 0) (13.6373 -0.429092 0) (13.314 -0.365098 0) (13.6284 -0.218887 0) (13.7312 -0.25385 0) (13.7361 0.0331751 0) (13.3315 0.0502945 0) (13.7907 -0.149452 0) (14.3004 -0.00422518 0) (14.0349 -0.0187293 0) (13.8788 0.0554922 0) (14.2287 -0.029923 0) (12.2061 4.78365 0) (13.5208 5.93278 0) (14.88 4.30019 0) (15.637 2.23608 0) (15.8273 0.211523 0) (15.4548 -0.993955 0) (14.9022 -1.1372 0) (14.5336 -1.32389 0) (13.9648 -1.05464 0) (13.5773 -0.334576 0) (13.4121 -0.364626 0) (13.7199 -0.288222 0) (13.7314 -0.265001 0) (13.5068 0.0916734 0) (13.5432 0.0185374 0) (13.8542 -0.239431 0) (14 0.0190206 0) (13.5907 0.0468645 0) (13.7895 0.00966149 0) (14.1481 -0.0844431 0) (10.5043 4.35208 0) (11.6333 5.36665 0) (13.4074 4.03021 0) (14.5424 2.16348 0) (15.3585 0.242917 0) (15.1427 -0.886099 0) (14.7286 -1.06726 0) (14.4206 -1.23828 0) (13.7133 -0.949754 0) (13.5326 -0.30133 0) (13.3224 -0.366544 0) (13.4764 -0.300695 0) (13.3194 -0.214376 0) (13.2065 0.0815727 0) (13.4879 -0.0455528 0) (13.3623 -0.235714 0) (13.3642 0.0586823 0) (13.0976 0.0418788 0) (13.5284 -0.0765826 0) (13.6077 -0.124333 0) (8.40439 3.93935 0) (9.78487 4.75294 0) (11.7545 3.62019 0) (13.6333 1.91124 0) (14.7741 0.196203 0) (14.6523 -0.79457 0) (14.4416 -1.01486 0) (14.0684 -1.13644 0) (13.2619 -0.842744 0) (13.1823 -0.273578 0) (12.7767 -0.316431 0) (12.8486 -0.290157 0) (12.6569 -0.197269 0) (12.6019 0.0392535 0) (12.7155 -0.0418637 0) (12.2981 -0.162123 0) (12.4348 0.0581837 0) (12.3057 0.00493767 0) (12.6242 -0.105569 0) (12.4364 -0.113297 0) (5.84687 3.343 0) (7.76467 4.01555 0) (10.28 3.02652 0) (12.7585 1.52847 0) (13.9513 0.117641 0) (14.0609 -0.758003 0) (13.9611 -0.986011 0) (13.3219 -0.994469 0) (12.4061 -0.710004 0) (12.2946 -0.239905 0) (11.7317 -0.254478 0) (11.6979 -0.256259 0) (11.3457 -0.14395 0) (11.2494 0.0504276 0) (11.2172 0.000670756 0) (10.8352 -0.107557 0) (11.1191 0.020227 0) (10.9297 -0.0129235 0) (11.0803 -0.0845186 0) (10.8134 -0.0818569 0) (3.24158 2.67846 0) (5.88451 3.18773 0) (9.01484 2.33076 0) (11.6654 1.11874 0) (13.0604 -0.00356886 0) (13.3309 -0.737304 0) (12.9318 -0.883142 0) (11.889 -0.784495 0) (10.8489 -0.542068 0) (10.559 -0.172482 0) (9.9025 -0.154462 0) (9.76179 -0.167747 0) (9.35804 -0.0707798 0) (9.33802 0.0612646 0) (9.27826 0.0290862 0) (9.04299 -0.0769793 0) (9.2725 0.00232433 0) (9.00882 0.00468719 0) (9.12446 -0.0537352 0) (8.88486 -0.0533001 0) (0.953865 1.8664 0) (4.23181 2.23767 0) (7.7542 1.54044 0) (10.5938 0.619248 0) (12.0001 -0.190611 0) (11.8132 -0.670079 0) (10.7872 -0.67565 0) (9.41293 -0.508505 0) (8.33456 -0.32014 0) (7.95237 -0.0617767 0) (7.42243 -0.0495805 0) (7.27939 -0.0827428 0) (6.966 -0.0233627 0) (7.03354 0.0558692 0) (6.99918 0.0393165 0) (6.89277 -0.0504351 0) (7.00087 0.00484415 0) (6.80007 0.0153448 0) (6.91401 -0.0345931 0) (6.71607 -0.0288255 0) (-0.843903 1.15527 0) (3.01427 1.23167 0) (6.58279 0.694948 0) (8.91377 0.14212 0) (9.45817 -0.257469 0) (8.55968 -0.424916 0) (7.22651 -0.340008 0) (5.96193 -0.20618 0) (5.12606 -0.11957 0) (4.85247 0.00989757 0) (4.60466 0.0100463 0) (4.53233 -0.0281154 0) (4.36186 -0.00231789 0) (4.46996 0.0380357 0) (4.49555 0.0322394 0) (4.46503 -0.0271069 0) (4.48764 0.00666957 0) (4.4081 0.0150519 0) (4.47831 -0.0180407 0) (4.3437 -0.00936066 0) (-1.80453 0.174356 0) (1.34851 0.115614 0) (3.50317 -0.00657006 0) (4.35801 -0.0456079 0) (4.2006 -0.0587925 0) (3.39638 -0.0536675 0) (2.55271 -0.0179644 0) (1.94065 -0.00167617 0) (1.57711 -0.00663876 0) (1.51118 0.018506 0) (1.54223 0.0144266 0) (1.54981 -0.00365082 0) (1.49555 -0.000653872 0) (1.57142 0.0105417 0) (1.65064 0.0118006 0) (1.65791 -0.00740784 0) (1.64481 0.00355081 0) (1.65712 0.00590297 0) (1.67882 -0.00357139 0) (1.6292 0.00079596 0) ) ; boundaryField { inlet { type fixedValue; value uniform (10 0 0); } outlet { type zeroGradient; } walls { type fixedValue; value uniform (0 0 0); } frontAndBack { type empty; } } // ************************************************************************* //
5396750e7c2045316ee249dcb1ab6995bb7233c8
5ebedbaf45a0e0702288010c6d6377e0f9254879
/PutGamma.cpp
1b8229792e1612aa7eba1f617716400e23cc6cf5
[]
no_license
AmanMander123/RatioProtectivePut
a9f860352170428394685eb79aa5b707daff5342
c39b88bcc6d7fc9622abf06f6d69ec98c4c03b9a
refs/heads/master
2022-02-20T12:14:17.918979
2021-02-10T23:33:41
2021-02-10T23:33:41
25,649,120
5
4
null
null
null
null
UTF-8
C++
false
false
353
cpp
// // PutGamma.cpp // RatioProtectivePut // // Created by Aman on 2014-10-23. // Copyright (c) 2014 Aman. All rights reserved. // #include "PutGamma.h" //Calculate Euro vanilla Put Gamma double put_gamma (const double S, const double K, const double r, const double v, const double T) { return norm_pdf(d_j(1, S, K, r, v, T))/(S*v*sqrt(T)); }
8856f56cc5303ae9c96b18ff3c98282d4a7bcdf2
c50d61136efbd74c97d939468542e40e0fbb79e1
/core/src/time/timestep.h
c613e6c64b8917a433e0fa7fdc20689c6786dc27
[]
no_license
Ajblast/GameEngine
e95836d631fa2e2057ab9a5219ceb57fcbf5b23f
db2473add049125f7e2c21965a3957e4f3d74ffc
refs/heads/main
2023-09-01T17:31:20.655818
2021-10-17T13:03:45
2021-10-17T13:03:45
327,814,676
0
0
null
null
null
null
UTF-8
C++
false
false
595
h
#pragma once #include "common.h" #include "durations.h" namespace GRAVEngine { namespace Time { // Simple representation of a step in time class GRAVAPI timestep { public: // Clock start and stop points timestep(timePoint startTick, timePoint endTick); // The amount of time in nanoseconds timestep(timeDurationCount time); // The amount of time in seconds timestep(float time = 0.0f); operator float() const; double getSeconds() const; double getMilliseconds() const; private: // The elapsed duration in nanoseconds nanoseconds m_Time; }; } }
067e3084f3d18a59dd2adc2ff79e9e2d7ff9047b
a1091ad42e6a07b6fbb6fe876feb03547a8da1eb
/MITK-superbuild/ep/include/ITK-4.7/itkLaplacianDeformationQuadEdgeMeshFilterWithHardConstraints.h
273adaea43ca774d5a12e7f2bd702a330a899ccd
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
Sotatek-TuyenLuu/DP2
bc61866fe5d388dd11209f4d02744df073ec114f
a48dd0a41c788981009c5ddd034b0e21644c8077
refs/heads/master
2020-03-10T04:59:52.461184
2018-04-12T07:19:27
2018-04-12T07:19:27
129,206,578
1
0
null
null
null
null
UTF-8
C++
false
false
4,749
h
/*========================================================================= * * Copyright Insight Software Consortium * * 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.txt * * 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 __itkLaplacianDeformationQuadEdgeMeshFilterWithHardConstraints_h #define __itkLaplacianDeformationQuadEdgeMeshFilterWithHardConstraints_h #include "itkLaplacianDeformationQuadEdgeMeshFilter.h" namespace itk { /** * \class LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints * * \brief Laplacian mesh deformation with hard constraints (interpolating * displacement for some handle points) * * Laplacian mesh deformation offers the ability to deform 3D surface mesh * while preserving local details. * * In this context output mesh vertices are exactly constrained to provided output locations. * * For details, see http://hdl.handle.net/10380/3410 * * \ingroup ITKQuadEdgeMeshFiltering */ template< class TInputMesh, class TOutputMesh, class TSolverTraits > class LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints: public LaplacianDeformationQuadEdgeMeshFilter< TInputMesh, TOutputMesh, TSolverTraits > { public: /** Basic types. */ typedef LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints Self; typedef LaplacianDeformationQuadEdgeMeshFilter< TInputMesh, TOutputMesh, TSolverTraits > Superclass; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; /** Input types. */ typedef TInputMesh InputMeshType; itkStaticConstMacro(InputPointDimension, unsigned int, InputMeshType::PointDimension); /** Output types. */ typedef TOutputMesh OutputMeshType; typedef typename Superclass::OutputPointType OutputPointType; typedef typename Superclass::OutputCoordRepType OutputCoordRepType; typedef typename Superclass::OutputPointIdentifier OutputPointIdentifier; itkStaticConstMacro(OutputPointDimension, unsigned int, OutputMeshType::PointDimension); typedef TSolverTraits SolverTraits; typedef typename Superclass::ValueType ValueType; typedef typename Superclass::MatrixType MatrixType; typedef typename Superclass::VectorType VectorType; itkNewMacro(Self); itkTypeMacro(LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints, LaplacianDeformationQuadEdgeMeshFilter); protected: LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints(); virtual ~LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints() {} void PrintSelf(std::ostream & os, Indent indent) const; typedef typename Superclass::OutputMapPointIdentifier OutputMapPointIdentifier; typedef typename Superclass::OutputMapPointIdentifierIterator OutputMapPointIdentifierIterator; typedef typename Superclass::OutputMapPointIdentifierConstIterator OutputMapPointIdentifierConstIterator; typedef typename Superclass::ConstraintMapType ConstraintMapType; typedef typename Superclass::ConstraintMapConstIterator ConstraintMapConstIterator; typedef typename Superclass::RowType RowType; typedef typename Superclass::RowConstIterator RowConstIterator; typedef typename Superclass::RowIterator RowIterator; virtual void ComputeVertexIdMapping(); /** * \brief Fill matrix iM and vectors Bx and m_By depending on if one * vertex is on the border or not. */ void FillMatrix(MatrixType & iM, VectorType & iBx, VectorType & iBy, VectorType & iBz); virtual void GenerateData() ITK_OVERRIDE; private: LaplacianDeformationQuadEdgeMeshFilterWithHardConstraints(const Self &); // purposely not // implemented void operator=(const Self &); // purposely not // implemented }; } // end namespace itk #include "itkLaplacianDeformationQuadEdgeMeshFilterWithHardConstraints.hxx" #endif
3855744d23cf5c66ce351f30e0ae3aa5d91da9c5
8f08cf24ddc4b2ce3e091d8c1d1f013ccadba0ac
/BaseDataMag/CBase_Material_Base_Infor.cpp
b2ab64f9d4fe39c306584118d84d2b7fc2b95d21
[]
no_license
rcw0125/lgLogic
42cf0a67b367d0a2ab86260639aface6cb847680
47a11962ab0132420231ca88157db862203f5cdc
refs/heads/master
2020-03-10T05:12:29.589505
2018-04-12T07:31:13
2018-04-12T07:31:13
129,211,942
0
2
null
null
null
null
GB18030
C++
false
false
966
cpp
// 逻辑类CBase_Material_Base_Infor的用户逻辑程序源文件 // 用户系统的逻辑程序应放在本文件中实现,逻辑函数的定义应放在_CBase_Material_Base_Infor.h中。 // 由于本文件中定义的函数均为L3集成开发环境自动生成,且在_CBase_Material_Base_Infor.h和 // 中插入了相关的代码,因此请不要删除或修改本文件中的函数定义。用户系统程序员应当只修改函数的具体 // 实现代码。如要添加、删除或修改逻辑函数的定义,请使用集成开发环境完成。 #include "StdAfx.h" #include "_CBase_Material_Base_Infor.h" //当对象被装载到系统中时,被调用 void CBase_Material_Base_Infor::OnLoaded() { __super::OnLoaded(); // TODO: 在此处添加对象装载时的处理代码 } //当对象被卸载时,被调用 void CBase_Material_Base_Infor::OnUnloaded() { __super::OnUnloaded(); // TODO: 在此处添加对象卸载时的处理代码 }
7b451c691142c917f2bbb508eba584283d20aa2c
a170461845f5b240daf2090810b4be706191f837
/cpp/QT5.12Samp2019/chap06Forms/samp6_4MDI/ui_qwmainwindow.h
20b6af5dff4a7b641aec08a695964e6c3fa013ad
[]
no_license
longhuarst/QTDemo
ec3873f85434c61cd2a8af7e568570d62c2e6da8
34f87f4b2337a140122b7c38937ab4fcf5f10575
refs/heads/master
2022-04-25T10:59:54.434587
2020-04-26T16:55:29
2020-04-26T16:55:29
259,048,398
1
1
null
null
null
null
UTF-8
C++
false
false
9,827
h
/******************************************************************************** ** Form generated from reading UI file 'qwmainwindow.ui' ** ** Created by: Qt User Interface Compiler version 5.9.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_QWMAINWINDOW_H #define UI_QWMAINWINDOW_H #include <QtCore/QVariant> #include <QtWidgets/QAction> #include <QtWidgets/QApplication> #include <QtWidgets/QButtonGroup> #include <QtWidgets/QHeaderView> #include <QtWidgets/QMainWindow> #include <QtWidgets/QMdiArea> #include <QtWidgets/QStatusBar> #include <QtWidgets/QToolBar> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_QWMainWindow { public: QAction *actDoc_New; QAction *actQuit; QAction *actDoc_Open; QAction *actFont; QAction *actCut; QAction *actCopy; QAction *actPaste; QAction *actViewMode; QAction *actCascade; QAction *actTile; QAction *actCloseALL; QWidget *centralWidget; QMdiArea *mdiArea; QToolBar *mainToolBar; QStatusBar *statusBar; void setupUi(QMainWindow *QWMainWindow) { if (QWMainWindow->objectName().isEmpty()) QWMainWindow->setObjectName(QStringLiteral("QWMainWindow")); QWMainWindow->resize(388, 249); actDoc_New = new QAction(QWMainWindow); actDoc_New->setObjectName(QStringLiteral("actDoc_New")); QIcon icon; icon.addFile(QStringLiteral(":/images/images/100.bmp"), QSize(), QIcon::Normal, QIcon::Off); actDoc_New->setIcon(icon); actQuit = new QAction(QWMainWindow); actQuit->setObjectName(QStringLiteral("actQuit")); QIcon icon1; icon1.addFile(QStringLiteral(":/images/images/132.bmp"), QSize(), QIcon::Normal, QIcon::Off); actQuit->setIcon(icon1); actDoc_Open = new QAction(QWMainWindow); actDoc_Open->setObjectName(QStringLiteral("actDoc_Open")); QIcon icon2; icon2.addFile(QStringLiteral(":/images/images/122.bmp"), QSize(), QIcon::Normal, QIcon::Off); actDoc_Open->setIcon(icon2); actFont = new QAction(QWMainWindow); actFont->setObjectName(QStringLiteral("actFont")); actFont->setEnabled(false); QIcon icon3; icon3.addFile(QStringLiteral(":/images/images/506.bmp"), QSize(), QIcon::Normal, QIcon::Off); actFont->setIcon(icon3); actCut = new QAction(QWMainWindow); actCut->setObjectName(QStringLiteral("actCut")); actCut->setEnabled(false); QIcon icon4; icon4.addFile(QStringLiteral(":/images/images/200.bmp"), QSize(), QIcon::Normal, QIcon::Off); actCut->setIcon(icon4); actCopy = new QAction(QWMainWindow); actCopy->setObjectName(QStringLiteral("actCopy")); actCopy->setEnabled(false); QIcon icon5; icon5.addFile(QStringLiteral(":/images/images/202.bmp"), QSize(), QIcon::Normal, QIcon::Off); actCopy->setIcon(icon5); actPaste = new QAction(QWMainWindow); actPaste->setObjectName(QStringLiteral("actPaste")); actPaste->setEnabled(false); QIcon icon6; icon6.addFile(QStringLiteral(":/images/images/204.bmp"), QSize(), QIcon::Normal, QIcon::Off); actPaste->setIcon(icon6); actViewMode = new QAction(QWMainWindow); actViewMode->setObjectName(QStringLiteral("actViewMode")); actViewMode->setCheckable(true); QIcon icon7; icon7.addFile(QStringLiteral(":/images/images/230.bmp"), QSize(), QIcon::Normal, QIcon::Off); actViewMode->setIcon(icon7); actCascade = new QAction(QWMainWindow); actCascade->setObjectName(QStringLiteral("actCascade")); QIcon icon8; icon8.addFile(QStringLiteral(":/images/images/400.bmp"), QSize(), QIcon::Normal, QIcon::Off); actCascade->setIcon(icon8); actTile = new QAction(QWMainWindow); actTile->setObjectName(QStringLiteral("actTile")); QIcon icon9; icon9.addFile(QStringLiteral(":/images/images/406.bmp"), QSize(), QIcon::Normal, QIcon::Off); actTile->setIcon(icon9); actCloseALL = new QAction(QWMainWindow); actCloseALL->setObjectName(QStringLiteral("actCloseALL")); QIcon icon10; icon10.addFile(QStringLiteral(":/images/images/128.bmp"), QSize(), QIcon::Normal, QIcon::Off); actCloseALL->setIcon(icon10); centralWidget = new QWidget(QWMainWindow); centralWidget->setObjectName(QStringLiteral("centralWidget")); mdiArea = new QMdiArea(centralWidget); mdiArea->setObjectName(QStringLiteral("mdiArea")); mdiArea->setGeometry(QRect(45, 10, 291, 176)); QWMainWindow->setCentralWidget(centralWidget); mainToolBar = new QToolBar(QWMainWindow); mainToolBar->setObjectName(QStringLiteral("mainToolBar")); mainToolBar->setAutoFillBackground(true); mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); QWMainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar); statusBar = new QStatusBar(QWMainWindow); statusBar->setObjectName(QStringLiteral("statusBar")); QWMainWindow->setStatusBar(statusBar); mainToolBar->addAction(actDoc_New); mainToolBar->addAction(actDoc_Open); mainToolBar->addAction(actCloseALL); mainToolBar->addSeparator(); mainToolBar->addAction(actCut); mainToolBar->addAction(actCopy); mainToolBar->addAction(actPaste); mainToolBar->addAction(actFont); mainToolBar->addSeparator(); mainToolBar->addAction(actViewMode); mainToolBar->addAction(actCascade); mainToolBar->addAction(actTile); mainToolBar->addSeparator(); mainToolBar->addAction(actQuit); retranslateUi(QWMainWindow); QObject::connect(actQuit, SIGNAL(triggered()), QWMainWindow, SLOT(close())); QMetaObject::connectSlotsByName(QWMainWindow); } // setupUi void retranslateUi(QMainWindow *QWMainWindow) { QWMainWindow->setWindowTitle(QApplication::translate("QWMainWindow", "MDI\345\272\224\347\224\250\347\250\213\345\272\217", Q_NULLPTR)); actDoc_New->setText(QApplication::translate("QWMainWindow", "\346\226\260\345\273\272\346\226\207\346\241\243", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actDoc_New->setToolTip(QApplication::translate("QWMainWindow", "\346\226\260\345\273\272\346\226\207\346\241\243\347\252\227\345\217\243", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actQuit->setText(QApplication::translate("QWMainWindow", "\351\200\200\345\207\272", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actQuit->setToolTip(QApplication::translate("QWMainWindow", "\351\200\200\345\207\272\346\234\254\347\263\273\347\273\237", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actDoc_Open->setText(QApplication::translate("QWMainWindow", "\346\211\223\345\274\200\346\226\207\346\241\243", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actDoc_Open->setToolTip(QApplication::translate("QWMainWindow", "\346\211\223\345\274\200\346\226\207\346\241\243", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actFont->setText(QApplication::translate("QWMainWindow", "\345\255\227\344\275\223\350\256\276\347\275\256", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actFont->setToolTip(QApplication::translate("QWMainWindow", "\345\255\227\344\275\223\350\256\276\347\275\256", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actCut->setText(QApplication::translate("QWMainWindow", "\345\211\252\345\210\207", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actCut->setToolTip(QApplication::translate("QWMainWindow", "\345\211\252\345\210\207", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actCopy->setText(QApplication::translate("QWMainWindow", "\345\244\215\345\210\266", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actCopy->setToolTip(QApplication::translate("QWMainWindow", "\345\244\215\345\210\266", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actPaste->setText(QApplication::translate("QWMainWindow", "\347\262\230\350\264\264", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actPaste->setToolTip(QApplication::translate("QWMainWindow", "\347\262\230\350\264\264", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actViewMode->setText(QApplication::translate("QWMainWindow", "MDI\346\250\241\345\274\217", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actViewMode->setToolTip(QApplication::translate("QWMainWindow", "\347\252\227\345\217\243\346\250\241\345\274\217\346\210\226\351\241\265\351\235\242\346\250\241\345\274\217", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actCascade->setText(QApplication::translate("QWMainWindow", "\347\272\247\350\201\224\345\261\225\345\274\200", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actCascade->setToolTip(QApplication::translate("QWMainWindow", "\347\252\227\345\217\243\347\272\247\350\201\224\345\261\225\345\274\200", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actTile->setText(QApplication::translate("QWMainWindow", "\345\271\263\351\223\272\345\261\225\345\274\200", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actTile->setToolTip(QApplication::translate("QWMainWindow", "\347\252\227\345\217\243\345\271\263\351\223\272\345\261\225\345\274\200", Q_NULLPTR)); #endif // QT_NO_TOOLTIP actCloseALL->setText(QApplication::translate("QWMainWindow", "\345\205\263\351\227\255\345\205\250\351\203\250", Q_NULLPTR)); #ifndef QT_NO_TOOLTIP actCloseALL->setToolTip(QApplication::translate("QWMainWindow", "\345\205\263\351\227\255\346\211\200\346\234\211\347\252\227\345\217\243", Q_NULLPTR)); #endif // QT_NO_TOOLTIP } // retranslateUi }; namespace Ui { class QWMainWindow: public Ui_QWMainWindow {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_QWMAINWINDOW_H
7811d3503ee62063bbf31360c0b6972cfbc8bc11
acff1e354047becf999e10154bac01dbf210cd4c
/Chapter-11-Associative-Container/ex11.38-wordCount.cpp
2d884e865af9676e3e7dcfa6cde63c9d0875a8e3
[]
no_license
middleprince/CPP-Primer
e1f6440a6aa4c11d9f3b3b0b88579d2294d2ef53
345d99a4b3f41aab24598edc61a01b6f09f0ab61
refs/heads/master
2021-06-25T00:28:01.014655
2021-01-18T13:27:38
2021-01-18T13:27:38
189,856,807
0
0
null
null
null
null
UTF-8
C++
false
false
792
cpp
#include <map> #include <iostream> #include <string> #include <unordered_map> #include <set> using namespace std; void printMap(const multimap<string, string> &map_value) { for (const auto &item : map_value) cout << "Autor is: " << item.first << "| book name: " << item.second << endl; } int main() { unordered_map<string, size_t> words; set<string> excludes{"The", "But", "And", "Or", "A", "An", "The", "but", "and", "or", "an", "a"}; string word; while (cin >> word) { if (excludes.find(word) == excludes.end()) ++words[word]; } for (const auto &item : words) { cout << item.first << " occurs : " << item.second << ((item.second > 1) ? "times" : "time" )<< endl; } return 0; }
3d79064ba95a0aba26cf375890b9ce31c396b601
1b5c69d3d3c8c5dc4de9735b93a4d91ca7642a42
/abc061-080/abc080a.cpp
3f55c4f3025ba2a1e0de34b0ec8acb71bb259e90
[]
no_license
ritsuxis/kyoupro
19059ce166d2c35f643ce52aeb13663c1acece06
ce0a4aa0c18e19e038f29d1db586258970b35b2b
refs/heads/master
2022-12-23T08:25:51.282513
2020-10-02T12:43:16
2020-10-02T12:43:16
232,855,372
0
0
null
null
null
null
UTF-8
C++
false
false
514
cpp
#include<bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n ; i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる using namespace std; typedef long long ll; // long longをllでかけるようにした const int INF = 1e9; int main(void){ int t, a, b; cin >> t >> a >> b; cout << (t * a < b ? t * a : b); }
b1212fd6c59bec95d64928b3a377548affaca2d2
499f9261b0ed4bf0ed8ada397b6d489044edec2f
/x-files/rx-0.ino
81e709da1b976391f3efcc42cf23cdf12f93486f
[]
no_license
MaMeSal19/arduino-projects
c815f23721261d25c8279c8fddd7612d94641489
aad359f5d5317ba54fb800b7bec5048c6c3e85a1
refs/heads/master
2021-05-05T08:14:29.858625
2018-02-12T17:54:44
2018-02-12T17:54:44
118,938,156
0
0
null
null
null
null
UTF-8
C++
false
false
481
ino
int incomingByte = 0; // for incoming serial data void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps } void loop() { // send data only when you receive data: if (Serial.available() > 0) { // read the incoming byte: incomingByte = Serial.read(); // say what you got: Serial.println(" "); Serial.println(incomingByte, DEC); } }
c1c7de53d01063b94a70d76ce0c148d435b8607d
3b822b73a63ae0b4caabc34c8c817ddff418de12
/Array/longestarithematicsubarray.cpp
4ebf5e9d42cff6e6e4b0f6ed99f5ede1f728e1e8
[]
no_license
okpiyush/LearningCPP
7db314a2b68db345bb60cbfd0498b58bcf81717f
ce40b820144470bd36691d03bc1b4c4eeab70b87
refs/heads/master
2023-07-15T16:51:04.801472
2021-08-31T10:06:21
2021-08-31T10:06:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
125
cpp
//an arithematic array is an arra that contains atleast 2 integres and the different between 2 consecutive integers is equal
bc99e556fa070dc455b9227e2368ba1ee325b4b3
4e3a078270c4313a2308677db96edce54a502752
/applications/SolidMechanicsApplication/custom_strategies/time_integration_methods/simo_step_rotation_method.cpp
352bf13d92a7a17e2585f3be6fce49b34341c1ce
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
vchen30/Kratos
560e5f5042bc680ccdbbf6c8d0365b79b5f3b13a
af229369838d765a7c53d4c1a33051be3fb6b72c
refs/heads/master
2020-03-07T08:12:28.945538
2018-03-29T15:27:58
2018-03-29T15:27:58
127,370,895
0
0
null
2018-03-30T02:25:18
2018-03-30T02:25:18
null
UTF-8
C++
false
false
3,261
cpp
// // Project Name: KratosSolidMechanicsApplication $ // Created by: $Author: JMCarbonell $ // Last modified by: $Co-Author: $ // Date: $Date: November 2017 $ // Revision: $Revision: 0.0 $ // // // System includes // External includes // Project includes #include "custom_strategies/time_integration_methods/simo_step_rotation_method.hpp" #include "utilities/beam_math_utilities.hpp" namespace Kratos { // specilization to array_1d template<> void SimoStepRotationMethod<Variable<array_1d<double, 3> >, array_1d<double,3> >::Update(NodeType& rNode) { KRATOS_TRY // predict step variable from previous and current values array_1d<double,3>& CurrentStepVariable = rNode.FastGetSolutionStepValue(*this->mpStepVariable, 0); array_1d<double,3>& CurrentVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 0); array_1d<double,3>& PreviousVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 1); // update delta variable array_1d<double,3> DeltaVariable; noalias(DeltaVariable) = CurrentVariable - PreviousVariable; Quaternion<double> DeltaVariableQuaternion = Quaternion<double>::FromRotationVector(DeltaVariable); // linear delta variable array_1d<double,3> LinearDeltaVariable; noalias(LinearDeltaVariable) = -CurrentStepVariable; // update step variable Quaternion<double> StepVariableQuaternion = Quaternion<double>::FromRotationVector(CurrentStepVariable); StepVariableQuaternion = DeltaVariableQuaternion * StepVariableQuaternion; StepVariableQuaternion.ToRotationVector(CurrentStepVariable); LinearDeltaVariable += CurrentStepVariable; // update variable: Quaternion<double> VariableQuaternion = Quaternion<double>::FromRotationVector(PreviousVariable); VariableQuaternion = DeltaVariableQuaternion * VariableQuaternion; VariableQuaternion.ToRotationVector( CurrentVariable ); // update variable previous iteration instead of previous step PreviousVariable = CurrentVariable; // update linear delta variable: VariableQuaternion = StepVariableQuaternion.conjugate() * VariableQuaternion; LinearDeltaVariable = BeamMathUtils<double>::MapToCurrentLocalFrame( VariableQuaternion, LinearDeltaVariable ); // update first derivative array_1d<double,3>& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0); noalias(CurrentFirstDerivative) += this->mNewmark.c1 * LinearDeltaVariable; // update second derivative array_1d<double,3>& CurrentSecondDerivative = rNode.FastGetSolutionStepValue(*this->mpSecondDerivative, 0); noalias(CurrentSecondDerivative) += this->mNewmark.c0 * LinearDeltaVariable; // std::cout<<*this->mpVariable<<" Update Node["<<rNode.Id()<<"]"<<CurrentVariable<<" "<<CurrentStepVariable<<" "<<CurrentFirstDerivative<<" "<<CurrentSecondDerivative<<std::endl; KRATOS_CATCH( "" ) } } // namespace Kratos.
3112fbfeac4e507ea53f66b8705451618ff5d0db
f00e2f9de7f822cc757c4887532b0da360443e9f
/Judger.cpp
28239ad1ba450bab4df35a138ed9ed11566b3796
[]
no_license
AndersonZhangyq/BlackJack
1e9a3f82903d3f1c919d23f4f8af79cd0009cb1f
e74be26dfc771abc114f7366435ad6be87798495
refs/heads/master
2021-08-24T14:06:02.880715
2017-12-10T04:39:17
2017-12-10T04:39:17
112,824,792
0
0
null
null
null
null
UTF-8
C++
false
false
4,426
cpp
#include "stdafx.h" #include "Judger.h" #include "Printer.h" #include <vector> #include <iostream> using namespace std; void Judger::judgeWinner(Player player, Dealer dealer, int player_id, float times) { if (dealer.isBlackJack()) { cout << "玩家 " << player_id << " 输了!庄家拿到了 BlackJack!" << endl; player.afterJudgeSetBet(Lose, times); return; } if (player.isBlackJack()) { cout << "玩家 " << player_id << " 赢了!BlackJack 最大!" << endl; player.afterJudgeSetBet(Win, times); return; } int p_b = player.getBest(); int d_b = dealer.getBest(); if (p_b > d_b) { cout << "玩家 " << player_id << " 赢了!手牌总和为:" << p_b; player.afterJudgeSetBet(Win, times); } else if (p_b < d_b) { cout << "玩家 " << player_id << " 输了!手牌总和为:" << p_b; player.afterJudgeSetBet(Lose, times); } else { cout << "平局!玩家 " << player_id << " 的手牌总和为:" << p_b; player.afterJudgeSetBet(Draw, times); } cout << " 庄家的手牌总和为:" << d_b << endl; } bool Judger::isPlayerBoom(Player player, int player_id) { std::vector<int> total = player.getCardTotal(); // If the smallest sum is bigger than 21, than boom if (total[0] > 22) { Printer::boom(total[0], player.getHandDescriptionString(), player_id); return true; } return false; } bool Judger::isDealerBoom(Dealer dealer) { std::vector<int> total = dealer.getCardTotal(); // If the smallest sum is bigger than 21, than boom if (total[0] > 22) { Printer::boom(total[0], dealer.getHandDescriptionString(), -1); return true; } return false; } void Judger::judegeBetweenPlayer(Player a, int a_id, Player b, int b_id) { int a_best = a.getBest(), b_best = b.getBest(); if (a_best > 22 || b_best > 22) { if (a_best > 22 && b_best > 22) { // 平局没有赌注变更 cout << "平局!玩家 " << a_id << " 的手牌总和为:" << a_best << endl << "玩家 " << b_id << " 的手牌总和为:" << b_best << endl; } else if (a_best > 22) { cout << "玩家 " << a_id << " 输了!手牌总和为:" << a_best << endl << "玩家 " << b_id << " 赢了!手牌总和为:" << b_best << endl; a.afterJudgeSetBet(Lose, 0.5, true, a.getTotalBet()); b.afterJudgeSetBet(Win, 0.5, true, a.getTotalBet()); cout << "玩家 " << a_id << " 将 " << a.getTotalBet() * 0.5 << " 给了玩家" << b_id << endl << "Player " << a_id << " has " << a.getLeftBet() << " left" << endl << "Player " << b_id << " has " << b.getLeftBet() << " left" << endl; } else { cout << "玩家 " << a_id << " 赢了!手牌总和为:" << a_best << endl << "玩家 " << b_id << " 输了!手牌总和为:" << b_best << endl; a.afterJudgeSetBet(Win, 0.5, true, b.getTotalBet()); b.afterJudgeSetBet(Lose, 0.5, true, b.getTotalBet()); cout << "玩家 " << b_id << " 将 " << a.getTotalBet() * 0.5 << " 给了玩家" << a_id << endl << "Player " << a_id << " has " << a.getLeftBet() << " left" << endl << "Player " << b_id << " has " << b.getLeftBet() << " left" << endl; } } else { if (a_best == b_best) { // 平局没有赌注变更 cout << "平局!玩家 " << a_id << " 的手牌总和为:" << a_best << endl << "玩家 " << b_id << " 的手牌总和为:" << b_best << endl; } else if (a_best > b_best) { cout << "玩家 " << a_id << " 赢了!手牌总和为:" << a_best << endl << "玩家 " << b_id << " 输了!手牌总和为:" << b_best << endl; a.afterJudgeSetBet(Win, 0.5, true, b.getTotalBet()); b.afterJudgeSetBet(Lose, 0.5, true, b.getTotalBet()); cout << "玩家 " << b_id << " 将 " << a.getTotalBet() * 0.5 << " 给了玩家" << a_id << endl << "Player " << a_id << " has " << a.getLeftBet() << " left" << endl << "Player " << b_id << " has " << b.getLeftBet() << " left" << endl; } else { cout << "玩家 " << a_id << " 输了!手牌总和为:" << a_best << endl << "玩家 " << b_id << " 赢了!手牌总和为:" << b_best << endl; a.afterJudgeSetBet(Lose, 0.5, true, a.getTotalBet()); b.afterJudgeSetBet(Win, 0.5, true, a.getTotalBet()); cout << "玩家 " << a_id << " 将 " << a.getTotalBet() * 0.5 << " 给了玩家" << b_id << endl << "Player " << a_id << " has " << a.getLeftBet() << " left" << endl << "Player " << b_id << " has " << b.getLeftBet() << " left" << endl; } } }
a749039a8ba87f47d6e82efc070ec3a7107356eb
9e71fe7f9be86bfd6524077ae035d1a5f38a0f65
/meave/ga/SimpleTrialSubGenChild/simple-trial.hpp
9729310dab70219fb3259a1eb6bb6d9f170b204a
[]
no_license
faramir-dev/meave
0e3acc2671490eba385b2e161828253b73cc39b0
b0cb9f0ba0ce771aac97c366b41e6b2abfcfe10c
refs/heads/master
2021-09-15T23:52:53.797793
2018-06-13T05:57:02
2018-06-13T05:57:02
115,875,263
0
0
null
null
null
null
UTF-8
C++
false
false
14,210
hpp
#ifndef MEAVE_GA_SIMPLE_TRIAL_HPP # define MEAVE_GA_SIMPLE_TRIAL_HPP # include "meave/commons.hpp" # include "meave/lib/math.hpp" # include "meave/lib/seed.hpp" # include "meave/lib/str_printf.hpp" # include "meave/lib/xrange.hpp" # include "meave/ctrnn/neuron.hpp" # include <algorithm> # include <fstream> # include <sstream> # include <tuple> namespace meave { namespace ga { struct Nothing { void operator()(...) const noexcept { } }; struct SinglePrecision { typedef float Float; typedef uns Len; }; template <typename T> struct GenChildItemByItem { template <typename Float> void operator()(Float d[], const Float m[], const Float f[]) { T &t = static_cast<T&>(*this); for (uns _ = 0; _ < t.gsize(); ++_) { if (t.dist() < t.recprob()) d[_] = m[_]; else d[_] = f[_]; d[_] += t.norm_dist() * t.gaus_vec_mut(); if (d[_] > 1.0) d[_] = 2.0 - d[_]; d[_] = ::meave::math::abs(d[_]); } } }; template <typename T> struct GenChildLinear { template <typename Float> void operator()(Float d[], const Float m[], const Float f[]) { T &t = static_cast<T&>(*this); const Float r = t.dist(); for (uns _ = 0; _ < t.gsize(); ++_) { if (t.dist() < t.recprob()) d[_] = m[_]; else d[_] = r*m[_] + (1 - r)*f[_]; d[_] += t.norm_dist() * t.gaus_vec_mut(); if (d[_] > 1.0) d[_] = 2.0 - d[_]; d[_] = ::meave::math::abs(d[_]); } } }; template <typename T> struct GenChildNormal { template <typename Float> void operator()(Float d[], const Float m[], const Float f[]) { T &t = static_cast<T&>(*this); const Float r = t.template normal_dist<9, 1, 10>(); for (uns _ = 0; _ < t.gsize(); ++_) { if (t.dist() < t.recprob()) d[_] = r*m[_] + (1 - r)*f[_]; else d[_] = (1-r)*m[_] + r*f[_]; d[_] += t.norm_dist() * t.gaus_vec_mut(); d[_] = d[_] - long(d[_]); } } }; /** * @tparam Params * -- Evolution Parameters -- * Param::gens() -- number of generaitions (10_000) * Param::gaus_vec_mut -- Gassian vector mutation (0.01) * Param::psize -- population size (20) * Param::recprob() -- probability of recombination (0.5) * Param::demewidth() -- deme width * * -- Fitness Evaluation Parameters -- * Param::trial() -- units of time for each trial (50) * Param::eval() -- time at which the agent starts beaing evaluated * Param::repeat() -- number of trials per fitness evaluation (100) * Param::velrange() -- range of different possible velocities [0, 2] * Param::startposrange() -- range of different starting positions [0, 100] * * -- euler integration parameters -- * Param::ts() -- time step of simulation <floating point> * * -- CTRNN parameters -- * Param::nn() -- number of neurons (3) * Param::psize -- population size * Param::range() -- range of weights: [-5.0, +5.0] * * Param::subgen_lens() -- range of lens for subgen() [+5, +5] */ template <typename Types, typename Params, template<typename> class GenChildT> class SimpleTrialSubGen : public Types , public Params , public GenChildT<SimpleTrialSubGen<Types, Params, GenChildT>> { public: typedef GenChildT<SimpleTrialSubGen<Types, Params, GenChildT>> GenChild; typedef typename Types::Float Float; typedef typename Types::Len Len; typedef $::default_random_engine RandomGenerator; Float dist() noexcept { return dist_(rand_); } Float norm_dist() noexcept { return norm_dist_(rand_); } template<uns a, uns b, uns div> Float uniform_dist() noexcept { static thread_local $::uniform_real_distribution<Float> dist(a/float(div), b/float(div)); return dist(rand_); } template<uns mean, uns stddev, uns div> Float normal_dist() noexcept { static thread_local $::normal_distribution<Float> dist(mean/float(div), stddev/float(div)); return dist(rand_); } /** * @return Genome size. */ constexpr uns gsize() const noexcept { return P::nn()*P::nn() + 2*P::nn(); } /** * @todo int/float (0.1) has big rounding error... * @return Number of trials. */ constexpr uns trials_num() const { return static_cast<uns>( static_cast<Float>(this->trial())/this->ts() ); } private: typedef Params P; class Phenotype { private: $::vector<Float> weights_; $::vector<Float> biases_; $::vector<Float> time_constants_; public: $::vector<Float> &weights() { return weights_; } const $::vector<Float> &weights() const { return weights_; } Float &weights(const ::size_t i) { return weights_[i]; } Float weights(const ::size_t i) const { return weights_[i]; } $::vector<Float> &biases() { return biases_; } const $::vector<Float> &biases() const { return biases_; } Float &biases(const ::size_t i) { return biases_[i]; } Float biases(const ::size_t i) const { return biases_[i]; } $::vector<Float> &time_constants() { return time_constants_; } const $::vector<Float> &time_constants() const { return time_constants_; } Float &time_constants(const ::size_t i) { return time_constants_[i]; } Float time_constants(const ::size_t i) const { return time_constants_[i]; } }; private: typedef meave::ctrnn::NNCalc<Float, Len> NNCalc; NNCalc nncalc_; $::vector<Float> population_; mutable RandomGenerator rand_; mutable $::uniform_real_distribution<Float> dist_; mutable $::normal_distribution<Float> norm_dist_; /** * @todo int/float (0.1) has big rounding error... * @return Number of timesteps after which agents starts to be evaluated. */ constexpr uns evals_num() const { return static_cast<uns>( static_cast<Float>(this->eval()/this->ts()) ); } /** * Convert index-th genotype to phenotype. * @return Desired phenotype. */ Phenotype phenotype(const uns index) const { const Float *it_gen = &population_[index * gsize()]; Phenotype $$; const Float *it_w_end = it_gen; $::advance(it_w_end, P::nn() * P::nn()); $::transform(it_gen, it_w_end, $::inserter($$.weights(), $$.weights().begin()), [this](const Float $) -> Float { return $ * 2 * P::range() - P::range(); }); const Float *it_b_end = it_w_end; $::advance(it_b_end, P::nn()); $::transform(it_w_end, it_b_end, $::inserter($$.biases(), $$.biases().begin()), [this](const Float $) -> Float { return $ * 2 * P::range() - P::range(); }); const Float *it_tc_end = it_b_end; $::advance(it_tc_end, P::nn()); $::transform(it_b_end, it_tc_end, $::inserter($$.time_constants(), $$.time_constants().begin()), [](const Float $) -> Float { return ::exp(4*$); }); return $$; } private: void save_member(const uns index, const std::string &file_name) const { $::ofstream f(file_name); f.write(&population_[index*gsize()], gsize()*sizeof(population_[0])); f.close(); } /** * Fitness evaluation. */ enum FitnessKind { FITNESS_RAND , FITNESS_FULL }; template<FitnessKind FK = FITNESS_RAND, typename Wr = Nothing> Float fitness(const uns index, Wr wr = Nothing()) const noexcept { const Phenotype phe = phenotype(index); Float f = 0; if (FK == FITNESS_RAND) { // Regular fitness evaluation for (uns repeat = P::repeat(); repeat--; ) { const Float vel = dist_(rand_) * P::velrange(); const Float start_pos = dist_(rand_) * P::startposrange(); f += run_sim(start_pos, vel, phe, wr); } f /= P::repeat(); } if (FK == FITNESS_FULL) { const uns i_max = 200; for (const uns i: meave::make_xrange(0U, i_max)) { Float temp = 0; const uns j_max = 11; for (const uns j: meave::make_xrange(0U, j_max)) { const uns start_pos = j*10; const Float f_start_pos = static_cast<Float>(start_pos); const Float f_vel = static_cast<Float>(i) / 100; const Float err = run_sim(f_start_pos, f_vel, phe, wr); temp += err; }; temp /= j_max; f += temp; }; f /= i_max; } return f; } /** * Runs simulation for one phenotype... */ template<typename WRITER> Float run_sim(const double start, const double vel, const Phenotype &phenotype, WRITER wr = Nothing()) const noexcept { $::vector<Float> y(P::nn()); $::vector<Float> ei(P::nn(), 0.0); std::vector<Float> v(P::nn()); $::transform(phenotype.biases().begin(), phenotype.biases().end(), v.begin(), [this](const Float $) -> Float { return -$ + dist_(rand_) * 2 * P::range() - P::range(); }); Float distance = start; Float f = 0; for (uns trial_idx = 0; trial_idx < trials_num(); ++trial_idx) { nncalc_.sigm(v.begin(), phenotype.biases().begin(), y.begin()); distance += P::ts() * vel; const Float input = distance / 20; ei[0] = input; nncalc_.val(y.begin(), phenotype.time_constants().begin(), ei.begin(), phenotype.weights().begin(), v.begin()); const auto out = v[P::nn() - 1]; wr(start, input, trial_idx, out, vel, f); if (trial_idx > evals_num()) { f += ::meave::math::abs(out - vel); } } const Float $$ = 1 - f / (P::trial() - P::eval()); return $$; } class PairDesc { private: uns max_[2]; uns min_; public: PairDesc(const uns max_0, const uns max_1, const uns min) : max_{max_0, max_1} , min_(min) { } PairDesc(const PairDesc&) = default; PairDesc(PairDesc&&) = default; ~PairDesc() = default; uns max(const uns idx) const noexcept { return max_[idx]; } uns min() const noexcept { return min_; } }; PairDesc choose_pair() const noexcept { const auto subgen_lens = Params::subgen_lens(); const auto subgen_len = $::uniform_int_distribution<uns>{$::get<0>(subgen_lens), $::get<1>(subgen_lens)}(rand_); $::uniform_int_distribution<uns> dist{0, P::psize() - 1}; uns members[ subgen_len ]; for (uns i = 0; i < subgen_len; ) { members[i] = dist(rand_); if (i == 0 || &members[i] == $::find(&members[0], &members[i], members[i])) ++i; } Float evals[ subgen_len ]; for(uns i = 0; i < subgen_len; ++i) { evals[i] = fitness<>(members[i]); } DLOG(INFO) << "choose_pair, items: [" << dbg_items(subgen_len, members, evals) << "]"; uns max_idx[2]{0, 1}; if (evals[0] < evals[1]) $::swap(max_idx[0], max_idx[1]); uns min_idx = max_idx[1]; for (uns i = 2; i < subgen_len; ++i) { if (evals[ max_idx[0] ] < evals[i]) { max_idx[1] = max_idx[0]; max_idx[0] = i; } else if( evals[ max_idx[1] ] < evals[i]) { max_idx[1] = i; } else if (evals[min_idx] > evals[i]) { min_idx = i; } } return PairDesc(members[max_idx[0]], members[max_idx[1]], members[min_idx]); } friend $::ostream &operator<<($::ostream &_, const PairDesc &$) noexcept { return _ << "{" << $.max(0) << ", " << $.max(1) << " (" << $.min() << ")}"; } template<typename It, typename Jt> $::string dbg_items(const uns num, const It members, const Jt fitnesses) const noexcept { assert(members != It()); $::stringstream o; for (uns _ = 0; _ < num; _++) { if (_) o << ", "; o << members[_]; if (fitnesses != Jt()) o << "(" << fitnesses[_] << ")"; } return o.str(); } /** * Performs transfusion and mutation on reals with a Gaussian vector mutation * * Note: Father is replaced by its child. :-) */ void gen_child(const PairDesc &picked) noexcept { static thread_local $::normal_distribution<Float> normal_distribution(0, P::gaus_vec_mut()); const Float *m = &population_[gsize() * picked.max(0)]; const Float *f = &population_[gsize() * picked.max(1)]; Float *d = &population_[gsize() * picked.min()]; GenChild &gen_child_func = static_cast<GenChild&>(*this); gen_child_func(d, m, f); } /** * Perform's Inman's microbial algorithm with fitness eveluations anytime. * Fitness function is in the range (-inf, +1] . */ void evolve() noexcept { $::ofstream out_worstbest("./worstbest.csv", $::ofstream::trunc); out_worstbest << "MinFitnessIndex" << "\t" << "MinFitnessValue" << "\t" << "MaxFitnessIndex" << "\t" << "MaxFitnessValue" << $::endl; for (uns popgen_idx = 0; popgen_idx < 5 * P::psize() * gsize() + 1; ++popgen_idx) { PairDesc picked = choose_pair(); DLOG(INFO) << "Picked-members: " << picked; gen_child(picked); if (0 == (popgen_idx + 1) % P::psize()) { const uns population_idx = popgen_idx/P::psize(); Float min_fits = +$::numeric_limits<Float>::max(); // The worst member Float max_fits = -$::numeric_limits<Float>::max(); // The best member uns min_idx = 0; uns max_idx = 0; for (uns i = 0; i < P::psize(); ++i) { $::ofstream out_res(str_printf("./results_%.3u_%.3u.csv", population_idx, i), $::ofstream::trunc); out_res << "Population" << "\t" << "Member" << "\t" << "Experiment" << "\t" << "Start" << "\t" << "Input" << "\t" << "RealOutput" << "\t" << "ExpectedOutput" << "\t" << "f" << $::endl; const Float fit = fitness<FITNESS_FULL>(i, [population_idx, i, &out_res](const float start, const float input, const uns idx, const double real, const double expected, const double f) { out_res << population_idx << "\t" << i << "\t" << idx << "\t" << start << "\t" << input << "\t" << real << "\t" << expected << "\t" << f << $::endl; }); if (fit < min_fits) $::tie(min_fits, min_idx) = $::make_tuple(fit, i); if (fit > max_fits) $::tie(max_fits, max_idx) = $::make_tuple(fit, i); } out_worstbest << min_idx << "\t" << min_fits << "\t" << max_idx << "\t" << max_fits << $::endl; LOG(INFO) << "Population Statistics"; LOG(INFO) << "\tPopulation: " << (popgen_idx / P::psize()); LOG(INFO) << "\tmin-fitness (worst memmber): " << min_fits << '[' << min_idx << ']'; LOG(INFO) << "\tmax-fitness (best member): " << max_fits << '[' << max_idx << ']'; } } } public: SimpleTrialSubGen() noexcept : nncalc_(P::nn(), P::ts()) , population_(P::psize() * gsize()) , rand_(meave::seed()) , dist_(0.0, 1.0) { $::generate(population_.begin(), population_.end(), [this]() -> Float { return dist_(rand_); }); } void operator()() noexcept { evolve(); } }; } } /* meave::ga */ #endif // MEAVE_GA_SIMPLE_TRIAL_HPP
956238dfa16a717ccf21514c2e2a985f8277f9a4
3363bcb05e074b3ac516b555e59d86502393ce55
/MVC_test/Common.h
6535dd772ed66ec72e8b2428f901b298f8ed22cf
[]
no_license
noelleter/OOD_TP_Blackjack
b66fca1d8383cda39b58b7d374d1670aa8285265
ac3d5c80d93f77e64b5499740b980e867063dbcd
refs/heads/master
2020-09-22T01:01:47.455926
2019-11-30T10:33:47
2019-11-30T10:33:47
224,986,451
0
0
null
null
null
null
UTF-8
C++
false
false
366
h
// // Common.h // MVC_test // // Created by 김노은 on 29/11/2019. // Copyright © 2019 Noeun-Kim. All rights reserved. // #ifndef Common_h #define Common_h #include <stdio.h> #pragma once #include <string> using namespace std; typedef void (*DataChangeHandler)(string newData); typedef void (*DataChangeHandler_Integer)(int newData); #endif /* Common_h */
0b15e3cd352a4e4de97a6c11defd2fae2a99e7b4
98de51032125a81fbd3a3aa10e41854b0d51160f
/am_map.c
3559762969bed3fb4c628cbe5120ded6fa101e98
[]
no_license
igor-pokrovsky/svgadoom
84e1ea3d9180737751497ab7ac591043425e2858
0e79cc7367ae16962510e02669340ae2e9b91b4d
refs/heads/master
2023-03-03T01:51:22.698180
2021-02-13T12:39:13
2021-02-13T12:39:13
338,552,606
0
0
null
null
null
null
UTF-8
C++
false
false
27,147
c
// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // $Id:$ // // Copyright (C) 1993-1996 by id Software, Inc. // // This source is available for distribution and/or modification // only under the terms of the DOOM Source Code License as // published by id Software. All rights reserved. // // The source is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License // for more details. // // // $Log:$ // // DESCRIPTION: the automap code // //----------------------------------------------------------------------------- static const char rcsid[] = "$Id: am_map.c,v 1.4 1997/02/03 21:24:33 b1 Exp $"; #include <stdio.h> #include "z_zone.h" #include "doomdef.h" #include "st_stuff.h" #include "p_local.h" #include "w_wad.h" #include "m_cheat.h" #include "i_unix.h" // Needs access to LFB. #include "v_video.h" // State. #include "doomstat.h" #include "r_state.h" // Data. #include "dstrings.h" #include "am_map.h" // For use if I do walls with outsides/insides #define REDS (256-5*16) #define REDRANGE 16 #define BLUES (256-4*16+8) #define BLUERANGE 8 #define GREENS (7*16) #define GREENRANGE 16 #define GRAYS (6*16) #define GRAYSRANGE 16 #define BROWNS (4*16) #define BROWNRANGE 16 #define YELLOWS (256-32+7) #define YELLOWRANGE 1 #define BLACK 0 #define WHITE (256-47) // Automap colors #define BACKGROUND BLACK #define YOURCOLORS WHITE #define YOURRANGE 0 #define WALLCOLORS REDS #define WALLRANGE REDRANGE #define TSWALLCOLORS GRAYS #define TSWALLRANGE GRAYSRANGE #define FDWALLCOLORS BROWNS #define FDWALLRANGE BROWNRANGE #define CDWALLCOLORS YELLOWS #define CDWALLRANGE YELLOWRANGE #define THINGCOLORS GREENS #define THINGRANGE GREENRANGE #define SECRETWALLCOLORS WALLCOLORS #define SECRETWALLRANGE WALLRANGE #define GRIDCOLORS (GRAYS + GRAYSRANGE/2) #define GRIDRANGE 0 #define XHAIRCOLORS GRAYS // drawing stuff #define FB 0 #define AM_PANDOWNKEY KEY_DOWNARROW #define AM_PANUPKEY KEY_UPARROW #define AM_PANRIGHTKEY KEY_RIGHTARROW #define AM_PANLEFTKEY KEY_LEFTARROW #define AM_ZOOMINKEY '=' #define AM_ZOOMOUTKEY '-' #define AM_STARTKEY KEY_TAB #define AM_ENDKEY KEY_TAB #define AM_GOBIGKEY '0' #define AM_FOLLOWKEY 'f' #define AM_GRIDKEY 'g' #define AM_MARKKEY 'm' #define AM_CLEARMARKKEY 'c' #define AM_NUMMARKPOINTS 10 // scale on entry #define INITSCALEMTOF (.2*FRACUNIT) // how much the automap moves window per tic in frame-buffer coordinates // moves 140 pixels in 1 second #define F_PANINC 4 // how much zoom-in per tic // goes to 2x in 1 second #define M_ZOOMIN ((int) (1.02*FRACUNIT)) // how much zoom-out per tic // pulls out to 0.5x in 1 second #define M_ZOOMOUT ((int) (FRACUNIT/1.02)) // translates between frame-buffer and map distances #define FTOM(x) FixedMul(((x)<<16),scale_ftom) #define MTOF(x) (FixedMul((x),scale_mtof)>>16) // translates between frame-buffer and map coordinates #define CXMTOF(x) (f_x + MTOF((x)-m_x)) #define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y))) // the following is crap #define LINE_NEVERSEE ML_DONTDRAW typedef struct { int x, y; } fpoint_t; typedef struct { fpoint_t a, b; } fline_t; typedef struct { fixed_t x,y; } mpoint_t; typedef struct { mpoint_t a, b; } mline_t; typedef struct { fixed_t slp, islp; } islope_t; // // The vector graphics for the automap. // A line drawing of the player pointing right, // starting from the middle. // #define R ((8*PLAYERRADIUS)/7) mline_t player_arrow[] = { { { -R+R/8, 0 }, { R, 0 } }, // ----- { { R, 0 }, { R-R/2, R/4 } }, // -----> { { R, 0 }, { R-R/2, -R/4 } }, { { -R+R/8, 0 }, { -R-R/8, R/4 } }, // >----> { { -R+R/8, 0 }, { -R-R/8, -R/4 } }, { { -R+3*R/8, 0 }, { -R+R/8, R/4 } }, // >>---> { { -R+3*R/8, 0 }, { -R+R/8, -R/4 } } }; #undef R #define NUMPLYRLINES (sizeof(player_arrow)/sizeof(mline_t)) #define R ((8*PLAYERRADIUS)/7) mline_t cheat_player_arrow[] = { { { -R+R/8, 0 }, { R, 0 } }, // ----- { { R, 0 }, { R-R/2, R/6 } }, // -----> { { R, 0 }, { R-R/2, -R/6 } }, { { -R+R/8, 0 }, { -R-R/8, R/6 } }, // >-----> { { -R+R/8, 0 }, { -R-R/8, -R/6 } }, { { -R+3*R/8, 0 }, { -R+R/8, R/6 } }, // >>-----> { { -R+3*R/8, 0 }, { -R+R/8, -R/6 } }, { { -R/2, 0 }, { -R/2, -R/6 } }, // >>-d---> { { -R/2, -R/6 }, { -R/2+R/6, -R/6 } }, { { -R/2+R/6, -R/6 }, { -R/2+R/6, R/4 } }, { { -R/6, 0 }, { -R/6, -R/6 } }, // >>-dd--> { { -R/6, -R/6 }, { 0, -R/6 } }, { { 0, -R/6 }, { 0, R/4 } }, { { R/6, R/4 }, { R/6, -R/7 } }, // >>-ddt-> { { R/6, -R/7 }, { R/6+R/32, -R/7-R/32 } }, { { R/6+R/32, -R/7-R/32 }, { R/6+R/10, -R/7 } } }; #undef R #define NUMCHEATPLYRLINES (sizeof(cheat_player_arrow)/sizeof(mline_t)) #define R (FRACUNIT) mline_t triangle_guy[] = { { { -.867*R, -.5*R }, { .867*R, -.5*R } }, { { .867*R, -.5*R } , { 0, R } }, { { 0, R }, { -.867*R, -.5*R } } }; #undef R #define NUMTRIANGLEGUYLINES (sizeof(triangle_guy)/sizeof(mline_t)) #define R (FRACUNIT) mline_t thintriangle_guy[] = { { { -.5*R, -.7*R }, { R, 0 } }, { { R, 0 }, { -.5*R, .7*R } }, { { -.5*R, .7*R }, { -.5*R, -.7*R } } }; #undef R #define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t)) static int cheating = 0; static int grid = 0; static int leveljuststarted = 1; // kluge until AM_LevelInit() is called boolean automapactive = false; static int finit_width = SCREENWIDTH; static int finit_height = SCREENHEIGHT - 32; // location of window on screen static int f_x; static int f_y; // size of window on screen static int f_w; static int f_h; static int lightlev; // used for funky strobing effect static byte* fb; // pseudo-frame buffer static int amclock; static mpoint_t m_paninc; // how far the window pans each tic (map coords) static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords) static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords) static fixed_t m_x, m_y; // LL x,y where the window is on the map (map coords) static fixed_t m_x2, m_y2; // UR x,y where the window is on the map (map coords) // // width/height of window on map (map coords) // static fixed_t m_w; static fixed_t m_h; // based on level size static fixed_t min_x; static fixed_t min_y; static fixed_t max_x; static fixed_t max_y; static fixed_t max_w; // max_x-min_x, static fixed_t max_h; // max_y-min_y // based on player size static fixed_t min_w; static fixed_t min_h; static fixed_t min_scale_mtof; // used to tell when to stop zooming out static fixed_t max_scale_mtof; // used to tell when to stop zooming in // old stuff for recovery later static fixed_t old_m_w, old_m_h; static fixed_t old_m_x, old_m_y; // old location used by the Follower routine static mpoint_t f_oldloc; // used by MTOF to scale from map-to-frame-buffer coords static fixed_t scale_mtof = INITSCALEMTOF; // used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof) static fixed_t scale_ftom; static player_t *plr; // the player represented by an arrow static patch_t *marknums[10]; // numbers used for marking by the automap static mpoint_t markpoints[AM_NUMMARKPOINTS]; // where the points are static int markpointnum = 0; // next point to be assigned static int followplayer = 1; // specifies whether to follow the player around static unsigned char cheat_amap_seq[] = { 0xb2, 0x26, 0x26, 0x2e, 0xff }; static cheatseq_t cheat_amap = { cheat_amap_seq, 0 }; static boolean stopped = true; extern boolean viewactive; //extern byte screens[][SCREENWIDTH*SCREENHEIGHT]; void V_MarkRect ( int x, int y, int width, int height ); // Calculates the slope and slope according to the x-axis of a line // segment in map coordinates (with the upright y-axis n' all) so // that it can be used with the brain-dead drawing stuff. void AM_getIslope ( mline_t* ml, islope_t* is ) { int dx, dy; dy = ml->a.y - ml->b.y; dx = ml->b.x - ml->a.x; if (!dy) is->islp = (dx<0?-MAXINT:MAXINT); else is->islp = FixedDiv(dx, dy); if (!dx) is->slp = (dy<0?-MAXINT:MAXINT); else is->slp = FixedDiv(dy, dx); } // // // void AM_activateNewScale(void) { m_x += m_w/2; m_y += m_h/2; m_w = FTOM(f_w); m_h = FTOM(f_h); m_x -= m_w/2; m_y -= m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; } // // // void AM_saveScaleAndLoc(void) { old_m_x = m_x; old_m_y = m_y; old_m_w = m_w; old_m_h = m_h; } // // // void AM_restoreScaleAndLoc(void) { m_w = old_m_w; m_h = old_m_h; if (!followplayer) { m_x = old_m_x; m_y = old_m_y; } else { m_x = plr->mo->x - m_w/2; m_y = plr->mo->y - m_h/2; } m_x2 = m_x + m_w; m_y2 = m_y + m_h; // Change the scaling multipliers scale_mtof = FixedDiv(f_w<<FRACBITS, m_w); scale_ftom = FixedDiv(FRACUNIT, scale_mtof); } // // adds a marker at the current location // void AM_addMark(void) { markpoints[markpointnum].x = m_x + m_w/2; markpoints[markpointnum].y = m_y + m_h/2; markpointnum = (markpointnum + 1) % AM_NUMMARKPOINTS; } // // Determines bounding box of all vertices, // sets global variables controlling zoom range. // void AM_findMinMaxBoundaries(void) { int i; fixed_t a; fixed_t b; min_x = min_y = MAXINT; max_x = max_y = -MAXINT; for (i=0;i<numvertexes;i++) { if (vertexes[i].x < min_x) min_x = vertexes[i].x; else if (vertexes[i].x > max_x) max_x = vertexes[i].x; if (vertexes[i].y < min_y) min_y = vertexes[i].y; else if (vertexes[i].y > max_y) max_y = vertexes[i].y; } max_w = max_x - min_x; max_h = max_y - min_y; min_w = 2*PLAYERRADIUS; // const? never changed? min_h = 2*PLAYERRADIUS; a = FixedDiv(f_w<<FRACBITS, max_w); b = FixedDiv(f_h<<FRACBITS, max_h); min_scale_mtof = a < b ? a : b; max_scale_mtof = FixedDiv(f_h<<FRACBITS, 2*PLAYERRADIUS); } // // // void AM_changeWindowLoc(void) { if (m_paninc.x || m_paninc.y) { followplayer = 0; f_oldloc.x = MAXINT; } m_x += m_paninc.x; m_y += m_paninc.y; if (m_x + m_w/2 > max_x) m_x = max_x - m_w/2; else if (m_x + m_w/2 < min_x) m_x = min_x - m_w/2; if (m_y + m_h/2 > max_y) m_y = max_y - m_h/2; else if (m_y + m_h/2 < min_y) m_y = min_y - m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; } // // // void AM_initVariables(void) { int pnum; static event_t st_notify = { ev_keyup, AM_MSGENTERED }; automapactive = true; fb = screens[0]; f_oldloc.x = MAXINT; amclock = 0; lightlev = 0; m_paninc.x = m_paninc.y = 0; ftom_zoommul = FRACUNIT; mtof_zoommul = FRACUNIT; m_w = FTOM(f_w); m_h = FTOM(f_h); // find player to center on initially if (!playeringame[pnum = consoleplayer]) for (pnum=0;pnum<MAXPLAYERS;pnum++) if (playeringame[pnum]) break; plr = &players[pnum]; m_x = plr->mo->x - m_w/2; m_y = plr->mo->y - m_h/2; AM_changeWindowLoc(); // for saving & restoring old_m_x = m_x; old_m_y = m_y; old_m_w = m_w; old_m_h = m_h; // inform the status bar of the change ST_Responder(&st_notify); } // // // void AM_loadPics(void) { int i; char namebuf[9]; for (i=0;i<10;i++) { sprintf(namebuf, "AMMNUM%d", i); marknums[i] = W_CacheLumpName(namebuf, PU_STATIC); } } void AM_unloadPics(void) { int i; for (i=0;i<10;i++) Z_ChangeTag(marknums[i], PU_CACHE); } void AM_clearMarks(void) { int i; for (i=0;i<AM_NUMMARKPOINTS;i++) markpoints[i].x = -1; // means empty markpointnum = 0; } // // should be called at the start of every level // right now, i figure it out myself // void AM_LevelInit(void) { leveljuststarted = 0; f_x = f_y = 0; f_w = finit_width; f_h = finit_height; AM_clearMarks(); AM_findMinMaxBoundaries(); scale_mtof = FixedDiv(min_scale_mtof, (int) (0.7*FRACUNIT)); if (scale_mtof > max_scale_mtof) scale_mtof = min_scale_mtof; scale_ftom = FixedDiv(FRACUNIT, scale_mtof); } // // // void AM_Stop (void) { static event_t st_notify = { 0, ev_keyup, AM_MSGEXITED }; AM_unloadPics(); automapactive = false; ST_Responder(&st_notify); stopped = true; } // // // void AM_Start (void) { static int lastlevel = -1, lastepisode = -1; if (!stopped) AM_Stop(); stopped = false; if (lastlevel != gamemap || lastepisode != gameepisode) { AM_LevelInit(); lastlevel = gamemap; lastepisode = gameepisode; } AM_initVariables(); AM_loadPics(); } // // set the window scale to the maximum size // void AM_minOutWindowScale(void) { scale_mtof = min_scale_mtof; scale_ftom = FixedDiv(FRACUNIT, scale_mtof); AM_activateNewScale(); } // // set the window scale to the minimum size // void AM_maxOutWindowScale(void) { scale_mtof = max_scale_mtof; scale_ftom = FixedDiv(FRACUNIT, scale_mtof); AM_activateNewScale(); } // // Handle events (user inputs) in automap mode // boolean AM_Responder ( event_t* ev ) { int rc; static int cheatstate=0; static int bigstate=0; static char buffer[20]; rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY) { AM_Start (); viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; switch(ev->data1) { case AM_PANRIGHTKEY: // pan right if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; break; case AM_PANLEFTKEY: // pan left if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; break; case AM_PANUPKEY: // pan up if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; break; case AM_PANDOWNKEY: // pan down if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; break; case AM_ZOOMOUTKEY: // zoom out mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; break; case AM_ZOOMINKEY: // zoom in mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; break; case AM_ENDKEY: bigstate = 0; viewactive = true; AM_Stop (); break; case AM_GOBIGKEY: bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); break; case AM_FOLLOWKEY: followplayer = !followplayer; f_oldloc.x = MAXINT; plr->message = followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF; break; case AM_GRIDKEY: grid = !grid; plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF; break; case AM_MARKKEY: sprintf(buffer, "%s %d", AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); break; case AM_CLEARMARKKEY: AM_clearMarks(); plr->message = AMSTR_MARKSCLEARED; break; default: cheatstate=0; rc = false; } if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data1)) { rc = false; cheating = (cheating+1) % 3; } } else if (ev->type == ev_keyup) { rc = false; switch (ev->data1) { case AM_PANRIGHTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANLEFTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANUPKEY: if (!followplayer) m_paninc.y = 0; break; case AM_PANDOWNKEY: if (!followplayer) m_paninc.y = 0; break; case AM_ZOOMOUTKEY: case AM_ZOOMINKEY: mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; break; } } return rc; } // // Zooming // void AM_changeWindowScale(void) { // Change the scaling multipliers scale_mtof = FixedMul(scale_mtof, mtof_zoommul); scale_ftom = FixedDiv(FRACUNIT, scale_mtof); if (scale_mtof < min_scale_mtof) AM_minOutWindowScale(); else if (scale_mtof > max_scale_mtof) AM_maxOutWindowScale(); else AM_activateNewScale(); } // // // void AM_doFollowPlayer(void) { if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y) { m_x = FTOM(MTOF(plr->mo->x)) - m_w/2; m_y = FTOM(MTOF(plr->mo->y)) - m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; f_oldloc.x = plr->mo->x; f_oldloc.y = plr->mo->y; // m_x = FTOM(MTOF(plr->mo->x - m_w/2)); // m_y = FTOM(MTOF(plr->mo->y - m_h/2)); // m_x = plr->mo->x - m_w/2; // m_y = plr->mo->y - m_h/2; } } // // // void AM_updateLightLev(void) { static int nexttic = 0; //static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 }; static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 }; static int litelevelscnt = 0; // Change light level if (amclock>nexttic) { lightlev = litelevels[litelevelscnt++]; if (litelevelscnt == sizeof(litelevels)/sizeof(int)) litelevelscnt = 0; nexttic = amclock + 6 - (amclock % 6); } } // // Updates on Game Tick // void AM_Ticker (void) { if (!automapactive) return; amclock++; if (followplayer) AM_doFollowPlayer(); // Change the zoom if necessary if (ftom_zoommul != FRACUNIT) AM_changeWindowScale(); // Change x,y location if (m_paninc.x || m_paninc.y) AM_changeWindowLoc(); // Update light level // AM_updateLightLev(); } // // Clear automap frame buffer. // void AM_clearFB(int color) { memset(fb, color, f_w*f_h); } // // Automap clipping of lines. // // Based on Cohen-Sutherland clipping algorithm but with a slightly // faster reject and precalculated slopes. If the speed is needed, // use a hash algorithm to handle the common cases. // boolean AM_clipMline ( mline_t* ml, fline_t* fl ) { enum { LEFT =1, RIGHT =2, BOTTOM =4, TOP =8 }; register int outcode1 = 0; register int outcode2 = 0; register int outside; fpoint_t tmp; int dx; int dy; #define DOOUTCODE(oc, mx, my) \ (oc) = 0; \ if ((my) < 0) (oc) |= TOP; \ else if ((my) >= f_h) (oc) |= BOTTOM; \ if ((mx) < 0) (oc) |= LEFT; \ else if ((mx) >= f_w) (oc) |= RIGHT; // do trivial rejects and outcodes if (ml->a.y > m_y2) outcode1 = TOP; else if (ml->a.y < m_y) outcode1 = BOTTOM; if (ml->b.y > m_y2) outcode2 = TOP; else if (ml->b.y < m_y) outcode2 = BOTTOM; if (outcode1 & outcode2) return false; // trivially outside if (ml->a.x < m_x) outcode1 |= LEFT; else if (ml->a.x > m_x2) outcode1 |= RIGHT; if (ml->b.x < m_x) outcode2 |= LEFT; else if (ml->b.x > m_x2) outcode2 |= RIGHT; if (outcode1 & outcode2) return false; // trivially outside // transform to frame-buffer coordinates. fl->a.x = CXMTOF(ml->a.x); fl->a.y = CYMTOF(ml->a.y); fl->b.x = CXMTOF(ml->b.x); fl->b.y = CYMTOF(ml->b.y); DOOUTCODE(outcode1, fl->a.x, fl->a.y); DOOUTCODE(outcode2, fl->b.x, fl->b.y); if (outcode1 & outcode2) return false; while (outcode1 | outcode2) { // may be partially inside box // find an outside point if (outcode1) outside = outcode1; else outside = outcode2; // clip to each side if (outside & TOP) { dy = fl->a.y - fl->b.y; dx = fl->b.x - fl->a.x; tmp.x = fl->a.x + (dx*(fl->a.y))/dy; tmp.y = 0; } else if (outside & BOTTOM) { dy = fl->a.y - fl->b.y; dx = fl->b.x - fl->a.x; tmp.x = fl->a.x + (dx*(fl->a.y-f_h))/dy; tmp.y = f_h-1; } else if (outside & RIGHT) { dy = fl->b.y - fl->a.y; dx = fl->b.x - fl->a.x; tmp.y = fl->a.y + (dy*(f_w-1 - fl->a.x))/dx; tmp.x = f_w-1; } else if (outside & LEFT) { dy = fl->b.y - fl->a.y; dx = fl->b.x - fl->a.x; tmp.y = fl->a.y + (dy*(-fl->a.x))/dx; tmp.x = 0; } if (outside == outcode1) { fl->a = tmp; DOOUTCODE(outcode1, fl->a.x, fl->a.y); } else { fl->b = tmp; DOOUTCODE(outcode2, fl->b.x, fl->b.y); } if (outcode1 & outcode2) return false; // trivially outside } return true; } #undef DOOUTCODE // // Classic Bresenham w/ whatever optimizations needed for speed // void AM_drawFline ( fline_t* fl, int color ) { register int x; register int y; register int dx; register int dy; register int sx; register int sy; register int ax; register int ay; register int d; static int fuck = 0; // For debugging only if ( fl->a.x < 0 || fl->a.x >= f_w || fl->a.y < 0 || fl->a.y >= f_h || fl->b.x < 0 || fl->b.x >= f_w || fl->b.y < 0 || fl->b.y >= f_h) { fprintf(stderr, "fuck %d \r", fuck++); return; } #define PUTDOT(xx,yy,cc) fb[(yy)*f_w+(xx)]=(cc) dx = fl->b.x - fl->a.x; ax = 2 * (dx<0 ? -dx : dx); sx = dx<0 ? -1 : 1; dy = fl->b.y - fl->a.y; ay = 2 * (dy<0 ? -dy : dy); sy = dy<0 ? -1 : 1; x = fl->a.x; y = fl->a.y; if (ax > ay) { d = ay - ax/2; while (1) { PUTDOT(x,y,color); if (x == fl->b.x) return; if (d>=0) { y += sy; d -= ax; } x += sx; d += ay; } } else { d = ax - ay/2; while (1) { PUTDOT(x, y, color); if (y == fl->b.y) return; if (d >= 0) { x += sx; d -= ay; } y += sy; d += ax; } } } // // Clip lines, draw visible part sof lines. // void AM_drawMline ( mline_t* ml, int color ) { static fline_t fl; if (AM_clipMline(ml, &fl)) AM_drawFline(&fl, color); // draws it on frame buffer using fb coords } // // Draws flat (floor/ceiling tile) aligned grid lines. // void AM_drawGrid(int color) { fixed_t x, y; fixed_t start, end; mline_t ml; // Figure out start of vertical gridlines start = m_x; if ((start-bmaporgx)%(MAPBLOCKUNITS<<FRACBITS)) start += (MAPBLOCKUNITS<<FRACBITS) - ((start-bmaporgx)%(MAPBLOCKUNITS<<FRACBITS)); end = m_x + m_w; // draw vertical gridlines ml.a.y = m_y; ml.b.y = m_y+m_h; for (x=start; x<end; x+=(MAPBLOCKUNITS<<FRACBITS)) { ml.a.x = x; ml.b.x = x; AM_drawMline(&ml, color); } // Figure out start of horizontal gridlines start = m_y; if ((start-bmaporgy)%(MAPBLOCKUNITS<<FRACBITS)) start += (MAPBLOCKUNITS<<FRACBITS) - ((start-bmaporgy)%(MAPBLOCKUNITS<<FRACBITS)); end = m_y + m_h; // draw horizontal gridlines ml.a.x = m_x; ml.b.x = m_x + m_w; for (y=start; y<end; y+=(MAPBLOCKUNITS<<FRACBITS)) { ml.a.y = y; ml.b.y = y; AM_drawMline(&ml, color); } } // // Determines visible lines, draws them. // This is LineDef based, not LineSeg based. // void AM_drawWalls(void) { int i; static mline_t l; for (i=0;i<numlines;i++) { l.a.x = lines[i].v1->x; l.a.y = lines[i].v1->y; l.b.x = lines[i].v2->x; l.b.y = lines[i].v2->y; if (cheating || (lines[i].flags & ML_MAPPED)) { if ((lines[i].flags & LINE_NEVERSEE) && !cheating) continue; if (!lines[i].backsector) { AM_drawMline(&l, WALLCOLORS+lightlev); } else { if (lines[i].special == 39) { // teleporters AM_drawMline(&l, WALLCOLORS+WALLRANGE/2); } else if (lines[i].flags & ML_SECRET) // secret door { if (cheating) AM_drawMline(&l, SECRETWALLCOLORS + lightlev); else AM_drawMline(&l, WALLCOLORS+lightlev); } else if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change } else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change } else if (cheating) { AM_drawMline(&l, TSWALLCOLORS+lightlev); } } } else if (plr->powers[pw_allmap]) { if (!(lines[i].flags & LINE_NEVERSEE)) AM_drawMline(&l, GRAYS+3); } } } // // Rotation in 2D. // Used to rotate player arrow line character. // void AM_rotate ( fixed_t* x, fixed_t* y, angle_t a ) { fixed_t tmpx; tmpx = FixedMul(*x,finecosine[a>>ANGLETOFINESHIFT]) - FixedMul(*y,finesine[a>>ANGLETOFINESHIFT]); *y = FixedMul(*x,finesine[a>>ANGLETOFINESHIFT]) + FixedMul(*y,finecosine[a>>ANGLETOFINESHIFT]); *x = tmpx; } void AM_drawLineCharacter ( mline_t* lineguy, int lineguylines, fixed_t scale, angle_t angle, int color, fixed_t x, fixed_t y ) { int i; mline_t l; for (i=0;i<lineguylines;i++) { l.a.x = lineguy[i].a.x; l.a.y = lineguy[i].a.y; if (scale) { l.a.x = FixedMul(scale, l.a.x); l.a.y = FixedMul(scale, l.a.y); } if (angle) AM_rotate(&l.a.x, &l.a.y, angle); l.a.x += x; l.a.y += y; l.b.x = lineguy[i].b.x; l.b.y = lineguy[i].b.y; if (scale) { l.b.x = FixedMul(scale, l.b.x); l.b.y = FixedMul(scale, l.b.y); } if (angle) AM_rotate(&l.b.x, &l.b.y, angle); l.b.x += x; l.b.y += y; AM_drawMline(&l, color); } } void AM_drawPlayers(void) { int i; player_t* p; static int their_colors[] = { GREENS, GRAYS, BROWNS, REDS }; int their_color = -1; int color; if (!netgame) { if (cheating) AM_drawLineCharacter (cheat_player_arrow, NUMCHEATPLYRLINES, 0, plr->mo->angle, WHITE, plr->mo->x, plr->mo->y); else AM_drawLineCharacter (player_arrow, NUMPLYRLINES, 0, plr->mo->angle, WHITE, plr->mo->x, plr->mo->y); return; } for (i=0;i<MAXPLAYERS;i++) { their_color++; p = &players[i]; if ( (deathmatch && !singledemo) && p != plr) continue; if (!playeringame[i]) continue; if (p->powers[pw_invisibility]) color = 246; // *close* to black else color = their_colors[their_color]; AM_drawLineCharacter (player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y); } } void AM_drawThings ( int colors, int colorrange) { int i; mobj_t* t; for (i=0;i<numsectors;i++) { t = sectors[i].thinglist; while (t) { AM_drawLineCharacter (thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<<FRACBITS, t->angle, colors+lightlev, t->x, t->y); t = t->snext; } } } void AM_drawMarks(void) { int i, fx, fy, w, h; for (i=0;i<AM_NUMMARKPOINTS;i++) { if (markpoints[i].x != -1) { // w = SHORT(marknums[i]->width); // h = SHORT(marknums[i]->height); w = 5; // because something's wrong with the wad, i guess h = 6; // because something's wrong with the wad, i guess fx = CXMTOF(markpoints[i].x); fy = CYMTOF(markpoints[i].y); if (fx >= f_x && fx <= f_w - w && fy >= f_y && fy <= f_h - h) V_DrawPatch(fx, fy, FB, marknums[i]); } } } void AM_drawCrosshair(int color) { fb[(f_w*(f_h+1))/2] = color; // single point for now } void AM_Drawer (void) { if (!automapactive) return; AM_clearFB(BACKGROUND); if (grid) AM_drawGrid(GRIDCOLORS); AM_drawWalls(); AM_drawPlayers(); if (cheating==2) AM_drawThings(THINGCOLORS, THINGRANGE); AM_drawCrosshair(XHAIRCOLORS); AM_drawMarks(); V_MarkRect(f_x, f_y, f_w, f_h); }
c3f40f82e29494919b6d33a2667d2889607403c3
f7459ee823ee613b7d32f3a446bcdd6b93abd49a
/progress.hpp
e959da2b3159eb948aef840b8d2b455c0578f4c1
[]
no_license
hectorhiramvelez/pupr_senior_proj
228932fe3809da2e2f96df20ca63bf52bf189a65
6ef4a3e9acf804fcbffe3d705a812657397b2dec
refs/heads/master
2021-01-05T22:04:46.878750
2020-03-26T13:54:45
2020-03-26T13:54:45
241,149,725
0
0
null
null
null
null
UTF-8
C++
false
false
512
hpp
#pragma once #ifndef PROGRESS_HPP #define PROGRESS_HPP #include "autolock.hpp" #include <boost/thread/mutex.hpp> class progress { private: mutable boost::mutex _lock; double value; public: progress(double value = 0); progress(const progress& P); ~progress(); double getProgress() const; double& getProgress(); void setProgress(double value = 0); operator double() const; progress& operator = (const progress& P); progress& operator = (double value); }; #endif /* PROGRESS_HPP */
c735ac4de5b2eb9cda1b86288432a391becdab70
eb63a54b7184bd904cb40d9f341c2055496fd4bf
/src/FileController.cpp
86127bf5f13c0cb621359b435165cdbd56c1e14e
[]
no_license
gr4yscale/fastMemories
f015d98fe831d87b03ce3b20660c692720f57562
23e47f4e8ab3a2a75f9b3a4fcccfa82170a4a724
refs/heads/master
2021-01-19T16:52:04.815138
2015-10-16T09:09:25
2015-10-16T09:09:25
41,979,859
0
0
null
null
null
null
UTF-8
C++
false
false
6,649
cpp
// // FileController.cpp // fastMemories // // Created by Tyler Powers on 10/8/15. // // #include "ofMain.h" #include "FileController.h" static FILE * sLogFile = stdout; static XMP_Status DumpCallback ( void * refCon, XMP_StringPtr outStr, XMP_StringLen outLen ) { XMP_Status status = 0; size_t count; FILE * outFile = static_cast < FILE * > ( refCon ); count = fwrite ( outStr, 1, outLen, outFile ); if ( count != outLen ) status = errno; return status; } FileController::FileController() { } void FileController::loadFilePaths() { cout << "whut" << endl; loadDirectory(config::exportedDirectory); } void FileController::loadDirectory(ofDirectory dir) { int size = dir.listDir(); for(int i = 0; i < size; i++) { if (dir.getFile(i).isDirectory() == 1) { ofDirectory subDir(dir.getFile(i).getAbsolutePath()); subDir.allowExt("jpg"); subDir.allowExt("JPG"); loadDirectory(subDir); } else { fileNames.push_back(dir.getPath(i)); } } } void FileController::writeMetadataPick() { string shPath; shPath = ofToDataPath( "openChildApp.sh", true ); char *shPathChar; shPathChar = new char[ shPath.length() + 1 ]; strcpy( shPathChar, shPath.c_str() ); //-- int pid = fork(); cout << "pid :: " << pid << endl; switch ( pid ) { case -1 : cout << "Uh-Oh! fork() failed.\n" << endl; case 0 : execl( shPathChar, shPathChar, NULL ); default : return; } } // // string originalDir = "/Users/gr4yscale/[fastMemoriesTest]/source"; // string exportedDir = "/Users/gr4yscale/[fastMemoriesTest]/exported"; // // if(!SXMPMeta::Initialize()){ // ofLogError() << "Could not initialize XMP toolkit!"; // return; // } else{ // ofLogVerbose() << "Initialised XMP toolkit"; // } // // XMP_OptionBits options = 0; // // // Must initialize SXMPFiles before we use it // if(!SXMPFiles::Initialize(options)){ // ofLogError() << "Could not initialize XMP SXMPFiles."; // return; // } else{ // ofLogVerbose() << "Initialised XMP SXMPFiles"; // } // // // load xmp files and sort photos array by XMP // // for(int i = 0; i < fileNames.size(); i++) { // string path = fileNames[i]; // size_t lastSlashIndex = path.find_last_of("/"); // string subPath = path.substr(exportedDir.length() + 1, lastSlashIndex - exportedDir.length() - 1); // string originalFileName = path.substr(lastSlashIndex + 18, path.length() - lastSlashIndex); // string sourceXMPFileName = originalFileName.replace(originalFileName.end() - 3, originalFileName.end(), "xmp"); // string xmpFileNameFullPath = originalDir + "/" + subPath + "/" + sourceXMPFileName; // // loadXMPTest(xmpFileNameFullPath.c_str()); // break; // } //} // //void ofApp::loadXMPTest(const char * fileName) { // bool ok; // char buffer [1000]; // // SXMPMeta xmpMeta; // SXMPFiles xmpFile; // XMP_FileFormat format; // XMP_OptionBits openFlags, handlerFlags; // XMP_PacketInfo xmpPacket; // // cout << "derpin"; // cout << fileName; // // sprintf ( buffer, "Dumping main XMP for %s", fileName ); // // WriteMinorLabel ( sLogFile, buffer ); // // xmpFile.OpenFile ( fileName, kXMP_UnknownFile, kXMPFiles_OpenForRead ); // ok = xmpFile.GetFileInfo ( 0, &openFlags, &format, &handlerFlags ); // if ( ! ok ) return; // // fprintf ( sLogFile, "File info : format = \"%.4s\", handler flags = %.8X\n", &format, handlerFlags ); // fflush ( sLogFile ); // // cout << " goin for it"; // // ok = xmpFile.GetXMP ( &xmpMeta, 0, &xmpPacket ); // if ( ! ok ) return; // // // cout << "here now"; // // XMP_Int32 offset = (XMP_Int32)xmpPacket.offset; // XMP_Int32 length = xmpPacket.length; // fprintf ( sLogFile, "Packet info : offset = %d, length = %d\n", offset, length ); // fflush ( sLogFile ); // // fprintf ( sLogFile, "\nInitial XMP from %s\n", fileName ); // xmpMeta.DumpObject ( DumpCallback, sLogFile ); // // xmpFile.CloseFile(); //} // //void ofApp::loadXMP(string path){ // // ofLogVerbose() << "Attempting to load XMP from: " << path; // // try { // // Options to open the file with - read only and use a file handler // XMP_OptionBits opts = kXMPFiles_OpenForRead | kXMPFiles_OpenUseSmartHandler; // // bool ok; // // SXMPMeta::Initialize(); // // SXMPFiles myFile; // std::string status = ""; // // // First we try and open the file // ok = myFile.OpenFile(path, kXMP_UnknownFile, opts); // if (!ok) { // status += "No smart handler available for " + path + "\n"; // status += "Trying packet scanning.\n"; // // // Now try using packet scanning // opts = kXMPFiles_OpenForRead | kXMPFiles_OpenUsePacketScanning; // ok = myFile.OpenFile(path, kXMP_UnknownFile, opts); // } // // // If the file is open then read the metadata // if (ok) { // ofLogVerbose() << status; // ofLogVerbose() << path << " is opened successfully"; // // // Create the xmp object and get the xmp data // SXMPMeta meta; // if (myFile.GetXMP(&meta, NULL, NULL)) { // cout << "yup"; // } else { // cout << "nah"; // } // // // string labelValue = ""; // // string labelPath = "Label"; // // meta.GetProperty(kXMP_NS_XMP, labelPath.c_str(), &labelValue, NULL); // // cout << labelValue; // // // meta.DumpObject(dumpXMPObject, NULL); // // SXMPIterator iter(meta, kXMP_NS_RDF); // string schemaNS="", propPath="", propVal=""; // while(iter.Next(&schemaNS, &propPath, &propVal)){ // cout << propPath << " = " << propVal << endl; // } // // } else { // ofLogError() << "Unable to open " << path; // } // // myFile.CloseFile(); // // } catch(XMP_Error & e) { // ofLogError() << "ERROR: " << e.GetErrMsg(); // } //}
58dd72d639d049b243caa7013433c84a3d0f3770
4c87d2dc30d289d9319dc87e512ae18e2ebbdb0c
/sketch_may01b/sketch_may01b.ino
9a8734d5b0bf6399bcf2bf3f787d229a3aac9bd9
[]
no_license
fauzanbakri/Arduino_Folder
ae9c515e008521d470aed7fb633401de7734a9eb
6ed34ea7f01351f66c20e484227ad5940bbab178
refs/heads/master
2022-12-10T12:05:08.650024
2020-08-22T06:24:31
2020-08-22T06:24:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
425
ino
void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(16, OUTPUT); digitalWrite(16, LOW); } void loop() { // put your main code here, to run repeatedly: int ldr = analogRead(A0); Serial.println(ldr); if (ldr < 700){ digitalWrite(16, HIGH); delay(1000); }else if(800 < ldr){ digitalWrite(16, LOW); delay(1000); }else{ delay(1000); } delay(1000); }
71914b398233c14f2bc0a3d5c3bb56bb94bc1f11
afda43e6891fe1af51fe3404185f4066aa492f25
/tests/catch.hpp
54cd480e498949e01dd6e80852423472367b1bbe
[ "MIT" ]
permissive
skaupper/BKEngine
b52e303fd037e0c63a84d7b2257697c516d3f377
13ea1d6d2ee44bc7ba4074a6da0d79678b4a1f0b
refs/heads/master
2021-06-25T04:31:46.445880
2017-09-02T14:47:43
2017-09-02T14:47:43
82,278,165
9
1
null
2017-09-02T23:11:49
2017-02-17T09:04:32
C++
UTF-8
C++
false
false
423,418
hpp
/* * Catch v1.9.7 * Generated: 2017-08-10 23:49:15.233907 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * * Distributed under the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED #define TWOBLUECUBES_CATCH_HPP_INCLUDED #ifdef __clang__ # pragma clang system_header #elif defined __GNUC__ # pragma GCC system_header #endif // #included from: internal/catch_suppress_warnings.h #ifdef __clang__ # ifdef __ICC // icpc defines the __clang__ macro # pragma warning(push) # pragma warning(disable: 161 1682) # else // __ICC # pragma clang diagnostic ignored "-Wglobal-constructors" # pragma clang diagnostic ignored "-Wvariadic-macros" # pragma clang diagnostic ignored "-Wc99-extensions" # pragma clang diagnostic ignored "-Wunused-variable" # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wpadded" # pragma clang diagnostic ignored "-Wc++98-compat" # pragma clang diagnostic ignored "-Wc++98-compat-pedantic" # pragma clang diagnostic ignored "-Wswitch-enum" # pragma clang diagnostic ignored "-Wcovered-switch-default" # endif #elif defined __GNUC__ # pragma GCC diagnostic ignored "-Wvariadic-macros" # pragma GCC diagnostic ignored "-Wunused-variable" # pragma GCC diagnostic ignored "-Wparentheses" # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpadded" #endif #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) # define CATCH_IMPL #endif #ifdef CATCH_IMPL # ifndef CLARA_CONFIG_MAIN # define CLARA_CONFIG_MAIN_NOT_DEFINED # define CLARA_CONFIG_MAIN # endif #endif // #included from: internal/catch_notimplemented_exception.h #define TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED // #included from: catch_common.h #define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED // #included from: catch_compiler_capabilities.h #define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED // Detect a number of compiler features - mostly C++11/14 conformance - by compiler // The following features are defined: // // CATCH_CONFIG_CPP11_NULLPTR : is nullptr supported? // CATCH_CONFIG_CPP11_NOEXCEPT : is noexcept supported? // CATCH_CONFIG_CPP11_GENERATED_METHODS : The delete and default keywords for compiler generated methods // CATCH_CONFIG_CPP11_IS_ENUM : std::is_enum is supported? // CATCH_CONFIG_CPP11_TUPLE : std::tuple is supported // CATCH_CONFIG_CPP11_LONG_LONG : is long long supported? // CATCH_CONFIG_CPP11_OVERRIDE : is override supported? // CATCH_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr) // CATCH_CONFIG_CPP11_SHUFFLE : is std::shuffle supported? // CATCH_CONFIG_CPP11_TYPE_TRAITS : are type_traits and enable_if supported? // CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported? // CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported? // CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? // CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? // CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? // **************** // Note to maintainers: if new toggles are added please document them // in configuration.md, too // **************** // In general each macro has a _NO_<feature name> form // (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) which disables the feature. // Many features, at point of detection, define an _INTERNAL_ macro, so they // can be combined, en-mass, with the _NO_ forms later. // All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11 #ifdef __cplusplus # if __cplusplus >= 201103L # define CATCH_CPP11_OR_GREATER # endif # if __cplusplus >= 201402L # define CATCH_CPP14_OR_GREATER # endif #endif #ifdef __clang__ # if __has_feature(cxx_nullptr) # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # endif # if __has_feature(cxx_noexcept) # define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # endif # if defined(CATCH_CPP11_OR_GREATER) # define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ _Pragma( "clang diagnostic push" ) \ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) # define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ _Pragma( "clang diagnostic pop" ) # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ _Pragma( "clang diagnostic push" ) \ _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ _Pragma( "clang diagnostic pop" ) # endif #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals #if defined(__CYGWIN__) || defined(__QNX__) # if !defined(CATCH_CONFIG_POSIX_SIGNALS) # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS # endif #endif #ifdef __OS400__ # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS # define CATCH_CONFIG_COLOUR_NONE #endif //////////////////////////////////////////////////////////////////////////////// // Cygwin #ifdef __CYGWIN__ // Required for some versions of Cygwin to declare gettimeofday // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin # define _BSD_SOURCE #endif // __CYGWIN__ //////////////////////////////////////////////////////////////////////////////// // Borland #ifdef __BORLANDC__ #endif // __BORLANDC__ //////////////////////////////////////////////////////////////////////////////// // EDG #ifdef __EDG_VERSION__ #endif // __EDG_VERSION__ //////////////////////////////////////////////////////////////////////////////// // Digital Mars #ifdef __DMC__ #endif // __DMC__ //////////////////////////////////////////////////////////////////////////////// // GCC #ifdef __GNUC__ # if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # endif // - otherwise more recent versions define __cplusplus >= 201103L // and will get picked up below #endif // __GNUC__ //////////////////////////////////////////////////////////////////////////////// // Visual C++ #ifdef _MSC_VER #define CATCH_INTERNAL_CONFIG_WINDOWS_SEH #if (_MSC_VER >= 1600) # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR #endif #if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015)) #define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT #define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS #define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE #define CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS #endif #endif // _MSC_VER //////////////////////////////////////////////////////////////////////////////// // Use variadic macros if the compiler supports them #if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \ ( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \ ( defined __GNUC__ && __GNUC__ >= 3 ) || \ ( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L ) #define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS #endif // Use __COUNTER__ if the compiler supports it #if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \ ( defined __GNUC__ && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 )) ) || \ ( defined __clang__ && __clang_major__ >= 3 ) #define CATCH_INTERNAL_CONFIG_COUNTER #endif //////////////////////////////////////////////////////////////////////////////// // C++ language feature support // catch all support for C++11 #if defined(CATCH_CPP11_OR_GREATER) # if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # endif # ifndef CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # endif # ifndef CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS # define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS # endif # ifndef CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM # define CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM # endif # ifndef CATCH_INTERNAL_CONFIG_CPP11_TUPLE # define CATCH_INTERNAL_CONFIG_CPP11_TUPLE # endif # ifndef CATCH_INTERNAL_CONFIG_VARIADIC_MACROS # define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS # endif # if !defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) # define CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG # endif # if !defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) # define CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE # endif # if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) # define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR # endif # if !defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) # define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE # endif # if !defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS) # define CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS # endif #endif // __cplusplus >= 201103L // Now set the actual defines based on the above + anything the user has configured #if defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NO_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_NULLPTR #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NO_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_NOEXCEPT #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_NO_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_GENERATED_METHODS #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_NO_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_IS_ENUM #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_CPP11_NO_TUPLE) && !defined(CATCH_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_TUPLE #endif #if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS) # define CATCH_CONFIG_VARIADIC_MACROS #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_LONG_LONG #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_OVERRIDE #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_UNIQUE_PTR #endif // Use of __COUNTER__ is suppressed if __JETBRAINS_IDE__ is #defined (meaning we're being parsed by a JetBrains IDE for // analytics) because, at time of writing, __COUNTER__ is not properly handled by it. // This does not affect compilation #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__) # define CATCH_CONFIG_COUNTER #endif #if defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_NO_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_SHUFFLE #endif # if defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_NO_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_TYPE_TRAITS # endif #if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) # define CATCH_CONFIG_WINDOWS_SEH #endif // This is set by default, because we assume that unix compilers are posix-signal-compatible by default. #if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) # define CATCH_CONFIG_POSIX_SIGNALS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS # define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS #endif // noexcept support: #if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT) # define CATCH_NOEXCEPT noexcept # define CATCH_NOEXCEPT_IS(x) noexcept(x) #else # define CATCH_NOEXCEPT throw() # define CATCH_NOEXCEPT_IS(x) #endif // nullptr support #ifdef CATCH_CONFIG_CPP11_NULLPTR # define CATCH_NULL nullptr #else # define CATCH_NULL NULL #endif // override support #ifdef CATCH_CONFIG_CPP11_OVERRIDE # define CATCH_OVERRIDE override #else # define CATCH_OVERRIDE #endif // unique_ptr support #ifdef CATCH_CONFIG_CPP11_UNIQUE_PTR # define CATCH_AUTO_PTR( T ) std::unique_ptr<T> #else # define CATCH_AUTO_PTR( T ) std::auto_ptr<T> #endif #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) #ifdef CATCH_CONFIG_COUNTER # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) #else # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) #endif #define INTERNAL_CATCH_STRINGIFY2( expr ) #expr #define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr ) #include <sstream> #include <algorithm> namespace Catch { struct IConfig; struct CaseSensitive { enum Choice { Yes, No }; }; class NonCopyable { #ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS NonCopyable( NonCopyable const& ) = delete; NonCopyable( NonCopyable && ) = delete; NonCopyable& operator = ( NonCopyable const& ) = delete; NonCopyable& operator = ( NonCopyable && ) = delete; #else NonCopyable( NonCopyable const& info ); NonCopyable& operator = ( NonCopyable const& ); #endif protected: NonCopyable() {} virtual ~NonCopyable(); }; class SafeBool { public: typedef void (SafeBool::*type)() const; static type makeSafe( bool value ) { return value ? &SafeBool::trueValue : 0; } private: void trueValue() const {} }; template<typename ContainerT> void deleteAll( ContainerT& container ) { typename ContainerT::const_iterator it = container.begin(); typename ContainerT::const_iterator itEnd = container.end(); for(; it != itEnd; ++it ) delete *it; } template<typename AssociativeContainerT> void deleteAllValues( AssociativeContainerT& container ) { typename AssociativeContainerT::const_iterator it = container.begin(); typename AssociativeContainerT::const_iterator itEnd = container.end(); for(; it != itEnd; ++it ) delete it->second; } bool startsWith( std::string const& s, std::string const& prefix ); bool startsWith( std::string const& s, char prefix ); bool endsWith( std::string const& s, std::string const& suffix ); bool endsWith( std::string const& s, char suffix ); bool contains( std::string const& s, std::string const& infix ); void toLowerInPlace( std::string& s ); std::string toLower( std::string const& s ); std::string trim( std::string const& str ); bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); struct pluralise { pluralise( std::size_t count, std::string const& label ); friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); std::size_t m_count; std::string m_label; }; struct SourceLineInfo { SourceLineInfo(); SourceLineInfo( char const* _file, std::size_t _line ); # ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS SourceLineInfo(SourceLineInfo const& other) = default; SourceLineInfo( SourceLineInfo && ) = default; SourceLineInfo& operator = ( SourceLineInfo const& ) = default; SourceLineInfo& operator = ( SourceLineInfo && ) = default; # endif bool empty() const; bool operator == ( SourceLineInfo const& other ) const; bool operator < ( SourceLineInfo const& other ) const; char const* file; std::size_t line; }; std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); // This is just here to avoid compiler warnings with macro constants and boolean literals inline bool isTrue( bool value ){ return value; } inline bool alwaysTrue() { return true; } inline bool alwaysFalse() { return false; } void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ); void seedRng( IConfig const& config ); unsigned int rngSeed(); // Use this in variadic streaming macros to allow // >> +StreamEndStop // as well as // >> stuff +StreamEndStop struct StreamEndStop { std::string operator+() { return std::string(); } }; template<typename T> T const& operator + ( T const& value, StreamEndStop ) { return value; } } #define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) ) #define CATCH_INTERNAL_ERROR( msg ) ::Catch::throwLogicError( msg, CATCH_INTERNAL_LINEINFO ); namespace Catch { class NotImplementedException : public std::exception { public: NotImplementedException( SourceLineInfo const& lineInfo ); virtual ~NotImplementedException() CATCH_NOEXCEPT {} virtual const char* what() const CATCH_NOEXCEPT; private: std::string m_what; SourceLineInfo m_lineInfo; }; } // end namespace Catch /////////////////////////////////////////////////////////////////////////////// #define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO ) // #included from: internal/catch_context.h #define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED // #included from: catch_interfaces_generators.h #define TWOBLUECUBES_CATCH_INTERFACES_GENERATORS_H_INCLUDED #include <string> namespace Catch { struct IGeneratorInfo { virtual ~IGeneratorInfo(); virtual bool moveNext() = 0; virtual std::size_t getCurrentIndex() const = 0; }; struct IGeneratorsForTest { virtual ~IGeneratorsForTest(); virtual IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) = 0; virtual bool moveNext() = 0; }; IGeneratorsForTest* createGeneratorsForTest(); } // end namespace Catch // #included from: catch_ptr.hpp #define TWOBLUECUBES_CATCH_PTR_HPP_INCLUDED #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif namespace Catch { // An intrusive reference counting smart pointer. // T must implement addRef() and release() methods // typically implementing the IShared interface template<typename T> class Ptr { public: Ptr() : m_p( CATCH_NULL ){} Ptr( T* p ) : m_p( p ){ if( m_p ) m_p->addRef(); } Ptr( Ptr const& other ) : m_p( other.m_p ){ if( m_p ) m_p->addRef(); } ~Ptr(){ if( m_p ) m_p->release(); } void reset() { if( m_p ) m_p->release(); m_p = CATCH_NULL; } Ptr& operator = ( T* p ){ Ptr temp( p ); swap( temp ); return *this; } Ptr& operator = ( Ptr const& other ){ Ptr temp( other ); swap( temp ); return *this; } void swap( Ptr& other ) { std::swap( m_p, other.m_p ); } T* get() const{ return m_p; } T& operator*() const { return *m_p; } T* operator->() const { return m_p; } bool operator !() const { return m_p == CATCH_NULL; } operator SafeBool::type() const { return SafeBool::makeSafe( m_p != CATCH_NULL ); } private: T* m_p; }; struct IShared : NonCopyable { virtual ~IShared(); virtual void addRef() const = 0; virtual void release() const = 0; }; template<typename T = IShared> struct SharedImpl : T { SharedImpl() : m_rc( 0 ){} virtual void addRef() const { ++m_rc; } virtual void release() const { if( --m_rc == 0 ) delete this; } mutable unsigned int m_rc; }; } // end namespace Catch #ifdef __clang__ #pragma clang diagnostic pop #endif namespace Catch { class TestCase; class Stream; struct IResultCapture; struct IRunner; struct IGeneratorsForTest; struct IConfig; struct IContext { virtual ~IContext(); virtual IResultCapture* getResultCapture() = 0; virtual IRunner* getRunner() = 0; virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0; virtual bool advanceGeneratorsForCurrentTest() = 0; virtual Ptr<IConfig const> getConfig() const = 0; }; struct IMutableContext : IContext { virtual ~IMutableContext(); virtual void setResultCapture( IResultCapture* resultCapture ) = 0; virtual void setRunner( IRunner* runner ) = 0; virtual void setConfig( Ptr<IConfig const> const& config ) = 0; }; IContext& getCurrentContext(); IMutableContext& getCurrentMutableContext(); void cleanUpContext(); Stream createStream( std::string const& streamName ); } // #included from: internal/catch_test_registry.hpp #define TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED // #included from: catch_interfaces_testcase.h #define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED #include <vector> namespace Catch { class TestSpec; struct ITestCase : IShared { virtual void invoke () const = 0; protected: virtual ~ITestCase(); }; class TestCase; struct IConfig; struct ITestCaseRegistry { virtual ~ITestCaseRegistry(); virtual std::vector<TestCase> const& getAllTests() const = 0; virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0; }; bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ); std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ); } namespace Catch { template<typename C> class MethodTestCase : public SharedImpl<ITestCase> { public: MethodTestCase( void (C::*method)() ) : m_method( method ) {} virtual void invoke() const { C obj; (obj.*m_method)(); } private: virtual ~MethodTestCase() {} void (C::*m_method)(); }; typedef void(*TestFunction)(); struct NameAndDesc { NameAndDesc( const char* _name = "", const char* _description= "" ) : name( _name ), description( _description ) {} const char* name; const char* description; }; void registerTestCase ( ITestCase* testCase, char const* className, NameAndDesc const& nameAndDesc, SourceLineInfo const& lineInfo ); struct AutoReg { AutoReg ( TestFunction function, SourceLineInfo const& lineInfo, NameAndDesc const& nameAndDesc ); template<typename C> AutoReg ( void (C::*method)(), char const* className, NameAndDesc const& nameAndDesc, SourceLineInfo const& lineInfo ) { registerTestCase ( new MethodTestCase<C>( method ), className, nameAndDesc, lineInfo ); } ~AutoReg(); private: AutoReg( AutoReg const& ); void operator= ( AutoReg const& ); }; void registerTestCaseFunction ( TestFunction function, SourceLineInfo const& lineInfo, NameAndDesc const& nameAndDesc ); } // end namespace Catch #ifdef CATCH_CONFIG_VARIADIC_MACROS /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ static void TestName(); \ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); } /* NOLINT */ \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ static void TestName() #define INTERNAL_CATCH_TESTCASE( ... ) \ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); } /* NOLINT */ \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ namespace{ \ struct TestName : ClassName{ \ void test(); \ }; \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); /* NOLINT */ \ } \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ void TestName::test() #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); /* NOLINT */ \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS #else /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \ static void TestName(); \ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); } /* NOLINT */ \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ static void TestName() #define INTERNAL_CATCH_TESTCASE( Name, Desc ) \ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); } /* NOLINT */ \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ namespace{ \ struct TestCaseName : ClassName{ \ void test(); \ }; \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); /* NOLINT */ \ } \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ void TestCaseName::test() #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \ CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); /* NOLINT */ \ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS #endif // #included from: internal/catch_capture.hpp #define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED // #included from: catch_result_builder.h #define TWOBLUECUBES_CATCH_RESULT_BUILDER_H_INCLUDED // #included from: catch_result_type.h #define TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED namespace Catch { // ResultWas::OfType enum struct ResultWas { enum OfType { Unknown = -1, Ok = 0, Info = 1, Warning = 2, FailureBit = 0x10, ExpressionFailed = FailureBit | 1, ExplicitFailure = FailureBit | 2, Exception = 0x100 | FailureBit, ThrewException = Exception | 1, DidntThrowException = Exception | 2, FatalErrorCondition = 0x200 | FailureBit }; }; inline bool isOk( ResultWas::OfType resultType ) { return ( resultType & ResultWas::FailureBit ) == 0; } inline bool isJustInfo( int flags ) { return flags == ResultWas::Info; } // ResultDisposition::Flags enum struct ResultDisposition { enum Flags { Normal = 0x01, ContinueOnFailure = 0x02, // Failures fail test, but execution continues FalseTest = 0x04, // Prefix expression with ! SuppressFail = 0x08 // Failures are reported but do not fail the test }; }; inline ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) ); } inline bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } inline bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } } // end namespace Catch // #included from: catch_assertionresult.h #define TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED #include <string> namespace Catch { struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; struct DecomposedExpression { virtual ~DecomposedExpression() {} virtual bool isBinaryExpression() const { return false; } virtual void reconstructExpression( std::string& dest ) const = 0; // Only simple binary comparisons can be decomposed. // If more complex check is required then wrap sub-expressions in parentheses. template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( T const& ); template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( T const& ); template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator * ( T const& ); template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator / ( T const& ); template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator % ( T const& ); template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( T const& ); template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( T const& ); private: DecomposedExpression& operator = (DecomposedExpression const&); }; struct AssertionInfo { AssertionInfo(); AssertionInfo( char const * _macroName, SourceLineInfo const& _lineInfo, char const * _capturedExpression, ResultDisposition::Flags _resultDisposition, char const * _secondArg = ""); char const * macroName; SourceLineInfo lineInfo; char const * capturedExpression; ResultDisposition::Flags resultDisposition; char const * secondArg; }; struct AssertionResultData { AssertionResultData() : decomposedExpression( CATCH_NULL ) , resultType( ResultWas::Unknown ) , negated( false ) , parenthesized( false ) {} void negate( bool parenthesize ) { negated = !negated; parenthesized = parenthesize; if( resultType == ResultWas::Ok ) resultType = ResultWas::ExpressionFailed; else if( resultType == ResultWas::ExpressionFailed ) resultType = ResultWas::Ok; } std::string const& reconstructExpression() const { if( decomposedExpression != CATCH_NULL ) { decomposedExpression->reconstructExpression( reconstructedExpression ); if( parenthesized ) { reconstructedExpression.insert( 0, 1, '(' ); reconstructedExpression.append( 1, ')' ); } if( negated ) { reconstructedExpression.insert( 0, 1, '!' ); } decomposedExpression = CATCH_NULL; } return reconstructedExpression; } mutable DecomposedExpression const* decomposedExpression; mutable std::string reconstructedExpression; std::string message; ResultWas::OfType resultType; bool negated; bool parenthesized; }; class AssertionResult { public: AssertionResult(); AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); ~AssertionResult(); # ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS AssertionResult( AssertionResult const& ) = default; AssertionResult( AssertionResult && ) = default; AssertionResult& operator = ( AssertionResult const& ) = default; AssertionResult& operator = ( AssertionResult && ) = default; # endif bool isOk() const; bool succeeded() const; ResultWas::OfType getResultType() const; bool hasExpression() const; bool hasMessage() const; std::string getExpression() const; std::string getExpressionInMacro() const; bool hasExpandedExpression() const; std::string getExpandedExpression() const; std::string getMessage() const; SourceLineInfo getSourceInfo() const; std::string getTestMacroName() const; void discardDecomposedExpression() const; void expandDecomposedExpression() const; protected: AssertionInfo m_info; AssertionResultData m_resultData; }; } // end namespace Catch // #included from: catch_matchers.hpp #define TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED namespace Catch { namespace Matchers { namespace Impl { template<typename ArgT> struct MatchAllOf; template<typename ArgT> struct MatchAnyOf; template<typename ArgT> struct MatchNotOf; class MatcherUntypedBase { public: std::string toString() const { if( m_cachedToString.empty() ) m_cachedToString = describe(); return m_cachedToString; } protected: virtual ~MatcherUntypedBase(); virtual std::string describe() const = 0; mutable std::string m_cachedToString; private: MatcherUntypedBase& operator = ( MatcherUntypedBase const& ); }; template<typename ObjectT> struct MatcherMethod { virtual bool match( ObjectT const& arg ) const = 0; }; template<typename PtrT> struct MatcherMethod<PtrT*> { virtual bool match( PtrT* arg ) const = 0; }; template<typename ObjectT, typename ComparatorT = ObjectT> struct MatcherBase : MatcherUntypedBase, MatcherMethod<ObjectT> { MatchAllOf<ComparatorT> operator && ( MatcherBase const& other ) const; MatchAnyOf<ComparatorT> operator || ( MatcherBase const& other ) const; MatchNotOf<ComparatorT> operator ! () const; }; template<typename ArgT> struct MatchAllOf : MatcherBase<ArgT> { virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { for( std::size_t i = 0; i < m_matchers.size(); ++i ) { if (!m_matchers[i]->match(arg)) return false; } return true; } virtual std::string describe() const CATCH_OVERRIDE { std::string description; description.reserve( 4 + m_matchers.size()*32 ); description += "( "; for( std::size_t i = 0; i < m_matchers.size(); ++i ) { if( i != 0 ) description += " and "; description += m_matchers[i]->toString(); } description += " )"; return description; } MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) { m_matchers.push_back( &other ); return *this; } std::vector<MatcherBase<ArgT> const*> m_matchers; }; template<typename ArgT> struct MatchAnyOf : MatcherBase<ArgT> { virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { for( std::size_t i = 0; i < m_matchers.size(); ++i ) { if (m_matchers[i]->match(arg)) return true; } return false; } virtual std::string describe() const CATCH_OVERRIDE { std::string description; description.reserve( 4 + m_matchers.size()*32 ); description += "( "; for( std::size_t i = 0; i < m_matchers.size(); ++i ) { if( i != 0 ) description += " or "; description += m_matchers[i]->toString(); } description += " )"; return description; } MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) { m_matchers.push_back( &other ); return *this; } std::vector<MatcherBase<ArgT> const*> m_matchers; }; template<typename ArgT> struct MatchNotOf : MatcherBase<ArgT> { MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { return !m_underlyingMatcher.match( arg ); } virtual std::string describe() const CATCH_OVERRIDE { return "not " + m_underlyingMatcher.toString(); } MatcherBase<ArgT> const& m_underlyingMatcher; }; template<typename ObjectT, typename ComparatorT> MatchAllOf<ComparatorT> MatcherBase<ObjectT, ComparatorT>::operator && ( MatcherBase const& other ) const { return MatchAllOf<ComparatorT>() && *this && other; } template<typename ObjectT, typename ComparatorT> MatchAnyOf<ComparatorT> MatcherBase<ObjectT, ComparatorT>::operator || ( MatcherBase const& other ) const { return MatchAnyOf<ComparatorT>() || *this || other; } template<typename ObjectT, typename ComparatorT> MatchNotOf<ComparatorT> MatcherBase<ObjectT, ComparatorT>::operator ! () const { return MatchNotOf<ComparatorT>( *this ); } } // namespace Impl // The following functions create the actual matcher objects. // This allows the types to be inferred // - deprecated: prefer ||, && and ! template<typename T> Impl::MatchNotOf<T> Not( Impl::MatcherBase<T> const& underlyingMatcher ) { return Impl::MatchNotOf<T>( underlyingMatcher ); } template<typename T> Impl::MatchAllOf<T> AllOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2 ) { return Impl::MatchAllOf<T>() && m1 && m2; } template<typename T> Impl::MatchAllOf<T> AllOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2, Impl::MatcherBase<T> const& m3 ) { return Impl::MatchAllOf<T>() && m1 && m2 && m3; } template<typename T> Impl::MatchAnyOf<T> AnyOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2 ) { return Impl::MatchAnyOf<T>() || m1 || m2; } template<typename T> Impl::MatchAnyOf<T> AnyOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2, Impl::MatcherBase<T> const& m3 ) { return Impl::MatchAnyOf<T>() || m1 || m2 || m3; } } // namespace Matchers using namespace Matchers; using Matchers::Impl::MatcherBase; } // namespace Catch namespace Catch { struct TestFailureException{}; template<typename T> class ExpressionLhs; struct CopyableStream { CopyableStream() {} CopyableStream( CopyableStream const& other ) { oss << other.oss.str(); } CopyableStream& operator=( CopyableStream const& other ) { oss.str(std::string()); oss << other.oss.str(); return *this; } std::ostringstream oss; }; class ResultBuilder : public DecomposedExpression { public: ResultBuilder( char const* macroName, SourceLineInfo const& lineInfo, char const* capturedExpression, ResultDisposition::Flags resultDisposition, char const* secondArg = "" ); ~ResultBuilder(); template<typename T> ExpressionLhs<T const&> operator <= ( T const& operand ); ExpressionLhs<bool> operator <= ( bool value ); template<typename T> ResultBuilder& operator << ( T const& value ) { stream().oss << value; return *this; } ResultBuilder& setResultType( ResultWas::OfType result ); ResultBuilder& setResultType( bool result ); void endExpression( DecomposedExpression const& expr ); virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE; AssertionResult build() const; AssertionResult build( DecomposedExpression const& expr ) const; void useActiveException( ResultDisposition::Flags resultDisposition = ResultDisposition::Normal ); void captureResult( ResultWas::OfType resultType ); void captureExpression(); void captureExpectedException( std::string const& expectedMessage ); void captureExpectedException( Matchers::Impl::MatcherBase<std::string> const& matcher ); void handleResult( AssertionResult const& result ); void react(); bool shouldDebugBreak() const; bool allowThrows() const; template<typename ArgT, typename MatcherT> void captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString ); void setExceptionGuard(); void unsetExceptionGuard(); private: AssertionInfo m_assertionInfo; AssertionResultData m_data; CopyableStream &stream() { if(!m_usedStream) { m_usedStream = true; m_stream().oss.str(""); } return m_stream(); } static CopyableStream &m_stream() { static CopyableStream s; return s; } bool m_shouldDebugBreak; bool m_shouldThrow; bool m_guardException; bool m_usedStream; }; } // namespace Catch // Include after due to circular dependency: // #included from: catch_expression_lhs.hpp #define TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED // #included from: catch_evaluate.hpp #define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4389) // '==' : signed/unsigned mismatch #pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform) #endif #include <cstddef> namespace Catch { namespace Internal { enum Operator { IsEqualTo, IsNotEqualTo, IsLessThan, IsGreaterThan, IsLessThanOrEqualTo, IsGreaterThanOrEqualTo }; template<Operator Op> struct OperatorTraits { static const char* getName(){ return "*error*"; } }; template<> struct OperatorTraits<IsEqualTo> { static const char* getName(){ return "=="; } }; template<> struct OperatorTraits<IsNotEqualTo> { static const char* getName(){ return "!="; } }; template<> struct OperatorTraits<IsLessThan> { static const char* getName(){ return "<"; } }; template<> struct OperatorTraits<IsGreaterThan> { static const char* getName(){ return ">"; } }; template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } }; template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } }; template<typename T> T& opCast(T const& t) { return const_cast<T&>(t); } // nullptr_t support based on pull request #154 from Konstantin Baumann #ifdef CATCH_CONFIG_CPP11_NULLPTR inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; } #endif // CATCH_CONFIG_CPP11_NULLPTR // So the compare overloads can be operator agnostic we convey the operator as a template // enum, which is used to specialise an Evaluator for doing the comparison. template<typename T1, typename T2, Operator Op> struct Evaluator{}; template<typename T1, typename T2> struct Evaluator<T1, T2, IsEqualTo> { static bool evaluate( T1 const& lhs, T2 const& rhs) { return bool( opCast( lhs ) == opCast( rhs ) ); } }; template<typename T1, typename T2> struct Evaluator<T1, T2, IsNotEqualTo> { static bool evaluate( T1 const& lhs, T2 const& rhs ) { return bool( opCast( lhs ) != opCast( rhs ) ); } }; template<typename T1, typename T2> struct Evaluator<T1, T2, IsLessThan> { static bool evaluate( T1 const& lhs, T2 const& rhs ) { return bool( opCast( lhs ) < opCast( rhs ) ); } }; template<typename T1, typename T2> struct Evaluator<T1, T2, IsGreaterThan> { static bool evaluate( T1 const& lhs, T2 const& rhs ) { return bool( opCast( lhs ) > opCast( rhs ) ); } }; template<typename T1, typename T2> struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> { static bool evaluate( T1 const& lhs, T2 const& rhs ) { return bool( opCast( lhs ) >= opCast( rhs ) ); } }; template<typename T1, typename T2> struct Evaluator<T1, T2, IsLessThanOrEqualTo> { static bool evaluate( T1 const& lhs, T2 const& rhs ) { return bool( opCast( lhs ) <= opCast( rhs ) ); } }; template<Operator Op, typename T1, typename T2> bool applyEvaluator( T1 const& lhs, T2 const& rhs ) { return Evaluator<T1, T2, Op>::evaluate( lhs, rhs ); } // This level of indirection allows us to specialise for integer types // to avoid signed/ unsigned warnings // "base" overload template<Operator Op, typename T1, typename T2> bool compare( T1 const& lhs, T2 const& rhs ) { return Evaluator<T1, T2, Op>::evaluate( lhs, rhs ); } // unsigned X to int template<Operator Op> bool compare( unsigned int lhs, int rhs ) { return applyEvaluator<Op>( lhs, static_cast<unsigned int>( rhs ) ); } template<Operator Op> bool compare( unsigned long lhs, int rhs ) { return applyEvaluator<Op>( lhs, static_cast<unsigned int>( rhs ) ); } template<Operator Op> bool compare( unsigned char lhs, int rhs ) { return applyEvaluator<Op>( lhs, static_cast<unsigned int>( rhs ) ); } // unsigned X to long template<Operator Op> bool compare( unsigned int lhs, long rhs ) { return applyEvaluator<Op>( lhs, static_cast<unsigned long>( rhs ) ); } template<Operator Op> bool compare( unsigned long lhs, long rhs ) { return applyEvaluator<Op>( lhs, static_cast<unsigned long>( rhs ) ); } template<Operator Op> bool compare( unsigned char lhs, long rhs ) { return applyEvaluator<Op>( lhs, static_cast<unsigned long>( rhs ) ); } // int to unsigned X template<Operator Op> bool compare( int lhs, unsigned int rhs ) { return applyEvaluator<Op>( static_cast<unsigned int>( lhs ), rhs ); } template<Operator Op> bool compare( int lhs, unsigned long rhs ) { return applyEvaluator<Op>( static_cast<unsigned int>( lhs ), rhs ); } template<Operator Op> bool compare( int lhs, unsigned char rhs ) { return applyEvaluator<Op>( static_cast<unsigned int>( lhs ), rhs ); } // long to unsigned X template<Operator Op> bool compare( long lhs, unsigned int rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } template<Operator Op> bool compare( long lhs, unsigned long rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } template<Operator Op> bool compare( long lhs, unsigned char rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } // pointer to long (when comparing against NULL) template<Operator Op, typename T> bool compare( long lhs, T* rhs ) { return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs ); } template<Operator Op, typename T> bool compare( T* lhs, long rhs ) { return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) ); } // pointer to int (when comparing against NULL) template<Operator Op, typename T> bool compare( int lhs, T* rhs ) { return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs ); } template<Operator Op, typename T> bool compare( T* lhs, int rhs ) { return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) ); } #ifdef CATCH_CONFIG_CPP11_LONG_LONG // long long to unsigned X template<Operator Op> bool compare( long long lhs, unsigned int rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } template<Operator Op> bool compare( long long lhs, unsigned long rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } template<Operator Op> bool compare( long long lhs, unsigned long long rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } template<Operator Op> bool compare( long long lhs, unsigned char rhs ) { return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs ); } // unsigned long long to X template<Operator Op> bool compare( unsigned long long lhs, int rhs ) { return applyEvaluator<Op>( static_cast<long>( lhs ), rhs ); } template<Operator Op> bool compare( unsigned long long lhs, long rhs ) { return applyEvaluator<Op>( static_cast<long>( lhs ), rhs ); } template<Operator Op> bool compare( unsigned long long lhs, long long rhs ) { return applyEvaluator<Op>( static_cast<long>( lhs ), rhs ); } template<Operator Op> bool compare( unsigned long long lhs, char rhs ) { return applyEvaluator<Op>( static_cast<long>( lhs ), rhs ); } // pointer to long long (when comparing against NULL) template<Operator Op, typename T> bool compare( long long lhs, T* rhs ) { return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs ); } template<Operator Op, typename T> bool compare( T* lhs, long long rhs ) { return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) ); } #endif // CATCH_CONFIG_CPP11_LONG_LONG #ifdef CATCH_CONFIG_CPP11_NULLPTR // pointer to nullptr_t (when comparing against nullptr) template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) { return Evaluator<T*, T*, Op>::evaluate( nullptr, rhs ); } template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) { return Evaluator<T*, T*, Op>::evaluate( lhs, nullptr ); } #endif // CATCH_CONFIG_CPP11_NULLPTR } // end of namespace Internal } // end of namespace Catch #ifdef _MSC_VER #pragma warning(pop) #endif // #included from: catch_tostring.h #define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED #include <sstream> #include <iomanip> #include <limits> #include <vector> #include <cstddef> #ifdef __OBJC__ // #included from: catch_objc_arc.hpp #define TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED #import <Foundation/Foundation.h> #ifdef __has_feature #define CATCH_ARC_ENABLED __has_feature(objc_arc) #else #define CATCH_ARC_ENABLED 0 #endif void arcSafeRelease( NSObject* obj ); id performOptionalSelector( id obj, SEL sel ); #if !CATCH_ARC_ENABLED inline void arcSafeRelease( NSObject* obj ) { [obj release]; } inline id performOptionalSelector( id obj, SEL sel ) { if( [obj respondsToSelector: sel] ) return [obj performSelector: sel]; return nil; } #define CATCH_UNSAFE_UNRETAINED #define CATCH_ARC_STRONG #else inline void arcSafeRelease( NSObject* ){} inline id performOptionalSelector( id obj, SEL sel ) { #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" #endif if( [obj respondsToSelector: sel] ) return [obj performSelector: sel]; #ifdef __clang__ #pragma clang diagnostic pop #endif return nil; } #define CATCH_UNSAFE_UNRETAINED __unsafe_unretained #define CATCH_ARC_STRONG __strong #endif #endif #ifdef CATCH_CONFIG_CPP11_TUPLE #include <tuple> #endif #ifdef CATCH_CONFIG_CPP11_IS_ENUM #include <type_traits> #endif namespace Catch { // Why we're here. template<typename T> std::string toString( T const& value ); // Built in overloads std::string toString( std::string const& value ); std::string toString( std::wstring const& value ); std::string toString( const char* const value ); std::string toString( char* const value ); std::string toString( const wchar_t* const value ); std::string toString( wchar_t* const value ); std::string toString( int value ); std::string toString( unsigned long value ); std::string toString( unsigned int value ); std::string toString( const double value ); std::string toString( const float value ); std::string toString( bool value ); std::string toString( char value ); std::string toString( signed char value ); std::string toString( unsigned char value ); #ifdef CATCH_CONFIG_CPP11_LONG_LONG std::string toString( long long value ); std::string toString( unsigned long long value ); #endif #ifdef CATCH_CONFIG_CPP11_NULLPTR std::string toString( std::nullptr_t ); #endif #ifdef __OBJC__ std::string toString( NSString const * const& nsstring ); std::string toString( NSString * CATCH_ARC_STRONG & nsstring ); std::string toString( NSObject* const& nsObject ); #endif namespace Detail { extern const std::string unprintableString; #if !defined(CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK) struct BorgType { template<typename T> BorgType( T const& ); }; struct TrueType { char sizer[1]; }; struct FalseType { char sizer[2]; }; TrueType& testStreamable( std::ostream& ); FalseType testStreamable( FalseType ); FalseType operator<<( std::ostream const&, BorgType const& ); template<typename T> struct IsStreamInsertable { static std::ostream &s; static T const&t; enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) }; }; #else template<typename T> class IsStreamInsertable { template<typename SS, typename TT> static auto test(int) -> decltype( std::declval<SS&>() << std::declval<TT>(), std::true_type() ); template<typename, typename> static auto test(...) -> std::false_type; public: static const bool value = decltype(test<std::ostream,const T&>(0))::value; }; #endif #if defined(CATCH_CONFIG_CPP11_IS_ENUM) template<typename T, bool IsEnum = std::is_enum<T>::value > struct EnumStringMaker { static std::string convert( T const& ) { return unprintableString; } }; template<typename T> struct EnumStringMaker<T,true> { static std::string convert( T const& v ) { return ::Catch::toString( static_cast<typename std::underlying_type<T>::type>(v) ); } }; #endif template<bool C> struct StringMakerBase { #if defined(CATCH_CONFIG_CPP11_IS_ENUM) template<typename T> static std::string convert( T const& v ) { return EnumStringMaker<T>::convert( v ); } #else template<typename T> static std::string convert( T const& ) { return unprintableString; } #endif }; template<> struct StringMakerBase<true> { template<typename T> static std::string convert( T const& _value ) { std::ostringstream oss; oss << _value; return oss.str(); } }; std::string rawMemoryToString( const void *object, std::size_t size ); template<typename T> std::string rawMemoryToString( const T& object ) { return rawMemoryToString( &object, sizeof(object) ); } } // end namespace Detail template<typename T> struct StringMaker : Detail::StringMakerBase<Detail::IsStreamInsertable<T>::value> {}; template<typename T> struct StringMaker<T*> { template<typename U> static std::string convert( U* p ) { if( !p ) return "NULL"; else return Detail::rawMemoryToString( p ); } }; template<typename R, typename C> struct StringMaker<R C::*> { static std::string convert( R C::* p ) { if( !p ) return "NULL"; else return Detail::rawMemoryToString( p ); } }; namespace Detail { template<typename InputIterator> std::string rangeToString( InputIterator first, InputIterator last ); } //template<typename T, typename Allocator> //struct StringMaker<std::vector<T, Allocator> > { // static std::string convert( std::vector<T,Allocator> const& v ) { // return Detail::rangeToString( v.begin(), v.end() ); // } //}; template<typename T, typename Allocator> std::string toString( std::vector<T,Allocator> const& v ) { return Detail::rangeToString( v.begin(), v.end() ); } #ifdef CATCH_CONFIG_CPP11_TUPLE // toString for tuples namespace TupleDetail { template< typename Tuple, std::size_t N = 0, bool = (N < std::tuple_size<Tuple>::value) > struct ElementPrinter { static void print( const Tuple& tuple, std::ostream& os ) { os << ( N ? ", " : " " ) << Catch::toString(std::get<N>(tuple)); ElementPrinter<Tuple,N+1>::print(tuple,os); } }; template< typename Tuple, std::size_t N > struct ElementPrinter<Tuple,N,false> { static void print( const Tuple&, std::ostream& ) {} }; } template<typename ...Types> struct StringMaker<std::tuple<Types...>> { static std::string convert( const std::tuple<Types...>& tuple ) { std::ostringstream os; os << '{'; TupleDetail::ElementPrinter<std::tuple<Types...>>::print( tuple, os ); os << " }"; return os.str(); } }; #endif // CATCH_CONFIG_CPP11_TUPLE namespace Detail { template<typename T> std::string makeString( T const& value ) { return StringMaker<T>::convert( value ); } } // end namespace Detail /// \brief converts any type to a string /// /// The default template forwards on to ostringstream - except when an /// ostringstream overload does not exist - in which case it attempts to detect /// that and writes {?}. /// Overload (not specialise) this template for custom typs that you don't want /// to provide an ostream overload for. template<typename T> std::string toString( T const& value ) { return StringMaker<T>::convert( value ); } namespace Detail { template<typename InputIterator> std::string rangeToString( InputIterator first, InputIterator last ) { std::ostringstream oss; oss << "{ "; if( first != last ) { oss << Catch::toString( *first ); for( ++first ; first != last ; ++first ) oss << ", " << Catch::toString( *first ); } oss << " }"; return oss.str(); } } } // end namespace Catch namespace Catch { template<typename LhsT, Internal::Operator Op, typename RhsT> class BinaryExpression; template<typename ArgT, typename MatcherT> class MatchExpression; // Wraps the LHS of an expression and overloads comparison operators // for also capturing those and RHS (if any) template<typename T> class ExpressionLhs : public DecomposedExpression { public: ExpressionLhs( ResultBuilder& rb, T lhs ) : m_rb( rb ), m_lhs( lhs ), m_truthy(false) {} ExpressionLhs& operator = ( const ExpressionLhs& ); template<typename RhsT> BinaryExpression<T, Internal::IsEqualTo, RhsT const&> operator == ( RhsT const& rhs ) { return captureExpression<Internal::IsEqualTo>( rhs ); } template<typename RhsT> BinaryExpression<T, Internal::IsNotEqualTo, RhsT const&> operator != ( RhsT const& rhs ) { return captureExpression<Internal::IsNotEqualTo>( rhs ); } template<typename RhsT> BinaryExpression<T, Internal::IsLessThan, RhsT const&> operator < ( RhsT const& rhs ) { return captureExpression<Internal::IsLessThan>( rhs ); } template<typename RhsT> BinaryExpression<T, Internal::IsGreaterThan, RhsT const&> operator > ( RhsT const& rhs ) { return captureExpression<Internal::IsGreaterThan>( rhs ); } template<typename RhsT> BinaryExpression<T, Internal::IsLessThanOrEqualTo, RhsT const&> operator <= ( RhsT const& rhs ) { return captureExpression<Internal::IsLessThanOrEqualTo>( rhs ); } template<typename RhsT> BinaryExpression<T, Internal::IsGreaterThanOrEqualTo, RhsT const&> operator >= ( RhsT const& rhs ) { return captureExpression<Internal::IsGreaterThanOrEqualTo>( rhs ); } BinaryExpression<T, Internal::IsEqualTo, bool> operator == ( bool rhs ) { return captureExpression<Internal::IsEqualTo>( rhs ); } BinaryExpression<T, Internal::IsNotEqualTo, bool> operator != ( bool rhs ) { return captureExpression<Internal::IsNotEqualTo>( rhs ); } void endExpression() { m_truthy = m_lhs ? true : false; m_rb .setResultType( m_truthy ) .endExpression( *this ); } virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { dest = Catch::toString( m_lhs ); } private: template<Internal::Operator Op, typename RhsT> BinaryExpression<T, Op, RhsT&> captureExpression( RhsT& rhs ) const { return BinaryExpression<T, Op, RhsT&>( m_rb, m_lhs, rhs ); } template<Internal::Operator Op> BinaryExpression<T, Op, bool> captureExpression( bool rhs ) const { return BinaryExpression<T, Op, bool>( m_rb, m_lhs, rhs ); } private: ResultBuilder& m_rb; T m_lhs; bool m_truthy; }; template<typename LhsT, Internal::Operator Op, typename RhsT> class BinaryExpression : public DecomposedExpression { public: BinaryExpression( ResultBuilder& rb, LhsT lhs, RhsT rhs ) : m_rb( rb ), m_lhs( lhs ), m_rhs( rhs ) {} BinaryExpression& operator = ( BinaryExpression& ); void endExpression() const { m_rb .setResultType( Internal::compare<Op>( m_lhs, m_rhs ) ) .endExpression( *this ); } virtual bool isBinaryExpression() const CATCH_OVERRIDE { return true; } virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { std::string lhs = Catch::toString( m_lhs ); std::string rhs = Catch::toString( m_rhs ); char delim = lhs.size() + rhs.size() < 40 && lhs.find('\n') == std::string::npos && rhs.find('\n') == std::string::npos ? ' ' : '\n'; dest.reserve( 7 + lhs.size() + rhs.size() ); // 2 for spaces around operator // 2 for operator // 2 for parentheses (conditionally added later) // 1 for negation (conditionally added later) dest = lhs; dest += delim; dest += Internal::OperatorTraits<Op>::getName(); dest += delim; dest += rhs; } private: ResultBuilder& m_rb; LhsT m_lhs; RhsT m_rhs; }; template<typename ArgT, typename MatcherT> class MatchExpression : public DecomposedExpression { public: MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString ) : m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {} virtual bool isBinaryExpression() const CATCH_OVERRIDE { return true; } virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { std::string matcherAsString = m_matcher.toString(); dest = Catch::toString( m_arg ); dest += ' '; if( matcherAsString == Detail::unprintableString ) dest += m_matcherString; else dest += matcherAsString; } private: ArgT m_arg; MatcherT m_matcher; char const* m_matcherString; }; } // end namespace Catch namespace Catch { template<typename T> ExpressionLhs<T const&> ResultBuilder::operator <= ( T const& operand ) { return ExpressionLhs<T const&>( *this, operand ); } inline ExpressionLhs<bool> ResultBuilder::operator <= ( bool value ) { return ExpressionLhs<bool>( *this, value ); } template<typename ArgT, typename MatcherT> void ResultBuilder::captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString ) { MatchExpression<ArgT const&, MatcherT const&> expr( arg, matcher, matcherString ); setResultType( matcher.match( arg ) ); endExpression( expr ); } } // namespace Catch // #included from: catch_message.h #define TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED #include <string> namespace Catch { struct MessageInfo { MessageInfo( std::string const& _macroName, SourceLineInfo const& _lineInfo, ResultWas::OfType _type ); std::string macroName; SourceLineInfo lineInfo; ResultWas::OfType type; std::string message; unsigned int sequence; bool operator == ( MessageInfo const& other ) const { return sequence == other.sequence; } bool operator < ( MessageInfo const& other ) const { return sequence < other.sequence; } private: static unsigned int globalCount; }; struct MessageBuilder { MessageBuilder( std::string const& macroName, SourceLineInfo const& lineInfo, ResultWas::OfType type ) : m_info( macroName, lineInfo, type ) {} template<typename T> MessageBuilder& operator << ( T const& value ) { m_stream << value; return *this; } MessageInfo m_info; std::ostringstream m_stream; }; class ScopedMessage { public: ScopedMessage( MessageBuilder const& builder ); ScopedMessage( ScopedMessage const& other ); ~ScopedMessage(); MessageInfo m_info; }; } // end namespace Catch // #included from: catch_interfaces_capture.h #define TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED #include <string> namespace Catch { class TestCase; class AssertionResult; struct AssertionInfo; struct SectionInfo; struct SectionEndInfo; struct MessageInfo; class ScopedMessageBuilder; struct Counts; struct IResultCapture { virtual ~IResultCapture(); virtual void assertionEnded( AssertionResult const& result ) = 0; virtual bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) = 0; virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; virtual void pushScopedMessage( MessageInfo const& message ) = 0; virtual void popScopedMessage( MessageInfo const& message ) = 0; virtual std::string getCurrentTestName() const = 0; virtual const AssertionResult* getLastResult() const = 0; virtual void exceptionEarlyReported() = 0; virtual void handleFatalErrorCondition( std::string const& message ) = 0; virtual bool lastAssertionPassed() = 0; virtual void assertionPassed() = 0; virtual void assertionRun() = 0; }; IResultCapture& getResultCapture(); } // #included from: catch_debugger.h #define TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED // #included from: catch_platform.h #define TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) # define CATCH_PLATFORM_MAC #elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) # define CATCH_PLATFORM_IPHONE #elif defined(linux) || defined(__linux) || defined(__linux__) # define CATCH_PLATFORM_LINUX #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) # define CATCH_PLATFORM_WINDOWS # if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) # define CATCH_DEFINES_NOMINMAX # endif # if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) # define CATCH_DEFINES_WIN32_LEAN_AND_MEAN # endif #endif #include <string> namespace Catch{ bool isDebuggerActive(); void writeToDebugConsole( std::string const& text ); } #ifdef CATCH_PLATFORM_MAC // The following code snippet based on: // http://cocoawithlove.com/2008/03/break-into-debugger.html #if defined(__ppc64__) || defined(__ppc__) #define CATCH_TRAP() \ __asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \ : : : "memory","r0","r3","r4" ) /* NOLINT */ #else #define CATCH_TRAP() __asm__("int $3\n" : : /* NOLINT */ ) #endif #elif defined(CATCH_PLATFORM_LINUX) // If we can use inline assembler, do it because this allows us to break // directly at the location of the failing check instead of breaking inside // raise() called from it, i.e. one stack frame below. #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */ #else // Fall back to the generic way. #include <signal.h> #define CATCH_TRAP() raise(SIGTRAP) #endif #elif defined(_MSC_VER) #define CATCH_TRAP() __debugbreak() #elif defined(__MINGW32__) extern "C" __declspec(dllimport) void __stdcall DebugBreak(); #define CATCH_TRAP() DebugBreak() #endif #ifdef CATCH_TRAP #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } #else #define CATCH_BREAK_INTO_DEBUGGER() Catch::alwaysTrue(); #endif // #included from: catch_interfaces_runner.h #define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED namespace Catch { class TestCase; struct IRunner { virtual ~IRunner(); virtual bool aborting() const = 0; }; } #if defined(CATCH_CONFIG_FAST_COMPILE) /////////////////////////////////////////////////////////////////////////////// // We can speedup compilation significantly by breaking into debugger lower in // the callstack, because then we don't have to expand CATCH_BREAK_INTO_DEBUGGER // macro in each assertion #define INTERNAL_CATCH_REACT( resultBuilder ) \ resultBuilder.react(); /////////////////////////////////////////////////////////////////////////////// // Another way to speed-up compilation is to omit local try-catch for REQUIRE* // macros. // This can potentially cause false negative, if the test code catches // the exception before it propagates back up to the runner. #define INTERNAL_CATCH_TEST_NO_TRY( macroName, resultDisposition, expr ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ __catchResult.setExceptionGuard(); \ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ ( __catchResult <= expr ).endExpression(); \ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ __catchResult.unsetExceptionGuard(); \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::isTrue( false && static_cast<bool>( !!(expr) ) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. #define INTERNAL_CHECK_THAT_NO_TRY( macroName, matcher, resultDisposition, arg ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \ __catchResult.setExceptionGuard(); \ __catchResult.captureMatch( arg, matcher, #matcher ); \ __catchResult.unsetExceptionGuard(); \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) #else /////////////////////////////////////////////////////////////////////////////// // In the event of a failure works out if the debugger needs to be invoked // and/or an exception thrown and takes appropriate action. // This needs to be done as a macro so the debugger will stop in the user // source code rather than in Catch library code #define INTERNAL_CATCH_REACT( resultBuilder ) \ if( resultBuilder.shouldDebugBreak() ) CATCH_BREAK_INTO_DEBUGGER(); \ resultBuilder.react(); #endif /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ try { \ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ ( __catchResult <= expr ).endExpression(); \ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ } \ catch( ... ) { \ __catchResult.useActiveException( resultDisposition ); \ } \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::isTrue( false && static_cast<bool>( !!(expr) ) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( macroName, resultDisposition, expr ) \ INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ); \ if( Catch::getResultCapture().lastAssertionPassed() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_ELSE( macroName, resultDisposition, expr ) \ INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ); \ if( !Catch::getResultCapture().lastAssertionPassed() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, expr ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ try { \ static_cast<void>(expr); \ __catchResult.captureResult( Catch::ResultWas::Ok ); \ } \ catch( ... ) { \ __catchResult.useActiveException( resultDisposition ); \ } \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS( macroName, resultDisposition, matcher, expr ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition, #matcher ); \ if( __catchResult.allowThrows() ) \ try { \ static_cast<void>(expr); \ __catchResult.captureResult( Catch::ResultWas::DidntThrowException ); \ } \ catch( ... ) { \ __catchResult.captureExpectedException( matcher ); \ } \ else \ __catchResult.captureResult( Catch::ResultWas::Ok ); \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr ", " #exceptionType, resultDisposition ); \ if( __catchResult.allowThrows() ) \ try { \ static_cast<void>(expr); \ __catchResult.captureResult( Catch::ResultWas::DidntThrowException ); \ } \ catch( exceptionType ) { \ __catchResult.captureResult( Catch::ResultWas::Ok ); \ } \ catch( ... ) { \ __catchResult.useActiveException( resultDisposition ); \ } \ else \ __catchResult.captureResult( Catch::ResultWas::Ok ); \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) /////////////////////////////////////////////////////////////////////////////// #ifdef CATCH_CONFIG_VARIADIC_MACROS #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ __catchResult << __VA_ARGS__ + ::Catch::StreamEndStop(); \ __catchResult.captureResult( messageType ); \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) #else #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, log ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ __catchResult << log + ::Catch::StreamEndStop(); \ __catchResult.captureResult( messageType ); \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) #endif /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_INFO( macroName, log ) \ Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) = Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log; /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \ try { \ __catchResult.captureMatch( arg, matcher, #matcher ); \ } catch( ... ) { \ __catchResult.useActiveException( resultDisposition | Catch::ResultDisposition::ContinueOnFailure ); \ } \ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) // #included from: internal/catch_section.h #define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED // #included from: catch_section_info.h #define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED // #included from: catch_totals.hpp #define TWOBLUECUBES_CATCH_TOTALS_HPP_INCLUDED #include <cstddef> namespace Catch { struct Counts { Counts() : passed( 0 ), failed( 0 ), failedButOk( 0 ) {} Counts operator - ( Counts const& other ) const { Counts diff; diff.passed = passed - other.passed; diff.failed = failed - other.failed; diff.failedButOk = failedButOk - other.failedButOk; return diff; } Counts& operator += ( Counts const& other ) { passed += other.passed; failed += other.failed; failedButOk += other.failedButOk; return *this; } std::size_t total() const { return passed + failed + failedButOk; } bool allPassed() const { return failed == 0 && failedButOk == 0; } bool allOk() const { return failed == 0; } std::size_t passed; std::size_t failed; std::size_t failedButOk; }; struct Totals { Totals operator - ( Totals const& other ) const { Totals diff; diff.assertions = assertions - other.assertions; diff.testCases = testCases - other.testCases; return diff; } Totals delta( Totals const& prevTotals ) const { Totals diff = *this - prevTotals; if( diff.assertions.failed > 0 ) ++diff.testCases.failed; else if( diff.assertions.failedButOk > 0 ) ++diff.testCases.failedButOk; else ++diff.testCases.passed; return diff; } Totals& operator += ( Totals const& other ) { assertions += other.assertions; testCases += other.testCases; return *this; } Counts assertions; Counts testCases; }; } #include <string> namespace Catch { struct SectionInfo { SectionInfo ( SourceLineInfo const& _lineInfo, std::string const& _name, std::string const& _description = std::string() ); std::string name; std::string description; SourceLineInfo lineInfo; }; struct SectionEndInfo { SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds ) : sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds ) {} SectionInfo sectionInfo; Counts prevAssertions; double durationInSeconds; }; } // end namespace Catch // #included from: catch_timer.h #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED #ifdef _MSC_VER namespace Catch { typedef unsigned long long UInt64; } #else #include <stdint.h> namespace Catch { typedef uint64_t UInt64; } #endif namespace Catch { class Timer { public: Timer() : m_ticks( 0 ) {} void start(); unsigned int getElapsedMicroseconds() const; unsigned int getElapsedMilliseconds() const; double getElapsedSeconds() const; private: UInt64 m_ticks; }; } // namespace Catch #include <string> namespace Catch { class Section : NonCopyable { public: Section( SectionInfo const& info ); ~Section(); // This indicates whether the section should be executed or not operator bool() const; private: SectionInfo m_info; std::string m_name; Counts m_assertions; bool m_sectionIncluded; Timer m_timer; }; } // end namespace Catch #ifdef CATCH_CONFIG_VARIADIC_MACROS #define INTERNAL_CATCH_SECTION( ... ) \ if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) #else #define INTERNAL_CATCH_SECTION( name, desc ) \ if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, name, desc ) ) #endif // #included from: internal/catch_generators.hpp #define TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED #include <vector> #include <string> #include <stdlib.h> namespace Catch { template<typename T> struct IGenerator { virtual ~IGenerator() {} virtual T getValue( std::size_t index ) const = 0; virtual std::size_t size () const = 0; }; template<typename T> class BetweenGenerator : public IGenerator<T> { public: BetweenGenerator( T from, T to ) : m_from( from ), m_to( to ){} virtual T getValue( std::size_t index ) const { return m_from+static_cast<int>( index ); } virtual std::size_t size() const { return static_cast<std::size_t>( 1+m_to-m_from ); } private: T m_from; T m_to; }; template<typename T> class ValuesGenerator : public IGenerator<T> { public: ValuesGenerator(){} void add( T value ) { m_values.push_back( value ); } virtual T getValue( std::size_t index ) const { return m_values[index]; } virtual std::size_t size() const { return m_values.size(); } private: std::vector<T> m_values; }; template<typename T> class CompositeGenerator { public: CompositeGenerator() : m_totalSize( 0 ) {} // *** Move semantics, similar to auto_ptr *** CompositeGenerator( CompositeGenerator& other ) : m_fileInfo( other.m_fileInfo ), m_totalSize( 0 ) { move( other ); } CompositeGenerator& setFileInfo( const char* fileInfo ) { m_fileInfo = fileInfo; return *this; } ~CompositeGenerator() { deleteAll( m_composed ); } operator T () const { size_t overallIndex = getCurrentContext().getGeneratorIndex( m_fileInfo, m_totalSize ); typename std::vector<const IGenerator<T>*>::const_iterator it = m_composed.begin(); typename std::vector<const IGenerator<T>*>::const_iterator itEnd = m_composed.end(); for( size_t index = 0; it != itEnd; ++it ) { const IGenerator<T>* generator = *it; if( overallIndex >= index && overallIndex < index + generator->size() ) { return generator->getValue( overallIndex-index ); } index += generator->size(); } CATCH_INTERNAL_ERROR( "Indexed past end of generated range" ); return T(); // Suppress spurious "not all control paths return a value" warning in Visual Studio - if you know how to fix this please do so } void add( const IGenerator<T>* generator ) { m_totalSize += generator->size(); m_composed.push_back( generator ); } CompositeGenerator& then( CompositeGenerator& other ) { move( other ); return *this; } CompositeGenerator& then( T value ) { ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>(); valuesGen->add( value ); add( valuesGen ); return *this; } private: void move( CompositeGenerator& other ) { m_composed.insert( m_composed.end(), other.m_composed.begin(), other.m_composed.end() ); m_totalSize += other.m_totalSize; other.m_composed.clear(); } std::vector<const IGenerator<T>*> m_composed; std::string m_fileInfo; size_t m_totalSize; }; namespace Generators { template<typename T> CompositeGenerator<T> between( T from, T to ) { CompositeGenerator<T> generators; generators.add( new BetweenGenerator<T>( from, to ) ); return generators; } template<typename T> CompositeGenerator<T> values( T val1, T val2 ) { CompositeGenerator<T> generators; ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>(); valuesGen->add( val1 ); valuesGen->add( val2 ); generators.add( valuesGen ); return generators; } template<typename T> CompositeGenerator<T> values( T val1, T val2, T val3 ){ CompositeGenerator<T> generators; ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>(); valuesGen->add( val1 ); valuesGen->add( val2 ); valuesGen->add( val3 ); generators.add( valuesGen ); return generators; } template<typename T> CompositeGenerator<T> values( T val1, T val2, T val3, T val4 ) { CompositeGenerator<T> generators; ValuesGenerator<T>* valuesGen = new ValuesGenerator<T>(); valuesGen->add( val1 ); valuesGen->add( val2 ); valuesGen->add( val3 ); valuesGen->add( val4 ); generators.add( valuesGen ); return generators; } } // end namespace Generators using namespace Generators; } // end namespace Catch #define INTERNAL_CATCH_LINESTR2( line ) #line #define INTERNAL_CATCH_LINESTR( line ) INTERNAL_CATCH_LINESTR2( line ) #define INTERNAL_CATCH_GENERATE( expr ) expr.setFileInfo( __FILE__ "(" INTERNAL_CATCH_LINESTR( __LINE__ ) ")" ) // #included from: internal/catch_interfaces_exception.h #define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED #include <string> #include <vector> // #included from: catch_interfaces_registry_hub.h #define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED #include <string> namespace Catch { class TestCase; struct ITestCaseRegistry; struct IExceptionTranslatorRegistry; struct IExceptionTranslator; struct IReporterRegistry; struct IReporterFactory; struct ITagAliasRegistry; struct IRegistryHub { virtual ~IRegistryHub(); virtual IReporterRegistry const& getReporterRegistry() const = 0; virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0; }; struct IMutableRegistryHub { virtual ~IMutableRegistryHub(); virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) = 0; virtual void registerListener( Ptr<IReporterFactory> const& factory ) = 0; virtual void registerTest( TestCase const& testInfo ) = 0; virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; }; IRegistryHub& getRegistryHub(); IMutableRegistryHub& getMutableRegistryHub(); void cleanUp(); std::string translateActiveException(); } namespace Catch { typedef std::string(*exceptionTranslateFunction)(); struct IExceptionTranslator; typedef std::vector<const IExceptionTranslator*> ExceptionTranslators; struct IExceptionTranslator { virtual ~IExceptionTranslator(); virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; }; struct IExceptionTranslatorRegistry { virtual ~IExceptionTranslatorRegistry(); virtual std::string translateActiveException() const = 0; }; class ExceptionTranslatorRegistrar { template<typename T> class ExceptionTranslator : public IExceptionTranslator { public: ExceptionTranslator( std::string(*translateFunction)( T& ) ) : m_translateFunction( translateFunction ) {} virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const CATCH_OVERRIDE { try { if( it == itEnd ) throw; else return (*it)->translate( it+1, itEnd ); } catch( T& ex ) { return m_translateFunction( ex ); } } protected: std::string(*m_translateFunction)( T& ); }; public: template<typename T> ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { getMutableRegistryHub().registerTranslator ( new ExceptionTranslator<T>( translateFunction ) ); } }; } /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ static std::string translatorName( signature ); \ namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); }\ static std::string translatorName( signature ) #define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) // #included from: internal/catch_approx.hpp #define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED #include <cmath> #include <limits> #if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) #include <type_traits> #endif namespace Catch { namespace Detail { class Approx { public: explicit Approx ( double value ) : m_epsilon( std::numeric_limits<float>::epsilon()*100 ), m_margin( 0.0 ), m_scale( 1.0 ), m_value( value ) {} static Approx custom() { return Approx( 0 ); } #if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> Approx operator()( T value ) { Approx approx( static_cast<double>(value) ); approx.epsilon( m_epsilon ); approx.margin( m_margin ); approx.scale( m_scale ); return approx; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> explicit Approx( T value ): Approx(static_cast<double>(value)) {} template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator == ( const T& lhs, Approx const& rhs ) { // Thanks to Richard Harris for his help refining this formula auto lhs_v = double(lhs); bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value))); if (relativeOK) { return true; } return std::fabs(lhs_v - rhs.m_value) < rhs.m_margin; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator == ( Approx const& lhs, const T& rhs ) { return operator==( rhs, lhs ); } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator != ( T lhs, Approx const& rhs ) { return !operator==( lhs, rhs ); } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator != ( Approx const& lhs, T rhs ) { return !operator==( rhs, lhs ); } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator <= ( T lhs, Approx const& rhs ) { return double(lhs) < rhs.m_value || lhs == rhs; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator <= ( Approx const& lhs, T rhs ) { return lhs.m_value < double(rhs) || lhs == rhs; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator >= ( T lhs, Approx const& rhs ) { return double(lhs) > rhs.m_value || lhs == rhs; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> friend bool operator >= ( Approx const& lhs, T rhs ) { return lhs.m_value > double(rhs) || lhs == rhs; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> Approx& epsilon( T newEpsilon ) { m_epsilon = double(newEpsilon); return *this; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> Approx& margin( T newMargin ) { m_margin = double(newMargin); return *this; } template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> Approx& scale( T newScale ) { m_scale = double(newScale); return *this; } #else Approx operator()( double value ) { Approx approx( value ); approx.epsilon( m_epsilon ); approx.margin( m_margin ); approx.scale( m_scale ); return approx; } friend bool operator == ( double lhs, Approx const& rhs ) { // Thanks to Richard Harris for his help refining this formula bool relativeOK = std::fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs), std::fabs(rhs.m_value) ) ); if (relativeOK) { return true; } return std::fabs(lhs - rhs.m_value) < rhs.m_margin; } friend bool operator == ( Approx const& lhs, double rhs ) { return operator==( rhs, lhs ); } friend bool operator != ( double lhs, Approx const& rhs ) { return !operator==( lhs, rhs ); } friend bool operator != ( Approx const& lhs, double rhs ) { return !operator==( rhs, lhs ); } friend bool operator <= ( double lhs, Approx const& rhs ) { return lhs < rhs.m_value || lhs == rhs; } friend bool operator <= ( Approx const& lhs, double rhs ) { return lhs.m_value < rhs || lhs == rhs; } friend bool operator >= ( double lhs, Approx const& rhs ) { return lhs > rhs.m_value || lhs == rhs; } friend bool operator >= ( Approx const& lhs, double rhs ) { return lhs.m_value > rhs || lhs == rhs; } Approx& epsilon( double newEpsilon ) { m_epsilon = newEpsilon; return *this; } Approx& margin( double newMargin ) { m_margin = newMargin; return *this; } Approx& scale( double newScale ) { m_scale = newScale; return *this; } #endif std::string toString() const { std::ostringstream oss; oss << "Approx( " << Catch::toString( m_value ) << " )"; return oss.str(); } private: double m_epsilon; double m_margin; double m_scale; double m_value; }; } template<> inline std::string toString<Detail::Approx>( Detail::Approx const& value ) { return value.toString(); } } // end namespace Catch // #included from: internal/catch_matchers_string.h #define TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED namespace Catch { namespace Matchers { namespace StdString { struct CasedString { CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); std::string adjustString( std::string const& str ) const; std::string caseSensitivitySuffix() const; CaseSensitive::Choice m_caseSensitivity; std::string m_str; }; struct StringMatcherBase : MatcherBase<std::string> { StringMatcherBase( std::string const& operation, CasedString const& comparator ); virtual std::string describe() const CATCH_OVERRIDE; CasedString m_comparator; std::string m_operation; }; struct EqualsMatcher : StringMatcherBase { EqualsMatcher( CasedString const& comparator ); virtual bool match( std::string const& source ) const CATCH_OVERRIDE; }; struct ContainsMatcher : StringMatcherBase { ContainsMatcher( CasedString const& comparator ); virtual bool match( std::string const& source ) const CATCH_OVERRIDE; }; struct StartsWithMatcher : StringMatcherBase { StartsWithMatcher( CasedString const& comparator ); virtual bool match( std::string const& source ) const CATCH_OVERRIDE; }; struct EndsWithMatcher : StringMatcherBase { EndsWithMatcher( CasedString const& comparator ); virtual bool match( std::string const& source ) const CATCH_OVERRIDE; }; } // namespace StdString // The following functions create the actual matcher objects. // This allows the types to be inferred StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); } // namespace Matchers } // namespace Catch // #included from: internal/catch_matchers_vector.h #define TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED namespace Catch { namespace Matchers { namespace Vector { template<typename T> struct ContainsElementMatcher : MatcherBase<std::vector<T>, T> { ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} bool match(std::vector<T> const &v) const CATCH_OVERRIDE { return std::find(v.begin(), v.end(), m_comparator) != v.end(); } virtual std::string describe() const CATCH_OVERRIDE { return "Contains: " + Catch::toString( m_comparator ); } T const& m_comparator; }; template<typename T> struct ContainsMatcher : MatcherBase<std::vector<T>, std::vector<T> > { ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} bool match(std::vector<T> const &v) const CATCH_OVERRIDE { // !TBD: see note in EqualsMatcher if (m_comparator.size() > v.size()) return false; for (size_t i = 0; i < m_comparator.size(); ++i) if (std::find(v.begin(), v.end(), m_comparator[i]) == v.end()) return false; return true; } virtual std::string describe() const CATCH_OVERRIDE { return "Contains: " + Catch::toString( m_comparator ); } std::vector<T> const& m_comparator; }; template<typename T> struct EqualsMatcher : MatcherBase<std::vector<T>, std::vector<T> > { EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} bool match(std::vector<T> const &v) const CATCH_OVERRIDE { // !TBD: This currently works if all elements can be compared using != // - a more general approach would be via a compare template that defaults // to using !=. but could be specialised for, e.g. std::vector<T> etc // - then just call that directly if (m_comparator.size() != v.size()) return false; for (size_t i = 0; i < v.size(); ++i) if (m_comparator[i] != v[i]) return false; return true; } virtual std::string describe() const CATCH_OVERRIDE { return "Equals: " + Catch::toString( m_comparator ); } std::vector<T> const& m_comparator; }; } // namespace Vector // The following functions create the actual matcher objects. // This allows the types to be inferred template<typename T> Vector::ContainsMatcher<T> Contains( std::vector<T> const& comparator ) { return Vector::ContainsMatcher<T>( comparator ); } template<typename T> Vector::ContainsElementMatcher<T> VectorContains( T const& comparator ) { return Vector::ContainsElementMatcher<T>( comparator ); } template<typename T> Vector::EqualsMatcher<T> Equals( std::vector<T> const& comparator ) { return Vector::EqualsMatcher<T>( comparator ); } } // namespace Matchers } // namespace Catch // #included from: internal/catch_interfaces_tag_alias_registry.h #define TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED // #included from: catch_tag_alias.h #define TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED #include <string> namespace Catch { struct TagAlias { TagAlias( std::string const& _tag, SourceLineInfo _lineInfo ) : tag( _tag ), lineInfo( _lineInfo ) {} std::string tag; SourceLineInfo lineInfo; }; struct RegistrarForTagAliases { RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); }; } // end namespace Catch #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } // #included from: catch_option.hpp #define TWOBLUECUBES_CATCH_OPTION_HPP_INCLUDED namespace Catch { // An optional type template<typename T> class Option { public: Option() : nullableValue( CATCH_NULL ) {} Option( T const& _value ) : nullableValue( new( storage ) T( _value ) ) {} Option( Option const& _other ) : nullableValue( _other ? new( storage ) T( *_other ) : CATCH_NULL ) {} ~Option() { reset(); } Option& operator= ( Option const& _other ) { if( &_other != this ) { reset(); if( _other ) nullableValue = new( storage ) T( *_other ); } return *this; } Option& operator = ( T const& _value ) { reset(); nullableValue = new( storage ) T( _value ); return *this; } void reset() { if( nullableValue ) nullableValue->~T(); nullableValue = CATCH_NULL; } T& operator*() { return *nullableValue; } T const& operator*() const { return *nullableValue; } T* operator->() { return nullableValue; } const T* operator->() const { return nullableValue; } T valueOr( T const& defaultValue ) const { return nullableValue ? *nullableValue : defaultValue; } bool some() const { return nullableValue != CATCH_NULL; } bool none() const { return nullableValue == CATCH_NULL; } bool operator !() const { return nullableValue == CATCH_NULL; } operator SafeBool::type() const { return SafeBool::makeSafe( some() ); } private: T *nullableValue; union { char storage[sizeof(T)]; // These are here to force alignment for the storage long double dummy1; void (*dummy2)(); long double dummy3; #ifdef CATCH_CONFIG_CPP11_LONG_LONG long long dummy4; #endif }; }; } // end namespace Catch namespace Catch { struct ITagAliasRegistry { virtual ~ITagAliasRegistry(); virtual Option<TagAlias> find( std::string const& alias ) const = 0; virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; static ITagAliasRegistry const& get(); }; } // end namespace Catch // These files are included here so the single_include script doesn't put them // in the conditionally compiled sections // #included from: internal/catch_test_case_info.h #define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED #include <string> #include <set> #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif namespace Catch { struct ITestCase; struct TestCaseInfo { enum SpecialProperties{ None = 0, IsHidden = 1 << 1, ShouldFail = 1 << 2, MayFail = 1 << 3, Throws = 1 << 4, NonPortable = 1 << 5 }; TestCaseInfo( std::string const& _name, std::string const& _className, std::string const& _description, std::set<std::string> const& _tags, SourceLineInfo const& _lineInfo ); TestCaseInfo( TestCaseInfo const& other ); friend void setTags( TestCaseInfo& testCaseInfo, std::set<std::string> const& tags ); bool isHidden() const; bool throws() const; bool okToFail() const; bool expectedToFail() const; std::string name; std::string className; std::string description; std::set<std::string> tags; std::set<std::string> lcaseTags; std::string tagsAsString; SourceLineInfo lineInfo; SpecialProperties properties; }; class TestCase : public TestCaseInfo { public: TestCase( ITestCase* testCase, TestCaseInfo const& info ); TestCase( TestCase const& other ); TestCase withName( std::string const& _newName ) const; void invoke() const; TestCaseInfo const& getTestCaseInfo() const; void swap( TestCase& other ); bool operator == ( TestCase const& other ) const; bool operator < ( TestCase const& other ) const; TestCase& operator = ( TestCase const& other ); private: Ptr<ITestCase> test; }; TestCase makeTestCase( ITestCase* testCase, std::string const& className, std::string const& name, std::string const& description, SourceLineInfo const& lineInfo ); } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __OBJC__ // #included from: internal/catch_objc.hpp #define TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED #import <objc/runtime.h> #include <string> // NB. Any general catch headers included here must be included // in catch.hpp first to make sure they are included by the single // header for non obj-usage /////////////////////////////////////////////////////////////////////////////// // This protocol is really only here for (self) documenting purposes, since // all its methods are optional. @protocol OcFixture @optional -(void) setUp; -(void) tearDown; @end namespace Catch { class OcMethod : public SharedImpl<ITestCase> { public: OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {} virtual void invoke() const { id obj = [[m_cls alloc] init]; performOptionalSelector( obj, @selector(setUp) ); performOptionalSelector( obj, m_sel ); performOptionalSelector( obj, @selector(tearDown) ); arcSafeRelease( obj ); } private: virtual ~OcMethod() {} Class m_cls; SEL m_sel; }; namespace Detail{ inline std::string getAnnotation( Class cls, std::string const& annotationName, std::string const& testCaseName ) { NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()]; SEL sel = NSSelectorFromString( selStr ); arcSafeRelease( selStr ); id value = performOptionalSelector( cls, sel ); if( value ) return [(NSString*)value UTF8String]; return ""; } } inline size_t registerTestMethods() { size_t noTestMethods = 0; int noClasses = objc_getClassList( CATCH_NULL, 0 ); Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); objc_getClassList( classes, noClasses ); for( int c = 0; c < noClasses; c++ ) { Class cls = classes[c]; { u_int count; Method* methods = class_copyMethodList( cls, &count ); for( u_int m = 0; m < count ; m++ ) { SEL selector = method_getName(methods[m]); std::string methodName = sel_getName(selector); if( startsWith( methodName, "Catch_TestCase_" ) ) { std::string testCaseName = methodName.substr( 15 ); std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); const char* className = class_getName( cls ); getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo() ) ); noTestMethods++; } } free(methods); } } return noTestMethods; } namespace Matchers { namespace Impl { namespace NSStringMatchers { struct StringHolder : MatcherBase<NSString*>{ StringHolder( NSString* substr ) : m_substr( [substr copy] ){} StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){} StringHolder() { arcSafeRelease( m_substr ); } virtual bool match( NSString* arg ) const CATCH_OVERRIDE { return false; } NSString* m_substr; }; struct Equals : StringHolder { Equals( NSString* substr ) : StringHolder( substr ){} virtual bool match( NSString* str ) const CATCH_OVERRIDE { return (str != nil || m_substr == nil ) && [str isEqualToString:m_substr]; } virtual std::string describe() const CATCH_OVERRIDE { return "equals string: " + Catch::toString( m_substr ); } }; struct Contains : StringHolder { Contains( NSString* substr ) : StringHolder( substr ){} virtual bool match( NSString* str ) const { return (str != nil || m_substr == nil ) && [str rangeOfString:m_substr].location != NSNotFound; } virtual std::string describe() const CATCH_OVERRIDE { return "contains string: " + Catch::toString( m_substr ); } }; struct StartsWith : StringHolder { StartsWith( NSString* substr ) : StringHolder( substr ){} virtual bool match( NSString* str ) const { return (str != nil || m_substr == nil ) && [str rangeOfString:m_substr].location == 0; } virtual std::string describe() const CATCH_OVERRIDE { return "starts with: " + Catch::toString( m_substr ); } }; struct EndsWith : StringHolder { EndsWith( NSString* substr ) : StringHolder( substr ){} virtual bool match( NSString* str ) const { return (str != nil || m_substr == nil ) && [str rangeOfString:m_substr].location == [str length] - [m_substr length]; } virtual std::string describe() const CATCH_OVERRIDE { return "ends with: " + Catch::toString( m_substr ); } }; } // namespace NSStringMatchers } // namespace Impl inline Impl::NSStringMatchers::Equals Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); } inline Impl::NSStringMatchers::Contains Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); } inline Impl::NSStringMatchers::StartsWith StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); } inline Impl::NSStringMatchers::EndsWith EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); } } // namespace Matchers using namespace Matchers; } // namespace Catch /////////////////////////////////////////////////////////////////////////////// #define OC_TEST_CASE( name, desc )\ +(NSString*) INTERNAL_CATCH_UNIQUE_NAME( Catch_Name_test ) \ {\ return @ name; \ }\ +(NSString*) INTERNAL_CATCH_UNIQUE_NAME( Catch_Description_test ) \ { \ return @ desc; \ } \ -(void) INTERNAL_CATCH_UNIQUE_NAME( Catch_TestCase_test ) #endif #ifdef CATCH_IMPL // !TBD: Move the leak detector code into a separate header #ifdef CATCH_CONFIG_WINDOWS_CRTDBG #include <crtdbg.h> class LeakDetector { public: LeakDetector() { int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); flag |= _CRTDBG_LEAK_CHECK_DF; flag |= _CRTDBG_ALLOC_MEM_DF; _CrtSetDbgFlag(flag); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); // Change this to leaking allocation's number to break there _CrtSetBreakAlloc(-1); } }; #else class LeakDetector {}; #endif LeakDetector leakDetector; // #included from: internal/catch_impl.hpp #define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED // Collect all the implementation files together here // These are the equivalent of what would usually be cpp files #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #endif // #included from: ../catch_session.hpp #define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED // #included from: internal/catch_commandline.hpp #define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED // #included from: catch_config.hpp #define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED // #included from: catch_test_spec_parser.hpp #define TWOBLUECUBES_CATCH_TEST_SPEC_PARSER_HPP_INCLUDED #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif // #included from: catch_test_spec.hpp #define TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif // #included from: catch_wildcard_pattern.hpp #define TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED #include <stdexcept> namespace Catch { class WildcardPattern { enum WildcardPosition { NoWildcard = 0, WildcardAtStart = 1, WildcardAtEnd = 2, WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd }; public: WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ) : m_caseSensitivity( caseSensitivity ), m_wildcard( NoWildcard ), m_pattern( adjustCase( pattern ) ) { if( startsWith( m_pattern, '*' ) ) { m_pattern = m_pattern.substr( 1 ); m_wildcard = WildcardAtStart; } if( endsWith( m_pattern, '*' ) ) { m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd ); } } virtual ~WildcardPattern(); virtual bool matches( std::string const& str ) const { switch( m_wildcard ) { case NoWildcard: return m_pattern == adjustCase( str ); case WildcardAtStart: return endsWith( adjustCase( str ), m_pattern ); case WildcardAtEnd: return startsWith( adjustCase( str ), m_pattern ); case WildcardAtBothEnds: return contains( adjustCase( str ), m_pattern ); } #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunreachable-code" #endif throw std::logic_error( "Unknown enum" ); #ifdef __clang__ #pragma clang diagnostic pop #endif } private: std::string adjustCase( std::string const& str ) const { return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str; } CaseSensitive::Choice m_caseSensitivity; WildcardPosition m_wildcard; std::string m_pattern; }; } #include <string> #include <vector> namespace Catch { class TestSpec { struct Pattern : SharedImpl<> { virtual ~Pattern(); virtual bool matches( TestCaseInfo const& testCase ) const = 0; }; class NamePattern : public Pattern { public: NamePattern( std::string const& name ) : m_wildcardPattern( toLower( name ), CaseSensitive::No ) {} virtual ~NamePattern(); virtual bool matches( TestCaseInfo const& testCase ) const { return m_wildcardPattern.matches( toLower( testCase.name ) ); } private: WildcardPattern m_wildcardPattern; }; class TagPattern : public Pattern { public: TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {} virtual ~TagPattern(); virtual bool matches( TestCaseInfo const& testCase ) const { return testCase.lcaseTags.find( m_tag ) != testCase.lcaseTags.end(); } private: std::string m_tag; }; class ExcludedPattern : public Pattern { public: ExcludedPattern( Ptr<Pattern> const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {} virtual ~ExcludedPattern(); virtual bool matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); } private: Ptr<Pattern> m_underlyingPattern; }; struct Filter { std::vector<Ptr<Pattern> > m_patterns; bool matches( TestCaseInfo const& testCase ) const { // All patterns in a filter must match for the filter to be a match for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd = m_patterns.end(); it != itEnd; ++it ) { if( !(*it)->matches( testCase ) ) return false; } return true; } }; public: bool hasFilters() const { return !m_filters.empty(); } bool matches( TestCaseInfo const& testCase ) const { // A TestSpec matches if any filter matches for( std::vector<Filter>::const_iterator it = m_filters.begin(), itEnd = m_filters.end(); it != itEnd; ++it ) if( it->matches( testCase ) ) return true; return false; } private: std::vector<Filter> m_filters; friend class TestSpecParser; }; } #ifdef __clang__ #pragma clang diagnostic pop #endif namespace Catch { class TestSpecParser { enum Mode{ None, Name, QuotedName, Tag, EscapedName }; Mode m_mode; bool m_exclusion; std::size_t m_start, m_pos; std::string m_arg; std::vector<std::size_t> m_escapeChars; TestSpec::Filter m_currentFilter; TestSpec m_testSpec; ITagAliasRegistry const* m_tagAliases; public: TestSpecParser( ITagAliasRegistry const& tagAliases ) :m_mode(None), m_exclusion(false), m_start(0), m_pos(0), m_tagAliases( &tagAliases ) {} TestSpecParser& parse( std::string const& arg ) { m_mode = None; m_exclusion = false; m_start = std::string::npos; m_arg = m_tagAliases->expandAliases( arg ); m_escapeChars.clear(); for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) visitChar( m_arg[m_pos] ); if( m_mode == Name ) addPattern<TestSpec::NamePattern>(); return *this; } TestSpec testSpec() { addFilter(); return m_testSpec; } private: void visitChar( char c ) { if( m_mode == None ) { switch( c ) { case ' ': return; case '~': m_exclusion = true; return; case '[': return startNewMode( Tag, ++m_pos ); case '"': return startNewMode( QuotedName, ++m_pos ); case '\\': return escape(); default: startNewMode( Name, m_pos ); break; } } if( m_mode == Name ) { if( c == ',' ) { addPattern<TestSpec::NamePattern>(); addFilter(); } else if( c == '[' ) { if( subString() == "exclude:" ) m_exclusion = true; else addPattern<TestSpec::NamePattern>(); startNewMode( Tag, ++m_pos ); } else if( c == '\\' ) escape(); } else if( m_mode == EscapedName ) m_mode = Name; else if( m_mode == QuotedName && c == '"' ) addPattern<TestSpec::NamePattern>(); else if( m_mode == Tag && c == ']' ) addPattern<TestSpec::TagPattern>(); } void startNewMode( Mode mode, std::size_t start ) { m_mode = mode; m_start = start; } void escape() { if( m_mode == None ) m_start = m_pos; m_mode = EscapedName; m_escapeChars.push_back( m_pos ); } std::string subString() const { return m_arg.substr( m_start, m_pos - m_start ); } template<typename T> void addPattern() { std::string token = subString(); for( size_t i = 0; i < m_escapeChars.size(); ++i ) token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 ); m_escapeChars.clear(); if( startsWith( token, "exclude:" ) ) { m_exclusion = true; token = token.substr( 8 ); } if( !token.empty() ) { Ptr<TestSpec::Pattern> pattern = new T( token ); if( m_exclusion ) pattern = new TestSpec::ExcludedPattern( pattern ); m_currentFilter.m_patterns.push_back( pattern ); } m_exclusion = false; m_mode = None; } void addFilter() { if( !m_currentFilter.m_patterns.empty() ) { m_testSpec.m_filters.push_back( m_currentFilter ); m_currentFilter = TestSpec::Filter(); } } }; inline TestSpec parseTestSpec( std::string const& arg ) { return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); } } // namespace Catch #ifdef __clang__ #pragma clang diagnostic pop #endif // #included from: catch_interfaces_config.h #define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED #include <iosfwd> #include <string> #include <vector> namespace Catch { struct Verbosity { enum Level { NoOutput = 0, Quiet, Normal }; }; struct WarnAbout { enum What { Nothing = 0x00, NoAssertions = 0x01 }; }; struct ShowDurations { enum OrNot { DefaultForReporter, Always, Never }; }; struct RunTests { enum InWhatOrder { InDeclarationOrder, InLexicographicalOrder, InRandomOrder }; }; struct UseColour { enum YesOrNo { Auto, Yes, No }; }; class TestSpec; struct IConfig : IShared { virtual ~IConfig(); virtual bool allowThrows() const = 0; virtual std::ostream& stream() const = 0; virtual std::string name() const = 0; virtual bool includeSuccessfulResults() const = 0; virtual bool shouldDebugBreak() const = 0; virtual bool warnAboutMissingAssertions() const = 0; virtual int abortAfter() const = 0; virtual bool showInvisibles() const = 0; virtual ShowDurations::OrNot showDurations() const = 0; virtual TestSpec const& testSpec() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0; virtual unsigned int rngSeed() const = 0; virtual UseColour::YesOrNo useColour() const = 0; virtual std::vector<std::string> const& getSectionsToRun() const = 0; }; } // #included from: catch_stream.h #define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED // #included from: catch_streambuf.h #define TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED #include <streambuf> namespace Catch { class StreamBufBase : public std::streambuf { public: virtual ~StreamBufBase() CATCH_NOEXCEPT; }; } #include <streambuf> #include <ostream> #include <fstream> #include <memory> namespace Catch { std::ostream& cout(); std::ostream& cerr(); std::ostream& clog(); struct IStream { virtual ~IStream() CATCH_NOEXCEPT; virtual std::ostream& stream() const = 0; }; class FileStream : public IStream { mutable std::ofstream m_ofs; public: FileStream( std::string const& filename ); virtual ~FileStream() CATCH_NOEXCEPT; public: // IStream virtual std::ostream& stream() const CATCH_OVERRIDE; }; class CoutStream : public IStream { mutable std::ostream m_os; public: CoutStream(); virtual ~CoutStream() CATCH_NOEXCEPT; public: // IStream virtual std::ostream& stream() const CATCH_OVERRIDE; }; class DebugOutStream : public IStream { CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf; mutable std::ostream m_os; public: DebugOutStream(); virtual ~DebugOutStream() CATCH_NOEXCEPT; public: // IStream virtual std::ostream& stream() const CATCH_OVERRIDE; }; } #include <memory> #include <vector> #include <string> #include <stdexcept> #ifndef CATCH_CONFIG_CONSOLE_WIDTH #define CATCH_CONFIG_CONSOLE_WIDTH 80 #endif namespace Catch { struct ConfigData { ConfigData() : listTests( false ), listTags( false ), listReporters( false ), listTestNamesOnly( false ), listExtraInfo( false ), showSuccessfulTests( false ), shouldDebugBreak( false ), noThrow( false ), showHelp( false ), showInvisibles( false ), filenamesAsTags( false ), abortAfter( -1 ), rngSeed( 0 ), verbosity( Verbosity::Normal ), warnings( WarnAbout::Nothing ), showDurations( ShowDurations::DefaultForReporter ), runOrder( RunTests::InDeclarationOrder ), useColour( UseColour::Auto ) {} bool listTests; bool listTags; bool listReporters; bool listTestNamesOnly; bool listExtraInfo; bool showSuccessfulTests; bool shouldDebugBreak; bool noThrow; bool showHelp; bool showInvisibles; bool filenamesAsTags; int abortAfter; unsigned int rngSeed; Verbosity::Level verbosity; WarnAbout::What warnings; ShowDurations::OrNot showDurations; RunTests::InWhatOrder runOrder; UseColour::YesOrNo useColour; std::string outputFilename; std::string name; std::string processName; std::vector<std::string> reporterNames; std::vector<std::string> testsOrTags; std::vector<std::string> sectionsToRun; }; class Config : public SharedImpl<IConfig> { private: Config( Config const& other ); Config& operator = ( Config const& other ); virtual void dummy(); public: Config() {} Config( ConfigData const& data ) : m_data( data ), m_stream( openStream() ) { if( !data.testsOrTags.empty() ) { TestSpecParser parser( ITagAliasRegistry::get() ); for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) parser.parse( data.testsOrTags[i] ); m_testSpec = parser.testSpec(); } } virtual ~Config() {} std::string const& getFilename() const { return m_data.outputFilename ; } bool listTests() const { return m_data.listTests; } bool listTestNamesOnly() const { return m_data.listTestNamesOnly; } bool listTags() const { return m_data.listTags; } bool listReporters() const { return m_data.listReporters; } bool listExtraInfo() const { return m_data.listExtraInfo; } std::string getProcessName() const { return m_data.processName; } std::vector<std::string> const& getReporterNames() const { return m_data.reporterNames; } std::vector<std::string> const& getSectionsToRun() const CATCH_OVERRIDE { return m_data.sectionsToRun; } virtual TestSpec const& testSpec() const CATCH_OVERRIDE { return m_testSpec; } bool showHelp() const { return m_data.showHelp; } // IConfig interface virtual bool allowThrows() const CATCH_OVERRIDE { return !m_data.noThrow; } virtual std::ostream& stream() const CATCH_OVERRIDE { return m_stream->stream(); } virtual std::string name() const CATCH_OVERRIDE { return m_data.name.empty() ? m_data.processName : m_data.name; } virtual bool includeSuccessfulResults() const CATCH_OVERRIDE { return m_data.showSuccessfulTests; } virtual bool warnAboutMissingAssertions() const CATCH_OVERRIDE { return m_data.warnings & WarnAbout::NoAssertions; } virtual ShowDurations::OrNot showDurations() const CATCH_OVERRIDE { return m_data.showDurations; } virtual RunTests::InWhatOrder runOrder() const CATCH_OVERRIDE { return m_data.runOrder; } virtual unsigned int rngSeed() const CATCH_OVERRIDE { return m_data.rngSeed; } virtual UseColour::YesOrNo useColour() const CATCH_OVERRIDE { return m_data.useColour; } virtual bool shouldDebugBreak() const CATCH_OVERRIDE { return m_data.shouldDebugBreak; } virtual int abortAfter() const CATCH_OVERRIDE { return m_data.abortAfter; } virtual bool showInvisibles() const CATCH_OVERRIDE { return m_data.showInvisibles; } private: IStream const* openStream() { if( m_data.outputFilename.empty() ) return new CoutStream(); else if( m_data.outputFilename[0] == '%' ) { if( m_data.outputFilename == "%debug" ) return new DebugOutStream(); else throw std::domain_error( "Unrecognised stream: " + m_data.outputFilename ); } else return new FileStream( m_data.outputFilename ); } ConfigData m_data; CATCH_AUTO_PTR( IStream const ) m_stream; TestSpec m_testSpec; }; } // end namespace Catch // #included from: catch_clara.h #define TWOBLUECUBES_CATCH_CLARA_H_INCLUDED // Use Catch's value for console width (store Clara's off to the side, if present) #ifdef CLARA_CONFIG_CONSOLE_WIDTH #define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH #undef CLARA_CONFIG_CONSOLE_WIDTH #endif #define CLARA_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH // Declare Clara inside the Catch namespace #define STITCH_CLARA_OPEN_NAMESPACE namespace Catch { // #included from: ../external/clara.h // Version 0.0.2.4 // Only use header guard if we are not using an outer namespace #if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE) #ifndef STITCH_CLARA_OPEN_NAMESPACE #define TWOBLUECUBES_CLARA_H_INCLUDED #define STITCH_CLARA_OPEN_NAMESPACE #define STITCH_CLARA_CLOSE_NAMESPACE #else #define STITCH_CLARA_CLOSE_NAMESPACE } #endif #define STITCH_TBC_TEXT_FORMAT_OPEN_NAMESPACE STITCH_CLARA_OPEN_NAMESPACE // ----------- #included from tbc_text_format.h ----------- // Only use header guard if we are not using an outer namespace #if !defined(TBC_TEXT_FORMAT_H_INCLUDED) || defined(STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE) #ifndef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE #define TBC_TEXT_FORMAT_H_INCLUDED #endif #include <string> #include <vector> #include <sstream> #include <algorithm> #include <cctype> // Use optional outer namespace #ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE namespace STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE { #endif namespace Tbc { #ifdef TBC_TEXT_FORMAT_CONSOLE_WIDTH const unsigned int consoleWidth = TBC_TEXT_FORMAT_CONSOLE_WIDTH; #else const unsigned int consoleWidth = 80; #endif struct TextAttributes { TextAttributes() : initialIndent( std::string::npos ), indent( 0 ), width( consoleWidth-1 ), tabChar( '\t' ) {} TextAttributes& setInitialIndent( std::size_t _value ) { initialIndent = _value; return *this; } TextAttributes& setIndent( std::size_t _value ) { indent = _value; return *this; } TextAttributes& setWidth( std::size_t _value ) { width = _value; return *this; } TextAttributes& setTabChar( char _value ) { tabChar = _value; return *this; } std::size_t initialIndent; // indent of first line, or npos std::size_t indent; // indent of subsequent lines, or all if initialIndent is npos std::size_t width; // maximum width of text, including indent. Longer text will wrap char tabChar; // If this char is seen the indent is changed to current pos }; class Text { public: Text( std::string const& _str, TextAttributes const& _attr = TextAttributes() ) : attr( _attr ) { std::string wrappableChars = " [({.,/|\\-"; std::size_t indent = _attr.initialIndent != std::string::npos ? _attr.initialIndent : _attr.indent; std::string remainder = _str; while( !remainder.empty() ) { if( lines.size() >= 1000 ) { lines.push_back( "... message truncated due to excessive size" ); return; } std::size_t tabPos = std::string::npos; std::size_t width = (std::min)( remainder.size(), _attr.width - indent ); std::size_t pos = remainder.find_first_of( '\n' ); if( pos <= width ) { width = pos; } pos = remainder.find_last_of( _attr.tabChar, width ); if( pos != std::string::npos ) { tabPos = pos; if( remainder[width] == '\n' ) width--; remainder = remainder.substr( 0, tabPos ) + remainder.substr( tabPos+1 ); } if( width == remainder.size() ) { spliceLine( indent, remainder, width ); } else if( remainder[width] == '\n' ) { spliceLine( indent, remainder, width ); if( width <= 1 || remainder.size() != 1 ) remainder = remainder.substr( 1 ); indent = _attr.indent; } else { pos = remainder.find_last_of( wrappableChars, width ); if( pos != std::string::npos && pos > 0 ) { spliceLine( indent, remainder, pos ); if( remainder[0] == ' ' ) remainder = remainder.substr( 1 ); } else { spliceLine( indent, remainder, width-1 ); lines.back() += "-"; } if( lines.size() == 1 ) indent = _attr.indent; if( tabPos != std::string::npos ) indent += tabPos; } } } void spliceLine( std::size_t _indent, std::string& _remainder, std::size_t _pos ) { lines.push_back( std::string( _indent, ' ' ) + _remainder.substr( 0, _pos ) ); _remainder = _remainder.substr( _pos ); } typedef std::vector<std::string>::const_iterator const_iterator; const_iterator begin() const { return lines.begin(); } const_iterator end() const { return lines.end(); } std::string const& last() const { return lines.back(); } std::size_t size() const { return lines.size(); } std::string const& operator[]( std::size_t _index ) const { return lines[_index]; } std::string toString() const { std::ostringstream oss; oss << *this; return oss.str(); } friend std::ostream& operator << ( std::ostream& _stream, Text const& _text ) { for( Text::const_iterator it = _text.begin(), itEnd = _text.end(); it != itEnd; ++it ) { if( it != _text.begin() ) _stream << "\n"; _stream << *it; } return _stream; } private: std::string str; TextAttributes attr; std::vector<std::string> lines; }; } // end namespace Tbc #ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE } // end outer namespace #endif #endif // TBC_TEXT_FORMAT_H_INCLUDED // ----------- end of #include from tbc_text_format.h ----------- // ........... back in clara.h #undef STITCH_TBC_TEXT_FORMAT_OPEN_NAMESPACE // ----------- #included from clara_compilers.h ----------- #ifndef TWOBLUECUBES_CLARA_COMPILERS_H_INCLUDED #define TWOBLUECUBES_CLARA_COMPILERS_H_INCLUDED // Detect a number of compiler features - mostly C++11/14 conformance - by compiler // The following features are defined: // // CLARA_CONFIG_CPP11_NULLPTR : is nullptr supported? // CLARA_CONFIG_CPP11_NOEXCEPT : is noexcept supported? // CLARA_CONFIG_CPP11_GENERATED_METHODS : The delete and default keywords for compiler generated methods // CLARA_CONFIG_CPP11_OVERRIDE : is override supported? // CLARA_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr) // CLARA_CONFIG_CPP11_OR_GREATER : Is C++11 supported? // CLARA_CONFIG_VARIADIC_MACROS : are variadic macros supported? // In general each macro has a _NO_<feature name> form // (e.g. CLARA_CONFIG_CPP11_NO_NULLPTR) which disables the feature. // Many features, at point of detection, define an _INTERNAL_ macro, so they // can be combined, en-mass, with the _NO_ forms later. // All the C++11 features can be disabled with CLARA_CONFIG_NO_CPP11 #ifdef __clang__ #if __has_feature(cxx_nullptr) #define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR #endif #if __has_feature(cxx_noexcept) #define CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT #endif #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// // GCC #ifdef __GNUC__ #if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) #define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR #endif // - otherwise more recent versions define __cplusplus >= 201103L // and will get picked up below #endif // __GNUC__ //////////////////////////////////////////////////////////////////////////////// // Visual C++ #ifdef _MSC_VER #if (_MSC_VER >= 1600) #define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR #define CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR #endif #if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015)) #define CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT #define CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS #endif #endif // _MSC_VER //////////////////////////////////////////////////////////////////////////////// // C++ language feature support // catch all support for C++11 #if defined(__cplusplus) && __cplusplus >= 201103L #define CLARA_CPP11_OR_GREATER #if !defined(CLARA_INTERNAL_CONFIG_CPP11_NULLPTR) #define CLARA_INTERNAL_CONFIG_CPP11_NULLPTR #endif #ifndef CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT #define CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT #endif #ifndef CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS #define CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS #endif #if !defined(CLARA_INTERNAL_CONFIG_CPP11_OVERRIDE) #define CLARA_INTERNAL_CONFIG_CPP11_OVERRIDE #endif #if !defined(CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) #define CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR #endif #endif // __cplusplus >= 201103L // Now set the actual defines based on the above + anything the user has configured #if defined(CLARA_INTERNAL_CONFIG_CPP11_NULLPTR) && !defined(CLARA_CONFIG_CPP11_NO_NULLPTR) && !defined(CLARA_CONFIG_CPP11_NULLPTR) && !defined(CLARA_CONFIG_NO_CPP11) #define CLARA_CONFIG_CPP11_NULLPTR #endif #if defined(CLARA_INTERNAL_CONFIG_CPP11_NOEXCEPT) && !defined(CLARA_CONFIG_CPP11_NO_NOEXCEPT) && !defined(CLARA_CONFIG_CPP11_NOEXCEPT) && !defined(CLARA_CONFIG_NO_CPP11) #define CLARA_CONFIG_CPP11_NOEXCEPT #endif #if defined(CLARA_INTERNAL_CONFIG_CPP11_GENERATED_METHODS) && !defined(CLARA_CONFIG_CPP11_NO_GENERATED_METHODS) && !defined(CLARA_CONFIG_CPP11_GENERATED_METHODS) && !defined(CLARA_CONFIG_NO_CPP11) #define CLARA_CONFIG_CPP11_GENERATED_METHODS #endif #if defined(CLARA_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CLARA_CONFIG_NO_OVERRIDE) && !defined(CLARA_CONFIG_CPP11_OVERRIDE) && !defined(CLARA_CONFIG_NO_CPP11) #define CLARA_CONFIG_CPP11_OVERRIDE #endif #if defined(CLARA_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CLARA_CONFIG_NO_UNIQUE_PTR) && !defined(CLARA_CONFIG_CPP11_UNIQUE_PTR) && !defined(CLARA_CONFIG_NO_CPP11) #define CLARA_CONFIG_CPP11_UNIQUE_PTR #endif // noexcept support: #if defined(CLARA_CONFIG_CPP11_NOEXCEPT) && !defined(CLARA_NOEXCEPT) #define CLARA_NOEXCEPT noexcept # define CLARA_NOEXCEPT_IS(x) noexcept(x) #else #define CLARA_NOEXCEPT throw() # define CLARA_NOEXCEPT_IS(x) #endif // nullptr support #ifdef CLARA_CONFIG_CPP11_NULLPTR #define CLARA_NULL nullptr #else #define CLARA_NULL NULL #endif // override support #ifdef CLARA_CONFIG_CPP11_OVERRIDE #define CLARA_OVERRIDE override #else #define CLARA_OVERRIDE #endif // unique_ptr support #ifdef CLARA_CONFIG_CPP11_UNIQUE_PTR # define CLARA_AUTO_PTR( T ) std::unique_ptr<T> #else # define CLARA_AUTO_PTR( T ) std::auto_ptr<T> #endif #endif // TWOBLUECUBES_CLARA_COMPILERS_H_INCLUDED // ----------- end of #include from clara_compilers.h ----------- // ........... back in clara.h #include <map> #include <stdexcept> #include <memory> #if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) #define CLARA_PLATFORM_WINDOWS #endif // Use optional outer namespace #ifdef STITCH_CLARA_OPEN_NAMESPACE STITCH_CLARA_OPEN_NAMESPACE #endif namespace Clara { struct UnpositionalTag {}; extern UnpositionalTag _; #ifdef CLARA_CONFIG_MAIN UnpositionalTag _; #endif namespace Detail { #ifdef CLARA_CONSOLE_WIDTH const unsigned int consoleWidth = CLARA_CONFIG_CONSOLE_WIDTH; #else const unsigned int consoleWidth = 80; #endif using namespace Tbc; inline bool startsWith( std::string const& str, std::string const& prefix ) { return str.size() >= prefix.size() && str.substr( 0, prefix.size() ) == prefix; } template<typename T> struct RemoveConstRef{ typedef T type; }; template<typename T> struct RemoveConstRef<T&>{ typedef T type; }; template<typename T> struct RemoveConstRef<T const&>{ typedef T type; }; template<typename T> struct RemoveConstRef<T const>{ typedef T type; }; template<typename T> struct IsBool { static const bool value = false; }; template<> struct IsBool<bool> { static const bool value = true; }; template<typename T> void convertInto( std::string const& _source, T& _dest ) { std::stringstream ss; ss << _source; ss >> _dest; if( ss.fail() ) throw std::runtime_error( "Unable to convert " + _source + " to destination type" ); } inline void convertInto( std::string const& _source, std::string& _dest ) { _dest = _source; } char toLowerCh(char c) { return static_cast<char>( std::tolower( c ) ); } inline void convertInto( std::string const& _source, bool& _dest ) { std::string sourceLC = _source; std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), toLowerCh ); if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" ) _dest = true; else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" ) _dest = false; else throw std::runtime_error( "Expected a boolean value but did not recognise:\n '" + _source + "'" ); } template<typename ConfigT> struct IArgFunction { virtual ~IArgFunction() {} #ifdef CLARA_CONFIG_CPP11_GENERATED_METHODS IArgFunction() = default; IArgFunction( IArgFunction const& ) = default; #endif virtual void set( ConfigT& config, std::string const& value ) const = 0; virtual bool takesArg() const = 0; virtual IArgFunction* clone() const = 0; }; template<typename ConfigT> class BoundArgFunction { public: BoundArgFunction() : functionObj( CLARA_NULL ) {} BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {} BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CLARA_NULL ) {} BoundArgFunction& operator = ( BoundArgFunction const& other ) { IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CLARA_NULL; delete functionObj; functionObj = newFunctionObj; return *this; } ~BoundArgFunction() { delete functionObj; } void set( ConfigT& config, std::string const& value ) const { functionObj->set( config, value ); } bool takesArg() const { return functionObj->takesArg(); } bool isSet() const { return functionObj != CLARA_NULL; } private: IArgFunction<ConfigT>* functionObj; }; template<typename C> struct NullBinder : IArgFunction<C>{ virtual void set( C&, std::string const& ) const {} virtual bool takesArg() const { return true; } virtual IArgFunction<C>* clone() const { return new NullBinder( *this ); } }; template<typename C, typename M> struct BoundDataMember : IArgFunction<C>{ BoundDataMember( M C::* _member ) : member( _member ) {} virtual void set( C& p, std::string const& stringValue ) const { convertInto( stringValue, p.*member ); } virtual bool takesArg() const { return !IsBool<M>::value; } virtual IArgFunction<C>* clone() const { return new BoundDataMember( *this ); } M C::* member; }; template<typename C, typename M> struct BoundUnaryMethod : IArgFunction<C>{ BoundUnaryMethod( void (C::*_member)( M ) ) : member( _member ) {} virtual void set( C& p, std::string const& stringValue ) const { typename RemoveConstRef<M>::type value; convertInto( stringValue, value ); (p.*member)( value ); } virtual bool takesArg() const { return !IsBool<M>::value; } virtual IArgFunction<C>* clone() const { return new BoundUnaryMethod( *this ); } void (C::*member)( M ); }; template<typename C> struct BoundNullaryMethod : IArgFunction<C>{ BoundNullaryMethod( void (C::*_member)() ) : member( _member ) {} virtual void set( C& p, std::string const& stringValue ) const { bool value; convertInto( stringValue, value ); if( value ) (p.*member)(); } virtual bool takesArg() const { return false; } virtual IArgFunction<C>* clone() const { return new BoundNullaryMethod( *this ); } void (C::*member)(); }; template<typename C> struct BoundUnaryFunction : IArgFunction<C>{ BoundUnaryFunction( void (*_function)( C& ) ) : function( _function ) {} virtual void set( C& obj, std::string const& stringValue ) const { bool value; convertInto( stringValue, value ); if( value ) function( obj ); } virtual bool takesArg() const { return false; } virtual IArgFunction<C>* clone() const { return new BoundUnaryFunction( *this ); } void (*function)( C& ); }; template<typename C, typename T> struct BoundBinaryFunction : IArgFunction<C>{ BoundBinaryFunction( void (*_function)( C&, T ) ) : function( _function ) {} virtual void set( C& obj, std::string const& stringValue ) const { typename RemoveConstRef<T>::type value; convertInto( stringValue, value ); function( obj, value ); } virtual bool takesArg() const { return !IsBool<T>::value; } virtual IArgFunction<C>* clone() const { return new BoundBinaryFunction( *this ); } void (*function)( C&, T ); }; } // namespace Detail inline std::vector<std::string> argsToVector( int argc, char const* const* const argv ) { std::vector<std::string> args( static_cast<std::size_t>( argc ) ); for( std::size_t i = 0; i < static_cast<std::size_t>( argc ); ++i ) args[i] = argv[i]; return args; } class Parser { enum Mode { None, MaybeShortOpt, SlashOpt, ShortOpt, LongOpt, Positional }; Mode mode; std::size_t from; bool inQuotes; public: struct Token { enum Type { Positional, ShortOpt, LongOpt }; Token( Type _type, std::string const& _data ) : type( _type ), data( _data ) {} Type type; std::string data; }; Parser() : mode( None ), from( 0 ), inQuotes( false ){} void parseIntoTokens( std::vector<std::string> const& args, std::vector<Token>& tokens ) { const std::string doubleDash = "--"; for( std::size_t i = 1; i < args.size() && args[i] != doubleDash; ++i ) parseIntoTokens( args[i], tokens); } void parseIntoTokens( std::string const& arg, std::vector<Token>& tokens ) { for( std::size_t i = 0; i < arg.size(); ++i ) { char c = arg[i]; if( c == '"' ) inQuotes = !inQuotes; mode = handleMode( i, c, arg, tokens ); } mode = handleMode( arg.size(), '\0', arg, tokens ); } Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) { switch( mode ) { case None: return handleNone( i, c ); case MaybeShortOpt: return handleMaybeShortOpt( i, c ); case ShortOpt: case LongOpt: case SlashOpt: return handleOpt( i, c, arg, tokens ); case Positional: return handlePositional( i, c, arg, tokens ); default: throw std::logic_error( "Unknown mode" ); } } Mode handleNone( std::size_t i, char c ) { if( inQuotes ) { from = i; return Positional; } switch( c ) { case '-': return MaybeShortOpt; #ifdef CLARA_PLATFORM_WINDOWS case '/': from = i+1; return SlashOpt; #endif default: from = i; return Positional; } } Mode handleMaybeShortOpt( std::size_t i, char c ) { switch( c ) { case '-': from = i+1; return LongOpt; default: from = i; return ShortOpt; } } Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) { if( std::string( ":=\0", 3 ).find( c ) == std::string::npos ) return mode; std::string optName = arg.substr( from, i-from ); if( mode == ShortOpt ) for( std::size_t j = 0; j < optName.size(); ++j ) tokens.push_back( Token( Token::ShortOpt, optName.substr( j, 1 ) ) ); else if( mode == SlashOpt && optName.size() == 1 ) tokens.push_back( Token( Token::ShortOpt, optName ) ); else tokens.push_back( Token( Token::LongOpt, optName ) ); return None; } Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) { if( inQuotes || std::string( "\0", 1 ).find( c ) == std::string::npos ) return mode; std::string data = arg.substr( from, i-from ); tokens.push_back( Token( Token::Positional, data ) ); return None; } }; template<typename ConfigT> struct CommonArgProperties { CommonArgProperties() {} CommonArgProperties( Detail::BoundArgFunction<ConfigT> const& _boundField ) : boundField( _boundField ) {} Detail::BoundArgFunction<ConfigT> boundField; std::string description; std::string detail; std::string placeholder; // Only value if boundField takes an arg bool takesArg() const { return !placeholder.empty(); } void validate() const { if( !boundField.isSet() ) throw std::logic_error( "option not bound" ); } }; struct OptionArgProperties { std::vector<std::string> shortNames; std::string longName; bool hasShortName( std::string const& shortName ) const { return std::find( shortNames.begin(), shortNames.end(), shortName ) != shortNames.end(); } bool hasLongName( std::string const& _longName ) const { return _longName == longName; } }; struct PositionalArgProperties { PositionalArgProperties() : position( -1 ) {} int position; // -1 means non-positional (floating) bool isFixedPositional() const { return position != -1; } }; template<typename ConfigT> class CommandLine { struct Arg : CommonArgProperties<ConfigT>, OptionArgProperties, PositionalArgProperties { Arg() {} Arg( Detail::BoundArgFunction<ConfigT> const& _boundField ) : CommonArgProperties<ConfigT>( _boundField ) {} using CommonArgProperties<ConfigT>::placeholder; // !TBD std::string dbgName() const { if( !longName.empty() ) return "--" + longName; if( !shortNames.empty() ) return "-" + shortNames[0]; return "positional args"; } std::string commands() const { std::ostringstream oss; bool first = true; std::vector<std::string>::const_iterator it = shortNames.begin(), itEnd = shortNames.end(); for(; it != itEnd; ++it ) { if( first ) first = false; else oss << ", "; oss << "-" << *it; } if( !longName.empty() ) { if( !first ) oss << ", "; oss << "--" << longName; } if( !placeholder.empty() ) oss << " <" << placeholder << ">"; return oss.str(); } }; typedef CLARA_AUTO_PTR( Arg ) ArgAutoPtr; friend void addOptName( Arg& arg, std::string const& optName ) { if( optName.empty() ) return; if( Detail::startsWith( optName, "--" ) ) { if( !arg.longName.empty() ) throw std::logic_error( "Only one long opt may be specified. '" + arg.longName + "' already specified, now attempting to add '" + optName + "'" ); arg.longName = optName.substr( 2 ); } else if( Detail::startsWith( optName, "-" ) ) arg.shortNames.push_back( optName.substr( 1 ) ); else throw std::logic_error( "option must begin with - or --. Option was: '" + optName + "'" ); } friend void setPositionalArg( Arg& arg, int position ) { arg.position = position; } class ArgBuilder { public: ArgBuilder( Arg* arg ) : m_arg( arg ) {} // Bind a non-boolean data member (requires placeholder string) template<typename C, typename M> void bind( M C::* field, std::string const& placeholder ) { m_arg->boundField = new Detail::BoundDataMember<C,M>( field ); m_arg->placeholder = placeholder; } // Bind a boolean data member (no placeholder required) template<typename C> void bind( bool C::* field ) { m_arg->boundField = new Detail::BoundDataMember<C,bool>( field ); } // Bind a method taking a single, non-boolean argument (requires a placeholder string) template<typename C, typename M> void bind( void (C::* unaryMethod)( M ), std::string const& placeholder ) { m_arg->boundField = new Detail::BoundUnaryMethod<C,M>( unaryMethod ); m_arg->placeholder = placeholder; } // Bind a method taking a single, boolean argument (no placeholder string required) template<typename C> void bind( void (C::* unaryMethod)( bool ) ) { m_arg->boundField = new Detail::BoundUnaryMethod<C,bool>( unaryMethod ); } // Bind a method that takes no arguments (will be called if opt is present) template<typename C> void bind( void (C::* nullaryMethod)() ) { m_arg->boundField = new Detail::BoundNullaryMethod<C>( nullaryMethod ); } // Bind a free function taking a single argument - the object to operate on (no placeholder string required) template<typename C> void bind( void (* unaryFunction)( C& ) ) { m_arg->boundField = new Detail::BoundUnaryFunction<C>( unaryFunction ); } // Bind a free function taking a single argument - the object to operate on (requires a placeholder string) template<typename C, typename T> void bind( void (* binaryFunction)( C&, T ), std::string const& placeholder ) { m_arg->boundField = new Detail::BoundBinaryFunction<C, T>( binaryFunction ); m_arg->placeholder = placeholder; } ArgBuilder& describe( std::string const& description ) { m_arg->description = description; return *this; } ArgBuilder& detail( std::string const& detail ) { m_arg->detail = detail; return *this; } protected: Arg* m_arg; }; class OptBuilder : public ArgBuilder { public: OptBuilder( Arg* arg ) : ArgBuilder( arg ) {} OptBuilder( OptBuilder& other ) : ArgBuilder( other ) {} OptBuilder& operator[]( std::string const& optName ) { addOptName( *ArgBuilder::m_arg, optName ); return *this; } }; public: CommandLine() : m_boundProcessName( new Detail::NullBinder<ConfigT>() ), m_highestSpecifiedArgPosition( 0 ), m_throwOnUnrecognisedTokens( false ) {} CommandLine( CommandLine const& other ) : m_boundProcessName( other.m_boundProcessName ), m_options ( other.m_options ), m_positionalArgs( other.m_positionalArgs ), m_highestSpecifiedArgPosition( other.m_highestSpecifiedArgPosition ), m_throwOnUnrecognisedTokens( other.m_throwOnUnrecognisedTokens ) { if( other.m_floatingArg.get() ) m_floatingArg.reset( new Arg( *other.m_floatingArg ) ); } CommandLine& setThrowOnUnrecognisedTokens( bool shouldThrow = true ) { m_throwOnUnrecognisedTokens = shouldThrow; return *this; } OptBuilder operator[]( std::string const& optName ) { m_options.push_back( Arg() ); addOptName( m_options.back(), optName ); OptBuilder builder( &m_options.back() ); return builder; } ArgBuilder operator[]( int position ) { m_positionalArgs.insert( std::make_pair( position, Arg() ) ); if( position > m_highestSpecifiedArgPosition ) m_highestSpecifiedArgPosition = position; setPositionalArg( m_positionalArgs[position], position ); ArgBuilder builder( &m_positionalArgs[position] ); return builder; } // Invoke this with the _ instance ArgBuilder operator[]( UnpositionalTag ) { if( m_floatingArg.get() ) throw std::logic_error( "Only one unpositional argument can be added" ); m_floatingArg.reset( new Arg() ); ArgBuilder builder( m_floatingArg.get() ); return builder; } template<typename C, typename M> void bindProcessName( M C::* field ) { m_boundProcessName = new Detail::BoundDataMember<C,M>( field ); } template<typename C, typename M> void bindProcessName( void (C::*_unaryMethod)( M ) ) { m_boundProcessName = new Detail::BoundUnaryMethod<C,M>( _unaryMethod ); } void optUsage( std::ostream& os, std::size_t indent = 0, std::size_t width = Detail::consoleWidth ) const { typename std::vector<Arg>::const_iterator itBegin = m_options.begin(), itEnd = m_options.end(), it; std::size_t maxWidth = 0; for( it = itBegin; it != itEnd; ++it ) maxWidth = (std::max)( maxWidth, it->commands().size() ); for( it = itBegin; it != itEnd; ++it ) { Detail::Text usage( it->commands(), Detail::TextAttributes() .setWidth( maxWidth+indent ) .setIndent( indent ) ); Detail::Text desc( it->description, Detail::TextAttributes() .setWidth( width - maxWidth - 3 ) ); for( std::size_t i = 0; i < (std::max)( usage.size(), desc.size() ); ++i ) { std::string usageCol = i < usage.size() ? usage[i] : ""; os << usageCol; if( i < desc.size() && !desc[i].empty() ) os << std::string( indent + 2 + maxWidth - usageCol.size(), ' ' ) << desc[i]; os << "\n"; } } } std::string optUsage() const { std::ostringstream oss; optUsage( oss ); return oss.str(); } void argSynopsis( std::ostream& os ) const { for( int i = 1; i <= m_highestSpecifiedArgPosition; ++i ) { if( i > 1 ) os << " "; typename std::map<int, Arg>::const_iterator it = m_positionalArgs.find( i ); if( it != m_positionalArgs.end() ) os << "<" << it->second.placeholder << ">"; else if( m_floatingArg.get() ) os << "<" << m_floatingArg->placeholder << ">"; else throw std::logic_error( "non consecutive positional arguments with no floating args" ); } // !TBD No indication of mandatory args if( m_floatingArg.get() ) { if( m_highestSpecifiedArgPosition > 1 ) os << " "; os << "[<" << m_floatingArg->placeholder << "> ...]"; } } std::string argSynopsis() const { std::ostringstream oss; argSynopsis( oss ); return oss.str(); } void usage( std::ostream& os, std::string const& procName ) const { validate(); os << "usage:\n " << procName << " "; argSynopsis( os ); if( !m_options.empty() ) { os << " [options]\n\nwhere options are: \n"; optUsage( os, 2 ); } os << "\n"; } std::string usage( std::string const& procName ) const { std::ostringstream oss; usage( oss, procName ); return oss.str(); } ConfigT parse( std::vector<std::string> const& args ) const { ConfigT config; parseInto( args, config ); return config; } std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const { std::string processName = args.empty() ? std::string() : args[0]; std::size_t lastSlash = processName.find_last_of( "/\\" ); if( lastSlash != std::string::npos ) processName = processName.substr( lastSlash+1 ); m_boundProcessName.set( config, processName ); std::vector<Parser::Token> tokens; Parser parser; parser.parseIntoTokens( args, tokens ); return populate( tokens, config ); } std::vector<Parser::Token> populate( std::vector<Parser::Token> const& tokens, ConfigT& config ) const { validate(); std::vector<Parser::Token> unusedTokens = populateOptions( tokens, config ); unusedTokens = populateFixedArgs( unusedTokens, config ); unusedTokens = populateFloatingArgs( unusedTokens, config ); return unusedTokens; } std::vector<Parser::Token> populateOptions( std::vector<Parser::Token> const& tokens, ConfigT& config ) const { std::vector<Parser::Token> unusedTokens; std::vector<std::string> errors; for( std::size_t i = 0; i < tokens.size(); ++i ) { Parser::Token const& token = tokens[i]; typename std::vector<Arg>::const_iterator it = m_options.begin(), itEnd = m_options.end(); for(; it != itEnd; ++it ) { Arg const& arg = *it; try { if( ( token.type == Parser::Token::ShortOpt && arg.hasShortName( token.data ) ) || ( token.type == Parser::Token::LongOpt && arg.hasLongName( token.data ) ) ) { if( arg.takesArg() ) { if( i == tokens.size()-1 || tokens[i+1].type != Parser::Token::Positional ) errors.push_back( "Expected argument to option: " + token.data ); else arg.boundField.set( config, tokens[++i].data ); } else { arg.boundField.set( config, "true" ); } break; } } catch( std::exception& ex ) { errors.push_back( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" ); } } if( it == itEnd ) { if( token.type == Parser::Token::Positional || !m_throwOnUnrecognisedTokens ) unusedTokens.push_back( token ); else if( errors.empty() && m_throwOnUnrecognisedTokens ) errors.push_back( "unrecognised option: " + token.data ); } } if( !errors.empty() ) { std::ostringstream oss; for( std::vector<std::string>::const_iterator it = errors.begin(), itEnd = errors.end(); it != itEnd; ++it ) { if( it != errors.begin() ) oss << "\n"; oss << *it; } throw std::runtime_error( oss.str() ); } return unusedTokens; } std::vector<Parser::Token> populateFixedArgs( std::vector<Parser::Token> const& tokens, ConfigT& config ) const { std::vector<Parser::Token> unusedTokens; int position = 1; for( std::size_t i = 0; i < tokens.size(); ++i ) { Parser::Token const& token = tokens[i]; typename std::map<int, Arg>::const_iterator it = m_positionalArgs.find( position ); if( it != m_positionalArgs.end() ) it->second.boundField.set( config, token.data ); else unusedTokens.push_back( token ); if( token.type == Parser::Token::Positional ) position++; } return unusedTokens; } std::vector<Parser::Token> populateFloatingArgs( std::vector<Parser::Token> const& tokens, ConfigT& config ) const { if( !m_floatingArg.get() ) return tokens; std::vector<Parser::Token> unusedTokens; for( std::size_t i = 0; i < tokens.size(); ++i ) { Parser::Token const& token = tokens[i]; if( token.type == Parser::Token::Positional ) m_floatingArg->boundField.set( config, token.data ); else unusedTokens.push_back( token ); } return unusedTokens; } void validate() const { if( m_options.empty() && m_positionalArgs.empty() && !m_floatingArg.get() ) throw std::logic_error( "No options or arguments specified" ); for( typename std::vector<Arg>::const_iterator it = m_options.begin(), itEnd = m_options.end(); it != itEnd; ++it ) it->validate(); } private: Detail::BoundArgFunction<ConfigT> m_boundProcessName; std::vector<Arg> m_options; std::map<int, Arg> m_positionalArgs; ArgAutoPtr m_floatingArg; int m_highestSpecifiedArgPosition; bool m_throwOnUnrecognisedTokens; }; } // end namespace Clara STITCH_CLARA_CLOSE_NAMESPACE #undef STITCH_CLARA_OPEN_NAMESPACE #undef STITCH_CLARA_CLOSE_NAMESPACE #endif // TWOBLUECUBES_CLARA_H_INCLUDED #undef STITCH_CLARA_OPEN_NAMESPACE // Restore Clara's value for console width, if present #ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH #define CLARA_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH #undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH #endif #include <fstream> #include <ctime> namespace Catch { inline void abortAfterFirst( ConfigData& config ) { config.abortAfter = 1; } inline void abortAfterX( ConfigData& config, int x ) { if( x < 1 ) throw std::runtime_error( "Value after -x or --abortAfter must be greater than zero" ); config.abortAfter = x; } inline void addTestOrTags( ConfigData& config, std::string const& _testSpec ) { config.testsOrTags.push_back( _testSpec ); } inline void addSectionToRun( ConfigData& config, std::string const& sectionName ) { config.sectionsToRun.push_back( sectionName ); } inline void addReporterName( ConfigData& config, std::string const& _reporterName ) { config.reporterNames.push_back( _reporterName ); } inline void addWarning( ConfigData& config, std::string const& _warning ) { if( _warning == "NoAssertions" ) config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions ); else throw std::runtime_error( "Unrecognised warning: '" + _warning + '\'' ); } inline void setOrder( ConfigData& config, std::string const& order ) { if( startsWith( "declared", order ) ) config.runOrder = RunTests::InDeclarationOrder; else if( startsWith( "lexical", order ) ) config.runOrder = RunTests::InLexicographicalOrder; else if( startsWith( "random", order ) ) config.runOrder = RunTests::InRandomOrder; else throw std::runtime_error( "Unrecognised ordering: '" + order + '\'' ); } inline void setRngSeed( ConfigData& config, std::string const& seed ) { if( seed == "time" ) { config.rngSeed = static_cast<unsigned int>( std::time(0) ); } else { std::stringstream ss; ss << seed; ss >> config.rngSeed; if( ss.fail() ) throw std::runtime_error( "Argument to --rng-seed should be the word 'time' or a number" ); } } inline void setVerbosity( ConfigData& config, int level ) { // !TBD: accept strings? config.verbosity = static_cast<Verbosity::Level>( level ); } inline void setShowDurations( ConfigData& config, bool _showDurations ) { config.showDurations = _showDurations ? ShowDurations::Always : ShowDurations::Never; } inline void setUseColour( ConfigData& config, std::string const& value ) { std::string mode = toLower( value ); if( mode == "yes" ) config.useColour = UseColour::Yes; else if( mode == "no" ) config.useColour = UseColour::No; else if( mode == "auto" ) config.useColour = UseColour::Auto; else throw std::runtime_error( "colour mode must be one of: auto, yes or no" ); } inline void forceColour( ConfigData& config ) { config.useColour = UseColour::Yes; } inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) { std::ifstream f( _filename.c_str() ); if( !f.is_open() ) throw std::domain_error( "Unable to load input file: " + _filename ); std::string line; while( std::getline( f, line ) ) { line = trim(line); if( !line.empty() && !startsWith( line, '#' ) ) { if( !startsWith( line, '"' ) ) line = '"' + line + '"'; addTestOrTags( config, line + ',' ); } } } inline Clara::CommandLine<ConfigData> makeCommandLineParser() { using namespace Clara; CommandLine<ConfigData> cli; cli.bindProcessName( &ConfigData::processName ); cli["-?"]["-h"]["--help"] .describe( "display usage information" ) .bind( &ConfigData::showHelp ); cli["-l"]["--list-tests"] .describe( "list all/matching test cases" ) .bind( &ConfigData::listTests ); cli["-t"]["--list-tags"] .describe( "list all/matching tags" ) .bind( &ConfigData::listTags ); cli["-s"]["--success"] .describe( "include successful tests in output" ) .bind( &ConfigData::showSuccessfulTests ); cli["-b"]["--break"] .describe( "break into debugger on failure" ) .bind( &ConfigData::shouldDebugBreak ); cli["-e"]["--nothrow"] .describe( "skip exception tests" ) .bind( &ConfigData::noThrow ); cli["-i"]["--invisibles"] .describe( "show invisibles (tabs, newlines)" ) .bind( &ConfigData::showInvisibles ); cli["-o"]["--out"] .describe( "output filename" ) .bind( &ConfigData::outputFilename, "filename" ); cli["-r"]["--reporter"] // .placeholder( "name[:filename]" ) .describe( "reporter to use (defaults to console)" ) .bind( &addReporterName, "name" ); cli["-n"]["--name"] .describe( "suite name" ) .bind( &ConfigData::name, "name" ); cli["-a"]["--abort"] .describe( "abort at first failure" ) .bind( &abortAfterFirst ); cli["-x"]["--abortx"] .describe( "abort after x failures" ) .bind( &abortAfterX, "no. failures" ); cli["-w"]["--warn"] .describe( "enable warnings" ) .bind( &addWarning, "warning name" ); // - needs updating if reinstated // cli.into( &setVerbosity ) // .describe( "level of verbosity (0=no output)" ) // .shortOpt( "v") // .longOpt( "verbosity" ) // .placeholder( "level" ); cli[_] .describe( "which test or tests to use" ) .bind( &addTestOrTags, "test name, pattern or tags" ); cli["-d"]["--durations"] .describe( "show test durations" ) .bind( &setShowDurations, "yes|no" ); cli["-f"]["--input-file"] .describe( "load test names to run from a file" ) .bind( &loadTestNamesFromFile, "filename" ); cli["-#"]["--filenames-as-tags"] .describe( "adds a tag for the filename" ) .bind( &ConfigData::filenamesAsTags ); cli["-c"]["--section"] .describe( "specify section to run" ) .bind( &addSectionToRun, "section name" ); // Less common commands which don't have a short form cli["--list-test-names-only"] .describe( "list all/matching test cases names only" ) .bind( &ConfigData::listTestNamesOnly ); cli["--list-extra-info"] .describe( "list all/matching test cases with more info" ) .bind( &ConfigData::listExtraInfo ); cli["--list-reporters"] .describe( "list all reporters" ) .bind( &ConfigData::listReporters ); cli["--order"] .describe( "test case order (defaults to decl)" ) .bind( &setOrder, "decl|lex|rand" ); cli["--rng-seed"] .describe( "set a specific seed for random numbers" ) .bind( &setRngSeed, "'time'|number" ); cli["--force-colour"] .describe( "force colourised output (deprecated)" ) .bind( &forceColour ); cli["--use-colour"] .describe( "should output be colourised" ) .bind( &setUseColour, "yes|no" ); return cli; } } // end namespace Catch // #included from: internal/catch_list.hpp #define TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED // #included from: catch_text.h #define TWOBLUECUBES_CATCH_TEXT_H_INCLUDED #define TBC_TEXT_FORMAT_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH #define CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE Catch // #included from: ../external/tbc_text_format.h // Only use header guard if we are not using an outer namespace #ifndef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE # ifdef TWOBLUECUBES_TEXT_FORMAT_H_INCLUDED # ifndef TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED # define TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED # endif # else # define TWOBLUECUBES_TEXT_FORMAT_H_INCLUDED # endif #endif #ifndef TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED #include <string> #include <vector> #include <sstream> // Use optional outer namespace #ifdef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE namespace CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE { #endif namespace Tbc { #ifdef TBC_TEXT_FORMAT_CONSOLE_WIDTH const unsigned int consoleWidth = TBC_TEXT_FORMAT_CONSOLE_WIDTH; #else const unsigned int consoleWidth = 80; #endif struct TextAttributes { TextAttributes() : initialIndent( std::string::npos ), indent( 0 ), width( consoleWidth-1 ) {} TextAttributes& setInitialIndent( std::size_t _value ) { initialIndent = _value; return *this; } TextAttributes& setIndent( std::size_t _value ) { indent = _value; return *this; } TextAttributes& setWidth( std::size_t _value ) { width = _value; return *this; } std::size_t initialIndent; // indent of first line, or npos std::size_t indent; // indent of subsequent lines, or all if initialIndent is npos std::size_t width; // maximum width of text, including indent. Longer text will wrap }; class Text { public: Text( std::string const& _str, TextAttributes const& _attr = TextAttributes() ) : attr( _attr ) { const std::string wrappableBeforeChars = "[({<\t"; const std::string wrappableAfterChars = "])}>-,./|\\"; const std::string wrappableInsteadOfChars = " \n\r"; std::string indent = _attr.initialIndent != std::string::npos ? std::string( _attr.initialIndent, ' ' ) : std::string( _attr.indent, ' ' ); typedef std::string::const_iterator iterator; iterator it = _str.begin(); const iterator strEnd = _str.end(); while( it != strEnd ) { if( lines.size() >= 1000 ) { lines.push_back( "... message truncated due to excessive size" ); return; } std::string suffix; std::size_t width = (std::min)( static_cast<size_t>( strEnd-it ), _attr.width-static_cast<size_t>( indent.size() ) ); iterator itEnd = it+width; iterator itNext = _str.end(); iterator itNewLine = std::find( it, itEnd, '\n' ); if( itNewLine != itEnd ) itEnd = itNewLine; if( itEnd != strEnd ) { bool foundWrapPoint = false; iterator findIt = itEnd; do { if( wrappableAfterChars.find( *findIt ) != std::string::npos && findIt != itEnd ) { itEnd = findIt+1; itNext = findIt+1; foundWrapPoint = true; } else if( findIt > it && wrappableBeforeChars.find( *findIt ) != std::string::npos ) { itEnd = findIt; itNext = findIt; foundWrapPoint = true; } else if( wrappableInsteadOfChars.find( *findIt ) != std::string::npos ) { itNext = findIt+1; itEnd = findIt; foundWrapPoint = true; } if( findIt == it ) break; else --findIt; } while( !foundWrapPoint ); if( !foundWrapPoint ) { // No good wrap char, so we'll break mid word and add a hyphen --itEnd; itNext = itEnd; suffix = "-"; } else { while( itEnd > it && wrappableInsteadOfChars.find( *(itEnd-1) ) != std::string::npos ) --itEnd; } } lines.push_back( indent + std::string( it, itEnd ) + suffix ); if( indent.size() != _attr.indent ) indent = std::string( _attr.indent, ' ' ); it = itNext; } } typedef std::vector<std::string>::const_iterator const_iterator; const_iterator begin() const { return lines.begin(); } const_iterator end() const { return lines.end(); } std::string const& last() const { return lines.back(); } std::size_t size() const { return lines.size(); } std::string const& operator[]( std::size_t _index ) const { return lines[_index]; } std::string toString() const { std::ostringstream oss; oss << *this; return oss.str(); } inline friend std::ostream& operator << ( std::ostream& _stream, Text const& _text ) { for( Text::const_iterator it = _text.begin(), itEnd = _text.end(); it != itEnd; ++it ) { if( it != _text.begin() ) _stream << "\n"; _stream << *it; } return _stream; } private: std::string str; TextAttributes attr; std::vector<std::string> lines; }; } // end namespace Tbc #ifdef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE } // end outer namespace #endif #endif // TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED #undef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE namespace Catch { using Tbc::Text; using Tbc::TextAttributes; } // #included from: catch_console_colour.hpp #define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED namespace Catch { struct Colour { enum Code { None = 0, White, Red, Green, Blue, Cyan, Yellow, Grey, Bright = 0x10, BrightRed = Bright | Red, BrightGreen = Bright | Green, LightGrey = Bright | Grey, BrightWhite = Bright | White, // By intention FileName = LightGrey, Warning = Yellow, ResultError = BrightRed, ResultSuccess = BrightGreen, ResultExpectedFailure = Warning, Error = BrightRed, Success = Green, OriginalExpression = Cyan, ReconstructedExpression = Yellow, SecondaryText = LightGrey, Headers = White }; // Use constructed object for RAII guard Colour( Code _colourCode ); Colour( Colour const& other ); ~Colour(); // Use static method for one-shot changes static void use( Code _colourCode ); private: bool m_moved; }; inline std::ostream& operator << ( std::ostream& os, Colour const& ) { return os; } } // end namespace Catch // #included from: catch_interfaces_reporter.h #define TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED #include <string> #include <ostream> #include <map> namespace Catch { struct ReporterConfig { explicit ReporterConfig( Ptr<IConfig const> const& _fullConfig ) : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} ReporterConfig( Ptr<IConfig const> const& _fullConfig, std::ostream& _stream ) : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} std::ostream& stream() const { return *m_stream; } Ptr<IConfig const> fullConfig() const { return m_fullConfig; } private: std::ostream* m_stream; Ptr<IConfig const> m_fullConfig; }; struct ReporterPreferences { ReporterPreferences() : shouldRedirectStdOut( false ) {} bool shouldRedirectStdOut; }; template<typename T> struct LazyStat : Option<T> { LazyStat() : used( false ) {} LazyStat& operator=( T const& _value ) { Option<T>::operator=( _value ); used = false; return *this; } void reset() { Option<T>::reset(); used = false; } bool used; }; struct TestRunInfo { TestRunInfo( std::string const& _name ) : name( _name ) {} std::string name; }; struct GroupInfo { GroupInfo( std::string const& _name, std::size_t _groupIndex, std::size_t _groupsCount ) : name( _name ), groupIndex( _groupIndex ), groupsCounts( _groupsCount ) {} std::string name; std::size_t groupIndex; std::size_t groupsCounts; }; struct AssertionStats { AssertionStats( AssertionResult const& _assertionResult, std::vector<MessageInfo> const& _infoMessages, Totals const& _totals ) : assertionResult( _assertionResult ), infoMessages( _infoMessages ), totals( _totals ) { if( assertionResult.hasMessage() ) { // Copy message into messages list. // !TBD This should have been done earlier, somewhere MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); builder << assertionResult.getMessage(); builder.m_info.message = builder.m_stream.str(); infoMessages.push_back( builder.m_info ); } } virtual ~AssertionStats(); # ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS AssertionStats( AssertionStats const& ) = default; AssertionStats( AssertionStats && ) = default; AssertionStats& operator = ( AssertionStats const& ) = default; AssertionStats& operator = ( AssertionStats && ) = default; # endif AssertionResult assertionResult; std::vector<MessageInfo> infoMessages; Totals totals; }; struct SectionStats { SectionStats( SectionInfo const& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ) : sectionInfo( _sectionInfo ), assertions( _assertions ), durationInSeconds( _durationInSeconds ), missingAssertions( _missingAssertions ) {} virtual ~SectionStats(); # ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS SectionStats( SectionStats const& ) = default; SectionStats( SectionStats && ) = default; SectionStats& operator = ( SectionStats const& ) = default; SectionStats& operator = ( SectionStats && ) = default; # endif SectionInfo sectionInfo; Counts assertions; double durationInSeconds; bool missingAssertions; }; struct TestCaseStats { TestCaseStats( TestCaseInfo const& _testInfo, Totals const& _totals, std::string const& _stdOut, std::string const& _stdErr, bool _aborting ) : testInfo( _testInfo ), totals( _totals ), stdOut( _stdOut ), stdErr( _stdErr ), aborting( _aborting ) {} virtual ~TestCaseStats(); # ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS TestCaseStats( TestCaseStats const& ) = default; TestCaseStats( TestCaseStats && ) = default; TestCaseStats& operator = ( TestCaseStats const& ) = default; TestCaseStats& operator = ( TestCaseStats && ) = default; # endif TestCaseInfo testInfo; Totals totals; std::string stdOut; std::string stdErr; bool aborting; }; struct TestGroupStats { TestGroupStats( GroupInfo const& _groupInfo, Totals const& _totals, bool _aborting ) : groupInfo( _groupInfo ), totals( _totals ), aborting( _aborting ) {} TestGroupStats( GroupInfo const& _groupInfo ) : groupInfo( _groupInfo ), aborting( false ) {} virtual ~TestGroupStats(); # ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS TestGroupStats( TestGroupStats const& ) = default; TestGroupStats( TestGroupStats && ) = default; TestGroupStats& operator = ( TestGroupStats const& ) = default; TestGroupStats& operator = ( TestGroupStats && ) = default; # endif GroupInfo groupInfo; Totals totals; bool aborting; }; struct TestRunStats { TestRunStats( TestRunInfo const& _runInfo, Totals const& _totals, bool _aborting ) : runInfo( _runInfo ), totals( _totals ), aborting( _aborting ) {} virtual ~TestRunStats(); # ifndef CATCH_CONFIG_CPP11_GENERATED_METHODS TestRunStats( TestRunStats const& _other ) : runInfo( _other.runInfo ), totals( _other.totals ), aborting( _other.aborting ) {} # else TestRunStats( TestRunStats const& ) = default; TestRunStats( TestRunStats && ) = default; TestRunStats& operator = ( TestRunStats const& ) = default; TestRunStats& operator = ( TestRunStats && ) = default; # endif TestRunInfo runInfo; Totals totals; bool aborting; }; class MultipleReporters; struct IStreamingReporter : IShared { virtual ~IStreamingReporter(); // Implementing class must also provide the following static method: // static std::string getDescription(); virtual ReporterPreferences getPreferences() const = 0; virtual void noMatchingTestCases( std::string const& spec ) = 0; virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; // The return value indicates if the messages buffer should be cleared: virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; virtual void sectionEnded( SectionStats const& sectionStats ) = 0; virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; virtual void skipTest( TestCaseInfo const& testInfo ) = 0; virtual MultipleReporters* tryAsMulti() { return CATCH_NULL; } }; struct IReporterFactory : IShared { virtual ~IReporterFactory(); virtual IStreamingReporter* create( ReporterConfig const& config ) const = 0; virtual std::string getDescription() const = 0; }; struct IReporterRegistry { typedef std::map<std::string, Ptr<IReporterFactory> > FactoryMap; typedef std::vector<Ptr<IReporterFactory> > Listeners; virtual ~IReporterRegistry(); virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig const> const& config ) const = 0; virtual FactoryMap const& getFactories() const = 0; virtual Listeners const& getListeners() const = 0; }; Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ); } #include <limits> #include <algorithm> namespace Catch { inline std::size_t listTests( Config const& config ) { TestSpec testSpec = config.testSpec(); if( config.testSpec().hasFilters() ) Catch::cout() << "Matching test cases:\n"; else { Catch::cout() << "All available test cases:\n"; testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); } std::size_t matchedTests = 0; TextAttributes nameAttr, descAttr, tagsAttr; nameAttr.setInitialIndent( 2 ).setIndent( 4 ); descAttr.setIndent( 4 ); tagsAttr.setIndent( 6 ); std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end(); it != itEnd; ++it ) { matchedTests++; TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); Colour::Code colour = testCaseInfo.isHidden() ? Colour::SecondaryText : Colour::None; Colour colourGuard( colour ); Catch::cout() << Text( testCaseInfo.name, nameAttr ) << std::endl; if( config.listExtraInfo() ) { Catch::cout() << " " << testCaseInfo.lineInfo << std::endl; std::string description = testCaseInfo.description; if( description.empty() ) description = "(NO DESCRIPTION)"; Catch::cout() << Text( description, descAttr ) << std::endl; } if( !testCaseInfo.tags.empty() ) Catch::cout() << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl; } if( !config.testSpec().hasFilters() ) Catch::cout() << pluralise( matchedTests, "test case" ) << '\n' << std::endl; else Catch::cout() << pluralise( matchedTests, "matching test case" ) << '\n' << std::endl; return matchedTests; } inline std::size_t listTestsNamesOnly( Config const& config ) { TestSpec testSpec = config.testSpec(); if( !config.testSpec().hasFilters() ) testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); std::size_t matchedTests = 0; std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end(); it != itEnd; ++it ) { matchedTests++; TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); if( startsWith( testCaseInfo.name, '#' ) ) Catch::cout() << '"' << testCaseInfo.name << '"'; else Catch::cout() << testCaseInfo.name; if ( config.listExtraInfo() ) Catch::cout() << "\t@" << testCaseInfo.lineInfo; Catch::cout() << std::endl; } return matchedTests; } struct TagInfo { TagInfo() : count ( 0 ) {} void add( std::string const& spelling ) { ++count; spellings.insert( spelling ); } std::string all() const { std::string out; for( std::set<std::string>::const_iterator it = spellings.begin(), itEnd = spellings.end(); it != itEnd; ++it ) out += "[" + *it + "]"; return out; } std::set<std::string> spellings; std::size_t count; }; inline std::size_t listTags( Config const& config ) { TestSpec testSpec = config.testSpec(); if( config.testSpec().hasFilters() ) Catch::cout() << "Tags for matching test cases:\n"; else { Catch::cout() << "All available tags:\n"; testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); } std::map<std::string, TagInfo> tagCounts; std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end(); it != itEnd; ++it ) { for( std::set<std::string>::const_iterator tagIt = it->getTestCaseInfo().tags.begin(), tagItEnd = it->getTestCaseInfo().tags.end(); tagIt != tagItEnd; ++tagIt ) { std::string tagName = *tagIt; std::string lcaseTagName = toLower( tagName ); std::map<std::string, TagInfo>::iterator countIt = tagCounts.find( lcaseTagName ); if( countIt == tagCounts.end() ) countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; countIt->second.add( tagName ); } } for( std::map<std::string, TagInfo>::const_iterator countIt = tagCounts.begin(), countItEnd = tagCounts.end(); countIt != countItEnd; ++countIt ) { std::ostringstream oss; oss << " " << std::setw(2) << countIt->second.count << " "; Text wrapper( countIt->second.all(), TextAttributes() .setInitialIndent( 0 ) .setIndent( oss.str().size() ) .setWidth( CATCH_CONFIG_CONSOLE_WIDTH-10 ) ); Catch::cout() << oss.str() << wrapper << '\n'; } Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; return tagCounts.size(); } inline std::size_t listReporters( Config const& /*config*/ ) { Catch::cout() << "Available reporters:\n"; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it; std::size_t maxNameLen = 0; for(it = itBegin; it != itEnd; ++it ) maxNameLen = (std::max)( maxNameLen, it->first.size() ); for(it = itBegin; it != itEnd; ++it ) { Text wrapper( it->second->getDescription(), TextAttributes() .setInitialIndent( 0 ) .setIndent( 7+maxNameLen ) .setWidth( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) ); Catch::cout() << " " << it->first << ':' << std::string( maxNameLen - it->first.size() + 2, ' ' ) << wrapper << '\n'; } Catch::cout() << std::endl; return factories.size(); } inline Option<std::size_t> list( Config const& config ) { Option<std::size_t> listedCount; if( config.listTests() || ( config.listExtraInfo() && !config.listTestNamesOnly() ) ) listedCount = listedCount.valueOr(0) + listTests( config ); if( config.listTestNamesOnly() ) listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config ); if( config.listTags() ) listedCount = listedCount.valueOr(0) + listTags( config ); if( config.listReporters() ) listedCount = listedCount.valueOr(0) + listReporters( config ); return listedCount; } } // end namespace Catch // #included from: internal/catch_run_context.hpp #define TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED // #included from: catch_test_case_tracker.hpp #define TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED #include <algorithm> #include <string> #include <assert.h> #include <vector> #include <stdexcept> CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS namespace Catch { namespace TestCaseTracking { struct NameAndLocation { std::string name; SourceLineInfo location; NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) : name( _name ), location( _location ) {} }; struct ITracker : SharedImpl<> { virtual ~ITracker(); // static queries virtual NameAndLocation const& nameAndLocation() const = 0; // dynamic queries virtual bool isComplete() const = 0; // Successfully completed or failed virtual bool isSuccessfullyCompleted() const = 0; virtual bool isOpen() const = 0; // Started but not complete virtual bool hasChildren() const = 0; virtual ITracker& parent() = 0; // actions virtual void close() = 0; // Successfully complete virtual void fail() = 0; virtual void markAsNeedingAnotherRun() = 0; virtual void addChild( Ptr<ITracker> const& child ) = 0; virtual ITracker* findChild( NameAndLocation const& nameAndLocation ) = 0; virtual void openChild() = 0; // Debug/ checking virtual bool isSectionTracker() const = 0; virtual bool isIndexTracker() const = 0; }; class TrackerContext { enum RunState { NotStarted, Executing, CompletedCycle }; Ptr<ITracker> m_rootTracker; ITracker* m_currentTracker; RunState m_runState; public: static TrackerContext& instance() { static TrackerContext s_instance; return s_instance; } TrackerContext() : m_currentTracker( CATCH_NULL ), m_runState( NotStarted ) {} ITracker& startRun(); void endRun() { m_rootTracker.reset(); m_currentTracker = CATCH_NULL; m_runState = NotStarted; } void startCycle() { m_currentTracker = m_rootTracker.get(); m_runState = Executing; } void completeCycle() { m_runState = CompletedCycle; } bool completedCycle() const { return m_runState == CompletedCycle; } ITracker& currentTracker() { return *m_currentTracker; } void setCurrentTracker( ITracker* tracker ) { m_currentTracker = tracker; } }; class TrackerBase : public ITracker { protected: enum CycleState { NotStarted, Executing, ExecutingChildren, NeedsAnotherRun, CompletedSuccessfully, Failed }; class TrackerHasName { NameAndLocation m_nameAndLocation; public: TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {} bool operator ()( Ptr<ITracker> const& tracker ) { return tracker->nameAndLocation().name == m_nameAndLocation.name && tracker->nameAndLocation().location == m_nameAndLocation.location; } }; typedef std::vector<Ptr<ITracker> > Children; NameAndLocation m_nameAndLocation; TrackerContext& m_ctx; ITracker* m_parent; Children m_children; CycleState m_runState; public: TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) : m_nameAndLocation( nameAndLocation ), m_ctx( ctx ), m_parent( parent ), m_runState( NotStarted ) {} virtual ~TrackerBase(); virtual NameAndLocation const& nameAndLocation() const CATCH_OVERRIDE { return m_nameAndLocation; } virtual bool isComplete() const CATCH_OVERRIDE { return m_runState == CompletedSuccessfully || m_runState == Failed; } virtual bool isSuccessfullyCompleted() const CATCH_OVERRIDE { return m_runState == CompletedSuccessfully; } virtual bool isOpen() const CATCH_OVERRIDE { return m_runState != NotStarted && !isComplete(); } virtual bool hasChildren() const CATCH_OVERRIDE { return !m_children.empty(); } virtual void addChild( Ptr<ITracker> const& child ) CATCH_OVERRIDE { m_children.push_back( child ); } virtual ITracker* findChild( NameAndLocation const& nameAndLocation ) CATCH_OVERRIDE { Children::const_iterator it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) ); return( it != m_children.end() ) ? it->get() : CATCH_NULL; } virtual ITracker& parent() CATCH_OVERRIDE { assert( m_parent ); // Should always be non-null except for root return *m_parent; } virtual void openChild() CATCH_OVERRIDE { if( m_runState != ExecutingChildren ) { m_runState = ExecutingChildren; if( m_parent ) m_parent->openChild(); } } virtual bool isSectionTracker() const CATCH_OVERRIDE { return false; } virtual bool isIndexTracker() const CATCH_OVERRIDE { return false; } void open() { m_runState = Executing; moveToThis(); if( m_parent ) m_parent->openChild(); } virtual void close() CATCH_OVERRIDE { // Close any still open children (e.g. generators) while( &m_ctx.currentTracker() != this ) m_ctx.currentTracker().close(); switch( m_runState ) { case NotStarted: case CompletedSuccessfully: case Failed: throw std::logic_error( "Illogical state" ); case NeedsAnotherRun: break;; case Executing: m_runState = CompletedSuccessfully; break; case ExecutingChildren: if( m_children.empty() || m_children.back()->isComplete() ) m_runState = CompletedSuccessfully; break; default: throw std::logic_error( "Unexpected state" ); } moveToParent(); m_ctx.completeCycle(); } virtual void fail() CATCH_OVERRIDE { m_runState = Failed; if( m_parent ) m_parent->markAsNeedingAnotherRun(); moveToParent(); m_ctx.completeCycle(); } virtual void markAsNeedingAnotherRun() CATCH_OVERRIDE { m_runState = NeedsAnotherRun; } private: void moveToParent() { assert( m_parent ); m_ctx.setCurrentTracker( m_parent ); } void moveToThis() { m_ctx.setCurrentTracker( this ); } }; class SectionTracker : public TrackerBase { std::vector<std::string> m_filters; public: SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) : TrackerBase( nameAndLocation, ctx, parent ) { if( parent ) { while( !parent->isSectionTracker() ) parent = &parent->parent(); SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); addNextFilters( parentSection.m_filters ); } } virtual ~SectionTracker(); virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; } static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { SectionTracker* section = CATCH_NULL; ITracker& currentTracker = ctx.currentTracker(); if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { assert( childTracker ); assert( childTracker->isSectionTracker() ); section = static_cast<SectionTracker*>( childTracker ); } else { section = new SectionTracker( nameAndLocation, ctx, &currentTracker ); currentTracker.addChild( section ); } if( !ctx.completedCycle() ) section->tryOpen(); return *section; } void tryOpen() { if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) ) open(); } void addInitialFilters( std::vector<std::string> const& filters ) { if( !filters.empty() ) { m_filters.push_back(""); // Root - should never be consulted m_filters.push_back(""); // Test Case - not a section filter m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); } } void addNextFilters( std::vector<std::string> const& filters ) { if( filters.size() > 1 ) m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() ); } }; class IndexTracker : public TrackerBase { int m_size; int m_index; public: IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ) : TrackerBase( nameAndLocation, ctx, parent ), m_size( size ), m_index( -1 ) {} virtual ~IndexTracker(); virtual bool isIndexTracker() const CATCH_OVERRIDE { return true; } static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) { IndexTracker* tracker = CATCH_NULL; ITracker& currentTracker = ctx.currentTracker(); if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { assert( childTracker ); assert( childTracker->isIndexTracker() ); tracker = static_cast<IndexTracker*>( childTracker ); } else { tracker = new IndexTracker( nameAndLocation, ctx, &currentTracker, size ); currentTracker.addChild( tracker ); } if( !ctx.completedCycle() && !tracker->isComplete() ) { if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun ) tracker->moveNext(); tracker->open(); } return *tracker; } int index() const { return m_index; } void moveNext() { m_index++; m_children.clear(); } virtual void close() CATCH_OVERRIDE { TrackerBase::close(); if( m_runState == CompletedSuccessfully && m_index < m_size-1 ) m_runState = Executing; } }; inline ITracker& TrackerContext::startRun() { m_rootTracker = new SectionTracker( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, CATCH_NULL ); m_currentTracker = CATCH_NULL; m_runState = Executing; return *m_rootTracker; } } // namespace TestCaseTracking using TestCaseTracking::ITracker; using TestCaseTracking::TrackerContext; using TestCaseTracking::SectionTracker; using TestCaseTracking::IndexTracker; } // namespace Catch CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS // #included from: catch_fatal_condition.hpp #define TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED namespace Catch { // Report the error condition inline void reportFatal( std::string const& message ) { IContext& context = Catch::getCurrentContext(); IResultCapture* resultCapture = context.getResultCapture(); resultCapture->handleFatalErrorCondition( message ); } } // namespace Catch #if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// // #included from: catch_windows_h_proxy.h #define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED #ifdef CATCH_DEFINES_NOMINMAX # define NOMINMAX #endif #ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN #endif #ifdef __AFXDLL #include <AfxWin.h> #else #include <windows.h> #endif #ifdef CATCH_DEFINES_NOMINMAX # undef NOMINMAX #endif #ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN # undef WIN32_LEAN_AND_MEAN #endif # if !defined ( CATCH_CONFIG_WINDOWS_SEH ) namespace Catch { struct FatalConditionHandler { void reset() {} }; } # else // CATCH_CONFIG_WINDOWS_SEH is defined namespace Catch { struct SignalDefs { DWORD id; const char* name; }; extern SignalDefs signalDefs[]; // There is no 1-1 mapping between signals and windows exceptions. // Windows can easily distinguish between SO and SigSegV, // but SigInt, SigTerm, etc are handled differently. SignalDefs signalDefs[] = { { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" }, }; struct FatalConditionHandler { static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) { if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) { reportFatal(signalDefs[i].name); } } // If its not an exception we care about, pass it along. // This stops us from eating debugger breaks etc. return EXCEPTION_CONTINUE_SEARCH; } FatalConditionHandler() { isSet = true; // 32k seems enough for Catch to handle stack overflow, // but the value was found experimentally, so there is no strong guarantee guaranteeSize = 32 * 1024; exceptionHandlerHandle = CATCH_NULL; // Register as first handler in current chain exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); // Pass in guarantee size to be filled SetThreadStackGuarantee(&guaranteeSize); } static void reset() { if (isSet) { // Unregister handler and restore the old guarantee RemoveVectoredExceptionHandler(exceptionHandlerHandle); SetThreadStackGuarantee(&guaranteeSize); exceptionHandlerHandle = CATCH_NULL; isSet = false; } } ~FatalConditionHandler() { reset(); } private: static bool isSet; static ULONG guaranteeSize; static PVOID exceptionHandlerHandle; }; bool FatalConditionHandler::isSet = false; ULONG FatalConditionHandler::guaranteeSize = 0; PVOID FatalConditionHandler::exceptionHandlerHandle = CATCH_NULL; } // namespace Catch # endif // CATCH_CONFIG_WINDOWS_SEH #else // Not Windows - assumed to be POSIX compatible ////////////////////////// # if !defined(CATCH_CONFIG_POSIX_SIGNALS) namespace Catch { struct FatalConditionHandler { void reset() {} }; } # else // CATCH_CONFIG_POSIX_SIGNALS is defined #include <signal.h> namespace Catch { struct SignalDefs { int id; const char* name; }; extern SignalDefs signalDefs[]; SignalDefs signalDefs[] = { { SIGINT, "SIGINT - Terminal interrupt signal" }, { SIGILL, "SIGILL - Illegal instruction signal" }, { SIGFPE, "SIGFPE - Floating point error signal" }, { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, { SIGTERM, "SIGTERM - Termination request signal" }, { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } }; struct FatalConditionHandler { static bool isSet; static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)]; static stack_t oldSigStack; static char altStackMem[SIGSTKSZ]; static void handleSignal( int sig ) { std::string name = "<unknown signal>"; for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) { SignalDefs &def = signalDefs[i]; if (sig == def.id) { name = def.name; break; } } reset(); reportFatal(name); raise( sig ); } FatalConditionHandler() { isSet = true; stack_t sigStack; sigStack.ss_sp = altStackMem; sigStack.ss_size = SIGSTKSZ; sigStack.ss_flags = 0; sigaltstack(&sigStack, &oldSigStack); struct sigaction sa = { 0 }; sa.sa_handler = handleSignal; sa.sa_flags = SA_ONSTACK; for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); } } ~FatalConditionHandler() { reset(); } static void reset() { if( isSet ) { // Set signals back to previous values -- hopefully nobody overwrote them in the meantime for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { sigaction(signalDefs[i].id, &oldSigActions[i], CATCH_NULL); } // Return the old stack sigaltstack(&oldSigStack, CATCH_NULL); isSet = false; } } }; bool FatalConditionHandler::isSet = false; struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; stack_t FatalConditionHandler::oldSigStack = {}; char FatalConditionHandler::altStackMem[SIGSTKSZ] = {}; } // namespace Catch # endif // CATCH_CONFIG_POSIX_SIGNALS #endif // not Windows #include <set> #include <string> namespace Catch { class StreamRedirect { public: StreamRedirect( std::ostream& stream, std::string& targetString ) : m_stream( stream ), m_prevBuf( stream.rdbuf() ), m_targetString( targetString ) { stream.rdbuf( m_oss.rdbuf() ); } ~StreamRedirect() { m_targetString += m_oss.str(); m_stream.rdbuf( m_prevBuf ); } private: std::ostream& m_stream; std::streambuf* m_prevBuf; std::ostringstream m_oss; std::string& m_targetString; }; // StdErr has two constituent streams in C++, std::cerr and std::clog // This means that we need to redirect 2 streams into 1 to keep proper // order of writes and cannot use StreamRedirect on its own class StdErrRedirect { public: StdErrRedirect(std::string& targetString) :m_cerrBuf( cerr().rdbuf() ), m_clogBuf(clog().rdbuf()), m_targetString(targetString){ cerr().rdbuf(m_oss.rdbuf()); clog().rdbuf(m_oss.rdbuf()); } ~StdErrRedirect() { m_targetString += m_oss.str(); cerr().rdbuf(m_cerrBuf); clog().rdbuf(m_clogBuf); } private: std::streambuf* m_cerrBuf; std::streambuf* m_clogBuf; std::ostringstream m_oss; std::string& m_targetString; }; /////////////////////////////////////////////////////////////////////////// class RunContext : public IResultCapture, public IRunner { RunContext( RunContext const& ); void operator =( RunContext const& ); public: explicit RunContext( Ptr<IConfig const> const& _config, Ptr<IStreamingReporter> const& reporter ) : m_runInfo( _config->name() ), m_context( getCurrentMutableContext() ), m_activeTestCase( CATCH_NULL ), m_config( _config ), m_reporter( reporter ), m_shouldReportUnexpected ( true ) { m_context.setRunner( this ); m_context.setConfig( m_config ); m_context.setResultCapture( this ); m_reporter->testRunStarting( m_runInfo ); } virtual ~RunContext() { m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) ); } void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) { m_reporter->testGroupStarting( GroupInfo( testSpec, groupIndex, groupsCount ) ); } void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ) { m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, aborting() ) ); } Totals runTest( TestCase const& testCase ) { Totals prevTotals = m_totals; std::string redirectedCout; std::string redirectedCerr; TestCaseInfo testInfo = testCase.getTestCaseInfo(); m_reporter->testCaseStarting( testInfo ); m_activeTestCase = &testCase; do { ITracker& rootTracker = m_trackerContext.startRun(); assert( rootTracker.isSectionTracker() ); static_cast<SectionTracker&>( rootTracker ).addInitialFilters( m_config->getSectionsToRun() ); do { m_trackerContext.startCycle(); m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( testInfo.name, testInfo.lineInfo ) ); runCurrentTest( redirectedCout, redirectedCerr ); } while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() ); } // !TBD: deprecated - this will be replaced by indexed trackers while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); Totals deltaTotals = m_totals.delta( prevTotals ); if( testInfo.expectedToFail() && deltaTotals.testCases.passed > 0 ) { deltaTotals.assertions.failed++; deltaTotals.testCases.passed--; deltaTotals.testCases.failed++; } m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded( TestCaseStats( testInfo, deltaTotals, redirectedCout, redirectedCerr, aborting() ) ); m_activeTestCase = CATCH_NULL; m_testCaseTracker = CATCH_NULL; return deltaTotals; } Ptr<IConfig const> config() const { return m_config; } private: // IResultCapture virtual void assertionEnded( AssertionResult const& result ) { if( result.getResultType() == ResultWas::Ok ) { m_totals.assertions.passed++; } else if( !result.isOk() ) { m_totals.assertions.failed++; } // We have no use for the return value (whether messages should be cleared), because messages were made scoped // and should be let to clear themselves out. static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); // Reset working state m_lastAssertionInfo = AssertionInfo( "", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition ); m_lastResult = result; } virtual bool lastAssertionPassed() { return m_totals.assertions.passed == (m_prevPassed + 1); } virtual void assertionPassed() { m_totals.assertions.passed++; m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"; m_lastAssertionInfo.macroName = ""; } virtual void assertionRun() { m_prevPassed = m_totals.assertions.passed; } virtual bool sectionStarted ( SectionInfo const& sectionInfo, Counts& assertions ) { ITracker& sectionTracker = SectionTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( sectionInfo.name, sectionInfo.lineInfo ) ); if( !sectionTracker.isOpen() ) return false; m_activeSections.push_back( &sectionTracker ); m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; m_reporter->sectionStarting( sectionInfo ); assertions = m_totals.assertions; return true; } bool testForMissingAssertions( Counts& assertions ) { if( assertions.total() != 0 ) return false; if( !m_config->warnAboutMissingAssertions() ) return false; if( m_trackerContext.currentTracker().hasChildren() ) return false; m_totals.assertions.failed++; assertions.failed++; return true; } virtual void sectionEnded( SectionEndInfo const& endInfo ) { Counts assertions = m_totals.assertions - endInfo.prevAssertions; bool missingAssertions = testForMissingAssertions( assertions ); if( !m_activeSections.empty() ) { m_activeSections.back()->close(); m_activeSections.pop_back(); } m_reporter->sectionEnded( SectionStats( endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions ) ); m_messages.clear(); } virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) { if( m_unfinishedSections.empty() ) m_activeSections.back()->fail(); else m_activeSections.back()->close(); m_activeSections.pop_back(); m_unfinishedSections.push_back( endInfo ); } virtual void pushScopedMessage( MessageInfo const& message ) { m_messages.push_back( message ); } virtual void popScopedMessage( MessageInfo const& message ) { m_messages.erase( std::remove( m_messages.begin(), m_messages.end(), message ), m_messages.end() ); } virtual std::string getCurrentTestName() const { return m_activeTestCase ? m_activeTestCase->getTestCaseInfo().name : std::string(); } virtual const AssertionResult* getLastResult() const { return &m_lastResult; } virtual void exceptionEarlyReported() { m_shouldReportUnexpected = false; } virtual void handleFatalErrorCondition( std::string const& message ) { // Don't rebuild the result -- the stringification itself can cause more fatal errors // Instead, fake a result data. AssertionResultData tempResult; tempResult.resultType = ResultWas::FatalErrorCondition; tempResult.message = message; AssertionResult result(m_lastAssertionInfo, tempResult); getResultCapture().assertionEnded(result); handleUnfinishedSections(); // Recreate section for test case (as we will lose the one that was in scope) TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description ); Counts assertions; assertions.failed = 1; SectionStats testCaseSectionStats( testCaseSection, assertions, 0, false ); m_reporter->sectionEnded( testCaseSectionStats ); TestCaseInfo testInfo = m_activeTestCase->getTestCaseInfo(); Totals deltaTotals; deltaTotals.testCases.failed = 1; deltaTotals.assertions.failed = 1; m_reporter->testCaseEnded( TestCaseStats( testInfo, deltaTotals, std::string(), std::string(), false ) ); m_totals.testCases.failed++; testGroupEnded( std::string(), m_totals, 1, 1 ); m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, false ) ); } public: // !TBD We need to do this another way! bool aborting() const { return m_totals.assertions.failed == static_cast<std::size_t>( m_config->abortAfter() ); } private: void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ) { TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description ); m_reporter->sectionStarting( testCaseSection ); Counts prevAssertions = m_totals.assertions; double duration = 0; m_shouldReportUnexpected = true; try { m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal ); seedRng( *m_config ); Timer timer; timer.start(); if( m_reporter->getPreferences().shouldRedirectStdOut ) { StreamRedirect coutRedir( Catch::cout(), redirectedCout ); StdErrRedirect errRedir( redirectedCerr ); invokeActiveTestCase(); } else { invokeActiveTestCase(); } duration = timer.getElapsedSeconds(); } catch( TestFailureException& ) { // This just means the test was aborted due to failure } catch(...) { // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions // are reported without translation at the point of origin. if (m_shouldReportUnexpected) { makeUnexpectedResultBuilder().useActiveException(); } } m_testCaseTracker->close(); handleUnfinishedSections(); m_messages.clear(); Counts assertions = m_totals.assertions - prevAssertions; bool missingAssertions = testForMissingAssertions( assertions ); if( testCaseInfo.okToFail() ) { std::swap( assertions.failedButOk, assertions.failed ); m_totals.assertions.failed -= assertions.failedButOk; m_totals.assertions.failedButOk += assertions.failedButOk; } SectionStats testCaseSectionStats( testCaseSection, assertions, duration, missingAssertions ); m_reporter->sectionEnded( testCaseSectionStats ); } void invokeActiveTestCase() { FatalConditionHandler fatalConditionHandler; // Handle signals m_activeTestCase->invoke(); fatalConditionHandler.reset(); } private: ResultBuilder makeUnexpectedResultBuilder() const { return ResultBuilder( m_lastAssertionInfo.macroName, m_lastAssertionInfo.lineInfo, m_lastAssertionInfo.capturedExpression, m_lastAssertionInfo.resultDisposition ); } void handleUnfinishedSections() { // If sections ended prematurely due to an exception we stored their // infos here so we can tear them down outside the unwind process. for( std::vector<SectionEndInfo>::const_reverse_iterator it = m_unfinishedSections.rbegin(), itEnd = m_unfinishedSections.rend(); it != itEnd; ++it ) sectionEnded( *it ); m_unfinishedSections.clear(); } TestRunInfo m_runInfo; IMutableContext& m_context; TestCase const* m_activeTestCase; ITracker* m_testCaseTracker; ITracker* m_currentSectionTracker; AssertionResult m_lastResult; Ptr<IConfig const> m_config; Totals m_totals; Ptr<IStreamingReporter> m_reporter; std::vector<MessageInfo> m_messages; AssertionInfo m_lastAssertionInfo; std::vector<SectionEndInfo> m_unfinishedSections; std::vector<ITracker*> m_activeSections; TrackerContext m_trackerContext; size_t m_prevPassed; bool m_shouldReportUnexpected; }; IResultCapture& getResultCapture() { if( IResultCapture* capture = getCurrentContext().getResultCapture() ) return *capture; else throw std::logic_error( "No result capture instance" ); } } // end namespace Catch // #included from: internal/catch_version.h #define TWOBLUECUBES_CATCH_VERSION_H_INCLUDED namespace Catch { // Versioning information struct Version { Version( unsigned int _majorVersion, unsigned int _minorVersion, unsigned int _patchNumber, char const * const _branchName, unsigned int _buildNumber ); unsigned int const majorVersion; unsigned int const minorVersion; unsigned int const patchNumber; // buildNumber is only used if branchName is not null char const * const branchName; unsigned int const buildNumber; friend std::ostream& operator << ( std::ostream& os, Version const& version ); private: void operator=( Version const& ); }; inline Version libraryVersion(); } #include <fstream> #include <stdlib.h> #include <limits> namespace Catch { Ptr<IStreamingReporter> createReporter( std::string const& reporterName, Ptr<Config> const& config ) { Ptr<IStreamingReporter> reporter = getRegistryHub().getReporterRegistry().create( reporterName, config.get() ); if( !reporter ) { std::ostringstream oss; oss << "No reporter registered with name: '" << reporterName << "'"; throw std::domain_error( oss.str() ); } return reporter; } #if !defined(CATCH_CONFIG_DEFAULT_REPORTER) #define CATCH_CONFIG_DEFAULT_REPORTER "console" #endif Ptr<IStreamingReporter> makeReporter( Ptr<Config> const& config ) { std::vector<std::string> reporters = config->getReporterNames(); if( reporters.empty() ) reporters.push_back( CATCH_CONFIG_DEFAULT_REPORTER ); Ptr<IStreamingReporter> reporter; for( std::vector<std::string>::const_iterator it = reporters.begin(), itEnd = reporters.end(); it != itEnd; ++it ) reporter = addReporter( reporter, createReporter( *it, config ) ); return reporter; } Ptr<IStreamingReporter> addListeners( Ptr<IConfig const> const& config, Ptr<IStreamingReporter> reporters ) { IReporterRegistry::Listeners listeners = getRegistryHub().getReporterRegistry().getListeners(); for( IReporterRegistry::Listeners::const_iterator it = listeners.begin(), itEnd = listeners.end(); it != itEnd; ++it ) reporters = addReporter(reporters, (*it)->create( ReporterConfig( config ) ) ); return reporters; } Totals runTests( Ptr<Config> const& config ) { Ptr<IConfig const> iconfig = config.get(); Ptr<IStreamingReporter> reporter = makeReporter( config ); reporter = addListeners( iconfig, reporter ); RunContext context( iconfig, reporter ); Totals totals; context.testGroupStarting( config->name(), 1, 1 ); TestSpec testSpec = config->testSpec(); if( !testSpec.hasFilters() ) testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests std::vector<TestCase> const& allTestCases = getAllTestCasesSorted( *iconfig ); for( std::vector<TestCase>::const_iterator it = allTestCases.begin(), itEnd = allTestCases.end(); it != itEnd; ++it ) { if( !context.aborting() && matchTest( *it, testSpec, *iconfig ) ) totals += context.runTest( *it ); else reporter->skipTest( *it ); } context.testGroupEnded( iconfig->name(), totals, 1, 1 ); return totals; } void applyFilenamesAsTags( IConfig const& config ) { std::vector<TestCase> const& tests = getAllTestCasesSorted( config ); for(std::size_t i = 0; i < tests.size(); ++i ) { TestCase& test = const_cast<TestCase&>( tests[i] ); std::set<std::string> tags = test.tags; std::string filename = test.lineInfo.file; std::string::size_type lastSlash = filename.find_last_of( "\\/" ); if( lastSlash != std::string::npos ) filename = filename.substr( lastSlash+1 ); std::string::size_type lastDot = filename.find_last_of( '.' ); if( lastDot != std::string::npos ) filename = filename.substr( 0, lastDot ); tags.insert( '#' + filename ); setTags( test, tags ); } } class Session : NonCopyable { static bool alreadyInstantiated; public: struct OnUnusedOptions { enum DoWhat { Ignore, Fail }; }; Session() : m_cli( makeCommandLineParser() ) { if( alreadyInstantiated ) { std::string msg = "Only one instance of Catch::Session can ever be used"; Catch::cerr() << msg << std::endl; throw std::logic_error( msg ); } alreadyInstantiated = true; } ~Session() { Catch::cleanUp(); } void showHelp( std::string const& processName ) { Catch::cout() << "\nCatch v" << libraryVersion() << "\n"; m_cli.usage( Catch::cout(), processName ); Catch::cout() << "For more detail usage please see the project docs\n" << std::endl; } int applyCommandLine( int argc, char const* const* const argv, OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { try { m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail ); m_unusedTokens = m_cli.parseInto( Clara::argsToVector( argc, argv ), m_configData ); if( m_configData.showHelp ) showHelp( m_configData.processName ); m_config.reset(); } catch( std::exception& ex ) { { Colour colourGuard( Colour::Red ); Catch::cerr() << "\nError(s) in input:\n" << Text( ex.what(), TextAttributes().setIndent(2) ) << "\n\n"; } m_cli.usage( Catch::cout(), m_configData.processName ); return (std::numeric_limits<int>::max)(); } return 0; } void useConfigData( ConfigData const& _configData ) { m_configData = _configData; m_config.reset(); } int run( int argc, char const* const* const argv ) { int returnCode = applyCommandLine( argc, argv ); if( returnCode == 0 ) returnCode = run(); return returnCode; } #if defined(WIN32) && defined(UNICODE) int run( int argc, wchar_t const* const* const argv ) { char **utf8Argv = new char *[ argc ]; for ( int i = 0; i < argc; ++i ) { int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); utf8Argv[ i ] = new char[ bufSize ]; WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); } int returnCode = applyCommandLine( argc, utf8Argv ); if( returnCode == 0 ) returnCode = run(); for ( int i = 0; i < argc; ++i ) delete [] utf8Argv[ i ]; delete [] utf8Argv; return returnCode; } #endif int run() { if( m_configData.showHelp ) return 0; try { config(); // Force config to be constructed seedRng( *m_config ); if( m_configData.filenamesAsTags ) applyFilenamesAsTags( *m_config ); // Handle list request if( Option<std::size_t> listed = list( config() ) ) return static_cast<int>( *listed ); return static_cast<int>( runTests( m_config ).assertions.failed ); } catch( std::exception& ex ) { Catch::cerr() << ex.what() << std::endl; return (std::numeric_limits<int>::max)(); } } Clara::CommandLine<ConfigData> const& cli() const { return m_cli; } std::vector<Clara::Parser::Token> const& unusedTokens() const { return m_unusedTokens; } ConfigData& configData() { return m_configData; } Config& config() { if( !m_config ) m_config = new Config( m_configData ); return *m_config; } private: Clara::CommandLine<ConfigData> m_cli; std::vector<Clara::Parser::Token> m_unusedTokens; ConfigData m_configData; Ptr<Config> m_config; }; bool Session::alreadyInstantiated = false; } // end namespace Catch // #included from: catch_registry_hub.hpp #define TWOBLUECUBES_CATCH_REGISTRY_HUB_HPP_INCLUDED // #included from: catch_test_case_registry_impl.hpp #define TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED #include <vector> #include <set> #include <sstream> #include <algorithm> namespace Catch { struct RandomNumberGenerator { typedef std::ptrdiff_t result_type; result_type operator()( result_type n ) const { return std::rand() % n; } #ifdef CATCH_CONFIG_CPP11_SHUFFLE static constexpr result_type min() { return 0; } static constexpr result_type max() { return 1000000; } result_type operator()() const { return std::rand() % max(); } #endif template<typename V> static void shuffle( V& vector ) { RandomNumberGenerator rng; #ifdef CATCH_CONFIG_CPP11_SHUFFLE std::shuffle( vector.begin(), vector.end(), rng ); #else std::random_shuffle( vector.begin(), vector.end(), rng ); #endif } }; inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) { std::vector<TestCase> sorted = unsortedTestCases; switch( config.runOrder() ) { case RunTests::InLexicographicalOrder: std::sort( sorted.begin(), sorted.end() ); break; case RunTests::InRandomOrder: { seedRng( config ); RandomNumberGenerator::shuffle( sorted ); } break; case RunTests::InDeclarationOrder: // already in declaration order break; } return sorted; } bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); } void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) { std::set<TestCase> seenFunctions; for( std::vector<TestCase>::const_iterator it = functions.begin(), itEnd = functions.end(); it != itEnd; ++it ) { std::pair<std::set<TestCase>::const_iterator, bool> prev = seenFunctions.insert( *it ); if( !prev.second ) { std::ostringstream ss; ss << Colour( Colour::Red ) << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n" << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << '\n' << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl; throw std::runtime_error(ss.str()); } } } std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) { std::vector<TestCase> filtered; filtered.reserve( testCases.size() ); for( std::vector<TestCase>::const_iterator it = testCases.begin(), itEnd = testCases.end(); it != itEnd; ++it ) if( matchTest( *it, testSpec, config ) ) filtered.push_back( *it ); return filtered; } std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) { return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); } class TestRegistry : public ITestCaseRegistry { public: TestRegistry() : m_currentSortOrder( RunTests::InDeclarationOrder ), m_unnamedCount( 0 ) {} virtual ~TestRegistry(); virtual void registerTest( TestCase const& testCase ) { std::string name = testCase.getTestCaseInfo().name; if( name.empty() ) { std::ostringstream oss; oss << "Anonymous test case " << ++m_unnamedCount; return registerTest( testCase.withName( oss.str() ) ); } m_functions.push_back( testCase ); } virtual std::vector<TestCase> const& getAllTests() const { return m_functions; } virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const { if( m_sortedFunctions.empty() ) enforceNoDuplicateTestCases( m_functions ); if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { m_sortedFunctions = sortTests( config, m_functions ); m_currentSortOrder = config.runOrder(); } return m_sortedFunctions; } private: std::vector<TestCase> m_functions; mutable RunTests::InWhatOrder m_currentSortOrder; mutable std::vector<TestCase> m_sortedFunctions; size_t m_unnamedCount; std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised }; /////////////////////////////////////////////////////////////////////////// class FreeFunctionTestCase : public SharedImpl<ITestCase> { public: FreeFunctionTestCase( TestFunction fun ) : m_fun( fun ) {} virtual void invoke() const { m_fun(); } private: virtual ~FreeFunctionTestCase(); TestFunction m_fun; }; inline std::string extractClassName( std::string const& classOrQualifiedMethodName ) { std::string className = classOrQualifiedMethodName; if( startsWith( className, '&' ) ) { std::size_t lastColons = className.rfind( "::" ); std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); if( penultimateColons == std::string::npos ) penultimateColons = 1; className = className.substr( penultimateColons, lastColons-penultimateColons ); } return className; } void registerTestCase ( ITestCase* testCase, char const* classOrQualifiedMethodName, NameAndDesc const& nameAndDesc, SourceLineInfo const& lineInfo ) { getMutableRegistryHub().registerTest ( makeTestCase ( testCase, extractClassName( classOrQualifiedMethodName ), nameAndDesc.name, nameAndDesc.description, lineInfo ) ); } void registerTestCaseFunction ( TestFunction function, SourceLineInfo const& lineInfo, NameAndDesc const& nameAndDesc ) { registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo ); } /////////////////////////////////////////////////////////////////////////// AutoReg::AutoReg ( TestFunction function, SourceLineInfo const& lineInfo, NameAndDesc const& nameAndDesc ) { registerTestCaseFunction( function, lineInfo, nameAndDesc ); } AutoReg::~AutoReg() {} } // end namespace Catch // #included from: catch_reporter_registry.hpp #define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED #include <map> namespace Catch { class ReporterRegistry : public IReporterRegistry { public: virtual ~ReporterRegistry() CATCH_OVERRIDE {} virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig const> const& config ) const CATCH_OVERRIDE { FactoryMap::const_iterator it = m_factories.find( name ); if( it == m_factories.end() ) return CATCH_NULL; return it->second->create( ReporterConfig( config ) ); } void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) { m_factories.insert( std::make_pair( name, factory ) ); } void registerListener( Ptr<IReporterFactory> const& factory ) { m_listeners.push_back( factory ); } virtual FactoryMap const& getFactories() const CATCH_OVERRIDE { return m_factories; } virtual Listeners const& getListeners() const CATCH_OVERRIDE { return m_listeners; } private: FactoryMap m_factories; Listeners m_listeners; }; } // #included from: catch_exception_translator_registry.hpp #define TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED #ifdef __OBJC__ #import "Foundation/Foundation.h" #endif namespace Catch { class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { public: ~ExceptionTranslatorRegistry() { deleteAll( m_translators ); } virtual void registerTranslator( const IExceptionTranslator* translator ) { m_translators.push_back( translator ); } virtual std::string translateActiveException() const { try { #ifdef __OBJC__ // In Objective-C try objective-c exceptions first @try { return tryTranslators(); } @catch (NSException *exception) { return Catch::toString( [exception description] ); } #else return tryTranslators(); #endif } catch( TestFailureException& ) { throw; } catch( std::exception& ex ) { return ex.what(); } catch( std::string& msg ) { return msg; } catch( const char* msg ) { return msg; } catch(...) { return "Unknown exception"; } } std::string tryTranslators() const { if( m_translators.empty() ) throw; else return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() ); } private: std::vector<const IExceptionTranslator*> m_translators; }; } // #included from: catch_tag_alias_registry.h #define TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED #include <map> namespace Catch { class TagAliasRegistry : public ITagAliasRegistry { public: virtual ~TagAliasRegistry(); virtual Option<TagAlias> find( std::string const& alias ) const; virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const; void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); private: std::map<std::string, TagAlias> m_registry; }; } // end namespace Catch namespace Catch { namespace { class RegistryHub : public IRegistryHub, public IMutableRegistryHub { RegistryHub( RegistryHub const& ); void operator=( RegistryHub const& ); public: // IRegistryHub RegistryHub() { } virtual IReporterRegistry const& getReporterRegistry() const CATCH_OVERRIDE { return m_reporterRegistry; } virtual ITestCaseRegistry const& getTestCaseRegistry() const CATCH_OVERRIDE { return m_testCaseRegistry; } virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() CATCH_OVERRIDE { return m_exceptionTranslatorRegistry; } virtual ITagAliasRegistry const& getTagAliasRegistry() const CATCH_OVERRIDE { return m_tagAliasRegistry; } public: // IMutableRegistryHub virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE { m_reporterRegistry.registerReporter( name, factory ); } virtual void registerListener( Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE { m_reporterRegistry.registerListener( factory ); } virtual void registerTest( TestCase const& testInfo ) CATCH_OVERRIDE { m_testCaseRegistry.registerTest( testInfo ); } virtual void registerTranslator( const IExceptionTranslator* translator ) CATCH_OVERRIDE { m_exceptionTranslatorRegistry.registerTranslator( translator ); } virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) CATCH_OVERRIDE { m_tagAliasRegistry.add( alias, tag, lineInfo ); } private: TestRegistry m_testCaseRegistry; ReporterRegistry m_reporterRegistry; ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; TagAliasRegistry m_tagAliasRegistry; }; // Single, global, instance inline RegistryHub*& getTheRegistryHub() { static RegistryHub* theRegistryHub = CATCH_NULL; if( !theRegistryHub ) theRegistryHub = new RegistryHub(); return theRegistryHub; } } IRegistryHub& getRegistryHub() { return *getTheRegistryHub(); } IMutableRegistryHub& getMutableRegistryHub() { return *getTheRegistryHub(); } void cleanUp() { delete getTheRegistryHub(); getTheRegistryHub() = CATCH_NULL; cleanUpContext(); } std::string translateActiveException() { return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); } } // end namespace Catch // #included from: catch_notimplemented_exception.hpp #define TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_HPP_INCLUDED #include <sstream> namespace Catch { NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo ) : m_lineInfo( lineInfo ) { std::ostringstream oss; oss << lineInfo << ": function "; oss << "not implemented"; m_what = oss.str(); } const char* NotImplementedException::what() const CATCH_NOEXCEPT { return m_what.c_str(); } } // end namespace Catch // #included from: catch_context_impl.hpp #define TWOBLUECUBES_CATCH_CONTEXT_IMPL_HPP_INCLUDED // #included from: catch_stream.hpp #define TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED #include <stdexcept> #include <cstdio> #include <iostream> namespace Catch { template<typename WriterF, size_t bufferSize=256> class StreamBufImpl : public StreamBufBase { char data[bufferSize]; WriterF m_writer; public: StreamBufImpl() { setp( data, data + sizeof(data) ); } ~StreamBufImpl() CATCH_NOEXCEPT { sync(); } private: int overflow( int c ) { sync(); if( c != EOF ) { if( pbase() == epptr() ) m_writer( std::string( 1, static_cast<char>( c ) ) ); else sputc( static_cast<char>( c ) ); } return 0; } int sync() { if( pbase() != pptr() ) { m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) ); setp( pbase(), epptr() ); } return 0; } }; /////////////////////////////////////////////////////////////////////////// FileStream::FileStream( std::string const& filename ) { m_ofs.open( filename.c_str() ); if( m_ofs.fail() ) { std::ostringstream oss; oss << "Unable to open file: '" << filename << '\''; throw std::domain_error( oss.str() ); } } std::ostream& FileStream::stream() const { return m_ofs; } struct OutputDebugWriter { void operator()( std::string const&str ) { writeToDebugConsole( str ); } }; DebugOutStream::DebugOutStream() : m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ), m_os( m_streamBuf.get() ) {} std::ostream& DebugOutStream::stream() const { return m_os; } // Store the streambuf from cout up-front because // cout may get redirected when running tests CoutStream::CoutStream() : m_os( Catch::cout().rdbuf() ) {} std::ostream& CoutStream::stream() const { return m_os; } #ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions std::ostream& cout() { return std::cout; } std::ostream& cerr() { return std::cerr; } std::ostream& clog() { return std::clog; } #endif } namespace Catch { class Context : public IMutableContext { Context() : m_config( CATCH_NULL ), m_runner( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {} Context( Context const& ); void operator=( Context const& ); public: virtual ~Context() { deleteAllValues( m_generatorsByTestName ); } public: // IContext virtual IResultCapture* getResultCapture() { return m_resultCapture; } virtual IRunner* getRunner() { return m_runner; } virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) { return getGeneratorsForCurrentTest() .getGeneratorInfo( fileInfo, totalSize ) .getCurrentIndex(); } virtual bool advanceGeneratorsForCurrentTest() { IGeneratorsForTest* generators = findGeneratorsForCurrentTest(); return generators && generators->moveNext(); } virtual Ptr<IConfig const> getConfig() const { return m_config; } public: // IMutableContext virtual void setResultCapture( IResultCapture* resultCapture ) { m_resultCapture = resultCapture; } virtual void setRunner( IRunner* runner ) { m_runner = runner; } virtual void setConfig( Ptr<IConfig const> const& config ) { m_config = config; } friend IMutableContext& getCurrentMutableContext(); private: IGeneratorsForTest* findGeneratorsForCurrentTest() { std::string testName = getResultCapture()->getCurrentTestName(); std::map<std::string, IGeneratorsForTest*>::const_iterator it = m_generatorsByTestName.find( testName ); return it != m_generatorsByTestName.end() ? it->second : CATCH_NULL; } IGeneratorsForTest& getGeneratorsForCurrentTest() { IGeneratorsForTest* generators = findGeneratorsForCurrentTest(); if( !generators ) { std::string testName = getResultCapture()->getCurrentTestName(); generators = createGeneratorsForTest(); m_generatorsByTestName.insert( std::make_pair( testName, generators ) ); } return *generators; } private: Ptr<IConfig const> m_config; IRunner* m_runner; IResultCapture* m_resultCapture; std::map<std::string, IGeneratorsForTest*> m_generatorsByTestName; }; namespace { Context* currentContext = CATCH_NULL; } IMutableContext& getCurrentMutableContext() { if( !currentContext ) currentContext = new Context(); return *currentContext; } IContext& getCurrentContext() { return getCurrentMutableContext(); } void cleanUpContext() { delete currentContext; currentContext = CATCH_NULL; } } // #included from: catch_console_colour_impl.hpp #define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_IMPL_HPP_INCLUDED // #included from: catch_errno_guard.hpp #define TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED #include <cerrno> namespace Catch { class ErrnoGuard { public: ErrnoGuard():m_oldErrno(errno){} ~ErrnoGuard() { errno = m_oldErrno; } private: int m_oldErrno; }; } namespace Catch { namespace { struct IColourImpl { virtual ~IColourImpl() {} virtual void use( Colour::Code _colourCode ) = 0; }; struct NoColourImpl : IColourImpl { void use( Colour::Code ) {} static IColourImpl* instance() { static NoColourImpl s_instance; return &s_instance; } }; } // anon namespace } // namespace Catch #if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) # ifdef CATCH_PLATFORM_WINDOWS # define CATCH_CONFIG_COLOUR_WINDOWS # else # define CATCH_CONFIG_COLOUR_ANSI # endif #endif #if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// namespace Catch { namespace { class Win32ColourImpl : public IColourImpl { public: Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) { CONSOLE_SCREEN_BUFFER_INFO csbiInfo; GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY ); originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY ); } virtual void use( Colour::Code _colourCode ) { switch( _colourCode ) { case Colour::None: return setTextAttribute( originalForegroundAttributes ); case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); case Colour::Red: return setTextAttribute( FOREGROUND_RED ); case Colour::Green: return setTextAttribute( FOREGROUND_GREEN ); case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE ); case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN ); case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN ); case Colour::Grey: return setTextAttribute( 0 ); case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY ); case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); case Colour::Bright: throw std::logic_error( "not a colour" ); } } private: void setTextAttribute( WORD _textAttribute ) { SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); } HANDLE stdoutHandle; WORD originalForegroundAttributes; WORD originalBackgroundAttributes; }; IColourImpl* platformColourInstance() { static Win32ColourImpl s_instance; Ptr<IConfig const> config = getCurrentContext().getConfig(); UseColour::YesOrNo colourMode = config ? config->useColour() : UseColour::Auto; if( colourMode == UseColour::Auto ) colourMode = !isDebuggerActive() ? UseColour::Yes : UseColour::No; return colourMode == UseColour::Yes ? &s_instance : NoColourImpl::instance(); } } // end anon namespace } // end namespace Catch #elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// #include <unistd.h> namespace Catch { namespace { // use POSIX/ ANSI console terminal codes // Thanks to Adam Strzelecki for original contribution // (http://github.com/nanoant) // https://github.com/philsquared/Catch/pull/131 class PosixColourImpl : public IColourImpl { public: virtual void use( Colour::Code _colourCode ) { switch( _colourCode ) { case Colour::None: case Colour::White: return setColour( "[0m" ); case Colour::Red: return setColour( "[0;31m" ); case Colour::Green: return setColour( "[0;32m" ); case Colour::Blue: return setColour( "[0;34m" ); case Colour::Cyan: return setColour( "[0;36m" ); case Colour::Yellow: return setColour( "[0;33m" ); case Colour::Grey: return setColour( "[1;30m" ); case Colour::LightGrey: return setColour( "[0;37m" ); case Colour::BrightRed: return setColour( "[1;31m" ); case Colour::BrightGreen: return setColour( "[1;32m" ); case Colour::BrightWhite: return setColour( "[1;37m" ); case Colour::Bright: throw std::logic_error( "not a colour" ); } } static IColourImpl* instance() { static PosixColourImpl s_instance; return &s_instance; } private: void setColour( const char* _escapeCode ) { Catch::cout() << '\033' << _escapeCode; } }; IColourImpl* platformColourInstance() { ErrnoGuard guard; Ptr<IConfig const> config = getCurrentContext().getConfig(); UseColour::YesOrNo colourMode = config ? config->useColour() : UseColour::Auto; if( colourMode == UseColour::Auto ) colourMode = (!isDebuggerActive() && isatty(STDOUT_FILENO) ) ? UseColour::Yes : UseColour::No; return colourMode == UseColour::Yes ? PosixColourImpl::instance() : NoColourImpl::instance(); } } // end anon namespace } // end namespace Catch #else // not Windows or ANSI /////////////////////////////////////////////// namespace Catch { static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } } // end namespace Catch #endif // Windows/ ANSI/ None namespace Catch { Colour::Colour( Code _colourCode ) : m_moved( false ) { use( _colourCode ); } Colour::Colour( Colour const& _other ) : m_moved( false ) { const_cast<Colour&>( _other ).m_moved = true; } Colour::~Colour(){ if( !m_moved ) use( None ); } void Colour::use( Code _colourCode ) { static IColourImpl* impl = platformColourInstance(); impl->use( _colourCode ); } } // end namespace Catch // #included from: catch_generators_impl.hpp #define TWOBLUECUBES_CATCH_GENERATORS_IMPL_HPP_INCLUDED #include <vector> #include <string> #include <map> namespace Catch { struct GeneratorInfo : IGeneratorInfo { GeneratorInfo( std::size_t size ) : m_size( size ), m_currentIndex( 0 ) {} bool moveNext() { if( ++m_currentIndex == m_size ) { m_currentIndex = 0; return false; } return true; } std::size_t getCurrentIndex() const { return m_currentIndex; } std::size_t m_size; std::size_t m_currentIndex; }; /////////////////////////////////////////////////////////////////////////// class GeneratorsForTest : public IGeneratorsForTest { public: ~GeneratorsForTest() { deleteAll( m_generatorsInOrder ); } IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) { std::map<std::string, IGeneratorInfo*>::const_iterator it = m_generatorsByName.find( fileInfo ); if( it == m_generatorsByName.end() ) { IGeneratorInfo* info = new GeneratorInfo( size ); m_generatorsByName.insert( std::make_pair( fileInfo, info ) ); m_generatorsInOrder.push_back( info ); return *info; } return *it->second; } bool moveNext() { std::vector<IGeneratorInfo*>::const_iterator it = m_generatorsInOrder.begin(); std::vector<IGeneratorInfo*>::const_iterator itEnd = m_generatorsInOrder.end(); for(; it != itEnd; ++it ) { if( (*it)->moveNext() ) return true; } return false; } private: std::map<std::string, IGeneratorInfo*> m_generatorsByName; std::vector<IGeneratorInfo*> m_generatorsInOrder; }; IGeneratorsForTest* createGeneratorsForTest() { return new GeneratorsForTest(); } } // end namespace Catch // #included from: catch_assertionresult.hpp #define TWOBLUECUBES_CATCH_ASSERTIONRESULT_HPP_INCLUDED namespace Catch { AssertionInfo::AssertionInfo():macroName(""), capturedExpression(""), resultDisposition(ResultDisposition::Normal), secondArg(""){} AssertionInfo::AssertionInfo( char const * _macroName, SourceLineInfo const& _lineInfo, char const * _capturedExpression, ResultDisposition::Flags _resultDisposition, char const * _secondArg) : macroName( _macroName ), lineInfo( _lineInfo ), capturedExpression( _capturedExpression ), resultDisposition( _resultDisposition ), secondArg( _secondArg ) {} AssertionResult::AssertionResult() {} AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) : m_info( info ), m_resultData( data ) {} AssertionResult::~AssertionResult() {} // Result was a success bool AssertionResult::succeeded() const { return Catch::isOk( m_resultData.resultType ); } // Result was a success, or failure is suppressed bool AssertionResult::isOk() const { return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); } ResultWas::OfType AssertionResult::getResultType() const { return m_resultData.resultType; } bool AssertionResult::hasExpression() const { return m_info.capturedExpression[0] != 0; } bool AssertionResult::hasMessage() const { return !m_resultData.message.empty(); } std::string capturedExpressionWithSecondArgument( char const * capturedExpression, char const * secondArg ) { return (secondArg[0] == 0 || secondArg[0] == '"' && secondArg[1] == '"') ? capturedExpression : std::string(capturedExpression) + ", " + secondArg; } std::string AssertionResult::getExpression() const { if( isFalseTest( m_info.resultDisposition ) ) return '!' + capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg); else return capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg); } std::string AssertionResult::getExpressionInMacro() const { if( m_info.macroName[0] == 0 ) return capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg); else return std::string(m_info.macroName) + "( " + capturedExpressionWithSecondArgument(m_info.capturedExpression, m_info.secondArg) + " )"; } bool AssertionResult::hasExpandedExpression() const { return hasExpression() && getExpandedExpression() != getExpression(); } std::string AssertionResult::getExpandedExpression() const { return m_resultData.reconstructExpression(); } std::string AssertionResult::getMessage() const { return m_resultData.message; } SourceLineInfo AssertionResult::getSourceInfo() const { return m_info.lineInfo; } std::string AssertionResult::getTestMacroName() const { return m_info.macroName; } void AssertionResult::discardDecomposedExpression() const { m_resultData.decomposedExpression = CATCH_NULL; } void AssertionResult::expandDecomposedExpression() const { m_resultData.reconstructExpression(); } } // end namespace Catch // #included from: catch_test_case_info.hpp #define TWOBLUECUBES_CATCH_TEST_CASE_INFO_HPP_INCLUDED #include <cctype> namespace Catch { inline TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { if( startsWith( tag, '.' ) || tag == "hide" || tag == "!hide" ) return TestCaseInfo::IsHidden; else if( tag == "!throws" ) return TestCaseInfo::Throws; else if( tag == "!shouldfail" ) return TestCaseInfo::ShouldFail; else if( tag == "!mayfail" ) return TestCaseInfo::MayFail; else if( tag == "!nonportable" ) return TestCaseInfo::NonPortable; else return TestCaseInfo::None; } inline bool isReservedTag( std::string const& tag ) { return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] ); } inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { if( isReservedTag( tag ) ) { std::ostringstream ss; ss << Colour(Colour::Red) << "Tag name [" << tag << "] not allowed.\n" << "Tag names starting with non alpha-numeric characters are reserved\n" << Colour(Colour::FileName) << _lineInfo << '\n'; throw std::runtime_error(ss.str()); } } TestCase makeTestCase( ITestCase* _testCase, std::string const& _className, std::string const& _name, std::string const& _descOrTags, SourceLineInfo const& _lineInfo ) { bool isHidden( startsWith( _name, "./" ) ); // Legacy support // Parse out tags std::set<std::string> tags; std::string desc, tag; bool inTag = false; for( std::size_t i = 0; i < _descOrTags.size(); ++i ) { char c = _descOrTags[i]; if( !inTag ) { if( c == '[' ) inTag = true; else desc += c; } else { if( c == ']' ) { TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); if( prop == TestCaseInfo::IsHidden ) isHidden = true; else if( prop == TestCaseInfo::None ) enforceNotReservedTag( tag, _lineInfo ); tags.insert( tag ); tag.clear(); inTag = false; } else tag += c; } } if( isHidden ) { tags.insert( "hide" ); tags.insert( "." ); } TestCaseInfo info( _name, _className, desc, tags, _lineInfo ); return TestCase( _testCase, info ); } void setTags( TestCaseInfo& testCaseInfo, std::set<std::string> const& tags ) { testCaseInfo.tags = tags; testCaseInfo.lcaseTags.clear(); std::ostringstream oss; for( std::set<std::string>::const_iterator it = tags.begin(), itEnd = tags.end(); it != itEnd; ++it ) { oss << '[' << *it << ']'; std::string lcaseTag = toLower( *it ); testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); testCaseInfo.lcaseTags.insert( lcaseTag ); } testCaseInfo.tagsAsString = oss.str(); } TestCaseInfo::TestCaseInfo( std::string const& _name, std::string const& _className, std::string const& _description, std::set<std::string> const& _tags, SourceLineInfo const& _lineInfo ) : name( _name ), className( _className ), description( _description ), lineInfo( _lineInfo ), properties( None ) { setTags( *this, _tags ); } TestCaseInfo::TestCaseInfo( TestCaseInfo const& other ) : name( other.name ), className( other.className ), description( other.description ), tags( other.tags ), lcaseTags( other.lcaseTags ), tagsAsString( other.tagsAsString ), lineInfo( other.lineInfo ), properties( other.properties ) {} bool TestCaseInfo::isHidden() const { return ( properties & IsHidden ) != 0; } bool TestCaseInfo::throws() const { return ( properties & Throws ) != 0; } bool TestCaseInfo::okToFail() const { return ( properties & (ShouldFail | MayFail ) ) != 0; } bool TestCaseInfo::expectedToFail() const { return ( properties & (ShouldFail ) ) != 0; } TestCase::TestCase( ITestCase* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {} TestCase::TestCase( TestCase const& other ) : TestCaseInfo( other ), test( other.test ) {} TestCase TestCase::withName( std::string const& _newName ) const { TestCase other( *this ); other.name = _newName; return other; } void TestCase::swap( TestCase& other ) { test.swap( other.test ); name.swap( other.name ); className.swap( other.className ); description.swap( other.description ); tags.swap( other.tags ); lcaseTags.swap( other.lcaseTags ); tagsAsString.swap( other.tagsAsString ); std::swap( TestCaseInfo::properties, static_cast<TestCaseInfo&>( other ).properties ); std::swap( lineInfo, other.lineInfo ); } void TestCase::invoke() const { test->invoke(); } bool TestCase::operator == ( TestCase const& other ) const { return test.get() == other.test.get() && name == other.name && className == other.className; } bool TestCase::operator < ( TestCase const& other ) const { return name < other.name; } TestCase& TestCase::operator = ( TestCase const& other ) { TestCase temp( other ); swap( temp ); return *this; } TestCaseInfo const& TestCase::getTestCaseInfo() const { return *this; } } // end namespace Catch // #included from: catch_version.hpp #define TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED namespace Catch { Version::Version ( unsigned int _majorVersion, unsigned int _minorVersion, unsigned int _patchNumber, char const * const _branchName, unsigned int _buildNumber ) : majorVersion( _majorVersion ), minorVersion( _minorVersion ), patchNumber( _patchNumber ), branchName( _branchName ), buildNumber( _buildNumber ) {} std::ostream& operator << ( std::ostream& os, Version const& version ) { os << version.majorVersion << '.' << version.minorVersion << '.' << version.patchNumber; // branchName is never null -> 0th char is \0 if it is empty if (version.branchName[0]) { os << '-' << version.branchName << '.' << version.buildNumber; } return os; } inline Version libraryVersion() { static Version version( 1, 9, 7, "", 0 ); return version; } } // #included from: catch_message.hpp #define TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED namespace Catch { MessageInfo::MessageInfo( std::string const& _macroName, SourceLineInfo const& _lineInfo, ResultWas::OfType _type ) : macroName( _macroName ), lineInfo( _lineInfo ), type( _type ), sequence( ++globalCount ) {} // This may need protecting if threading support is added unsigned int MessageInfo::globalCount = 0; //////////////////////////////////////////////////////////////////////////// ScopedMessage::ScopedMessage( MessageBuilder const& builder ) : m_info( builder.m_info ) { m_info.message = builder.m_stream.str(); getResultCapture().pushScopedMessage( m_info ); } ScopedMessage::ScopedMessage( ScopedMessage const& other ) : m_info( other.m_info ) {} ScopedMessage::~ScopedMessage() { if ( !std::uncaught_exception() ){ getResultCapture().popScopedMessage(m_info); } } } // end namespace Catch // #included from: catch_legacy_reporter_adapter.hpp #define TWOBLUECUBES_CATCH_LEGACY_REPORTER_ADAPTER_HPP_INCLUDED // #included from: catch_legacy_reporter_adapter.h #define TWOBLUECUBES_CATCH_LEGACY_REPORTER_ADAPTER_H_INCLUDED namespace Catch { // Deprecated struct IReporter : IShared { virtual ~IReporter(); virtual bool shouldRedirectStdout() const = 0; virtual void StartTesting() = 0; virtual void EndTesting( Totals const& totals ) = 0; virtual void StartGroup( std::string const& groupName ) = 0; virtual void EndGroup( std::string const& groupName, Totals const& totals ) = 0; virtual void StartTestCase( TestCaseInfo const& testInfo ) = 0; virtual void EndTestCase( TestCaseInfo const& testInfo, Totals const& totals, std::string const& stdOut, std::string const& stdErr ) = 0; virtual void StartSection( std::string const& sectionName, std::string const& description ) = 0; virtual void EndSection( std::string const& sectionName, Counts const& assertions ) = 0; virtual void NoAssertionsInSection( std::string const& sectionName ) = 0; virtual void NoAssertionsInTestCase( std::string const& testName ) = 0; virtual void Aborted() = 0; virtual void Result( AssertionResult const& result ) = 0; }; class LegacyReporterAdapter : public SharedImpl<IStreamingReporter> { public: LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter ); virtual ~LegacyReporterAdapter(); virtual ReporterPreferences getPreferences() const; virtual void noMatchingTestCases( std::string const& ); virtual void testRunStarting( TestRunInfo const& ); virtual void testGroupStarting( GroupInfo const& groupInfo ); virtual void testCaseStarting( TestCaseInfo const& testInfo ); virtual void sectionStarting( SectionInfo const& sectionInfo ); virtual void assertionStarting( AssertionInfo const& ); virtual bool assertionEnded( AssertionStats const& assertionStats ); virtual void sectionEnded( SectionStats const& sectionStats ); virtual void testCaseEnded( TestCaseStats const& testCaseStats ); virtual void testGroupEnded( TestGroupStats const& testGroupStats ); virtual void testRunEnded( TestRunStats const& testRunStats ); virtual void skipTest( TestCaseInfo const& ); private: Ptr<IReporter> m_legacyReporter; }; } namespace Catch { LegacyReporterAdapter::LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter ) : m_legacyReporter( legacyReporter ) {} LegacyReporterAdapter::~LegacyReporterAdapter() {} ReporterPreferences LegacyReporterAdapter::getPreferences() const { ReporterPreferences prefs; prefs.shouldRedirectStdOut = m_legacyReporter->shouldRedirectStdout(); return prefs; } void LegacyReporterAdapter::noMatchingTestCases( std::string const& ) {} void LegacyReporterAdapter::testRunStarting( TestRunInfo const& ) { m_legacyReporter->StartTesting(); } void LegacyReporterAdapter::testGroupStarting( GroupInfo const& groupInfo ) { m_legacyReporter->StartGroup( groupInfo.name ); } void LegacyReporterAdapter::testCaseStarting( TestCaseInfo const& testInfo ) { m_legacyReporter->StartTestCase( testInfo ); } void LegacyReporterAdapter::sectionStarting( SectionInfo const& sectionInfo ) { m_legacyReporter->StartSection( sectionInfo.name, sectionInfo.description ); } void LegacyReporterAdapter::assertionStarting( AssertionInfo const& ) { // Not on legacy interface } bool LegacyReporterAdapter::assertionEnded( AssertionStats const& assertionStats ) { if( assertionStats.assertionResult.getResultType() != ResultWas::Ok ) { for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); it != itEnd; ++it ) { if( it->type == ResultWas::Info ) { ResultBuilder rb( it->macroName.c_str(), it->lineInfo, "", ResultDisposition::Normal ); rb << it->message; rb.setResultType( ResultWas::Info ); AssertionResult result = rb.build(); m_legacyReporter->Result( result ); } } } m_legacyReporter->Result( assertionStats.assertionResult ); return true; } void LegacyReporterAdapter::sectionEnded( SectionStats const& sectionStats ) { if( sectionStats.missingAssertions ) m_legacyReporter->NoAssertionsInSection( sectionStats.sectionInfo.name ); m_legacyReporter->EndSection( sectionStats.sectionInfo.name, sectionStats.assertions ); } void LegacyReporterAdapter::testCaseEnded( TestCaseStats const& testCaseStats ) { m_legacyReporter->EndTestCase ( testCaseStats.testInfo, testCaseStats.totals, testCaseStats.stdOut, testCaseStats.stdErr ); } void LegacyReporterAdapter::testGroupEnded( TestGroupStats const& testGroupStats ) { if( testGroupStats.aborting ) m_legacyReporter->Aborted(); m_legacyReporter->EndGroup( testGroupStats.groupInfo.name, testGroupStats.totals ); } void LegacyReporterAdapter::testRunEnded( TestRunStats const& testRunStats ) { m_legacyReporter->EndTesting( testRunStats.totals ); } void LegacyReporterAdapter::skipTest( TestCaseInfo const& ) { } } // #included from: catch_timer.hpp #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++11-long-long" #endif #ifdef CATCH_PLATFORM_WINDOWS #else #include <sys/time.h> #endif namespace Catch { namespace { #ifdef CATCH_PLATFORM_WINDOWS UInt64 getCurrentTicks() { static UInt64 hz=0, hzo=0; if (!hz) { QueryPerformanceFrequency( reinterpret_cast<LARGE_INTEGER*>( &hz ) ); QueryPerformanceCounter( reinterpret_cast<LARGE_INTEGER*>( &hzo ) ); } UInt64 t; QueryPerformanceCounter( reinterpret_cast<LARGE_INTEGER*>( &t ) ); return ((t-hzo)*1000000)/hz; } #else UInt64 getCurrentTicks() { timeval t; gettimeofday(&t,CATCH_NULL); return static_cast<UInt64>( t.tv_sec ) * 1000000ull + static_cast<UInt64>( t.tv_usec ); } #endif } void Timer::start() { m_ticks = getCurrentTicks(); } unsigned int Timer::getElapsedMicroseconds() const { return static_cast<unsigned int>(getCurrentTicks() - m_ticks); } unsigned int Timer::getElapsedMilliseconds() const { return static_cast<unsigned int>(getElapsedMicroseconds()/1000); } double Timer::getElapsedSeconds() const { return getElapsedMicroseconds()/1000000.0; } } // namespace Catch #ifdef __clang__ #pragma clang diagnostic pop #endif // #included from: catch_common.hpp #define TWOBLUECUBES_CATCH_COMMON_HPP_INCLUDED #include <cstring> #include <cctype> namespace Catch { bool startsWith( std::string const& s, std::string const& prefix ) { return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); } bool startsWith( std::string const& s, char prefix ) { return !s.empty() && s[0] == prefix; } bool endsWith( std::string const& s, std::string const& suffix ) { return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); } bool endsWith( std::string const& s, char suffix ) { return !s.empty() && s[s.size()-1] == suffix; } bool contains( std::string const& s, std::string const& infix ) { return s.find( infix ) != std::string::npos; } char toLowerCh(char c) { return static_cast<char>( std::tolower( c ) ); } void toLowerInPlace( std::string& s ) { std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); } std::string toLower( std::string const& s ) { std::string lc = s; toLowerInPlace( lc ); return lc; } std::string trim( std::string const& str ) { static char const* whitespaceChars = "\n\r\t "; std::string::size_type start = str.find_first_not_of( whitespaceChars ); std::string::size_type end = str.find_last_not_of( whitespaceChars ); return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); } bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { bool replaced = false; std::size_t i = str.find( replaceThis ); while( i != std::string::npos ) { replaced = true; str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); if( i < str.size()-withThis.size() ) i = str.find( replaceThis, i+withThis.size() ); else i = std::string::npos; } return replaced; } pluralise::pluralise( std::size_t count, std::string const& label ) : m_count( count ), m_label( label ) {} std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { os << pluraliser.m_count << ' ' << pluraliser.m_label; if( pluraliser.m_count != 1 ) os << 's'; return os; } SourceLineInfo::SourceLineInfo() : file(""), line( 0 ){} SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line ) : file( _file ), line( _line ) {} bool SourceLineInfo::empty() const { return file[0] == '\0'; } bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const { return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); } bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const { return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0)); } void seedRng( IConfig const& config ) { if( config.rngSeed() != 0 ) std::srand( config.rngSeed() ); } unsigned int rngSeed() { return getCurrentContext().getConfig()->rngSeed(); } std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { #ifndef __GNUG__ os << info.file << '(' << info.line << ')'; #else os << info.file << ':' << info.line; #endif return os; } void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) { std::ostringstream oss; oss << locationInfo << ": Internal Catch error: '" << message << '\''; if( alwaysTrue() ) throw std::logic_error( oss.str() ); } } // #included from: catch_section.hpp #define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED namespace Catch { SectionInfo::SectionInfo ( SourceLineInfo const& _lineInfo, std::string const& _name, std::string const& _description ) : name( _name ), description( _description ), lineInfo( _lineInfo ) {} Section::Section( SectionInfo const& info ) : m_info( info ), m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) { m_timer.start(); } #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17 #endif Section::~Section() { if( m_sectionIncluded ) { SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() ); if( std::uncaught_exception() ) getResultCapture().sectionEndedEarly( endInfo ); else getResultCapture().sectionEnded( endInfo ); } } #if defined(_MSC_VER) #pragma warning(pop) #endif // This indicates whether the section should be executed or not Section::operator bool() const { return m_sectionIncluded; } } // end namespace Catch // #included from: catch_debugger.hpp #define TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED #ifdef CATCH_PLATFORM_MAC #include <assert.h> #include <stdbool.h> #include <sys/types.h> #include <unistd.h> #include <sys/sysctl.h> namespace Catch{ // The following function is taken directly from the following technical note: // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html // Returns true if the current process is being debugged (either // running under the debugger or has a debugger attached post facto). bool isDebuggerActive(){ int mib[4]; struct kinfo_proc info; size_t size; // Initialize the flags so that, if sysctl fails for some bizarre // reason, we get a predictable result. info.kp_proc.p_flag = 0; // Initialize mib, which tells sysctl the info we want, in this case // we're looking for information about a specific process ID. mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; mib[3] = getpid(); // Call sysctl. size = sizeof(info); if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, CATCH_NULL, 0) != 0 ) { Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; return false; } // We're being debugged if the P_TRACED flag is set. return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); } } // namespace Catch #elif defined(CATCH_PLATFORM_LINUX) #include <fstream> #include <string> namespace Catch{ // The standard POSIX way of detecting a debugger is to attempt to // ptrace() the process, but this needs to be done from a child and not // this process itself to still allow attaching to this process later // if wanted, so is rather heavy. Under Linux we have the PID of the // "debugger" (which doesn't need to be gdb, of course, it could also // be strace, for example) in /proc/$PID/status, so just get it from // there instead. bool isDebuggerActive(){ // Libstdc++ has a bug, where std::ifstream sets errno to 0 // This way our users can properly assert over errno values ErrnoGuard guard; std::ifstream in("/proc/self/status"); for( std::string line; std::getline(in, line); ) { static const int PREFIX_LEN = 11; if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) { // We're traced if the PID is not 0 and no other PID starts // with 0 digit, so it's enough to check for just a single // character. return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0'; } } return false; } } // namespace Catch #elif defined(_MSC_VER) extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); namespace Catch { bool isDebuggerActive() { return IsDebuggerPresent() != 0; } } #elif defined(__MINGW32__) extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); namespace Catch { bool isDebuggerActive() { return IsDebuggerPresent() != 0; } } #else namespace Catch { inline bool isDebuggerActive() { return false; } } #endif // Platform #ifdef CATCH_PLATFORM_WINDOWS namespace Catch { void writeToDebugConsole( std::string const& text ) { ::OutputDebugStringA( text.c_str() ); } } #else namespace Catch { void writeToDebugConsole( std::string const& text ) { // !TBD: Need a version for Mac/ XCode and other IDEs Catch::cout() << text; } } #endif // Platform // #included from: catch_tostring.hpp #define TWOBLUECUBES_CATCH_TOSTRING_HPP_INCLUDED namespace Catch { namespace Detail { const std::string unprintableString = "{?}"; namespace { const int hexThreshold = 255; struct Endianness { enum Arch { Big, Little }; static Arch which() { union _{ int asInt; char asChar[sizeof (int)]; } u; u.asInt = 1; return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little; } }; } std::string rawMemoryToString( const void *object, std::size_t size ) { // Reverse order for little endian architectures int i = 0, end = static_cast<int>( size ), inc = 1; if( Endianness::which() == Endianness::Little ) { i = end-1; end = inc = -1; } unsigned char const *bytes = static_cast<unsigned char const *>(object); std::ostringstream os; os << "0x" << std::setfill('0') << std::hex; for( ; i != end; i += inc ) os << std::setw(2) << static_cast<unsigned>(bytes[i]); return os.str(); } } std::string toString( std::string const& value ) { std::string s = value; if( getCurrentContext().getConfig()->showInvisibles() ) { for(size_t i = 0; i < s.size(); ++i ) { std::string subs; switch( s[i] ) { case '\n': subs = "\\n"; break; case '\t': subs = "\\t"; break; default: break; } if( !subs.empty() ) { s = s.substr( 0, i ) + subs + s.substr( i+1 ); ++i; } } } return '"' + s + '"'; } std::string toString( std::wstring const& value ) { std::string s; s.reserve( value.size() ); for(size_t i = 0; i < value.size(); ++i ) s += value[i] <= 0xff ? static_cast<char>( value[i] ) : '?'; return Catch::toString( s ); } std::string toString( const char* const value ) { return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" ); } std::string toString( char* const value ) { return Catch::toString( static_cast<const char*>( value ) ); } std::string toString( const wchar_t* const value ) { return value ? Catch::toString( std::wstring(value) ) : std::string( "{null string}" ); } std::string toString( wchar_t* const value ) { return Catch::toString( static_cast<const wchar_t*>( value ) ); } std::string toString( int value ) { std::ostringstream oss; oss << value; if( value > Detail::hexThreshold ) oss << " (0x" << std::hex << value << ')'; return oss.str(); } std::string toString( unsigned long value ) { std::ostringstream oss; oss << value; if( value > Detail::hexThreshold ) oss << " (0x" << std::hex << value << ')'; return oss.str(); } std::string toString( unsigned int value ) { return Catch::toString( static_cast<unsigned long>( value ) ); } template<typename T> std::string fpToString( T value, int precision ) { std::ostringstream oss; oss << std::setprecision( precision ) << std::fixed << value; std::string d = oss.str(); std::size_t i = d.find_last_not_of( '0' ); if( i != std::string::npos && i != d.size()-1 ) { if( d[i] == '.' ) i++; d = d.substr( 0, i+1 ); } return d; } std::string toString( const double value ) { return fpToString( value, 10 ); } std::string toString( const float value ) { return fpToString( value, 5 ) + 'f'; } std::string toString( bool value ) { return value ? "true" : "false"; } std::string toString( char value ) { if ( value == '\r' ) return "'\\r'"; if ( value == '\f' ) return "'\\f'"; if ( value == '\n' ) return "'\\n'"; if ( value == '\t' ) return "'\\t'"; if ( '\0' <= value && value < ' ' ) return toString( static_cast<unsigned int>( value ) ); char chstr[] = "' '"; chstr[1] = value; return chstr; } std::string toString( signed char value ) { return toString( static_cast<char>( value ) ); } std::string toString( unsigned char value ) { return toString( static_cast<char>( value ) ); } #ifdef CATCH_CONFIG_CPP11_LONG_LONG std::string toString( long long value ) { std::ostringstream oss; oss << value; if( value > Detail::hexThreshold ) oss << " (0x" << std::hex << value << ')'; return oss.str(); } std::string toString( unsigned long long value ) { std::ostringstream oss; oss << value; if( value > Detail::hexThreshold ) oss << " (0x" << std::hex << value << ')'; return oss.str(); } #endif #ifdef CATCH_CONFIG_CPP11_NULLPTR std::string toString( std::nullptr_t ) { return "nullptr"; } #endif #ifdef __OBJC__ std::string toString( NSString const * const& nsstring ) { if( !nsstring ) return "nil"; return "@" + toString([nsstring UTF8String]); } std::string toString( NSString * CATCH_ARC_STRONG & nsstring ) { if( !nsstring ) return "nil"; return "@" + toString([nsstring UTF8String]); } std::string toString( NSObject* const& nsObject ) { return toString( [nsObject description] ); } #endif } // end namespace Catch // #included from: catch_result_builder.hpp #define TWOBLUECUBES_CATCH_RESULT_BUILDER_HPP_INCLUDED namespace Catch { ResultBuilder::ResultBuilder( char const* macroName, SourceLineInfo const& lineInfo, char const* capturedExpression, ResultDisposition::Flags resultDisposition, char const* secondArg ) : m_assertionInfo( macroName, lineInfo, capturedExpression, resultDisposition, secondArg ), m_shouldDebugBreak( false ), m_shouldThrow( false ), m_guardException( false ), m_usedStream( false ) {} ResultBuilder::~ResultBuilder() { #if defined(CATCH_CONFIG_FAST_COMPILE) if ( m_guardException ) { stream().oss << "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; captureResult( ResultWas::ThrewException ); getCurrentContext().getResultCapture()->exceptionEarlyReported(); } #endif } ResultBuilder& ResultBuilder::setResultType( ResultWas::OfType result ) { m_data.resultType = result; return *this; } ResultBuilder& ResultBuilder::setResultType( bool result ) { m_data.resultType = result ? ResultWas::Ok : ResultWas::ExpressionFailed; return *this; } void ResultBuilder::endExpression( DecomposedExpression const& expr ) { // Flip bool results if FalseTest flag is set if( isFalseTest( m_assertionInfo.resultDisposition ) ) { m_data.negate( expr.isBinaryExpression() ); } getResultCapture().assertionRun(); if(getCurrentContext().getConfig()->includeSuccessfulResults() || m_data.resultType != ResultWas::Ok) { AssertionResult result = build( expr ); handleResult( result ); } else getResultCapture().assertionPassed(); } void ResultBuilder::useActiveException( ResultDisposition::Flags resultDisposition ) { m_assertionInfo.resultDisposition = resultDisposition; stream().oss << Catch::translateActiveException(); captureResult( ResultWas::ThrewException ); } void ResultBuilder::captureResult( ResultWas::OfType resultType ) { setResultType( resultType ); captureExpression(); } void ResultBuilder::captureExpectedException( std::string const& expectedMessage ) { if( expectedMessage.empty() ) captureExpectedException( Matchers::Impl::MatchAllOf<std::string>() ); else captureExpectedException( Matchers::Equals( expectedMessage ) ); } void ResultBuilder::captureExpectedException( Matchers::Impl::MatcherBase<std::string> const& matcher ) { assert( !isFalseTest( m_assertionInfo.resultDisposition ) ); AssertionResultData data = m_data; data.resultType = ResultWas::Ok; data.reconstructedExpression = capturedExpressionWithSecondArgument(m_assertionInfo.capturedExpression, m_assertionInfo.secondArg); std::string actualMessage = Catch::translateActiveException(); if( !matcher.match( actualMessage ) ) { data.resultType = ResultWas::ExpressionFailed; data.reconstructedExpression = actualMessage; } AssertionResult result( m_assertionInfo, data ); handleResult( result ); } void ResultBuilder::captureExpression() { AssertionResult result = build(); handleResult( result ); } void ResultBuilder::handleResult( AssertionResult const& result ) { getResultCapture().assertionEnded( result ); if( !result.isOk() ) { if( getCurrentContext().getConfig()->shouldDebugBreak() ) m_shouldDebugBreak = true; if( getCurrentContext().getRunner()->aborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) ) m_shouldThrow = true; } } void ResultBuilder::react() { #if defined(CATCH_CONFIG_FAST_COMPILE) if (m_shouldDebugBreak) { /////////////////////////////////////////////////////////////////// // To inspect the state during test, you need to go one level up the callstack // To go back to the test and change execution, jump over the throw statement /////////////////////////////////////////////////////////////////// CATCH_BREAK_INTO_DEBUGGER(); } #endif if( m_shouldThrow ) throw Catch::TestFailureException(); } bool ResultBuilder::shouldDebugBreak() const { return m_shouldDebugBreak; } bool ResultBuilder::allowThrows() const { return getCurrentContext().getConfig()->allowThrows(); } AssertionResult ResultBuilder::build() const { return build( *this ); } // CAVEAT: The returned AssertionResult stores a pointer to the argument expr, // a temporary DecomposedExpression, which in turn holds references to // operands, possibly temporary as well. // It should immediately be passed to handleResult; if the expression // needs to be reported, its string expansion must be composed before // the temporaries are destroyed. AssertionResult ResultBuilder::build( DecomposedExpression const& expr ) const { assert( m_data.resultType != ResultWas::Unknown ); AssertionResultData data = m_data; if(m_usedStream) data.message = m_stream().oss.str(); data.decomposedExpression = &expr; // for lazy reconstruction return AssertionResult( m_assertionInfo, data ); } void ResultBuilder::reconstructExpression( std::string& dest ) const { dest = capturedExpressionWithSecondArgument(m_assertionInfo.capturedExpression, m_assertionInfo.secondArg); } void ResultBuilder::setExceptionGuard() { m_guardException = true; } void ResultBuilder::unsetExceptionGuard() { m_guardException = false; } } // end namespace Catch // #included from: catch_tag_alias_registry.hpp #define TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED namespace Catch { TagAliasRegistry::~TagAliasRegistry() {} Option<TagAlias> TagAliasRegistry::find( std::string const& alias ) const { std::map<std::string, TagAlias>::const_iterator it = m_registry.find( alias ); if( it != m_registry.end() ) return it->second; else return Option<TagAlias>(); } std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { std::string expandedTestSpec = unexpandedTestSpec; for( std::map<std::string, TagAlias>::const_iterator it = m_registry.begin(), itEnd = m_registry.end(); it != itEnd; ++it ) { std::size_t pos = expandedTestSpec.find( it->first ); if( pos != std::string::npos ) { expandedTestSpec = expandedTestSpec.substr( 0, pos ) + it->second.tag + expandedTestSpec.substr( pos + it->first.size() ); } } return expandedTestSpec; } void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { if( !startsWith( alias, "[@" ) || !endsWith( alias, ']' ) ) { std::ostringstream oss; oss << Colour( Colour::Red ) << "error: tag alias, \"" << alias << "\" is not of the form [@alias name].\n" << Colour( Colour::FileName ) << lineInfo << '\n'; throw std::domain_error( oss.str().c_str() ); } if( !m_registry.insert( std::make_pair( alias, TagAlias( tag, lineInfo ) ) ).second ) { std::ostringstream oss; oss << Colour( Colour::Red ) << "error: tag alias, \"" << alias << "\" already registered.\n" << "\tFirst seen at " << Colour( Colour::Red ) << find(alias)->lineInfo << '\n' << Colour( Colour::Red ) << "\tRedefined at " << Colour( Colour::FileName) << lineInfo << '\n'; throw std::domain_error( oss.str().c_str() ); } } ITagAliasRegistry::~ITagAliasRegistry() {} ITagAliasRegistry const& ITagAliasRegistry::get() { return getRegistryHub().getTagAliasRegistry(); } RegistrarForTagAliases::RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ) { getMutableRegistryHub().registerTagAlias( alias, tag, lineInfo ); } } // end namespace Catch // #included from: catch_matchers_string.hpp namespace Catch { namespace Matchers { namespace StdString { CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) : m_caseSensitivity( caseSensitivity ), m_str( adjustString( str ) ) {} std::string CasedString::adjustString( std::string const& str ) const { return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str; } std::string CasedString::caseSensitivitySuffix() const { return m_caseSensitivity == CaseSensitive::No ? " (case insensitive)" : std::string(); } StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) : m_comparator( comparator ), m_operation( operation ) { } std::string StringMatcherBase::describe() const { std::string description; description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + m_comparator.caseSensitivitySuffix().size()); description += m_operation; description += ": \""; description += m_comparator.m_str; description += "\""; description += m_comparator.caseSensitivitySuffix(); return description; } EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} bool EqualsMatcher::match( std::string const& source ) const { return m_comparator.adjustString( source ) == m_comparator.m_str; } ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} bool ContainsMatcher::match( std::string const& source ) const { return contains( m_comparator.adjustString( source ), m_comparator.m_str ); } StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} bool StartsWithMatcher::match( std::string const& source ) const { return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); } EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} bool EndsWithMatcher::match( std::string const& source ) const { return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); } } // namespace StdString StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); } StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); } StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); } StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); } } // namespace Matchers } // namespace Catch // #included from: ../reporters/catch_reporter_multi.hpp #define TWOBLUECUBES_CATCH_REPORTER_MULTI_HPP_INCLUDED namespace Catch { class MultipleReporters : public SharedImpl<IStreamingReporter> { typedef std::vector<Ptr<IStreamingReporter> > Reporters; Reporters m_reporters; public: void add( Ptr<IStreamingReporter> const& reporter ) { m_reporters.push_back( reporter ); } public: // IStreamingReporter virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { return m_reporters[0]->getPreferences(); } virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->noMatchingTestCases( spec ); } virtual void testRunStarting( TestRunInfo const& testRunInfo ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->testRunStarting( testRunInfo ); } virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->testGroupStarting( groupInfo ); } virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->testCaseStarting( testInfo ); } virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->sectionStarting( sectionInfo ); } virtual void assertionStarting( AssertionInfo const& assertionInfo ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->assertionStarting( assertionInfo ); } // The return value indicates if the messages buffer should be cleared: virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { bool clearBuffer = false; for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) clearBuffer |= (*it)->assertionEnded( assertionStats ); return clearBuffer; } virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->sectionEnded( sectionStats ); } virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->testCaseEnded( testCaseStats ); } virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->testGroupEnded( testGroupStats ); } virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->testRunEnded( testRunStats ); } virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end(); it != itEnd; ++it ) (*it)->skipTest( testInfo ); } virtual MultipleReporters* tryAsMulti() CATCH_OVERRIDE { return this; } }; Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ) { Ptr<IStreamingReporter> resultingReporter; if( existingReporter ) { MultipleReporters* multi = existingReporter->tryAsMulti(); if( !multi ) { multi = new MultipleReporters; resultingReporter = Ptr<IStreamingReporter>( multi ); if( existingReporter ) multi->add( existingReporter ); } else resultingReporter = existingReporter; multi->add( additionalReporter ); } else resultingReporter = additionalReporter; return resultingReporter; } } // end namespace Catch // #included from: ../reporters/catch_reporter_xml.hpp #define TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED // #included from: catch_reporter_bases.hpp #define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED #include <cstring> #include <cfloat> #include <cstdio> #include <assert.h> namespace Catch { namespace { // Because formatting using c++ streams is stateful, drop down to C is required // Alternatively we could use stringstream, but its performance is... not good. std::string getFormattedDuration( double duration ) { // Max exponent + 1 is required to represent the whole part // + 1 for decimal point // + 3 for the 3 decimal places // + 1 for null terminator const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; char buffer[maxDoubleSize]; // Save previous errno, to prevent sprintf from overwriting it ErrnoGuard guard; #ifdef _MSC_VER sprintf_s(buffer, "%.3f", duration); #else sprintf(buffer, "%.3f", duration); #endif return std::string(buffer); } } struct StreamingReporterBase : SharedImpl<IStreamingReporter> { StreamingReporterBase( ReporterConfig const& _config ) : m_config( _config.fullConfig() ), stream( _config.stream() ) { m_reporterPrefs.shouldRedirectStdOut = false; } virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { return m_reporterPrefs; } virtual ~StreamingReporterBase() CATCH_OVERRIDE; virtual void noMatchingTestCases( std::string const& ) CATCH_OVERRIDE {} virtual void testRunStarting( TestRunInfo const& _testRunInfo ) CATCH_OVERRIDE { currentTestRunInfo = _testRunInfo; } virtual void testGroupStarting( GroupInfo const& _groupInfo ) CATCH_OVERRIDE { currentGroupInfo = _groupInfo; } virtual void testCaseStarting( TestCaseInfo const& _testInfo ) CATCH_OVERRIDE { currentTestCaseInfo = _testInfo; } virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE { m_sectionStack.push_back( _sectionInfo ); } virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) CATCH_OVERRIDE { m_sectionStack.pop_back(); } virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) CATCH_OVERRIDE { currentTestCaseInfo.reset(); } virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) CATCH_OVERRIDE { currentGroupInfo.reset(); } virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) CATCH_OVERRIDE { currentTestCaseInfo.reset(); currentGroupInfo.reset(); currentTestRunInfo.reset(); } virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE { // Don't do anything with this by default. // It can optionally be overridden in the derived class. } Ptr<IConfig const> m_config; std::ostream& stream; LazyStat<TestRunInfo> currentTestRunInfo; LazyStat<GroupInfo> currentGroupInfo; LazyStat<TestCaseInfo> currentTestCaseInfo; std::vector<SectionInfo> m_sectionStack; ReporterPreferences m_reporterPrefs; }; struct CumulativeReporterBase : SharedImpl<IStreamingReporter> { template<typename T, typename ChildNodeT> struct Node : SharedImpl<> { explicit Node( T const& _value ) : value( _value ) {} virtual ~Node() {} typedef std::vector<Ptr<ChildNodeT> > ChildNodes; T value; ChildNodes children; }; struct SectionNode : SharedImpl<> { explicit SectionNode( SectionStats const& _stats ) : stats( _stats ) {} virtual ~SectionNode(); bool operator == ( SectionNode const& other ) const { return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; } bool operator == ( Ptr<SectionNode> const& other ) const { return operator==( *other ); } SectionStats stats; typedef std::vector<Ptr<SectionNode> > ChildSections; typedef std::vector<AssertionStats> Assertions; ChildSections childSections; Assertions assertions; std::string stdOut; std::string stdErr; }; struct BySectionInfo { BySectionInfo( SectionInfo const& other ) : m_other( other ) {} BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} bool operator() ( Ptr<SectionNode> const& node ) const { return ((node->stats.sectionInfo.name == m_other.name) && (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); } private: void operator=( BySectionInfo const& ); SectionInfo const& m_other; }; typedef Node<TestCaseStats, SectionNode> TestCaseNode; typedef Node<TestGroupStats, TestCaseNode> TestGroupNode; typedef Node<TestRunStats, TestGroupNode> TestRunNode; CumulativeReporterBase( ReporterConfig const& _config ) : m_config( _config.fullConfig() ), stream( _config.stream() ) { m_reporterPrefs.shouldRedirectStdOut = false; } ~CumulativeReporterBase(); virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { return m_reporterPrefs; } virtual void testRunStarting( TestRunInfo const& ) CATCH_OVERRIDE {} virtual void testGroupStarting( GroupInfo const& ) CATCH_OVERRIDE {} virtual void testCaseStarting( TestCaseInfo const& ) CATCH_OVERRIDE {} virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); Ptr<SectionNode> node; if( m_sectionStack.empty() ) { if( !m_rootSection ) m_rootSection = new SectionNode( incompleteStats ); node = m_rootSection; } else { SectionNode& parentNode = *m_sectionStack.back(); SectionNode::ChildSections::const_iterator it = std::find_if( parentNode.childSections.begin(), parentNode.childSections.end(), BySectionInfo( sectionInfo ) ); if( it == parentNode.childSections.end() ) { node = new SectionNode( incompleteStats ); parentNode.childSections.push_back( node ); } else node = *it; } m_sectionStack.push_back( node ); m_deepestSection = node; } virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { assert( !m_sectionStack.empty() ); SectionNode& sectionNode = *m_sectionStack.back(); sectionNode.assertions.push_back( assertionStats ); // AssertionResult holds a pointer to a temporary DecomposedExpression, // which getExpandedExpression() calls to build the expression string. // Our section stack copy of the assertionResult will likely outlive the // temporary, so it must be expanded or discarded now to avoid calling // a destroyed object later. prepareExpandedExpression( sectionNode.assertions.back().assertionResult ); return true; } virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { assert( !m_sectionStack.empty() ); SectionNode& node = *m_sectionStack.back(); node.stats = sectionStats; m_sectionStack.pop_back(); } virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { Ptr<TestCaseNode> node = new TestCaseNode( testCaseStats ); assert( m_sectionStack.size() == 0 ); node->children.push_back( m_rootSection ); m_testCases.push_back( node ); m_rootSection.reset(); assert( m_deepestSection ); m_deepestSection->stdOut = testCaseStats.stdOut; m_deepestSection->stdErr = testCaseStats.stdErr; } virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { Ptr<TestGroupNode> node = new TestGroupNode( testGroupStats ); node->children.swap( m_testCases ); m_testGroups.push_back( node ); } virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { Ptr<TestRunNode> node = new TestRunNode( testRunStats ); node->children.swap( m_testGroups ); m_testRuns.push_back( node ); testRunEndedCumulative(); } virtual void testRunEndedCumulative() = 0; virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE {} virtual void prepareExpandedExpression( AssertionResult& result ) const { if( result.isOk() ) result.discardDecomposedExpression(); else result.expandDecomposedExpression(); } Ptr<IConfig const> m_config; std::ostream& stream; std::vector<AssertionStats> m_assertions; std::vector<std::vector<Ptr<SectionNode> > > m_sections; std::vector<Ptr<TestCaseNode> > m_testCases; std::vector<Ptr<TestGroupNode> > m_testGroups; std::vector<Ptr<TestRunNode> > m_testRuns; Ptr<SectionNode> m_rootSection; Ptr<SectionNode> m_deepestSection; std::vector<Ptr<SectionNode> > m_sectionStack; ReporterPreferences m_reporterPrefs; }; template<char C> char const* getLineOfChars() { static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; if( !*line ) { std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; } return line; } struct TestEventListenerBase : StreamingReporterBase { TestEventListenerBase( ReporterConfig const& _config ) : StreamingReporterBase( _config ) {} virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} virtual bool assertionEnded( AssertionStats const& ) CATCH_OVERRIDE { return false; } }; } // end namespace Catch // #included from: ../internal/catch_reporter_registrars.hpp #define TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED namespace Catch { template<typename T> class LegacyReporterRegistrar { class ReporterFactory : public IReporterFactory { virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new LegacyReporterAdapter( new T( config ) ); } virtual std::string getDescription() const { return T::getDescription(); } }; public: LegacyReporterRegistrar( std::string const& name ) { getMutableRegistryHub().registerReporter( name, new ReporterFactory() ); } }; template<typename T> class ReporterRegistrar { class ReporterFactory : public SharedImpl<IReporterFactory> { // *** Please Note ***: // - If you end up here looking at a compiler error because it's trying to register // your custom reporter class be aware that the native reporter interface has changed // to IStreamingReporter. The "legacy" interface, IReporter, is still supported via // an adapter. Just use REGISTER_LEGACY_REPORTER to take advantage of the adapter. // However please consider updating to the new interface as the old one is now // deprecated and will probably be removed quite soon! // Please contact me via github if you have any questions at all about this. // In fact, ideally, please contact me anyway to let me know you've hit this - as I have // no idea who is actually using custom reporters at all (possibly no-one!). // The new interface is designed to minimise exposure to interface changes in the future. virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new T( config ); } virtual std::string getDescription() const { return T::getDescription(); } }; public: ReporterRegistrar( std::string const& name ) { getMutableRegistryHub().registerReporter( name, new ReporterFactory() ); } }; template<typename T> class ListenerRegistrar { class ListenerFactory : public SharedImpl<IReporterFactory> { virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new T( config ); } virtual std::string getDescription() const { return std::string(); } }; public: ListenerRegistrar() { getMutableRegistryHub().registerListener( new ListenerFactory() ); } }; } #define INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) \ namespace{ Catch::LegacyReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } #define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \ namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } // Deprecated - use the form without INTERNAL_ #define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \ namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } #define CATCH_REGISTER_LISTENER( listenerType ) \ namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } // #included from: ../internal/catch_xmlwriter.hpp #define TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED #include <sstream> #include <string> #include <vector> #include <iomanip> namespace Catch { class XmlEncode { public: enum ForWhat { ForTextNodes, ForAttributes }; XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ) : m_str( str ), m_forWhat( forWhat ) {} void encodeTo( std::ostream& os ) const { // Apostrophe escaping not necessary if we always use " to write attributes // (see: http://www.w3.org/TR/xml/#syntax) for( std::size_t i = 0; i < m_str.size(); ++ i ) { char c = m_str[i]; switch( c ) { case '<': os << "&lt;"; break; case '&': os << "&amp;"; break; case '>': // See: http://www.w3.org/TR/xml/#syntax if( i > 2 && m_str[i-1] == ']' && m_str[i-2] == ']' ) os << "&gt;"; else os << c; break; case '\"': if( m_forWhat == ForAttributes ) os << "&quot;"; else os << c; break; default: // Escape control chars - based on contribution by @espenalb in PR #465 and // by @mrpi PR #588 if ( ( c >= 0 && c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' ) { // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 os << "\\x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>( c ); } else os << c; } } } friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { xmlEncode.encodeTo( os ); return os; } private: std::string m_str; ForWhat m_forWhat; }; class XmlWriter { public: class ScopedElement { public: ScopedElement( XmlWriter* writer ) : m_writer( writer ) {} ScopedElement( ScopedElement const& other ) : m_writer( other.m_writer ){ other.m_writer = CATCH_NULL; } ~ScopedElement() { if( m_writer ) m_writer->endElement(); } ScopedElement& writeText( std::string const& text, bool indent = true ) { m_writer->writeText( text, indent ); return *this; } template<typename T> ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { m_writer->writeAttribute( name, attribute ); return *this; } private: mutable XmlWriter* m_writer; }; XmlWriter() : m_tagIsOpen( false ), m_needsNewline( false ), m_os( Catch::cout() ) { writeDeclaration(); } XmlWriter( std::ostream& os ) : m_tagIsOpen( false ), m_needsNewline( false ), m_os( os ) { writeDeclaration(); } ~XmlWriter() { while( !m_tags.empty() ) endElement(); } XmlWriter& startElement( std::string const& name ) { ensureTagClosed(); newlineIfNecessary(); m_os << m_indent << '<' << name; m_tags.push_back( name ); m_indent += " "; m_tagIsOpen = true; return *this; } ScopedElement scopedElement( std::string const& name ) { ScopedElement scoped( this ); startElement( name ); return scoped; } XmlWriter& endElement() { newlineIfNecessary(); m_indent = m_indent.substr( 0, m_indent.size()-2 ); if( m_tagIsOpen ) { m_os << "/>"; m_tagIsOpen = false; } else { m_os << m_indent << "</" << m_tags.back() << ">"; } m_os << std::endl; m_tags.pop_back(); return *this; } XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ) { if( !name.empty() && !attribute.empty() ) m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; return *this; } XmlWriter& writeAttribute( std::string const& name, bool attribute ) { m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; return *this; } template<typename T> XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { std::ostringstream oss; oss << attribute; return writeAttribute( name, oss.str() ); } XmlWriter& writeText( std::string const& text, bool indent = true ) { if( !text.empty() ){ bool tagWasOpen = m_tagIsOpen; ensureTagClosed(); if( tagWasOpen && indent ) m_os << m_indent; m_os << XmlEncode( text ); m_needsNewline = true; } return *this; } XmlWriter& writeComment( std::string const& text ) { ensureTagClosed(); m_os << m_indent << "<!--" << text << "-->"; m_needsNewline = true; return *this; } void writeStylesheetRef( std::string const& url ) { m_os << "<?xml-stylesheet type=\"text/xsl\" href=\"" << url << "\"?>\n"; } XmlWriter& writeBlankLine() { ensureTagClosed(); m_os << '\n'; return *this; } void ensureTagClosed() { if( m_tagIsOpen ) { m_os << ">" << std::endl; m_tagIsOpen = false; } } private: XmlWriter( XmlWriter const& ); void operator=( XmlWriter const& ); void writeDeclaration() { m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; } void newlineIfNecessary() { if( m_needsNewline ) { m_os << std::endl; m_needsNewline = false; } } bool m_tagIsOpen; bool m_needsNewline; std::vector<std::string> m_tags; std::string m_indent; std::ostream& m_os; }; } namespace Catch { class XmlReporter : public StreamingReporterBase { public: XmlReporter( ReporterConfig const& _config ) : StreamingReporterBase( _config ), m_xml(_config.stream()), m_sectionDepth( 0 ) { m_reporterPrefs.shouldRedirectStdOut = true; } virtual ~XmlReporter() CATCH_OVERRIDE; static std::string getDescription() { return "Reports test results as an XML document"; } virtual std::string getStylesheetRef() const { return std::string(); } void writeSourceInfo( SourceLineInfo const& sourceInfo ) { m_xml .writeAttribute( "filename", sourceInfo.file ) .writeAttribute( "line", sourceInfo.line ); } public: // StreamingReporterBase virtual void noMatchingTestCases( std::string const& s ) CATCH_OVERRIDE { StreamingReporterBase::noMatchingTestCases( s ); } virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE { StreamingReporterBase::testRunStarting( testInfo ); std::string stylesheetRef = getStylesheetRef(); if( !stylesheetRef.empty() ) m_xml.writeStylesheetRef( stylesheetRef ); m_xml.startElement( "Catch" ); if( !m_config->name().empty() ) m_xml.writeAttribute( "name", m_config->name() ); } virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { StreamingReporterBase::testGroupStarting( groupInfo ); m_xml.startElement( "Group" ) .writeAttribute( "name", groupInfo.name ); } virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ) .writeAttribute( "name", trim( testInfo.name ) ) .writeAttribute( "description", testInfo.description ) .writeAttribute( "tags", testInfo.tagsAsString ); writeSourceInfo( testInfo.lineInfo ); if ( m_config->showDurations() == ShowDurations::Always ) m_testCaseTimer.start(); m_xml.ensureTagClosed(); } virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) .writeAttribute( "name", trim( sectionInfo.name ) ) .writeAttribute( "description", sectionInfo.description ); writeSourceInfo( sectionInfo.lineInfo ); m_xml.ensureTagClosed(); } } virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { } virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { AssertionResult const& result = assertionStats.assertionResult; bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); if( includeResults ) { // Print any info messages in <Info> tags. for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); it != itEnd; ++it ) { if( it->type == ResultWas::Info ) { m_xml.scopedElement( "Info" ) .writeText( it->message ); } else if ( it->type == ResultWas::Warning ) { m_xml.scopedElement( "Warning" ) .writeText( it->message ); } } } // Drop out if result was successful but we're not printing them. if( !includeResults && result.getResultType() != ResultWas::Warning ) return true; // Print the expression if there is one. if( result.hasExpression() ) { m_xml.startElement( "Expression" ) .writeAttribute( "success", result.succeeded() ) .writeAttribute( "type", result.getTestMacroName() ); writeSourceInfo( result.getSourceInfo() ); m_xml.scopedElement( "Original" ) .writeText( result.getExpression() ); m_xml.scopedElement( "Expanded" ) .writeText( result.getExpandedExpression() ); } // And... Print a result applicable to each result type. switch( result.getResultType() ) { case ResultWas::ThrewException: m_xml.startElement( "Exception" ); writeSourceInfo( result.getSourceInfo() ); m_xml.writeText( result.getMessage() ); m_xml.endElement(); break; case ResultWas::FatalErrorCondition: m_xml.startElement( "FatalErrorCondition" ); writeSourceInfo( result.getSourceInfo() ); m_xml.writeText( result.getMessage() ); m_xml.endElement(); break; case ResultWas::Info: m_xml.scopedElement( "Info" ) .writeText( result.getMessage() ); break; case ResultWas::Warning: // Warning will already have been written break; case ResultWas::ExplicitFailure: m_xml.startElement( "Failure" ); writeSourceInfo( result.getSourceInfo() ); m_xml.writeText( result.getMessage() ); m_xml.endElement(); break; default: break; } if( result.hasExpression() ) m_xml.endElement(); return true; } virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { StreamingReporterBase::sectionEnded( sectionStats ); if( --m_sectionDepth > 0 ) { XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); e.writeAttribute( "successes", sectionStats.assertions.passed ); e.writeAttribute( "failures", sectionStats.assertions.failed ); e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); if ( m_config->showDurations() == ShowDurations::Always ) e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); m_xml.endElement(); } } virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { StreamingReporterBase::testCaseEnded( testCaseStats ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); if ( m_config->showDurations() == ShowDurations::Always ) e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); if( !testCaseStats.stdOut.empty() ) m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); if( !testCaseStats.stdErr.empty() ) m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); m_xml.endElement(); } virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { StreamingReporterBase::testGroupEnded( testGroupStats ); // TODO: Check testGroupStats.aborting and act accordingly. m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); m_xml.endElement(); } virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { StreamingReporterBase::testRunEnded( testRunStats ); m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes", testRunStats.totals.assertions.passed ) .writeAttribute( "failures", testRunStats.totals.assertions.failed ) .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); m_xml.endElement(); } private: Timer m_testCaseTimer; XmlWriter m_xml; int m_sectionDepth; }; INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter ) } // end namespace Catch // #included from: ../reporters/catch_reporter_junit.hpp #define TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED #include <assert.h> namespace Catch { namespace { std::string getCurrentTimestamp() { // Beware, this is not reentrant because of backward compatibility issues // Also, UTC only, again because of backward compatibility (%z is C++11) time_t rawtime; std::time(&rawtime); const size_t timeStampSize = sizeof("2017-01-16T17:06:45Z"); #ifdef _MSC_VER std::tm timeInfo = {}; gmtime_s(&timeInfo, &rawtime); #else std::tm* timeInfo; timeInfo = std::gmtime(&rawtime); #endif char timeStamp[timeStampSize]; const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; #ifdef _MSC_VER std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); #else std::strftime(timeStamp, timeStampSize, fmt, timeInfo); #endif return std::string(timeStamp); } } class JunitReporter : public CumulativeReporterBase { public: JunitReporter( ReporterConfig const& _config ) : CumulativeReporterBase( _config ), xml( _config.stream() ), m_okToFail( false ) { m_reporterPrefs.shouldRedirectStdOut = true; } virtual ~JunitReporter() CATCH_OVERRIDE; static std::string getDescription() { return "Reports test results in an XML format that looks like Ant's junitreport target"; } virtual void noMatchingTestCases( std::string const& /*spec*/ ) CATCH_OVERRIDE {} virtual void testRunStarting( TestRunInfo const& runInfo ) CATCH_OVERRIDE { CumulativeReporterBase::testRunStarting( runInfo ); xml.startElement( "testsuites" ); } virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { suiteTimer.start(); stdOutForSuite.str(""); stdErrForSuite.str(""); unexpectedExceptions = 0; CumulativeReporterBase::testGroupStarting( groupInfo ); } virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE { m_okToFail = testCaseInfo.okToFail(); } virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) unexpectedExceptions++; return CumulativeReporterBase::assertionEnded( assertionStats ); } virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { stdOutForSuite << testCaseStats.stdOut; stdErrForSuite << testCaseStats.stdErr; CumulativeReporterBase::testCaseEnded( testCaseStats ); } virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { double suiteTime = suiteTimer.getElapsedSeconds(); CumulativeReporterBase::testGroupEnded( testGroupStats ); writeGroup( *m_testGroups.back(), suiteTime ); } virtual void testRunEndedCumulative() CATCH_OVERRIDE { xml.endElement(); } void writeGroup( TestGroupNode const& groupNode, double suiteTime ) { XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); TestGroupStats const& stats = groupNode.value; xml.writeAttribute( "name", stats.groupInfo.name ); xml.writeAttribute( "errors", unexpectedExceptions ); xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); xml.writeAttribute( "tests", stats.totals.assertions.total() ); xml.writeAttribute( "hostname", "tbd" ); // !TBD if( m_config->showDurations() == ShowDurations::Never ) xml.writeAttribute( "time", "" ); else xml.writeAttribute( "time", suiteTime ); xml.writeAttribute( "timestamp", getCurrentTimestamp() ); // Write test cases for( TestGroupNode::ChildNodes::const_iterator it = groupNode.children.begin(), itEnd = groupNode.children.end(); it != itEnd; ++it ) writeTestCase( **it ); xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite.str() ), false ); xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite.str() ), false ); } static std::string fileNameTag( const std::set<std::string> &tags ) { std::set<std::string>::const_iterator it = tags.lower_bound("#"); if( it != tags.end() && !it->empty() && it->front() == '#' ) return it->substr(1); return std::string(); } void writeTestCase( TestCaseNode const& testCaseNode ) { TestCaseStats const& stats = testCaseNode.value; // All test cases have exactly one section - which represents the // test case itself. That section may have 0-n nested sections assert( testCaseNode.children.size() == 1 ); SectionNode const& rootSection = *testCaseNode.children.front(); std::string className = stats.testInfo.className; if( className.empty() ) { className = fileNameTag(stats.testInfo.tags); if ( className.empty() ) className = "global"; } if ( !m_config->name().empty() ) className = m_config->name() + "." + className; writeSection( className, "", rootSection ); } void writeSection( std::string const& className, std::string const& rootName, SectionNode const& sectionNode ) { std::string name = trim( sectionNode.stats.sectionInfo.name ); if( !rootName.empty() ) name = rootName + '/' + name; if( !sectionNode.assertions.empty() || !sectionNode.stdOut.empty() || !sectionNode.stdErr.empty() ) { XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); if( className.empty() ) { xml.writeAttribute( "classname", name ); xml.writeAttribute( "name", "root" ); } else { xml.writeAttribute( "classname", className ); xml.writeAttribute( "name", name ); } xml.writeAttribute( "time", Catch::toString( sectionNode.stats.durationInSeconds ) ); writeAssertions( sectionNode ); if( !sectionNode.stdOut.empty() ) xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); if( !sectionNode.stdErr.empty() ) xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); } for( SectionNode::ChildSections::const_iterator it = sectionNode.childSections.begin(), itEnd = sectionNode.childSections.end(); it != itEnd; ++it ) if( className.empty() ) writeSection( name, "", **it ); else writeSection( className, name, **it ); } void writeAssertions( SectionNode const& sectionNode ) { for( SectionNode::Assertions::const_iterator it = sectionNode.assertions.begin(), itEnd = sectionNode.assertions.end(); it != itEnd; ++it ) writeAssertion( *it ); } void writeAssertion( AssertionStats const& stats ) { AssertionResult const& result = stats.assertionResult; if( !result.isOk() ) { std::string elementName; switch( result.getResultType() ) { case ResultWas::ThrewException: case ResultWas::FatalErrorCondition: elementName = "error"; break; case ResultWas::ExplicitFailure: elementName = "failure"; break; case ResultWas::ExpressionFailed: elementName = "failure"; break; case ResultWas::DidntThrowException: elementName = "failure"; break; // We should never see these here: case ResultWas::Info: case ResultWas::Warning: case ResultWas::Ok: case ResultWas::Unknown: case ResultWas::FailureBit: case ResultWas::Exception: elementName = "internalError"; break; } XmlWriter::ScopedElement e = xml.scopedElement( elementName ); xml.writeAttribute( "message", result.getExpandedExpression() ); xml.writeAttribute( "type", result.getTestMacroName() ); std::ostringstream oss; if( !result.getMessage().empty() ) oss << result.getMessage() << '\n'; for( std::vector<MessageInfo>::const_iterator it = stats.infoMessages.begin(), itEnd = stats.infoMessages.end(); it != itEnd; ++it ) if( it->type == ResultWas::Info ) oss << it->message << '\n'; oss << "at " << result.getSourceInfo(); xml.writeText( oss.str(), false ); } } XmlWriter xml; Timer suiteTimer; std::ostringstream stdOutForSuite; std::ostringstream stdErrForSuite; unsigned int unexpectedExceptions; bool m_okToFail; }; INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter ) } // end namespace Catch // #included from: ../reporters/catch_reporter_console.hpp #define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_HPP_INCLUDED #include <cfloat> #include <cstdio> namespace Catch { struct ConsoleReporter : StreamingReporterBase { ConsoleReporter( ReporterConfig const& _config ) : StreamingReporterBase( _config ), m_headerPrinted( false ) {} virtual ~ConsoleReporter() CATCH_OVERRIDE; static std::string getDescription() { return "Reports test results as plain lines of text"; } virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE { stream << "No test cases matched '" << spec << '\'' << std::endl; } virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { } virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE { AssertionResult const& result = _assertionStats.assertionResult; bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); // Drop out if result was successful but we're not printing them. if( !includeResults && result.getResultType() != ResultWas::Warning ) return false; lazyPrint(); AssertionPrinter printer( stream, _assertionStats, includeResults ); printer.print(); stream << std::endl; return true; } virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE { m_headerPrinted = false; StreamingReporterBase::sectionStarting( _sectionInfo ); } virtual void sectionEnded( SectionStats const& _sectionStats ) CATCH_OVERRIDE { if( _sectionStats.missingAssertions ) { lazyPrint(); Colour colour( Colour::ResultError ); if( m_sectionStack.size() > 1 ) stream << "\nNo assertions in section"; else stream << "\nNo assertions in test case"; stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; } if( m_config->showDurations() == ShowDurations::Always ) { stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; } if( m_headerPrinted ) { m_headerPrinted = false; } StreamingReporterBase::sectionEnded( _sectionStats ); } virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) CATCH_OVERRIDE { StreamingReporterBase::testCaseEnded( _testCaseStats ); m_headerPrinted = false; } virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) CATCH_OVERRIDE { if( currentGroupInfo.used ) { printSummaryDivider(); stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; printTotals( _testGroupStats.totals ); stream << '\n' << std::endl; } StreamingReporterBase::testGroupEnded( _testGroupStats ); } virtual void testRunEnded( TestRunStats const& _testRunStats ) CATCH_OVERRIDE { printTotalsDivider( _testRunStats.totals ); printTotals( _testRunStats.totals ); stream << std::endl; StreamingReporterBase::testRunEnded( _testRunStats ); } private: class AssertionPrinter { void operator= ( AssertionPrinter const& ); public: AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages ) : stream( _stream ), stats( _stats ), result( _stats.assertionResult ), colour( Colour::None ), message( result.getMessage() ), messages( _stats.infoMessages ), printInfoMessages( _printInfoMessages ) { switch( result.getResultType() ) { case ResultWas::Ok: colour = Colour::Success; passOrFail = "PASSED"; //if( result.hasMessage() ) if( _stats.infoMessages.size() == 1 ) messageLabel = "with message"; if( _stats.infoMessages.size() > 1 ) messageLabel = "with messages"; break; case ResultWas::ExpressionFailed: if( result.isOk() ) { colour = Colour::Success; passOrFail = "FAILED - but was ok"; } else { colour = Colour::Error; passOrFail = "FAILED"; } if( _stats.infoMessages.size() == 1 ) messageLabel = "with message"; if( _stats.infoMessages.size() > 1 ) messageLabel = "with messages"; break; case ResultWas::ThrewException: colour = Colour::Error; passOrFail = "FAILED"; messageLabel = "due to unexpected exception with "; if (_stats.infoMessages.size() == 1) messageLabel += "message"; if (_stats.infoMessages.size() > 1) messageLabel += "messages"; break; case ResultWas::FatalErrorCondition: colour = Colour::Error; passOrFail = "FAILED"; messageLabel = "due to a fatal error condition"; break; case ResultWas::DidntThrowException: colour = Colour::Error; passOrFail = "FAILED"; messageLabel = "because no exception was thrown where one was expected"; break; case ResultWas::Info: messageLabel = "info"; break; case ResultWas::Warning: messageLabel = "warning"; break; case ResultWas::ExplicitFailure: passOrFail = "FAILED"; colour = Colour::Error; if( _stats.infoMessages.size() == 1 ) messageLabel = "explicitly with message"; if( _stats.infoMessages.size() > 1 ) messageLabel = "explicitly with messages"; break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: case ResultWas::FailureBit: case ResultWas::Exception: passOrFail = "** internal error **"; colour = Colour::Error; break; } } void print() const { printSourceInfo(); if( stats.totals.assertions.total() > 0 ) { if( result.isOk() ) stream << '\n'; printResultType(); printOriginalExpression(); printReconstructedExpression(); } else { stream << '\n'; } printMessage(); } private: void printResultType() const { if( !passOrFail.empty() ) { Colour colourGuard( colour ); stream << passOrFail << ":\n"; } } void printOriginalExpression() const { if( result.hasExpression() ) { Colour colourGuard( Colour::OriginalExpression ); stream << " "; stream << result.getExpressionInMacro(); stream << '\n'; } } void printReconstructedExpression() const { if( result.hasExpandedExpression() ) { stream << "with expansion:\n"; Colour colourGuard( Colour::ReconstructedExpression ); stream << Text( result.getExpandedExpression(), TextAttributes().setIndent(2) ) << '\n'; } } void printMessage() const { if( !messageLabel.empty() ) stream << messageLabel << ':' << '\n'; for( std::vector<MessageInfo>::const_iterator it = messages.begin(), itEnd = messages.end(); it != itEnd; ++it ) { // If this assertion is a warning ignore any INFO messages if( printInfoMessages || it->type != ResultWas::Info ) stream << Text( it->message, TextAttributes().setIndent(2) ) << '\n'; } } void printSourceInfo() const { Colour colourGuard( Colour::FileName ); stream << result.getSourceInfo() << ": "; } std::ostream& stream; AssertionStats const& stats; AssertionResult const& result; Colour::Code colour; std::string passOrFail; std::string messageLabel; std::string message; std::vector<MessageInfo> messages; bool printInfoMessages; }; void lazyPrint() { if( !currentTestRunInfo.used ) lazyPrintRunInfo(); if( !currentGroupInfo.used ) lazyPrintGroupInfo(); if( !m_headerPrinted ) { printTestCaseAndSectionHeader(); m_headerPrinted = true; } } void lazyPrintRunInfo() { stream << '\n' << getLineOfChars<'~'>() << '\n'; Colour colour( Colour::SecondaryText ); stream << currentTestRunInfo->name << " is a Catch v" << libraryVersion() << " host application.\n" << "Run with -? for options\n\n"; if( m_config->rngSeed() != 0 ) stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; currentTestRunInfo.used = true; } void lazyPrintGroupInfo() { if( !currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1 ) { printClosedHeader( "Group: " + currentGroupInfo->name ); currentGroupInfo.used = true; } } void printTestCaseAndSectionHeader() { assert( !m_sectionStack.empty() ); printOpenHeader( currentTestCaseInfo->name ); if( m_sectionStack.size() > 1 ) { Colour colourGuard( Colour::Headers ); std::vector<SectionInfo>::const_iterator it = m_sectionStack.begin()+1, // Skip first section (test case) itEnd = m_sectionStack.end(); for( ; it != itEnd; ++it ) printHeaderString( it->name, 2 ); } SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; if( !lineInfo.empty() ){ stream << getLineOfChars<'-'>() << '\n'; Colour colourGuard( Colour::FileName ); stream << lineInfo << '\n'; } stream << getLineOfChars<'.'>() << '\n' << std::endl; } void printClosedHeader( std::string const& _name ) { printOpenHeader( _name ); stream << getLineOfChars<'.'>() << '\n'; } void printOpenHeader( std::string const& _name ) { stream << getLineOfChars<'-'>() << '\n'; { Colour colourGuard( Colour::Headers ); printHeaderString( _name ); } } // if string has a : in first line will set indent to follow it on // subsequent lines void printHeaderString( std::string const& _string, std::size_t indent = 0 ) { std::size_t i = _string.find( ": " ); if( i != std::string::npos ) i+=2; else i = 0; stream << Text( _string, TextAttributes() .setIndent( indent+i) .setInitialIndent( indent ) ) << '\n'; } struct SummaryColumn { SummaryColumn( std::string const& _label, Colour::Code _colour ) : label( _label ), colour( _colour ) {} SummaryColumn addRow( std::size_t count ) { std::ostringstream oss; oss << count; std::string row = oss.str(); for( std::vector<std::string>::iterator it = rows.begin(); it != rows.end(); ++it ) { while( it->size() < row.size() ) *it = ' ' + *it; while( it->size() > row.size() ) row = ' ' + row; } rows.push_back( row ); return *this; } std::string label; Colour::Code colour; std::vector<std::string> rows; }; void printTotals( Totals const& totals ) { if( totals.testCases.total() == 0 ) { stream << Colour( Colour::Warning ) << "No tests ran\n"; } else if( totals.assertions.total() > 0 && totals.testCases.allPassed() ) { stream << Colour( Colour::ResultSuccess ) << "All tests passed"; stream << " (" << pluralise( totals.assertions.passed, "assertion" ) << " in " << pluralise( totals.testCases.passed, "test case" ) << ')' << '\n'; } else { std::vector<SummaryColumn> columns; columns.push_back( SummaryColumn( "", Colour::None ) .addRow( totals.testCases.total() ) .addRow( totals.assertions.total() ) ); columns.push_back( SummaryColumn( "passed", Colour::Success ) .addRow( totals.testCases.passed ) .addRow( totals.assertions.passed ) ); columns.push_back( SummaryColumn( "failed", Colour::ResultError ) .addRow( totals.testCases.failed ) .addRow( totals.assertions.failed ) ); columns.push_back( SummaryColumn( "failed as expected", Colour::ResultExpectedFailure ) .addRow( totals.testCases.failedButOk ) .addRow( totals.assertions.failedButOk ) ); printSummaryRow( "test cases", columns, 0 ); printSummaryRow( "assertions", columns, 1 ); } } void printSummaryRow( std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row ) { for( std::vector<SummaryColumn>::const_iterator it = cols.begin(); it != cols.end(); ++it ) { std::string value = it->rows[row]; if( it->label.empty() ) { stream << label << ": "; if( value != "0" ) stream << value; else stream << Colour( Colour::Warning ) << "- none -"; } else if( value != "0" ) { stream << Colour( Colour::LightGrey ) << " | "; stream << Colour( it->colour ) << value << ' ' << it->label; } } stream << '\n'; } static std::size_t makeRatio( std::size_t number, std::size_t total ) { std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number/ total : 0; return ( ratio == 0 && number > 0 ) ? 1 : ratio; } static std::size_t& findMax( std::size_t& i, std::size_t& j, std::size_t& k ) { if( i > j && i > k ) return i; else if( j > k ) return j; else return k; } void printTotalsDivider( Totals const& totals ) { if( totals.testCases.total() > 0 ) { std::size_t failedRatio = makeRatio( totals.testCases.failed, totals.testCases.total() ); std::size_t failedButOkRatio = makeRatio( totals.testCases.failedButOk, totals.testCases.total() ); std::size_t passedRatio = makeRatio( totals.testCases.passed, totals.testCases.total() ); while( failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH-1 ) findMax( failedRatio, failedButOkRatio, passedRatio )++; while( failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH-1 ) findMax( failedRatio, failedButOkRatio, passedRatio )--; stream << Colour( Colour::Error ) << std::string( failedRatio, '=' ); stream << Colour( Colour::ResultExpectedFailure ) << std::string( failedButOkRatio, '=' ); if( totals.testCases.allPassed() ) stream << Colour( Colour::ResultSuccess ) << std::string( passedRatio, '=' ); else stream << Colour( Colour::Success ) << std::string( passedRatio, '=' ); } else { stream << Colour( Colour::Warning ) << std::string( CATCH_CONFIG_CONSOLE_WIDTH-1, '=' ); } stream << '\n'; } void printSummaryDivider() { stream << getLineOfChars<'-'>() << '\n'; } private: bool m_headerPrinted; }; INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter ) } // end namespace Catch // #included from: ../reporters/catch_reporter_compact.hpp #define TWOBLUECUBES_CATCH_REPORTER_COMPACT_HPP_INCLUDED namespace Catch { struct CompactReporter : StreamingReporterBase { CompactReporter( ReporterConfig const& _config ) : StreamingReporterBase( _config ) {} virtual ~CompactReporter(); static std::string getDescription() { return "Reports test results on a single line, suitable for IDEs"; } virtual ReporterPreferences getPreferences() const { ReporterPreferences prefs; prefs.shouldRedirectStdOut = false; return prefs; } virtual void noMatchingTestCases( std::string const& spec ) { stream << "No test cases matched '" << spec << '\'' << std::endl; } virtual void assertionStarting( AssertionInfo const& ) {} virtual bool assertionEnded( AssertionStats const& _assertionStats ) { AssertionResult const& result = _assertionStats.assertionResult; bool printInfoMessages = true; // Drop out if result was successful and we're not printing those if( !m_config->includeSuccessfulResults() && result.isOk() ) { if( result.getResultType() != ResultWas::Warning ) return false; printInfoMessages = false; } AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); printer.print(); stream << std::endl; return true; } virtual void sectionEnded(SectionStats const& _sectionStats) CATCH_OVERRIDE { if (m_config->showDurations() == ShowDurations::Always) { stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; } } virtual void testRunEnded( TestRunStats const& _testRunStats ) { printTotals( _testRunStats.totals ); stream << '\n' << std::endl; StreamingReporterBase::testRunEnded( _testRunStats ); } private: class AssertionPrinter { void operator= ( AssertionPrinter const& ); public: AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages ) : stream( _stream ) , stats( _stats ) , result( _stats.assertionResult ) , messages( _stats.infoMessages ) , itMessage( _stats.infoMessages.begin() ) , printInfoMessages( _printInfoMessages ) {} void print() { printSourceInfo(); itMessage = messages.begin(); switch( result.getResultType() ) { case ResultWas::Ok: printResultType( Colour::ResultSuccess, passedString() ); printOriginalExpression(); printReconstructedExpression(); if ( ! result.hasExpression() ) printRemainingMessages( Colour::None ); else printRemainingMessages(); break; case ResultWas::ExpressionFailed: if( result.isOk() ) printResultType( Colour::ResultSuccess, failedString() + std::string( " - but was ok" ) ); else printResultType( Colour::Error, failedString() ); printOriginalExpression(); printReconstructedExpression(); printRemainingMessages(); break; case ResultWas::ThrewException: printResultType( Colour::Error, failedString() ); printIssue( "unexpected exception with message:" ); printMessage(); printExpressionWas(); printRemainingMessages(); break; case ResultWas::FatalErrorCondition: printResultType( Colour::Error, failedString() ); printIssue( "fatal error condition with message:" ); printMessage(); printExpressionWas(); printRemainingMessages(); break; case ResultWas::DidntThrowException: printResultType( Colour::Error, failedString() ); printIssue( "expected exception, got none" ); printExpressionWas(); printRemainingMessages(); break; case ResultWas::Info: printResultType( Colour::None, "info" ); printMessage(); printRemainingMessages(); break; case ResultWas::Warning: printResultType( Colour::None, "warning" ); printMessage(); printRemainingMessages(); break; case ResultWas::ExplicitFailure: printResultType( Colour::Error, failedString() ); printIssue( "explicitly" ); printRemainingMessages( Colour::None ); break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: case ResultWas::FailureBit: case ResultWas::Exception: printResultType( Colour::Error, "** internal error **" ); break; } } private: // Colour::LightGrey static Colour::Code dimColour() { return Colour::FileName; } #ifdef CATCH_PLATFORM_MAC static const char* failedString() { return "FAILED"; } static const char* passedString() { return "PASSED"; } #else static const char* failedString() { return "failed"; } static const char* passedString() { return "passed"; } #endif void printSourceInfo() const { Colour colourGuard( Colour::FileName ); stream << result.getSourceInfo() << ':'; } void printResultType( Colour::Code colour, std::string const& passOrFail ) const { if( !passOrFail.empty() ) { { Colour colourGuard( colour ); stream << ' ' << passOrFail; } stream << ':'; } } void printIssue( std::string const& issue ) const { stream << ' ' << issue; } void printExpressionWas() { if( result.hasExpression() ) { stream << ';'; { Colour colour( dimColour() ); stream << " expression was:"; } printOriginalExpression(); } } void printOriginalExpression() const { if( result.hasExpression() ) { stream << ' ' << result.getExpression(); } } void printReconstructedExpression() const { if( result.hasExpandedExpression() ) { { Colour colour( dimColour() ); stream << " for: "; } stream << result.getExpandedExpression(); } } void printMessage() { if ( itMessage != messages.end() ) { stream << " '" << itMessage->message << '\''; ++itMessage; } } void printRemainingMessages( Colour::Code colour = dimColour() ) { if ( itMessage == messages.end() ) return; // using messages.end() directly yields compilation error: std::vector<MessageInfo>::const_iterator itEnd = messages.end(); const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) ); { Colour colourGuard( colour ); stream << " with " << pluralise( N, "message" ) << ':'; } for(; itMessage != itEnd; ) { // If this assertion is a warning ignore any INFO messages if( printInfoMessages || itMessage->type != ResultWas::Info ) { stream << " '" << itMessage->message << '\''; if ( ++itMessage != itEnd ) { Colour colourGuard( dimColour() ); stream << " and"; } } } } private: std::ostream& stream; AssertionStats const& stats; AssertionResult const& result; std::vector<MessageInfo> messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; }; // Colour, message variants: // - white: No tests ran. // - red: Failed [both/all] N test cases, failed [both/all] M assertions. // - white: Passed [both/all] N test cases (no assertions). // - red: Failed N tests cases, failed M assertions. // - green: Passed [both/all] N tests cases with M assertions. std::string bothOrAll( std::size_t count ) const { return count == 1 ? std::string() : count == 2 ? "both " : "all " ; } void printTotals( const Totals& totals ) const { if( totals.testCases.total() == 0 ) { stream << "No tests ran."; } else if( totals.testCases.failed == totals.testCases.total() ) { Colour colour( Colour::ResultError ); const std::string qualify_assertions_failed = totals.assertions.failed == totals.assertions.total() ? bothOrAll( totals.assertions.failed ) : std::string(); stream << "Failed " << bothOrAll( totals.testCases.failed ) << pluralise( totals.testCases.failed, "test case" ) << ", " "failed " << qualify_assertions_failed << pluralise( totals.assertions.failed, "assertion" ) << '.'; } else if( totals.assertions.total() == 0 ) { stream << "Passed " << bothOrAll( totals.testCases.total() ) << pluralise( totals.testCases.total(), "test case" ) << " (no assertions)."; } else if( totals.assertions.failed ) { Colour colour( Colour::ResultError ); stream << "Failed " << pluralise( totals.testCases.failed, "test case" ) << ", " "failed " << pluralise( totals.assertions.failed, "assertion" ) << '.'; } else { Colour colour( Colour::ResultSuccess ); stream << "Passed " << bothOrAll( totals.testCases.passed ) << pluralise( totals.testCases.passed, "test case" ) << " with " << pluralise( totals.assertions.passed, "assertion" ) << '.'; } } }; INTERNAL_CATCH_REGISTER_REPORTER( "compact", CompactReporter ) } // end namespace Catch namespace Catch { // These are all here to avoid warnings about not having any out of line // virtual methods NonCopyable::~NonCopyable() {} IShared::~IShared() {} IStream::~IStream() CATCH_NOEXCEPT {} FileStream::~FileStream() CATCH_NOEXCEPT {} CoutStream::~CoutStream() CATCH_NOEXCEPT {} DebugOutStream::~DebugOutStream() CATCH_NOEXCEPT {} StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} IContext::~IContext() {} IResultCapture::~IResultCapture() {} ITestCase::~ITestCase() {} ITestCaseRegistry::~ITestCaseRegistry() {} IRegistryHub::~IRegistryHub() {} IMutableRegistryHub::~IMutableRegistryHub() {} IExceptionTranslator::~IExceptionTranslator() {} IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {} IReporter::~IReporter() {} IReporterFactory::~IReporterFactory() {} IReporterRegistry::~IReporterRegistry() {} IStreamingReporter::~IStreamingReporter() {} AssertionStats::~AssertionStats() {} SectionStats::~SectionStats() {} TestCaseStats::~TestCaseStats() {} TestGroupStats::~TestGroupStats() {} TestRunStats::~TestRunStats() {} CumulativeReporterBase::SectionNode::~SectionNode() {} CumulativeReporterBase::~CumulativeReporterBase() {} StreamingReporterBase::~StreamingReporterBase() {} ConsoleReporter::~ConsoleReporter() {} CompactReporter::~CompactReporter() {} IRunner::~IRunner() {} IMutableContext::~IMutableContext() {} IConfig::~IConfig() {} XmlReporter::~XmlReporter() {} JunitReporter::~JunitReporter() {} TestRegistry::~TestRegistry() {} FreeFunctionTestCase::~FreeFunctionTestCase() {} IGeneratorInfo::~IGeneratorInfo() {} IGeneratorsForTest::~IGeneratorsForTest() {} WildcardPattern::~WildcardPattern() {} TestSpec::Pattern::~Pattern() {} TestSpec::NamePattern::~NamePattern() {} TestSpec::TagPattern::~TagPattern() {} TestSpec::ExcludedPattern::~ExcludedPattern() {} Matchers::Impl::MatcherUntypedBase::~MatcherUntypedBase() {} void Config::dummy() {} namespace TestCaseTracking { ITracker::~ITracker() {} TrackerBase::~TrackerBase() {} SectionTracker::~SectionTracker() {} IndexTracker::~IndexTracker() {} } } #ifdef __clang__ #pragma clang diagnostic pop #endif #endif #ifdef CATCH_CONFIG_MAIN // #included from: internal/catch_default_main.hpp #define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED #ifndef __OBJC__ #if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) // Standard C/C++ Win32 Unicode wmain entry point extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { #else // Standard C/C++ main entry point int main (int argc, char * argv[]) { #endif int result = Catch::Session().run( argc, argv ); return ( result < 0xff ? result : 0xff ); } #else // __OBJC__ // Objective-C entry point int main (int argc, char * const argv[]) { #if !CATCH_ARC_ENABLED NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; #endif Catch::registerTestMethods(); int result = Catch::Session().run( argc, (char* const*)argv ); #if !CATCH_ARC_ENABLED [pool drain]; #endif return ( result < 0xff ? result : 0xff ); } #endif // __OBJC__ #endif #ifdef CLARA_CONFIG_MAIN_NOT_DEFINED # undef CLARA_CONFIG_MAIN #endif ////// // If this config identifier is defined then all CATCH macros are prefixed with CATCH_ #ifdef CATCH_CONFIG_PREFIX_ALL #if defined(CATCH_CONFIG_FAST_COMPILE) #define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, expr ) #define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr ) #else #define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, expr ) #define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr ) #endif #define CATCH_REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", expr ) #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) #define CATCH_REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, expr ) #define CATCH_CHECK( expr ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CATCH_CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, expr ) #define CATCH_CHECKED_IF( expr ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, expr ) #define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", expr ) #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) #define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) #if defined(CATCH_CONFIG_FAST_COMPILE) #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT_NO_TRY( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) #else #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) #endif #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) #define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) #define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) ) #define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) ) #ifdef CATCH_CONFIG_VARIADIC_MACROS #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #else #define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description ) #define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description ) #define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description ) #define CATCH_REGISTER_TEST_CASE( function, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( function, name, description ) #define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) #define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, msg ) #define CATCH_FAIL_CHECK( msg ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, msg ) #define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, msg ) #endif #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) #define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) #define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) #define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr ) // "BDD-style" convenience wrappers #ifdef CATCH_CONFIG_VARIADIC_MACROS #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) #else #define CATCH_SCENARIO( name, tags ) CATCH_TEST_CASE( "Scenario: " name, tags ) #define CATCH_SCENARIO_METHOD( className, name, tags ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " name, tags ) #endif #define CATCH_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc, "" ) #define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc, "" ) #define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc, "" ) #define CATCH_THEN( desc ) CATCH_SECTION( std::string( " Then: ") + desc, "" ) #define CATCH_AND_THEN( desc ) CATCH_SECTION( std::string( " And: ") + desc, "" ) // If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required #else #if defined(CATCH_CONFIG_FAST_COMPILE) #define REQUIRE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "REQUIRE", Catch::ResultDisposition::Normal, expr ) #define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr ) #else #define REQUIRE( expr ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, expr ) #define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr ) #endif #define REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", expr ) #define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) #define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) #define REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, expr ) #define CHECK( expr ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, expr ) #define CHECKED_IF( expr ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, expr ) #define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", expr ) #define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) #define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) #define CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, expr ) #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) #if defined(CATCH_CONFIG_FAST_COMPILE) #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT_NO_TRY( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) #else #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) #endif #define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) #define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) #define SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) #define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) ) #define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) ) #ifdef CATCH_CONFIG_VARIADIC_MACROS #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) #define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #else #define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description ) #define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description ) #define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description ) #define REGISTER_TEST_CASE( method, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( method, name, description ) #define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) #define FAIL( msg ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, msg ) #define FAIL_CHECK( msg ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, msg ) #define SUCCEED( msg ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, msg ) #endif #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) #define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) #define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) #define GENERATE( expr) INTERNAL_CATCH_GENERATE( expr ) #endif #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) // "BDD-style" convenience wrappers #ifdef CATCH_CONFIG_VARIADIC_MACROS #define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) #else #define SCENARIO( name, tags ) TEST_CASE( "Scenario: " name, tags ) #define SCENARIO_METHOD( className, name, tags ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " name, tags ) #endif #define GIVEN( desc ) SECTION( std::string(" Given: ") + desc, "" ) #define WHEN( desc ) SECTION( std::string(" When: ") + desc, "" ) #define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc, "" ) #define THEN( desc ) SECTION( std::string(" Then: ") + desc, "" ) #define AND_THEN( desc ) SECTION( std::string(" And: ") + desc, "" ) using Catch::Detail::Approx; // #included from: internal/catch_reenable_warnings.h #define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED #ifdef __clang__ # ifdef __ICC // icpc defines the __clang__ macro # pragma warning(pop) # else # pragma clang diagnostic pop # endif #elif defined __GNUC__ # pragma GCC diagnostic pop #endif #endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
b0ce9d52858a092359fcf5fd2ae76f7505d1cfab
6cdc383cea1501c235c3558198994b457821c6dd
/Sortings_5_QuickSort/src/QuickSort.cpp
9a48b411694ce925cad316568a4bacef5d732cef
[]
no_license
anilkagak2/Basic_DataStructures
90652934ce837eb9e0d976a9d839bae22e597d55
83e93674cbefa82893c54476b90575f8ee8f8b15
refs/heads/master
2020-05-18T06:49:57.447700
2012-08-15T14:45:50
2012-08-15T14:45:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,847
cpp
/* defining the member functions of the class QuickSort */ /* except for the sorting methods all other methods remains same */ /* drawbacks --> ##1 traversing the same file twice */ #include "../include/QuickSort.h" #include <iostream> #include <fstream> using namespace std; // 1 /* default constructor, initializes the arr, num_vals variables */ template<class T> QuickSort<T>::QuickSort() { arr = NULL; /* pointer to the array structure */ num_vals = 0; /* number of values in the array */ } // 2 /* default destructor, frees the memory allocated to arr */ template<class T> QuickSort<T>::~QuickSort() { /* delete the arr if it is not NULL */ if(arr) { delete[] arr; } } // 3 /* file will only contain the data, not the datatype as string */ /* datatype for the program will be given via commandline */ /* loads the input from the file stream */ template<class T> void QuickSort<T>::load_input(char fileName[]) { /* will be traversing the file twice */ /* 1--> for noting the number of elements in the file */ /* 2--> for taking out the input */ /* opening the file for reading */ ifstream fp; fp.open(fileName); /* checking the stream for errors */ if(!fp) { cout << "Error Occurred in opening the file\n"; return ; } T tmp; /* counts the number of elements */ int count = 0; // till the end of file is reached while(fp.eof() == 0) { fp >> tmp; /* take the input to the tmp */ /* if end of file is hit */ if(fp.eof() == 1) break; count++; /* increase the count */ } // number of elements num_vals = count; // remove the bag state of the file fp.clear(); // move file pointer to the beginning of the file fp.seekg(0,ios::beg); //allocate space for count number of integers arr = new T[count]; int i = 0; // read the elemtents while(fp.eof() == 0) { fp >> arr[i]; /* take the input to the tmp */ i++; /* increase the count */ /* if end of file is hit */ if(fp.eof() == 1) break; } fp.close(); } // 4 /* prints the content of the arr */ template<class T> void QuickSort<T>::print() { // print the list for(int i =0;i<num_vals;i++) { cout << arr[i] << "->"; } } // 5 /* sorts the data in increasing order */ template<class T> void QuickSort<T>::sort_inc() { /* call the private sorting member function */ Quick_Sort(arr,0,num_vals); } // 6 /* Quicks the two sorted arrays, left-->mid and mid+1-->right */ template<class T> int QuickSort<T>::Partition1(T a[],int left,int right) { T x = a[left]; /* choose the pivot */ int l = left+1, r = right; // main partition routine while(l<r) { cout << l << " "; // till a[l] is lesser than x move l one step ahead while(l<=right && a[l]<x) l++; // till a[l] is greater than x move l one step behind while(r>left && a[r]>=x) r--; // exchange a[l],a[r] if( l < r) { T tmp = a[l]; a[l] = a[r]; a[r] = tmp; } } // exchange a[r], pivot //if(a[r] < x) { a[left] = a[r]; a[r] = x; } // return pivot's position return r; } // 7 /* Quicks the two sorted arrays, left-->mid and mid+1-->right */ template<class T> int QuickSort<T>::Partition2(T a[],int left,int right) { T x = a[left]; int i = left; int j = left+1; for(;j<=right;j++) { // exchange a[i],a[j] if(a[j]<x) { i++; T tmp = a[j]; a[j] = a[i]; a[i] = tmp; } } a[left] = a[i]; a[i] = x; return i; } // 8 /* recursive procedural call for sorting */ template<class T> void QuickSort<T>::Quick_Sort(T A[],int left,int right) { // if array size is greater than 1 if(left < right) { /* pivot is placed at its final position in the sorted array */ int q = Partition1(A,left,right); /* partitions the array, returns the pivot's index */ Quick_Sort(A,left,q-1); /* sort the first half of the array */ Quick_Sort(A,q+1,right); /* sort the second half of the array */ } }
1c1ae2d9064f9cd89dd0a8cc9daad9a078659fcd
1a2fe414533123957965e66dcf2b150b06d9adb4
/lab1_win_exceptions/getExceptionInformation/getExceptionInformation/getExceptionInformation.cpp
6b1bf9d3a72749ca4baa5d4f1a0585978897ad38
[]
no_license
turenkoaa/system_programming
8729450ee98ffdf13f796f86f0503e6881335144
0fdf935d3b70fbabc469907f67d881646a60c156
refs/heads/master
2021-08-24T01:53:46.382471
2017-12-07T14:47:32
2017-12-07T14:47:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,866
cpp
#include "stdafx.h" #include <windows.h> #include <iostream> using namespace std; EXCEPTION_RECORD exceptionRecord; DWORD infoFilterForZeroDivider(EXCEPTION_POINTERS *p) { exceptionRecord = *(p->ExceptionRecord); return EXCEPTION_EXECUTE_HANDLER; } void informationAboutException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_reads_opt_(nNumberOfArguments) CONST ULONG_PTR * lpArguments) { _try { RaiseException(dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments); } _except(infoFilterForZeroDivider(GetExceptionInformation())) { cout << "ExceptionCode: " << exceptionRecord.ExceptionCode << endl; cout << "ExceptionFlags: " << exceptionRecord.ExceptionFlags << endl; cout << "ExceptionAddress: " << exceptionRecord.ExceptionAddress << endl; cout << "NumberParameters: " << exceptionRecord.NumberParameters << endl; cout << "ExceptionRecord: " << exceptionRecord.ExceptionRecord << endl; if (exceptionRecord.ExceptionCode == dwExceptionCode) { cout << "Type of access: " << exceptionRecord.ExceptionInformation[0] << endl; cout << "Address of access: " << exceptionRecord.ExceptionInformation[1] << endl; } cout << endl; } return; } int main(int argc, char *argv[]) { int exc = 0; exc = atoi(argv[1]); cout << "Getting exception code\n1 - INT_DIVISION_BY_ZERO\n2 - EXCEPTION_FLT_INVALID_OPERATION" << endl; cout << exc << " has been chosen" << endl; switch (exc) { case 1: cout << "Information about EXCEPTION_INT_DIVIDE_BY_ZERO:\n"; informationAboutException(EXCEPTION_INT_DIVIDE_BY_ZERO, 0, 0, NULL); break; case 2: cout << "Information about EXCEPTION_FLT_INVALID_OPERATION:\n"; informationAboutException(EXCEPTION_FLT_INVALID_OPERATION, EXCEPTION_NONCONTINUABLE, 0, NULL); break; default: break; } system("pause"); return 0; }
c6f5e6301e00cdb80b11770b160b72f67455ad1f
baea6e46bf97f6b9da936de6afcfbcccc74802e7
/src/platforms/unix/tcp_connection.h
892a4d27e85750e9e391c8d8f2a85372047bab9d
[]
no_license
dharmeshkakadia/firmament
6de43c46f1a07a421999f3bc26651b7cfdc1e65b
cf28c69e5067d382752fe47c995314cab2dbe3ca
refs/heads/master
2020-12-24T10:24:25.748263
2013-04-02T23:07:05
2013-04-02T23:07:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,786
h
// The Firmament project // Copyright (c) 2011-2012 Malte Schwarzkopf <[email protected]> // // TCP connection class. #ifndef FIRMAMENT_PLATFORMS_UNIX_TCP_CONNECTION_H #define FIRMAMENT_PLATFORMS_UNIX_TCP_CONNECTION_H #include <boost/asio.hpp> #include <string> #include <boost/noncopyable.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/bind.hpp> #include <boost/thread.hpp> // This needs to go above other includes as it defines __PLATFORM_UNIX__ #include "platforms/unix/common.h" #include "base/common.h" #include "base/types.h" #include "misc/messaging_interface.h" #include "misc/uri_tools.h" #include "platforms/common.h" namespace firmament { namespace platform_unix { namespace streamsockets { using boost::asio::io_service; using boost::asio::ip::tcp; // TCP connection class using boost primitives. class TCPConnection : public boost::enable_shared_from_this<TCPConnection>, private boost::noncopyable { public: typedef shared_ptr<TCPConnection> connection_ptr; explicit TCPConnection(shared_ptr<io_service> io_service) // NOLINT : socket_(*io_service), io_service_(io_service), ready_(false) { } virtual ~TCPConnection(); // XXX(malte): unsafe raw pointer, fix this tcp::socket* socket() { return &socket_; } const string LocalEndpointString(); bool Ready() { return ready_; } const string RemoteEndpointString(); void Start(); void Close(); private: void HandleWrite(const boost::system::error_code& error, size_t bytes_transferred); tcp::socket socket_; shared_ptr<io_service> io_service_; bool ready_; }; } // namespace streamsockets } // namespace platform_unix } // namespace firmament #endif // FIRMAMENT_PLATFORMS_UNIX_TCP_CONNECTION_H
ce707cdfd43442e56e1aeee4a506ff0ea92e0a10
7675a145269b6e25339aab45c35c38ea3d0cf621
/single_run.cpp
ea7a68499794b8c4d6b9b7cf44a744342c75b65a
[]
no_license
jealie/BCBG-model
ae06e3dea9bd4fcd901b5a5e0cefaf2d3410112d
86d1f19dcb2655bab1d8ff1dfa7c579854b76395
refs/heads/master
2021-01-10T08:58:00.675866
2016-03-22T17:28:35
2016-03-22T17:28:35
49,929,428
1
2
null
null
null
null
UTF-8
C++
false
false
20,090
cpp
/* vim: set ft=cpp: */ #include "bcbg2.hpp" #include "constants.hpp" #include "run_sim.hpp" #include "helper_fct.hpp" #include "stdlib.h" #include <numeric> void printout(std::vector <float> means, int ch_n) { if (ch_n == 1) { std::cout << " CTX = " << means[CTX_N] << std::endl; std::cout << " CMPf = " << means[CMPf_N] << std::endl; #ifdef MSN_SEPARATION std::cout << " MSN D1 = " << means[MSND1_N] << std::endl; std::cout << " MSN D2 = " << means[MSND2_N] << std::endl; #else std::cout << " MSN = " << means[MSN_N] << std::endl; #endif std::cout << " FSI = " << means[FSI_N] << std::endl; std::cout << " STN = " << means[STN_N] << std::endl; std::cout << " GPe = " << means[GPe_N] << std::endl; std::cout << " GPi = " << means[GPi_N] << std::endl<< std::endl; } else { std::cout << " CTX = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[CTX_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; std::cout << " CMPf = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[CMPf_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; std::cout << " MSN = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[MSN_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; std::cout << " FSI = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[FSI_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; std::cout << " STN = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[STN_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; std::cout << " GPe = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[GPe_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; std::cout << " GPi = "; for (int ch_i=0; ch_i<ch_n; ch_i++) { std::cout << means[GPi_N*ch_n+ch_i] << " ; "; } std::cout << std::endl; } } int _is_near( float reference, float mean, float absolute_radius) { if ((mean >= reference - absolute_radius) and (mean <= reference + absolute_radius)) { return 1; } return 0; } int _has_changed_near( float reference, float mean, float proportional_change, float proportional_radius) { if ((mean >= reference * ( 1 + (proportional_change - proportional_radius))) && (mean <= reference * ( 1 + (proportional_change + proportional_radius)))) { return 1; } return 0; } float theta(float value) { return ((float)(value/4.)); } float pseudolog(float value) { if (value < 100) { return (value); // 0, 1, ..., 99 } else if (value < 200) { return ((100+(value-100)*10)); // 100, 110, ..., 990 } else if (value < 300) { return ((1000+(value-200)*100)); // 1000, 1100, ..., 9900 } else { std::cerr << "invalid parameter : " << value << std::endl; return (-1.); // throw an error } } void calc_score_1(std::vector <float> & params) { std::cout << "to be implemented" << std::endl; std::cerr << "to be implemented" << std::endl; } int main(int argc, char** argv) { int i,j; #ifdef ISSMALLDT float dt = 1e-3; #elif defined(ISBIGDT) float dt = 1e-5; #elif defined(ISHUGEDT) float dt = 1e-6; #else float dt = 1e-4; #endif #ifdef MULTICHANNELSMODEL int ch_n = 8; #elif defined(CELLSMODEL) int ch_n = 0; #else int ch_n = 1; #endif std::vector<float> params_synaptic; std::vector<int> params_delay; std::vector<float> means; std::vector<float> modulators_synaptic; std::vector<float> params_cs; int c = (int)(1./(dt*1000.0)+0.5); int im=0; params_delay.assign(ARGS_NUMBER,c); //////// delays given in Van Albada et al 2009 //int delay_model_CTX_Str = 2; //int delay_model_CTX_STN = 1; //int delay_model_Str_GPe = 1; //int delay_model_Str_GPi = 1; //int delay_model_STN_GPe = 1; //int delay_model_STN_GPi = 1; //int delay_model_GPe_STN = 1; //int delay_model_GPe_GPi = 1; //int striatal_afferents = 1; ////// delays given in Tsirogiannis et al 2010 int delay_model_CTX_Str = 4; int delay_model_CTX_STN = 1; int delay_model_Str_GPe = 3; int delay_model_Str_GPi = 3; int delay_model_STN_GPe = 1; int delay_model_STN_GPi = 1; int delay_model_GPe_STN = 1; int delay_model_GPe_GPi = 1; int delay_model_GPe_Str = 3; int delay_model_STN_Str = 3; int delay_model_CMPf = 1; params_delay[CTX_MSN] = c * delay_model_CTX_Str; params_delay[CTX_FSI] = c * delay_model_CTX_Str; params_delay[CTX_STN] = c * delay_model_CTX_STN; params_delay[CMPf_MSN] = c * 1; params_delay[CMPf_FSI] = c * 1; params_delay[CMPf_STN] = c * 1; params_delay[CMPf_GPe] = c * 1; params_delay[CMPf_GPi] = c * 1; params_delay[MSN_GPe] = c * delay_model_Str_GPe; params_delay[MSN_GPi] = c * delay_model_Str_GPi; params_delay[MSN_MSN] = c * 1; params_delay[FSI_MSN] = c * 1; params_delay[FSI_FSI] = c * 1; params_delay[STN_GPe] = c * delay_model_STN_GPe; params_delay[STN_GPi] = c * delay_model_STN_GPi; params_delay[STN_MSN] = c * delay_model_STN_Str; params_delay[STN_FSI] = c * delay_model_STN_Str; params_delay[GPe_STN] = c * delay_model_GPe_STN; params_delay[GPe_GPi] = c * delay_model_GPe_GPi; params_delay[GPe_MSN] = c * delay_model_GPe_Str; params_delay[GPe_FSI] = c * delay_model_GPe_Str; params_delay[GPe_GPe] = c * 1; params_delay[CTXPT_MSN]= c * delay_model_CTX_STN; params_delay[CTXPT_FSI]= c * delay_model_CTX_STN; std::vector<float> raw_params; raw_params.assign(ARGS_NUMBER,0.); float manual_input[ARGS_NUMBER]; if (ch_n == 1) { std::cerr << std::endl; } for (int i=0; i<ARGS_NUMBER; i++) { manual_input[i] = atof(argv[i+1+3]); // +3 : the first three runs correspond to the run n°, score bio previously computed, score electro previously computed if (manual_input[i] < 0.0) { manual_input[i] = 0.0; } else if (manual_input[i] > 1.0) { manual_input[i] = 1.0; } if (ch_n == 1) { std::cerr << " " << manual_input[i] ; } } if (ch_n == 1) { std::cerr << std::endl; } for (int i=0; i<ARGS_NUMBER; i++) {raw_params[i] = manual_input[i];} raw_params[CTX_MSN] = raw_params[CTX_MSN]*5995.0f+5.0f;// raw_params[CTX_FSI] = raw_params[CTX_FSI]*5995.0f+5.0f;//Warning: these are not axonal boutons count, but synapse number raw_params[CTX_STN] = raw_params[CTX_STN]*5995.0f+5.0f;// raw_params[CMPf_MSN] = param2boutons(raw_params[CMPf_MSN], false); raw_params[CMPf_FSI] = param2boutons(raw_params[CMPf_FSI], false); raw_params[CMPf_STN] = param2boutons(raw_params[CMPf_STN], false); raw_params[CMPf_GPe] = param2boutons(raw_params[CMPf_GPe], false); raw_params[CMPf_GPi] = param2boutons(raw_params[CMPf_GPi], false); raw_params[MSN_GPe] = param2boutons(raw_params[MSN_GPe], false); raw_params[MSN_GPi] = param2boutons(raw_params[MSN_GPi], false); raw_params[MSN_MSN] = param2boutons(raw_params[MSN_MSN], false); raw_params[FSI_MSN] = param2boutons(raw_params[FSI_MSN], false); raw_params[FSI_FSI] = param2boutons(raw_params[FSI_FSI], false); raw_params[STN_GPe] = param2boutons(raw_params[STN_GPe], false); raw_params[STN_GPi] = param2boutons(raw_params[STN_GPi], false); raw_params[STN_MSN] = param2boutons(raw_params[STN_MSN], true); // allow the optimization to set this connection to be null raw_params[STN_FSI] = param2boutons(raw_params[STN_FSI], true); // ^ raw_params[GPe_STN] = param2boutons(raw_params[GPe_STN], false); raw_params[GPe_GPi] = param2boutons(raw_params[GPe_GPi], false); raw_params[GPe_MSN] = param2boutons(raw_params[GPe_MSN], true); // ^ raw_params[GPe_FSI] = param2boutons(raw_params[GPe_FSI], true); // ^ raw_params[GPe_GPe] = param2boutons(raw_params[GPe_GPe], false); raw_params[CTXPT_MSN]= param2boutons(raw_params[CTXPT_MSN], false); raw_params[CTXPT_FSI]= param2boutons(raw_params[CTXPT_FSI], false); float score_0 = calc_score_selective_axons(raw_params,false,-1); // (factor 10³ for the numbers of neurons) float neurons_nb_CTX = 1400000; // total cortex (Christensen07, Collins10) float neurons_nb_CMPf = 86; // From Hunt91 and stereotaxic altases, this concerns only the non-gabaergic neurons of the CM/Pf. See count.odt for details of calculation #ifdef MSN_SEPARATION float neurons_nb_MSN = 15200; // Yelnik91 #else float neurons_nb_MSN = 15200*2; // Yelnik91 #endif float neurons_nb_FSI = 611; // 2% (cf Deng10 or Yelnik91) of the total striatal count 30 400 (Yelnik91) float neurons_nb_STN = 77; // Hardman02: (STN)/2 float neurons_nb_GPe = 251; // Hardman02: (GPe)/2 float neurons_nb_GPi = 143; // Hardman02: (GPi + SN Non Dopaminergic)/2 // rectifies the number of neurons to account for non-MSN population (Yelnik91) neurons_nb_MSN *= 0.87; neurons_nb_FSI *= 0.87; params_synaptic.assign(ARGS_NUMBER,0.); params_synaptic[CTX_MSN] = raw_params[CTX_MSN]; params_synaptic[CTX_FSI] = raw_params[CTX_FSI]; params_synaptic[CTX_STN] = raw_params[CTX_STN]; params_synaptic[CMPf_MSN] = (1. * raw_params[CMPf_MSN] * neurons_nb_CMPf) / (neurons_nb_MSN); params_synaptic[CMPf_FSI] = (1. * raw_params[CMPf_FSI] * neurons_nb_CMPf) / (neurons_nb_FSI); params_synaptic[CMPf_STN] = (1. * raw_params[CMPf_STN] * neurons_nb_CMPf) / (neurons_nb_STN); params_synaptic[CMPf_GPe] = (1. * raw_params[CMPf_GPe] * neurons_nb_CMPf) / (neurons_nb_GPe); params_synaptic[CMPf_GPi] = (1. * raw_params[CMPf_GPi] * neurons_nb_CMPf) / (neurons_nb_GPi); params_synaptic[MSN_GPe] = (1. * raw_params[MSN_GPe] * neurons_nb_MSN) / (neurons_nb_GPe); params_synaptic[MSN_GPi] = (0.82 * raw_params[MSN_GPi] * neurons_nb_MSN) / (neurons_nb_GPi); // based on Levesque 2005 params_synaptic[MSN_MSN] = (1. * raw_params[MSN_MSN] * neurons_nb_MSN) / (neurons_nb_MSN); params_synaptic[FSI_MSN] = (1. * raw_params[FSI_MSN] * neurons_nb_FSI) / (neurons_nb_MSN); params_synaptic[FSI_FSI] = (1. * raw_params[FSI_FSI] * neurons_nb_FSI) / (neurons_nb_FSI); params_synaptic[STN_GPe] =1.0* (0.83 * raw_params[STN_GPe] * neurons_nb_STN) / (neurons_nb_GPe); params_synaptic[STN_GPi] =1.0* (0.72 * raw_params[STN_GPi] * neurons_nb_STN) / (neurons_nb_GPi); params_synaptic[STN_MSN] =1.0* (0.17 * raw_params[STN_MSN] * neurons_nb_STN) / (neurons_nb_MSN); params_synaptic[STN_FSI] =1.0* (0.17 * raw_params[STN_FSI] * neurons_nb_STN) / (neurons_nb_FSI); params_synaptic[GPe_STN] = (0.84 * raw_params[GPe_STN] * neurons_nb_GPe) / (neurons_nb_STN); params_synaptic[GPe_GPi] = 1.0*(0.84 * raw_params[GPe_GPi] * neurons_nb_GPe) / (neurons_nb_GPi); params_synaptic[GPe_MSN] = (0.16 * raw_params[GPe_MSN] * neurons_nb_GPe) / (neurons_nb_MSN); params_synaptic[GPe_FSI] = (0.16 * raw_params[GPe_FSI] * neurons_nb_GPe) / (neurons_nb_FSI); params_synaptic[GPe_GPe] = (1. * raw_params[GPe_GPe] * neurons_nb_GPe) / (neurons_nb_GPe); params_synaptic[CTXPT_MSN] = raw_params[CTXPT_MSN]; params_synaptic[CTXPT_FSI] = raw_params[CTXPT_FSI]; params_synaptic[DIST_CTX_MSN] = raw_params[DIST_CTX_MSN]; params_synaptic[DIST_CTX_FSI] = raw_params[DIST_CTX_FSI]; params_synaptic[DIST_CTX_STN] = raw_params[DIST_CTX_STN]; params_synaptic[DIST_CMPf_MSN] = raw_params[DIST_CMPf_MSN]; params_synaptic[DIST_CMPf_FSI] = raw_params[DIST_CMPf_FSI]; params_synaptic[DIST_CMPf_STN] = raw_params[DIST_CMPf_STN]; params_synaptic[DIST_CMPf_GPe] = raw_params[DIST_CMPf_GPe]; params_synaptic[DIST_CMPf_GPi] = raw_params[DIST_CMPf_GPi]; params_synaptic[DIST_MSN_GPe] = raw_params[DIST_MSN_GPe]; params_synaptic[DIST_MSN_GPi] = raw_params[DIST_MSN_GPi]; params_synaptic[DIST_MSN_MSN] = raw_params[DIST_MSN_MSN]; params_synaptic[DIST_FSI_MSN] = raw_params[DIST_FSI_MSN]; params_synaptic[DIST_FSI_FSI] = raw_params[DIST_FSI_FSI]; params_synaptic[DIST_STN_GPe] = raw_params[DIST_STN_GPe]; params_synaptic[DIST_STN_GPi] = raw_params[DIST_STN_GPi]; params_synaptic[DIST_STN_MSN] = raw_params[DIST_STN_MSN]; params_synaptic[DIST_STN_FSI] = raw_params[DIST_STN_FSI]; params_synaptic[DIST_GPe_STN] = raw_params[DIST_GPe_STN]; params_synaptic[DIST_GPe_GPi] = raw_params[DIST_GPe_GPi]; params_synaptic[DIST_GPe_MSN] = raw_params[DIST_GPe_MSN]; params_synaptic[DIST_GPe_FSI] = raw_params[DIST_GPe_FSI]; params_synaptic[DIST_GPe_GPe] = raw_params[DIST_GPe_GPe]; params_synaptic[DIST_CTXPT_MSN] = raw_params[DIST_CTXPT_MSN]; params_synaptic[DIST_CTXPT_FSI] = raw_params[DIST_CTXPT_FSI]; params_synaptic[THETA_MSN] = raw_params[THETA_MSN]; params_synaptic[THETA_FSI] = raw_params[THETA_FSI]; params_synaptic[THETA_STN] = raw_params[THETA_STN]; params_synaptic[THETA_GPe] = raw_params[THETA_GPe]; params_synaptic[THETA_GPi] = raw_params[THETA_GPi]; params_synaptic[FSI_SMAX] = param2hz(raw_params[FSI_SMAX]); params_cs.assign(ARGS_NUMBER,0.); std::vector <float> cs; cs.assign(10,0.); // 0. => one-to-one // 1. => one-to-all cs[8] = 1.; // D* -> D* cs[0] = 0.; // CTX -> STN // no influence here cs[6] = 0.; // GPe -> D* // according to the general consensus, but see Spooren et al 1996 cs[3] = 1.; // STN -> D* // cf. Smith et al. 1990 (see most figures, and in particular figures 4 & 5) cs[7] = 1.; // GPe -> GPe // could be justified with Sato el al 200a cs[5] = 1.; // GPe -> GPi // !!!! Toggle this variable to check the focuse/diffused inhibition cs[4] = 0.; // GPe -> STN // Cf general consensus in rat & Sato et al 2000a cs[2] = 1.; // STN -> GPi // Cf general consensus in rat & Sato et al 2000a cs[1] = 1.; // STN -> GPe // Cf general consensus in rat & Sato et al 2000a params_cs[CTX_MSN] = 0.; params_cs[CTX_FSI] = 0.; // no influence params_cs[CTX_STN] = cs[0]; // no influence params_cs[MSN_GPe] = 0.; // for example, see Parent et al 1995c.. params_cs[MSN_GPi] = 0.; // same params_cs[STN_GPe] = cs[1]; params_cs[STN_GPi] = cs[2]; params_cs[STN_MSN] = cs[3]; params_cs[STN_FSI] = 1.; // cf Smith et al 1990 (see most figures, and in particular figures 4 & 5). Plus, there is no influence here params_cs[GPe_STN] = cs[4]; params_cs[GPe_GPi] = cs[5]; params_cs[GPe_MSN] = cs[6]; params_cs[GPe_FSI] = 1.; // Spooren96 params_cs[GPe_GPe] = cs[7]; params_cs[FSI_MSN] = 1.; // Cf general consensus params_cs[FSI_FSI] = 1.; // Cf general consensus params_cs[MSN_MSN] = cs[8]; params_cs[CMPf_MSN] = 1.; // Cf Parent04, but no influence here params_cs[CMPf_FSI] = 1.; // Cf Parent04, but no influence here params_cs[CMPf_STN] = 1.; // | params_cs[CMPf_GPe] = 1.; // | => cf. Sadikot et al 1992 (but note that there is no influence here) params_cs[CMPf_GPi] = 1.; // | params_cs[CTXPT_MSN] = 0.; // it is consistent with Parent et al. 2006 params_cs[CTXPT_FSI] = 0.; // no influence here modulators_synaptic.assign(DESACT_NUMBER,1.0f); int result; means.assign(NUCLEUS_NUMBER*ch_n,0.); // note that we never store the value for the cortex (but we can display it) MemoryBCBG2 mem = {-1}; // different convergence options can be #defined: #ifdef LIGHTCONV float sim_time = 0.5; #elif defined(TESTCONV) float sim_time = 10; #elif defined(SOUNDCONV) float sim_time = 5; #elif defined(OBJECTCONV) float sim_time = 6; #else float sim_time = 100; #endif // different circuitry of the BG can be #defined: #ifdef MSN_SEPARATION int msn_separation = 1; #else int msn_separation = 0; #endif // // // // for the test of deactivations // // // float score_desact = 0; float score_desact_other = 0; // to get the logs // last and bef-bef-last do not matter in the case of multichannels nuclei // verbose does not matter if >4 and multichannels // result = _run_sim(sim_time,0.001,dt,modulators_synaptic,params_cs,params_synaptic,params_delay,means,4,ch_n,msn_separation,0,mem,0); // verbose version for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[MSN_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[FSI_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[STN_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[GPe_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[GPi_N*ch_n+ch_i] << " "; } score_desact_other = calc_score_desactivation(means, params_synaptic, params_delay, 0.0f, sim_time, mem,true); result = _run_sim(sim_time,0.001,dt,modulators_synaptic,params_cs,params_synaptic,params_delay,means,5,ch_n,msn_separation,0,mem,0); // verbose version for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[MSN_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[FSI_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[STN_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[GPe_N*ch_n+ch_i] << " "; } for (int ch_i=0; ch_i < ch_n; ch_i++) { std::cout << means[GPi_N*ch_n+ch_i] << " "; } std::cout << std::endl; return 0; } int main_tsirogiannis(int argc, char** argv) { // re-implementation of Tsirogiannis et al 2010 int i,j; float dt = 1e-5; int nb_channels = 1; std::vector<float> params_synaptic; std::vector<int> params_delay; std::vector<float> means; std::vector<float> modulators_synaptic; means.assign(NUCLEUS_NUMBER,0.); int c = (int)(1./(dt*1000.0)+0.5); // c corresponds to 1ms in timesteps int im=0; params_delay.assign(ARGS_NUMBER,c); params_synaptic.assign(ARGS_NUMBER,1); modulators_synaptic.assign(ARGS_NUMBER,1); params_synaptic[TSIROGIANNIS_2010_CTXe_D1_D2] = 50; params_delay[TSIROGIANNIS_2010_CTXe_D1_D2] = 4*c; params_synaptic[TSIROGIANNIS_2010_CTXe_STN] = 2; params_delay[TSIROGIANNIS_2010_CTXe_STN] = c; params_synaptic[TSIROGIANNIS_2010_STN_STN] = 2; params_delay[TSIROGIANNIS_2010_STN_STN] = c; params_synaptic[TSIROGIANNIS_2010_GPe_STN] = 10; params_delay[TSIROGIANNIS_2010_GPe_STN] = c; params_synaptic[TSIROGIANNIS_2010_STN_GPe] = 3; params_delay[TSIROGIANNIS_2010_STN_GPe] = c; params_synaptic[TSIROGIANNIS_2010_D2_GPe] = 33; params_delay[TSIROGIANNIS_2010_D2_GPe] = 3*c; params_synaptic[TSIROGIANNIS_2010_GPe_GPe] = 1; params_delay[TSIROGIANNIS_2010_GPe_GPe] = c; params_synaptic[TSIROGIANNIS_2010_STN_GPi] = 3; params_delay[TSIROGIANNIS_2010_STN_GPi] = c; params_synaptic[TSIROGIANNIS_2010_D1_GPi] = 22; params_delay[TSIROGIANNIS_2010_D1_GPi] = 3*c; params_synaptic[TSIROGIANNIS_2010_GPe_GPi] = 5; params_delay[TSIROGIANNIS_2010_GPe_GPi] = c; params_synaptic[TSIROGIANNIS_2010_THETA_D1_D2] = 27.; params_synaptic[TSIROGIANNIS_2010_THETA_STN] = 18.5; params_synaptic[TSIROGIANNIS_2010_THETA_GPe] = 14.; params_synaptic[TSIROGIANNIS_2010_THETA_GPi] = 12.; int result = _run_sim_tsirogiannis_2010(1000,0.001,dt,modulators_synaptic,params_synaptic,params_delay,means,2); //output std::cout << "At rest" << std::endl; std::cout << " D1 = " << means[0] << std::endl; std::cout << " D2 = " << means[1] << std::endl; std::cout << " STN = " << means[2] << std::endl; std::cout << " GPe = " << means[3] << std::endl; std::cout << " GPi = " << means[4] << std::endl; std::cout << " CTXe = " << means[5] << std::endl; if (result) { std::cout << "CONVERGENCE OK" << std::endl; } else { std::cout << "PAS DE CONVERGENCE" << std::endl; } return 0; }
da69a2059d665ff7d9d52f126cd0c6ae2181199d
f83ef53177180ebfeb5a3e230aa29794f52ce1fc
/ACE/ACE_wrappers/TAO/tests/Multiple/Collocation_Tester.h
891f02233f70cb09a3b3aabc0e7ea573a86aee7a
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-sun-iiop" ]
permissive
msrLi/portingSources
fe7528b3fd08eed4a1b41383c88ee5c09c2294ef
57d561730ab27804a3172b33807f2bffbc9e52ae
refs/heads/master
2021-07-08T01:22:29.604203
2019-07-10T13:07:06
2019-07-10T13:07:06
196,183,165
2
1
Apache-2.0
2020-10-13T14:30:53
2019-07-10T10:16:46
null
UTF-8
C++
false
false
1,607
h
//============================================================================= /** * @file Collocation_Tester.h * * This file contains the class that tests the TAO's collocation * mechanism. * * @author Angelo Corsaro <[email protected]> */ //============================================================================= // -- Custom App. Include -- #include "MultipleC.h" #include "ace/Log_Msg.h" struct Quote { static const char *top; static const char *left; static const char *right; static const char *bottom; }; class Collocation_Tester { public: // -- Constructor/Destructors -- Collocation_Tester (CORBA::Object_ptr object); ~Collocation_Tester (); // -- Command -- /// Runs the test. void run (void); private: // -- Helper Methods -- /// Tests the method accessible thru the /// Top interface. int test_top (void); /// Tests the method accessible thru the /// Right interface. int test_right (void); /// Tests the method accessible thru the /// Left interface. int test_left (void); /// Tests the method accessible thru the /// Bottom interface. int test_bottom (void); /** * This method tests wether the answer obtained * is the one expected. As strcmp, it returns zero * if a match occurs and a non-zero value if there * is no match (actually 1 is returned if there is * no match. */ int match_answer (const char *actual_answer, const char *right_answer, const char *method_name); void shutdown (void); private: CORBA::Object_var object_; };
5c48d74991b34d30cf800d454fbe1ca22c5e5738
63a379626a832cf899ee6c89db1abe588b283cf8
/surfaceflinger/qeglfsbackingstore.cpp
1a4e5b37c35f788f9234a9aaab35f46dac400148
[]
no_license
mickybart/qt5-qpa-surfaceflinger-plugin
9a7ae80765c414482ace1f4d4aa8848494ad8c80
9c397cc156281e7f23d322d2619fa28bef4e40f0
refs/heads/master
2022-12-27T09:15:57.420022
2022-12-17T23:19:28
2022-12-17T23:19:28
59,843,358
6
3
null
null
null
null
UTF-8
C++
false
false
7,461
cpp
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** 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 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: 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. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qeglfsbackingstore.h" #include "qeglfswindow.h" #include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLPaintDevice> #include <QtGui/QOpenGLShaderProgram> #include <QtGui/QScreen> QT_BEGIN_NAMESPACE QEglFSBackingStore::QEglFSBackingStore(QWindow *window) : QPlatformBackingStore(window) , m_context(new QOpenGLContext) , m_texture(0) , m_program(0) { m_context->setFormat(window->requestedFormat()); m_context->setScreen(window->screen()); m_context->create(); } QEglFSBackingStore::~QEglFSBackingStore() { delete m_context; } QPaintDevice *QEglFSBackingStore::paintDevice() { return &m_image; } void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset) { Q_UNUSED(region); Q_UNUSED(offset); makeCurrent(); #ifdef QEGL_EXTRA_DEBUG qWarning("QEglBackingStore::flush %p", window); #endif if (!m_program) { static const char *textureVertexProgram = "attribute highp vec2 vertexCoordEntry;\n" "attribute highp vec2 textureCoordEntry;\n" "varying highp vec2 textureCoord;\n" "void main() {\n" " textureCoord = textureCoordEntry;\n" " gl_Position = vec4(vertexCoordEntry, 0.0, 1.0);\n" "}\n"; static const char *textureFragmentProgram = "uniform sampler2D texture;\n" "varying highp vec2 textureCoord;\n" "void main() {\n" " gl_FragColor = texture2D(texture, textureCoord).bgra;\n" "}\n"; m_program = new QOpenGLShaderProgram; m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); m_program->link(); m_vertexCoordEntry = m_program->attributeLocation("vertexCoordEntry"); m_textureCoordEntry = m_program->attributeLocation("textureCoordEntry"); } m_program->bind(); const GLfloat textureCoordinates[] = { 0, 1, 1, 1, 1, 0, 0, 0 }; QRectF r = window->geometry(); QRectF sr = window->screen()->geometry(); GLfloat x1 = (r.left() / sr.width()) * 2 - 1; GLfloat x2 = (r.right() / sr.width()) * 2 - 1; GLfloat y1 = (r.top() / sr.height()) * 2 - 1; GLfloat y2 = (r.bottom() / sr.height()) * 2 - 1; const GLfloat vertexCoordinates[] = { x1, y1, x2, y1, x2, y2, x1, y2 }; glEnableVertexAttribArray(m_vertexCoordEntry); glEnableVertexAttribArray(m_textureCoordEntry); glVertexAttribPointer(m_vertexCoordEntry, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinates); glVertexAttribPointer(m_textureCoordEntry, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinates); glBindTexture(GL_TEXTURE_2D, m_texture); if (!m_dirty.isNull()) { QRect imageRect = m_image.rect(); QRegion fixed; foreach (const QRect &rect, m_dirty.rects()) { // intersect with image rect to be sure QRect r = imageRect & rect; // if the rect is wide enough it's cheaper to just // extend it instead of doing an image copy if (r.width() >= imageRect.width() / 2) { r.setX(0); r.setWidth(imageRect.width()); } fixed |= r; } foreach (const QRect &rect, fixed.rects()) { // if the sub-rect is full-width we can pass the image data directly to // OpenGL instead of copying, since there's no gap between scanlines if (rect.width() == imageRect.width()) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, m_image.constScanLine(rect.y())); } else { glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, m_image.copy(rect).constBits()); } } m_dirty = QRegion(); } glDrawArrays(GL_TRIANGLE_FAN, 0, 4); m_program->release(); glBindTexture(GL_TEXTURE_2D, 0); glDisableVertexAttribArray(m_vertexCoordEntry); glDisableVertexAttribArray(m_textureCoordEntry); m_context->swapBuffers(window); m_context->doneCurrent(); } void QEglFSBackingStore::makeCurrent() { // needed to prevent QOpenGLContext::makeCurrent() from failing window()->setSurfaceType(QSurface::OpenGLSurface); (static_cast<QEglFSWindow *>(window()->handle()))->create(); m_context->makeCurrent(window()); } void QEglFSBackingStore::beginPaint(const QRegion &rgn) { m_dirty = m_dirty | rgn; } void QEglFSBackingStore::endPaint() { } void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents) { Q_UNUSED(staticContents); m_image = QImage(size, QImage::Format_RGB32); makeCurrent(); if (m_texture) glDeleteTextures(1, &m_texture); glGenTextures(1, &m_texture); glBindTexture(GL_TEXTURE_2D, m_texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); } QT_END_NAMESPACE
1a2ec94dc198f17e25ca0a3e87ff7b336b028c23
06dbe019cb11d870b933a6fb67a6601596b984d3
/10algorithm/10.2.1.cpp
c194305dc027285b1b7eaea1d3146c152ad675fd
[]
no_license
wenjinwong/cppPrimer
e6885b444f1e3c65513061f10f6344c726e76b1c
5c295abe0987f0624f1b94ee88f4307ca893eb38
refs/heads/master
2020-08-09T18:50:47.593523
2019-10-10T09:47:00
2019-10-10T09:47:00
214,147,678
0
0
null
null
null
null
UTF-8
C++
false
false
1,235
cpp
#include<iostream> #include<cctype> #include<string> #include<vector> #include<list> #include<deque> #include<fstream> #include<cstdlib> #include<ctime> #include<algorithm> #include<numeric> using namespace std; int main() { srand(time(NULL)); using vi = vector<const char *>; vi ii; int i = 0; while(i < 10) { ii.push_back("aaa"); // ii.insert(ii.begin(), rand() % 100); i++; } //int val = accumulate(ii.begin(), ii.end(), 0); //cout << val << endl; // 10.2.1 vi oo; i = 0; while(i<10) { oo.push_back("aaa"); // oo.push_back(rand() % 100); i++; } cout << equal(ii.cbegin(), ii.cend(), oo.begin()) << endl; vector<double> tt; i = 0; while(i < 10 && ++i) tt.push_back(rand() % 100); double v = accumulate(tt.cbegin(), tt.cend(), 0.0); cout << v << endl; char *p[] = {"aaa", "bbb"}; char *q[] = {"aaa", "bbb"}; cout << equal(begin(p), end(p), q) << endl; fill(tt.begin(), tt.end(), 0); vector<int> vec; fill_n(vec.begin(), 0, 0); vector<int> vec1; auto it = back_inserter(vec1); *it = 42; fill_n(back_inserter(vec1), 10, 0); vector<int> vvv; vvv.reserve(10); //fill_n(vvv.begin(), 100, 0); cout << vvv.size() << endl; fill_n(back_inserter(vvv), 10, 100); }
178ecb002c61d0cbc6c38663d631a0f12de1119c
4dab5577705cdfe8179ab78cb550eabc4000c3b4
/old/fgCtrlsTransmitter.h
420885f99e3495b234ca0f68bb0917b8a393f997
[]
no_license
hoodoer/Auto-Agent
8199c56a1e120ea2f5bd2c1bb2539871022ca0b7
257a705c1bd1c3edb556072d48ee28529fb9f538
refs/heads/master
2020-04-05T05:08:35.882316
2018-11-07T17:22:08
2018-11-07T17:22:08
156,582,605
1
0
null
null
null
null
UTF-8
C++
false
false
1,850
h
// This class simplifies using sockets to // control the aircraft in Flightgear. // To get FlightGear to listen for UDP // data, start Flightgear like this: // fgfs --native-ctrls='socket,in,UPDATERATE,,PORT,udp' // Where UPDATERATE is the HZ that udp updates will // be sent out, and the PORT where we'll be listening // // Written by Drew Kirkpatrick, [email protected] #ifndef FGCTRLSTRANSMITTER_H #define FGCTRLSTRANSMITTER_H #include "net_ctrls.hxx" class FgCtrlsTransmitter { public: FgCtrlsTransmitter(string hostname, int port); ~FgCtrlsTransmitter(); // -1...1 double getAileron() const; void setAileron(double newAileron); // -1...1 double getElevator() const; void setElevator(double newElevator); // -1...1 double getRudder() const; void setRudder(double newRudder); // -1...1 double getAileronTrim() const; void setAileronTrim(double newAileronTrim); // -1...1 double getElevatorTrim() const; void setElevatorTrim(double newElevatorTrim); // -1...1 double getRudderTrim() const; void setRudderTrim(double newRudderTrim); // 0...1 double getFlaps() const; void setFlaps(double newFlaps); // 0...1 double getThrottle(int engineNumber) const; void setThrottle(int engineNumber, double newThrottle); // ?? Bool ina int??? int getFreeze() const; void setFreeze(int newFreeze); // After setting values with the setXXX funcs, call // this function to actually send the udp transmission void sendData(); private: // Networking data string sendToHostname; // Host running FlightGear struct sockaddr_in *their_addr; socklen_t addr_len; int sendToPort; // Port FlightGear is listening on int sockfd; int numbytes; // Datatype to sent through UDP FGNetCtrls controls; }; #endif // FGCTRLSTRANSMITTER_H
50189fcc9542690ee5981d3c633321bf80a0809b
6dc5ad4ffcecdb55bba74dfaf006c54ee6141c3c
/sources/ThirdParty/PAINTLIB/paintlib_last/paintlib/gnu/im2jpeg/im2jpeg.h
1cf45cb7567890b6f3297b00c09d92b27e23c73b
[]
no_license
sebastienroy/curveunscan
7b3d02e67c6b7a1f626bfd657e337d826036ee63
fbe8b215fc25f265b174221b31bfdbba370bdcbe
refs/heads/master
2020-07-05T05:25:28.954806
2020-04-21T13:03:47
2020-04-21T13:03:47
202,535,325
2
0
null
null
null
null
UTF-8
C++
false
false
776
h
//---------------------------------------------------------------- // // FILE : im2jpeg.h // AUTHOR : Jose Miguel Buenaposada. ([email protected]) // //---------------------------------------------------------------- //-------------- RECURSION PROTECTION ---------------------------- #ifndef _IM2JPEG_H_ #define _IM2JPEG_H_ //--------------------- INCLUDE ---------------------------------- #include <iostream> #include <string> #include <fstream> #include "plstdpch.h" // Paintlib #include "planybmp.h" // Paintlib #include "planydec.h" // Paintlib #include "pljpegenc.h" // Paintlib //------------------ DEFINITION ---------------------------------- void printusemessage(); void parseargs(int nargs, char** args); #endif
6ffc7e73dd78aea097f213127a12c21e0087c181
59992f291e63473f4a1285fc94eb69420179bbbd
/CMPE250/project4-hatice-ecevit-2016400138-master/function.h
b44cb8026d8fa238c4cdf65554ad662bab9de7e6
[]
no_license
haticemelikeecevit/projects
9d4666d6d411bed629cb61cdacdeca3f7d39a567
979689fcb36ab53d4dc6910e0d0af115e3ecaea7
refs/heads/master
2020-03-16T21:43:16.439683
2019-03-07T17:24:43
2019-03-07T17:24:43
133,011,635
0
1
null
null
null
null
UTF-8
C++
false
false
3,715
h
#ifndef FUNCTION_H #define FUNCTION_H #include <vector> #include <string> #include "variable.h" using namespace std; /* An abstract subclass of node class and represents the functions. Due to the different functionality, we have variable and function classes. */ class Function : public Node{ public: Function(); // represents the list of variables that are inputs of this function vector<Variable *> inputs; // represents the output variable of the function. Variable * output; Function(int _id, string _name=""); // custom constructor // ~Function(); // destructor // adds given variable as an input of this function void addInput(Variable *input); // sets the output variable of the function void setOutput(Variable *_output); // following two functions are inherited features from node class vector<Node *> getIncomings(); vector<Node *> getOutgoings(); // following two functions will be implemented by the subclasses of Function class // performs forward pass and sets the value of output variable virtual void doForward() = 0; // performs backward pass and sets the derivative values of the input variables virtual void doBackward() = 0; }; /* Subclass of function class that provides forward and backward pass functionalities for multiplication */ class Multiplication : public Function{ public: Multiplication(int _id, string _name="mult"); void doForward(); void doBackward(); }; /* Subclass of function class that provides forward and backward pass functionalities for addition */ class Addition : public Function{ public: Addition(int _id, string _name="add"); void doForward(); void doBackward(); }; /* Subclass of function class that provides forward and backward pass functionalities for sine */ class Sine : public Function{ public: Sine(int _id, string _name="sin"); void doForward(); void doBackward(); }; class Cosine : public Function{ public: Cosine(int _id, string _name="cos"); void doForward(); void doBackward(); }; class Identity : public Function{ public: Identity(int _id, string _name="identity"); void doForward(); void doBackward(); }; class Tangent : public Function{ public: Tangent(int _id, string _name="tan"); void doForward(); void doBackward(); }; class ArcCosine : public Function{ public: ArcCosine(int _id, string _name="acos"); void doForward(); void doBackward(); }; class ArcSine : public Function{ public: ArcSine(int _id, string _name="asin"); void doForward(); void doBackward(); }; class ArcTangent : public Function{ public: ArcTangent(int _id, string _name="atan"); void doForward(); void doBackward(); }; class Exponential : public Function{ public: Exponential(int _id, string _name="exp"); void doForward(); void doBackward(); }; class Log : public Function{ public: Log(int _id, string _name="log"); void doForward(); void doBackward(); }; class Log10: public Function{ public: Log10(int _id, string _name="log10"); void doForward(); void doBackward(); }; class Power : public Function{ public: Power(int _id, string _name="pow"); void doForward(); void doBackward(); }; class Sqrt : public Function{ public: Sqrt(int _id, string _name="sqrt"); void doForward(); void doBackward(); }; class Subtraction : public Function{ public: Subtraction(int _id, string _name="subs"); void doForward(); void doBackward(); }; class Division : public Function{ public: Division(int _id, string _name="div"); void doForward(); void doBackward(); }; #endif // VARIABLEclass