blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
9e7684c2d9877c71d21d3d0f6925fdc35312a3d8
7abbbef9590f9c4b9469adcbae5ea8907478bf03
/chromium_git/chromium/src/components/browser_sync/browser/profile_sync_service_mock.h
41df3eae2c8250e87b979f4901645094ad946f0b
[ "BSD-3-Clause" ]
permissive
GiorgiGagnidze/CEF
845bdc2f54833254b3454ba8f6c61449431c7884
fbfc30b5d60f1ea7157da449e34dd9ba9c50f360
refs/heads/master
2021-01-10T17:32:27.640882
2016-03-23T07:43:04
2016-03-23T07:43:04
54,463,340
0
1
null
null
null
null
UTF-8
C++
false
false
4,641
h
// Copyright (c) 2012 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. #ifndef COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_MOCK_H_ #define COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_MOCK_H_ #include <string> #include <vector> #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "components/browser_sync/browser/profile_sync_service.h" #include "components/sync_driver/change_processor.h" #include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/device_info.h" #include "google_apis/gaia/google_service_auth_error.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/protocol/sync_protocol_error.h" #include "testing/gmock/include/gmock/gmock.h" class ProfileSyncServiceMock : public ProfileSyncService { public: explicit ProfileSyncServiceMock(InitParams init_params); // The second constructor defers to the first one. Use it when you need to // create a StrictMock or NiceMock of ProfileSyncServiceMock, because those // template classes cannot handle the input class having constructors with // arguments passed by value. Otherwise use the constructor above for cleaner // code. explicit ProfileSyncServiceMock(InitParams* init_params); virtual ~ProfileSyncServiceMock(); MOCK_METHOD4(OnBackendInitialized, void(const syncer::WeakHandle<syncer::JsBackend>&, const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&, const std::string&, bool)); MOCK_METHOD0(OnSyncCycleCompleted, void()); MOCK_METHOD2(OnUserChoseDatatypes, void(bool sync_everything, syncer::ModelTypeSet chosen_types)); MOCK_METHOD2(OnUnrecoverableError, void(const tracked_objects::Location& location, const std::string& message)); MOCK_CONST_METHOD0(GetUserShare, syncer::UserShare*()); MOCK_METHOD0(RequestStart, void()); MOCK_METHOD1(RequestStop, void(ProfileSyncService::SyncStopDataFate)); MOCK_METHOD1(AddObserver, void(sync_driver::SyncServiceObserver*)); MOCK_METHOD1(RemoveObserver, void(sync_driver::SyncServiceObserver*)); MOCK_METHOD0(GetJsController, base::WeakPtr<syncer::JsController>()); MOCK_CONST_METHOD0(IsFirstSetupComplete, bool()); MOCK_CONST_METHOD0(IsEncryptEverythingAllowed, bool()); MOCK_CONST_METHOD0(IsEncryptEverythingEnabled, bool()); MOCK_METHOD0(EnableEncryptEverything, void()); MOCK_METHOD1(ChangePreferredDataTypes, void(syncer::ModelTypeSet preferred_types)); MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet()); MOCK_CONST_METHOD0(GetPreferredDataTypes, syncer::ModelTypeSet()); MOCK_CONST_METHOD0(GetRegisteredDataTypes, syncer::ModelTypeSet()); MOCK_CONST_METHOD0(GetLastSessionSnapshot, syncer::sessions::SyncSessionSnapshot()); MOCK_METHOD1(QueryDetailedSyncStatus, bool(browser_sync::SyncBackendHost::Status* result)); MOCK_CONST_METHOD0(GetAuthError, const GoogleServiceAuthError&()); MOCK_CONST_METHOD0(IsFirstSetupInProgress, bool()); MOCK_CONST_METHOD0(GetLastSyncedTimeString, base::string16()); MOCK_CONST_METHOD0(HasUnrecoverableError, bool()); MOCK_CONST_METHOD0(IsSyncActive, bool()); MOCK_CONST_METHOD0(IsBackendInitialized, bool()); MOCK_CONST_METHOD0(IsSyncRequested, bool()); MOCK_CONST_METHOD0(waiting_for_auth, bool()); MOCK_METHOD1(OnActionableError, void(const syncer::SyncProtocolError&)); MOCK_METHOD1(SetSetupInProgress, void(bool)); MOCK_CONST_METHOD1(IsDataTypeControllerRunning, bool(syncer::ModelType)); // DataTypeManagerObserver mocks. MOCK_METHOD1(OnConfigureDone, void(const sync_driver::DataTypeManager::ConfigureResult&)); MOCK_METHOD0(OnConfigureStart, void()); MOCK_CONST_METHOD0(CanSyncStart, bool()); MOCK_CONST_METHOD0(IsManaged, bool()); MOCK_CONST_METHOD0(IsPassphraseRequired, bool()); MOCK_CONST_METHOD0(IsPassphraseRequiredForDecryption, bool()); MOCK_CONST_METHOD0(IsUsingSecondaryPassphrase, bool()); MOCK_CONST_METHOD0(GetPassphraseType, syncer::PassphraseType()); MOCK_CONST_METHOD0(GetExplicitPassphraseTime, base::Time()); MOCK_METHOD1(SetDecryptionPassphrase, bool(const std::string& passphrase)); MOCK_METHOD2(SetEncryptionPassphrase, void(const std::string& passphrase, PassphraseType type)); MOCK_METHOD1(StartUpSlowBackendComponents, void(BackendMode)); }; #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_MOCK_H_
[ "ggagn12@freeuni.edu.ge" ]
ggagn12@freeuni.edu.ge
52389984d14f214068f483fcd84115499d49c69f
658c31eec5b1ed614a5e65361a58ee5c95a07310
/a0/linkedlist.hpp
9cc3a7ebc054e41888d3c3b4630d444c90b1eb59
[]
no_license
yuxinyuan/COMP2012H
b01079b8d8a178b23b643006e2f79db2d93be214
64344e00d92f14d0f9f29badf75b751f5a39ab44
refs/heads/master
2020-05-19T09:40:40.279723
2015-09-10T15:00:33
2015-09-10T15:00:33
42,187,804
0
1
null
null
null
null
UTF-8
C++
false
false
1,527
hpp
/** * \file linkedlist.hpp * * Encapsulates an abstract interface layer for a sequence ADT, * without using member functions. Makes no assumptions about what * kind of concrete type Cell will be defined to be. */ #ifndef LINKEDLIST_HPP #define LINKEDLIST_HPP #include "linkedlist_internals.hpp" /** * \brief Size of the list from the node n * \return List size */ int list_size(const Node* n); /** * \brief Value at the position i (starting from 0) * \return Pointer to the value at position i in the list */ Cell* list_ith(Node* n, unsigned int i); /** * \brief Erase the value at position at node 'pos' of a list with head at 'n' * \return Pointer to the value after the position pos */ Node* list_erase(Node* n, Node* pos); /** * \brief Insert the value before the position 'pos' of a list with head at 'n' * \return Pointer to the inserted node */ Node* list_insert(Node* n, Node* pos, Cell* c); /** * \brief Insert an int before the position 'pos' of a list with head at 'n' * \return Pointer to the inserted node */ Node* list_insert_int(Node* n, Node* pos, const int value); /** * \brief Insert a double before the position 'pos' of a list with head at 'n' * \return Pointer to the inserted node */ Node* list_insert_double(Node* n, Node* pos, const double value); /** * \brief Insert a symbol before the position 'pos' of a list with head at 'n' * \return Pointer to the inserted node */ Node* list_insert_symbol(Node* n, Node* pos, const char* value); #endif // LINKEDLIST_HPP
[ "xyuaj@connect.ust.hk" ]
xyuaj@connect.ust.hk
fa8b49d2810e2cf80dc6c821053aef8b609fd120
be5ef0b58f898976be76fc69c23b53996d266e33
/Proyecto_Algoritmos/RestriccionData.h
c75c7a0d0608da1fbf3953db1e6ecc95a04821e0
[]
no_license
cristianhdz25/ProyectoFinalAlgoritmos
52b6c64ebf4cd3499b353f43e98a4e694c5f9fe7
93056c8df83830c3e3d4f133ad1ccd0dca8a1f1a
refs/heads/master
2022-11-17T06:18:00.849779
2020-07-03T17:08:14
2020-07-03T17:08:14
271,637,065
0
0
null
null
null
null
UTF-8
C++
false
false
603
h
#ifndef RESTRICCIONDATA_H #define RESTRICCIONDATA_H #include "Pais.h" #include <vector> class RestriccionData { public: static RestriccionData* getInstance(); RestriccionData(); void initRestriccion(); void registrarRestricciones(Pais* pais); void setRegistroRestricciones(vector<Pais*> registroRestricciones); vector<Pais*> getRegistroRestricciones() const; void anadirRestriccion(Pais* pais, int i); int existePais(string nombre); private: vector<Pais*> registroRestricciones; static RestriccionData* instance; }; #endif /* RESTRICCIONDATA_H */
[ "danits252016@gmail.com" ]
danits252016@gmail.com
0cae8e098c77de022cf7f05c09ddbb18d896d770
49b799fef3b6a53ae7773ff40b6172cd49bfc4b7
/demo1/Maths.h
a4eebbdfccaf9d55a2dd3784479bb4ca4037a833
[]
no_license
kellyelton/LeeAnn
f7fc71f1a24135977779f98a4e599ac5c35426d0
c7cecef4924d3f2e6e9288d4a7d6e9c73a0c5107
refs/heads/master
2021-01-01T05:47:34.018488
2012-07-26T16:39:19
2012-07-26T16:39:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
475
h
#pragma once class Maths { public: struct Position { float X; float Y; Position():X(0),Y(0) { } Position(float x, float y):X(x),Y(y) { } Position &operator+=(const Position &rhs) { X += rhs.X; Y += rhs.Y; return *this; } }; static void Clamp(double &arg, double min, double max) { if (arg < min) { arg = min; } if (arg > max) { arg = max; } } Maths(void); ~Maths(void); };
[ "kelly.elton@skylabsonline.com" ]
kelly.elton@skylabsonline.com
2e150c2c6acd15a5b4a2d340360db81260bdd0f1
79e1fa1d614a4422f3faeab01f1fdaf4da9a2da3
/stats.cpp
319a334b180a2e0a5af93a357808c3530cc7667b
[]
no_license
swapnilh/maze-for-programmers
a87c77670c61567305624d24b1f8ce9b08dd82ef
1fdaec0bee602a596231045ed6768d7589be46d8
refs/heads/master
2020-06-09T23:33:13.129528
2019-07-09T22:18:06
2019-07-09T22:18:06
193,528,257
1
0
null
null
null
null
UTF-8
C++
false
false
1,572
cpp
#include <iostream> #include <chrono> #include <vector> #include <cassert> #include "maze.hpp" #include "maze_generator.hpp" #include "binary_tree.hpp" #include "sidewinder.hpp" #include "dijkstra.hpp" #include "aldous_broder.hpp" #include "hunt_and_kill.hpp" #include "recursive_backtrack.hpp" constexpr auto GRID_DIM = 20; constexpr auto ITERATIONS = 100; int main () { Maze test_maze(GRID_DIM, GRID_DIM); std::vector<MazeGenerator*> generators; generators.push_back(new BinaryTreeGenerator(test_maze)); generators.push_back(new SidewinderGenerator(test_maze)); generators.push_back(new AldousBroderGenerator(test_maze)); generators.push_back(new HuntAndKillGenerator(test_maze)); generators.push_back(new RecursiveBacktrackGenerator(test_maze)); std::chrono::time_point<std::chrono::high_resolution_clock> start, stop; for (auto generator : generators) { int deadend_count = 0; start = std::chrono::high_resolution_clock::now(); for (int iter = 0; iter < ITERATIONS; iter++) { generator->Generate(); deadend_count += test_maze.GetDeadendCells().size(); test_maze.Reset(); } stop = std::chrono::high_resolution_clock::now(); auto avg_deadend_count = deadend_count / ITERATIONS; std::cout << generator->GetName() << " : " << avg_deadend_count << "/" << GRID_DIM*GRID_DIM << " (" << avg_deadend_count*100.0 / (GRID_DIM*GRID_DIM) << "%)" << std::endl; auto latency = std::chrono::duration_cast<std::chrono::nanoseconds> (stop-start).count(); std::cout << "Latency: " << latency/1000000.0 << " ms\n"; } return 0; }
[ "swapnilster@gmail.com" ]
swapnilster@gmail.com
e530dfe2338449d6dd4800dc98482b7cade532cc
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/third_party/WebKit/public/platform/WebScrollbarBehavior.h
655c01f1a79ab8b07bc55dfc985f8a9525b7c6f0
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
C++
false
false
854
h
// Copyright 2014 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. #ifndef WebScrollbarBehavior_h #define WebScrollbarBehavior_h #include "WebPointerProperties.h" namespace blink { struct WebPoint; struct WebRect; class WebScrollbarBehavior { public: virtual ~WebScrollbarBehavior() {} virtual bool shouldCenterOnThumb(WebPointerProperties::Button, bool shiftKeyPressed, bool altKeyPressed) { return false; } virtual bool shouldSnapBackToDragOrigin(const WebPoint& eventPoint, const WebRect& scrollbarRect, bool isHorizontal) { return false; } }; } // namespace blink #endif
[ "enrico.weigelt@gr13.net" ]
enrico.weigelt@gr13.net
3938635d5a1108a67c0553f6521ce22f28881652
3d5e097599e1a3996ec66e366902a9af8abb36dc
/src/utils/fileIO.hxx
d2f6e38670b1999016dd26c2c24888ffb3d02213
[]
no_license
Tecelecta/HIP-GSWITCH
4831fec64d84b20f23c30b943423a61a4be4e241
c1890201197f5bc57eff260a5936198843a3d6c5
refs/heads/master
2020-04-26T23:03:11.652855
2019-04-04T14:28:54
2019-04-04T14:28:54
173,890,847
0
0
null
null
null
null
UTF-8
C++
false
false
13,041
hxx
#ifndef __FILEIO_H #define __FILEIO_H #include <hip/hip_runtime.h> #include <type_traits> #include <iostream> #include <fstream> #include <vector> #include <limits> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <assert.h> #include <time.h> #include <string> #include <cmath> #include <algorithm> #include "utils/utils.hxx" #include "utils/2d_partition.hxx" struct graph_attr_t{ double avg_deg=0; double std_deg=0; double max_deg=0; double range=0; double GI=0; double Her=0; void fill(int* deg, int nv){ std::vector<double> tmp; for(int i=0; i<nv; ++i){ tmp.push_back(deg[i]); } std::sort(tmp.begin(), tmp.end()); for(auto x: tmp){ avg_deg += x; std_deg += x*x; } std_deg = sqrt((std_deg - avg_deg*avg_deg/nv) / (nv-1)); avg_deg /= nv; range = (tmp[nv-1]-tmp[0]);///avg_deg; max_deg = tmp[nv-1]; double sum = 0; for(int i=1; i<=nv; ++i){ sum += tmp[i-1]; } for(int i=1; i<=nv; ++i){ double du = tmp[i-1]; GI += (nv-i+0.5)*du/nv/sum; if(du!=0) Her += du*(log(sum)-log(du))/(sum); } GI = 1 - 2*GI; Her = Her / log(nv); //std::cout << avg_deg << " " << std_deg << " " << range << " " << GI << " " << Her << std::endl; } }; // normailze index start from 0 template<typename E> class edgelist_t{ public: void read_mtx(std::string path, bool directed=false, bool with_weight=false, bool with_header=false){ double start = wtime(); LOG("Loading %s\n", path.c_str()); this->directed = directed; this->with_weight = with_weight; std::ifstream fin(path); if(!fin.is_open()) ASSERT(false, "can not open file"); // skip comments while(1){ char c = fin.peek(); if(c>='0' && c<='9') break; fin.ignore(std::numeric_limits<std::streamsize>::max(), fin.widen('\n')); } // if with header (meaningless, just ignore) if(with_header) { fin >> nvertexs >> nvertexs >> nedges; fin.ignore(std::numeric_limits<std::streamsize>::max(), fin.widen('\n')); } else nvertexs = nedges = -1; vvector.clear(); evector.clear(); vmin=std::numeric_limits<int>::max(); vmax=-1; while(fin.good()){ int v0,v1; E w; fin >> v0 >> v1; if(fin.eof()) break; vmin = std::min(v0,vmin); vmin = std::min(v1,vmin); vmax = std::max(v0,vmax); vmax = std::max(v1,vmax); if(with_weight) fin >> w; else{ fin.ignore(std::numeric_limits<std::streamsize>::max(), fin.widen('\n')); } if(fin.eof()) break; if(v0 == v1) continue; vvector.push_back(v0); vvector.push_back(v1); if(with_weight) evector.push_back(w); } nvertexs = (vmax-vmin+1); nedges = vvector.size()>>1; if(nvertexs==0 || nedges==0) exit(1); fin.close(); double end = wtime(); LOG("IO time: %f s.\n",end-start); //reorder(); } void gen_weight(int lim){ with_weight = true; int64_t tot=0; LOG(" -- generate edge weight 0~%d\n",lim); for(int i = 0; i < nedges; i++){ E w = (E)rand_device<int>::rand_weight(lim); tot += w; evector.push_back(w); } mean_weight = (tot+.0)/nedges; } void reorder(){ struct pair_t{int deg, id;}; std::vector<pair_t> od(nvertexs, {0,0}); for(size_t i=0; i<od.size(); ++i) od[i].id=i; for(size_t i=0;i<vvector.size(); i+=2){ int v = vvector[i]-vmin; od[v].deg ++; } std::sort(od.begin(), od.end(), [](const pair_t& a, const pair_t& b)->bool{return a.deg>b.deg;}); std::vector<int> mapper(nvertexs, 0); for(size_t i=0; i<od.size(); ++i) mapper[od[i].id] = i; for(size_t i=0; i<vvector.size(); i+=2){ int v = vvector[i]-vmin; int u = vvector[i+1]-vmin; vvector[i] = mapper[v]+vmin; vvector[i+1] = mapper[u]+vmin; } } public: std::vector<int> vvector; std::vector<E> evector; int vmin, vmax; int nvertexs; int nedges; bool directed; bool with_weight; double mean_weight=0; }; template<GraphFmt format, typename E> class host_graph_t{}; template<typename E> class host_graph_t<CSR, E>{ public: void build(edgelist_t<E> el, bool quiet=false){ double start = wtime(); this->directed = el.directed; if(std::is_same<Empty,E>::value){ this->with_weight = false; }else{ this->with_weight = true; } int64_t vmax = el.vmax; int64_t vmin = el.vmin; int64_t mem_used = 0; nvertexs = (vmax-vmin+1); nedges = el.vvector.size()>>1; if(!directed) nedges <<= 1; odegrees = (int*)calloc(nvertexs, sizeof(int)); start_pos = (int*)malloc(sizeof(int)*nvertexs); mem_used += sizeof(int)*nvertexs*2; if(directed){ r_odegrees = (int*)calloc(nvertexs, sizeof(int)); r_start_pos = (int*)malloc(sizeof(int)*nvertexs); mem_used += sizeof(int)*nvertexs*2; } if(with_weight){ edge_weights = (E*)malloc(sizeof(E)*nedges); mem_used += sizeof(E)*nedges; if(directed){ r_edge_weights = (E*)malloc(sizeof(E)*nedges); mem_used += sizeof(E)*nedges; } }else{ edge_weights = NULL; r_edge_weights = NULL; } for(size_t i = 0; i < el.vvector.size(); i+=2) { odegrees[el.vvector[i]-vmin] ++; if(!directed) odegrees[el.vvector[i+1]-vmin] ++; else r_odegrees[el.vvector[i+1]-vmin] ++; } start_pos[0] = 0; for(int i = 1; i < nvertexs; ++i){ start_pos[i] = odegrees[i-1] + start_pos[i-1]; odegrees[i-1] = 0; } odegrees[nvertexs-1]=0; adj_list = (int*)malloc(sizeof(int)*nedges); mem_used += sizeof(int)*nedges; if(directed){ r_start_pos[0] = 0; for(int i = 1; i < nvertexs; ++i){ r_start_pos[i] = r_odegrees[i-1] + r_start_pos[i-1]; r_odegrees[i-1] = 0; } r_odegrees[nvertexs-1] = 0; r_adj_list = (int*)malloc(sizeof(int)*nedges); mem_used += sizeof(int)*nedges; } for(size_t i = 0; i < (el.vvector.size()>>1); i++){ int v0 = el.vvector[i<<1] - vmin; int v1 = el.vvector[i<<1|1] - vmin; adj_list[start_pos[v0] + odegrees[v0]] = v1; if(with_weight) edge_weights[start_pos[v0] + odegrees[v0]] = el.evector[i]; odegrees[v0] ++; // double it if(!directed){ adj_list[start_pos[v1] + odegrees[v1]] = v0; if(with_weight) edge_weights[start_pos[v1] + odegrees[v1]] = el.evector[i]; odegrees[v1] ++; }else{ r_adj_list[r_start_pos[v1] + r_odegrees[v1]] = v0; if(with_weight) r_edge_weights[r_start_pos[v1] + r_odegrees[v1]] = el.evector[i]; r_odegrees[v1] ++; } } if(!quiet) rinse(); attr.fill(odegrees, nvertexs); double end = wtime(); if(quiet) return; if(cmd_opt.verbose){ std::cout << "CSR transform time used: " << end-start << " s." << std::endl; std::cout << " -- nvertexs: " << nvertexs << " nedges: " << nedges << std::endl; std::cout << " -- degree range: " << attr.range << "; avg. degree " << attr.avg_deg << "; max degree " << attr.max_deg << std::endl; std::cout << " -- isdirected: " << (directed?"Yes":"No") << std::endl; std::cout << " -- isweighted: " << (with_weight?"Yes":"No") << std::endl; std::cout << "Host Graph memory used: " << (0.0+mem_used+2*sizeof(int)+2*sizeof(bool))/(1l<<30) << " Gb."<< std::endl; } if(ENABLE_2D_PARTITION){ chunks.build(nvertexs, adj_list, start_pos, odegrees); } } void store_to_binfile(std::string fname){ std::string newf = ".csr_"+std::string(get_fname(fname.c_str())); std::string dir = std::string(get_dirname(fname.c_str())); std::string fpath = dir + "/" + newf; if(fexist(fpath.c_str())) return; std::ofstream fout(fpath, std::ios::binary); fout.write((char*)&nvertexs, sizeof(nvertexs)); fout.write((char*)&nedges, sizeof(nvertexs)); fout.write((char*)&directed, sizeof(directed)); fout.write((char*)&with_weight, sizeof(with_weight)); fout.write((char*)odegrees, sizeof(int)*nvertexs); fout.write((char*)start_pos, sizeof(int)*nvertexs); fout.write((char*)adj_list, sizeof(int)*nedges); if(with_weight) fout.write((char*)edge_weights, sizeof(E)*nedges); if(directed){ fout.write((char*)r_odegrees, sizeof(int)*nvertexs); fout.write((char*)r_start_pos, sizeof(int)*nvertexs); fout.write((char*)r_adj_list, sizeof(int)*nedges); if(with_weight) fout.write((char*)r_edge_weights, sizeof(E)*nedges); } } void load_from_binfile(std::string fname){ std::string newf = ".csr_"+std::string(get_fname(fname.c_str())); std::string dir = std::string(get_dirname(fname.c_str())); std::string fpath = dir + "/" + newf; if(!file_exist(fpath.c_str())) exit(1); std::ifstream fin(fpath, std::ios::binary); fin.read((char*)&nvertexs, sizeof(nvertexs)); fin.read((char*)&nedges, sizeof(nvertexs)); fin.read((char*)&directed, sizeof(directed)); fin.read((char*)&with_weight, sizeof(with_weight)); fin.read((char*)odegrees, sizeof(int)*nvertexs); fin.read((char*)start_pos, sizeof(int)*nvertexs); fin.read((char*)adj_list, sizeof(int)*nedges); if(with_weight) fin.read((char*)edge_weights, sizeof(E)*nedges); if(directed){ fin.read((char*)r_odegrees, sizeof(int)*nvertexs); fin.read((char*)r_start_pos, sizeof(int)*nvertexs); fin.read((char*)r_adj_list, sizeof(int)*nedges); if(with_weight) fin.read((char*)r_edge_weights, sizeof(E)*nedges); } } int random_root(){ int root; while(1){ root = random()%nvertexs; if(odegrees[root]) break; } return root; } void rinse(){ int t=0; for(int v=0; v<nvertexs; ++v) { int s = start_pos[v]; start_pos[v] = t; int e = (v==(nvertexs-1)?nedges:start_pos[v+1]); std::sort(adj_list+s, adj_list+e); for(int j=s;j<e;++j){ int u = adj_list[j]; if(j>s && u==adj_list[j-1]) continue; adj_list[t++] = u; } odegrees[v] = t-start_pos[v]; } LOG(" -- remove duplicate edges: %d -> %d\n", nedges, t); nedges = t; std::vector<int> rename; int top = 0; for(int i = 0; i <nvertexs; ++i){ if(odegrees[i] == 0) rename.push_back(-1); else rename.push_back(top++); } t = 0; for(int v=0; v<nvertexs; ++v){ int s = start_pos[v]; int e = (v==(nvertexs-1)?nedges:start_pos[v+1]); if(s==e) continue; start_pos[t] = start_pos[v]; odegrees[t] = odegrees[v]; for(int j=s; j<e; ++j){ adj_list[j] = rename[adj_list[j]]; if(adj_list[j]==-1) printf("Error in file CSR transform."); } t++; } if(top != t) printf("Error in file CSR transform."); LOG(" -- remove solo vertices: %d -> %d\n", nvertexs, top); nvertexs = top; } public: E* edge_weights=NULL; int* adj_list=NULL; int* start_pos=NULL; int* odegrees=NULL; //for reversed graph E* r_edge_weights=NULL; int* r_adj_list=NULL; int* r_start_pos=NULL; int* r_odegrees=NULL; int nvertexs; int nedges; bool directed; bool with_weight; chunk_t chunks; graph_attr_t attr; //double mean_odegree; //int max_odegree; //int min_odegree; }; template<typename E> class host_graph_t<COO,E>{ public: void build(edgelist_t<E> el, bool quiet=false){ double start = wtime(); this->directed = el.directed; this->with_weight = el.with_weight; int64_t vmax = el.vmax; int64_t vmin = el.vmin; int64_t mem_used = 0; nvertexs = (vmax-vmin+1); nedges = el.vvector.size()>>1; edge_list = (packed_t*)malloc(sizeof(packed_t)*nedges); if(with_weight){ edge_weights = (E*)malloc(sizeof(E)*nedges); mem_used += sizeof(E)*nedges; } mem_used += sizeof(packed_t)*nedges; for(int i=0; i<nedges; i++){ int v0 = el.vvector[i<<1]-vmin; int v1 = el.vvector[i<<1|1]-vmin; packed_t v = ((int64_t)v0)<<32 | v1; edge_list[i] = v; if(with_weight) edge_weights[i] = el.evector[i]; } double end = wtime(); if(quiet) return; if(cmd_opt.verbose) { std::cout << "COO transform time used: " << end-start << " s." << std::endl; std::cout << " -- nvertexs: " << nvertexs << " nedges: " << nedges << std::endl; std::cout << " -- isdirected: " << (directed?"Yes":"No") << std::endl; std::cout << " -- isweighted: " << (with_weight?"Yes":"No") << std::endl; std::cout << "Host Graph memory used: " << (0.0+mem_used+2*sizeof(int)+2*sizeof(bool))/(1l<<30) << " Gb."<< std::endl; } } public: E* edge_weights; packed_t* edge_list; int nvertexs; int nedges; bool directed; bool with_weight; //int mean_odegree = 1; graph_attr_t attr; }; #endif
[ "lmy@ncic.ac.cn" ]
lmy@ncic.ac.cn
df471705f987fd5c64c2eba9e49a58e362221f6f
30ec2372ac36d40f4557c5f39cb606452e6e6bf5
/StRoot/StVecBosAna/VecBosEventInfo.h
a80b3900bf3dfc627c74fc2d284111d280946c89
[]
no_license
yfisyak/star-sw
fe77d1f6f246bfa200a0781a0335ede7e3f0ce77
449bba9cba3305baacbd7f18f7b3a51c61b81e61
refs/heads/main
2023-07-12T01:15:45.728968
2021-08-04T22:59:16
2021-08-04T22:59:16
382,115,093
2
0
null
2021-07-01T17:54:02
2021-07-01T17:54:01
null
UTF-8
C++
false
false
2,986
h
#ifndef VecBosEventInfo_h #define VecBosEventInfo_h #include "Globals.h" /** * A simple structure to keep track of the basic information about the barrel EMC detector signals. * This class has been inherited from the Run 9 analysis of the longitudinal asymmetry and contains * mostly transient data. */ class DetEventBemc { public: // Raw BTOW/BPRS hits int tileIn[mxBTile]; //! 0 if no data float adcTile[mxBTile][mxBtow]; //! float eneTile[mxBTile][mxBtow]; int statTile[mxBTile][mxBtow]; //! float maxAdc; //! int maxHtDsm; //! // Raw BSMD hits, both planes float adcBsmd[mxBSmd][mxBStrips]; //! int statBsmd[mxBSmd][mxBStrips]; //! void clear(); void print(int flag = 0); ClassDef(DetEventBemc, 2); }; /** * A simple structure to keep track of the basic information about the endcap EMC detector signals. * This class has been inherited from the Run 9 analysis of the longitudinal asymmetry and contains * mostly transient data. */ class DetEventEtow { public: int etowIn; float adc[mxEtowSec*mxEtowSub][mxEtowEta]; ///< the indices correspond to [phibin][etabin] float ene[mxEtowSec*mxEtowSub][mxEtowEta]; int stat[mxEtowSec*mxEtowSub][mxEtowEta]; float maxAdc; int maxSec, maxSub, maxEta; int maxHtDsm; void clear() { memset(adc, 0, sizeof(adc)); memset(ene, 0, sizeof(ene)); memset(stat, -1, sizeof(stat)); // default all dead maxAdc = 0; maxSec = maxSub = maxEta = 0; maxHtDsm = -1; } ClassDef(DetEventEtow, 2); }; /** * A simple structure to keep track of the basic information about the endcap preshower detector * signals. This class has been inherited from the Run 9 analysis of the longitudinal asymmetry and * contains mostly transient data. */ class DetEventEprs { public: int eprsIn; float adc[mxEtowSec*mxEtowSub][mxEtowEta][mxPrs]; ///< the indices correspond to [phibin][etabin][layer] float ene[mxEtowSec*mxEtowSub][mxEtowEta][mxPrs]; int stat[mxEtowSec*mxEtowSub][mxEtowEta][mxPrs]; void clear() { memset(adc, 0, sizeof(adc)); memset(ene, 0, sizeof(ene)); memset(stat, -1, sizeof(stat)); // default all dead } ClassDef(DetEventEprs, 1); }; /** * A simple structure to keep track of the basic information about the endcap showermax detector * signals. This class has been inherited from the Run 9 analysis of the longitudinal asymmetry and * contains mostly transient data. */ class DetEventEsmd { public: int esmdIn; float adc[mxEtowSec][mxEsmdPlane][mxEsmdStrip]; ///< the indices correspond to [phibin][etabin] float ene[mxEtowSec][mxEsmdPlane][mxEsmdStrip]; int stat[mxEtowSec][mxEsmdPlane][mxEsmdStrip]; void clear() { memset(adc, 0, sizeof(adc)); memset(ene, 0, sizeof(ene)); memset(stat, -1, sizeof(stat)); // default all dead } ClassDef(DetEventEsmd, 1); }; #endif
[ "fisyak@bnl.gov" ]
fisyak@bnl.gov
fcd6a877b0c375aa3695c23dc124c0ff47f36f82
260eea6bebbd75f073d51e85e26b4da7c8334a5b
/sample/libdetect_t_bak2/blackboard_detect.h
d7245073694925000618ad46b95bf1c24133b401
[]
no_license
lidongliangfly/3516a_sample
19bb23713673f361114ce40a902c1011b94fb3e0
9f31644be03a5cd28a86b9dd855865bc31df5c27
refs/heads/master
2021-01-17T04:27:27.722677
2016-05-09T09:37:13
2016-05-09T09:37:13
null
0
0
null
null
null
null
GB18030
C++
false
false
2,180
h
#pragma once #ifndef _blackboard_detect_h_ #define _blackboard_detect_h_ #include<opencv2/opencv.hpp> #include<time.h> #include "../libkvconfig/KVConfig.h" using namespace cv; using namespace std; class BlackboardDetecting { public: BlackboardDetecting(KVConfig *cfg); ~BlackboardDetecting(void); double diff_threshold_three; double diff_threshold; int N;//三帧差分法中buffer中的个数; int buflen;//双帧差分法中buffer中的个数; IplImage **buffer; KVConfig *cfg_; int luv_u_max; int luv_v_max; int luv_u_min; int luv_v_min; int luv_L; double merge_interval; double min_area; double max_area; BackgroundSubtractorMOG2 bg_model; double learning_rate; double mog_threshold; bool ismask_; Mat img_mask_; int video_width_; int video_height_; bool frame_difference_method (IplImage *image,std::vector<cv::Rect> &rect_vector); //IplImage *do_mask(const IplImage *img); void do_mask( Mat &img); cv::Rect masked_rect; std::vector<Rect> masked_rect_vec; std::vector < Rect > refineSegments2(Mat img, Mat & mask, Mat & dst,double interval,double minarea,double maxarea); void BlackboardDetecting::rect_fusion2(vector < Rect > &seq, double interval); Rect BlackboardDetecting::sort_rect(Rect a, Rect b); static int BlackboardDetecting::cmp_area(const Rect & a, const Rect & b); bool BlackboardDetecting::one_frame_bd( Mat img, vector < Rect > &r); void two_frame_method(IplImage*img,IplImage*silh); static int cmp_func_area(const CvRect&a,const CvRect&b); CvRect merge_rect(CvRect a,CvRect b); void rect_fusion(std::vector<cv::Rect> &seq,IplImage *image); void creat_buffer(IplImage *image); bool build_mask_internal(const char *key, Mat& img); Mat build_mask(const char *key,const char *key2 = 0); std::vector<cv::Point> load_roi(const char *pts); static int cmp_min_x(const Point & a, const Point & b); static int cmp_min_y(const Point & a, const Point & b); cv::Rect get_point_rect(std::vector<cv::Point> pt); cv::Rect get_rect(const char* pt1,const char* pt2); void luv_method(const Mat &img,Mat bg ,std::vector<Rect> &r); }; #endif
[ "root@Ubunut10.04" ]
root@Ubunut10.04
51cdf4775ddf851ea430dac441bf1d28e7f38929
9fd62754099fc3694afc504a81d327891cb808b9
/0283.cpp
5c9c3461c113c1267bb572255c33f1416fe0ca04
[]
no_license
a1pamys/acmp
2335f1e801647b25a68b9bfbae044f589aeae8e3
4f8b6af20ec6c737c4af07c67843a1cd21453328
refs/heads/master
2020-03-10T16:10:17.812635
2018-08-02T15:03:01
2018-08-02T15:03:01
129,466,707
0
0
null
null
null
null
UTF-8
C++
false
false
904
cpp
#include <stdio.h> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <cmath> using namespace std; int main() { string str; getline(cin, str); int len = int(str.length()), ctr=0, cps=0; bool sml = false; if(len < 2 || (str[len-1] >= 'A' && str[len-1] <= 'Z')) { printf("No"); return 0; } for(int i=0; i<len; i++) { if(str[i] >= 'A' && str[i] <= 'Z') { cps++; } while(str[i] >= 'a' && str[i] <= 'z') { sml = true; ctr++; i++; if(!(ctr >= 1 && ctr <=3) || cps < 1) { printf("No"); return 0; } cps = 1; } if(cps > 1) { printf("No"); return 0; } ctr = 0; sml = false; } printf("Yes"); return 0; }
[ "alpamys.duimagambetov@nu.edu.kz" ]
alpamys.duimagambetov@nu.edu.kz
3faf77325ca55bdc9a8766d67025ad291b73aa2b
54defce7b46332cca54b5904463eb3923ba00bb1
/Integer_21_завдання.cpp
150ea8174c2d8aad0b7319ccb28bd63aec74ea3e
[]
no_license
AlinaUrOk/Lesson4_Chornaya
47f8f686f758e15b43fb99bd176536fd0e9193a6
3d6ba8dbd2212846c28d8795f9f868a9b0ff6b81
refs/heads/main
2022-12-25T14:15:18.304045
2020-10-05T00:05:59
2020-10-05T00:05:59
301,252,185
0
0
null
null
null
null
UTF-8
C++
false
false
557
cpp
// Integer_21_завдання.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. // #include <iostream> /*Integer21. С начала суток прошло N секунд (N — целое). Найти количество се- кунд, прошедших с начала последней минуты.*/ int main() { int N = 8767543; int C = N % 60; std::cout << "C = " << C <<std:: endl; return 0; }
[ "noreply@github.com" ]
noreply@github.com
5f5413d1da6099624ee85d033c4dfe440b9b41ef
76d9f3eaeb8b3a121a4bf684ca397547ca8768d0
/arraydb/src/Compressor.cpp
55f44168985edde1ad55db980f62d495170b73d6
[]
no_license
chengchen09/tsh_project
6f7982eef1509a4344e2150a2f8f7d6adc50750e
bb2c1072a201af2c1f70045986a2dde9d4fda8ab
refs/heads/master
2020-04-23T21:54:05.200738
2012-06-27T08:55:49
2012-06-27T08:55:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,206
cpp
/*********************************************************************** * Filename : Compressor.cpp * Create : XXX 2012-03-06 * Created Time: 2012-03-06 * Description: * Modified : * **********************************************************************/ #include <zlib.h> #include <LzmaLib.h> #include "Compressor.h" namespace arraydb { CompressorFactory CompressorFactory::instance; CompressorFactory::CompressorFactory() { compressors.push_back(new NoCompression()); compressors.push_back(new ZlibCompressor()); compressors.push_back(new LzmaCompressor()); } /* * zlib compressor */ int ZlibCompressor::compressionLevel = Z_DEFAULT_COMPRESSION; size_t ZlibCompressor::compress(void *dest_buf, size_t chunk_size, const void *src_buf) { size_t size = chunk_size; uLongf dstLen = size; int rc = compress2((Bytef*)dest_buf, &dstLen, (Bytef*)src_buf, size, compressionLevel); return rc == Z_OK ? dstLen : 0; } size_t ZlibCompressor::decompress(void *dest_buf, size_t dest_size, const void *src_buf, size_t src_size) { uLongf dstLen = dest_size; int rc = uncompress((Bytef*)dest_buf, &dstLen, (Bytef*)src_buf, src_size); return rc == Z_OK ? dstLen : 0; } /* * lzma compressor */ size_t LzmaCompressor::compress(void *dest_buf, size_t chunk_size, const void *src_buf) { int status; size_t destlen, propsize; unsigned char *propbuf; propsize = LZMA_PROPS_SIZE; destlen = chunk_size - propsize; propbuf = (unsigned char *)dest_buf; status = LzmaCompress(&(((unsigned char *)dest_buf)[propsize]), &destlen, (const unsigned char *)src_buf, chunk_size, propbuf, &propsize, -1, 0, -1, -1, -1, -1, 1); return (status == SZ_OK) ? destlen + propsize : 0; } size_t LzmaCompressor::decompress(void *dest_buf, size_t dest_size, const void *src_buf, size_t src_size) { int status; size_t destlen, propsize; const unsigned char *propbuf; propsize = LZMA_PROPS_SIZE; destlen = dest_size; propbuf = (unsigned char *)src_buf; status = LzmaUncompress((unsigned char *)dest_buf, &destlen, &(((unsigned char *)src_buf)[propsize]), &destlen, propbuf, propsize); return (status == SZ_OK) ? destlen : 0; } }
[ "bus@supernode.(none)" ]
bus@supernode.(none)
35ebe38a460245337cbcfaa2ff24d736eb5354e6
f7024a61e980f026a557b80fb7b064a14a631699
/src/Rover3D_On_TriangleMesh/MechTests/TrMechTest1/src/Rover3DWheelFixedTriangleR.cpp
77614b95ae48c823d6a42cfdd8cc1093d3788787
[]
no_license
siconos/rover
b3c5ad566d071a4fc2f14451b57b3cb9b6eff543
60bd2ae0658d166b8124ff3d3bac020c737c8312
refs/heads/master
2021-01-21T23:16:30.523546
2017-06-23T14:40:38
2017-06-23T14:40:38
95,217,410
0
0
null
null
null
null
UTF-8
C++
false
false
29,532
cpp
/* Siconos-Example version 3.0.0, Copyright INRIA 2005-2010. * Siconos is a program dedicated to modeling, simulation and control * of non smooth dynamical systems. * Siconos is a 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. * Siconos 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 Siconos; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth FLOOR, Boston, MA 02110-1301 USA * * Contact: Vincent ACARY, siconos-team@lists.gforge.inria.fr * * Relation Implementation of Rover3DWheelFixedTriangleR.hpp * Author: Jan Michalczyk * Team: Bipop */ #include <stdio.h> #include <cmath> #include <fstream> #include <vector> #include <algorithm> #include "op3x3.h" #include "geomPrims.hpp" #include "Robot.h" #include "Rover3DWheelFixedTriangleR.hpp" #define PI 3.14159 #define NUMOFWHEELS 6 using namespace std; bool sortEdges(Edge a, Edge b) { return ( a._d < b._d ); } bool sortVertices(Vertex a, Vertex b) { return ( a._d < b._d ); } Rover3DWheelFixedTriangleR::Rover3DWheelFixedTriangleR(double Ax , double Ay, double Az, double Bx , double By, double Bz, double Cx , double Cy, double Cz, double radius, int id) : LagrangianScleronomousR(), _vert1(3), _vert2(3), _vert3(3), _normal(3), _planeNormal(3), _pcn(3), _orthoBase(3, 3), _radius(radius), _id(id) { _vert1.setValue(0, Ax); _vert1.setValue(1, Ay); _vert1.setValue(2, Az); _vert2.setValue(0, Bx); _vert2.setValue(1, By); _vert2.setValue(2, Bz); _vert3.setValue(0, Cx); _vert3.setValue(1, Cy); _vert3.setValue(2, Cz); //finding the normal to the plane where the triangle lies SiconosVector ab(3), ac(3); sub(_vert2, _vert1, ab); sub(_vert3, _vert1, ac); cross_product(ab, ac, _planeNormal); double normCoeff = _planeNormal.norm2(); //normalization scal(1.0/normCoeff, _planeNormal, _planeNormal); //flipping the normal if it's upside down if(_planeNormal.getValue(2) < 0){ _planeNormal.setValue(0, -_planeNormal.getValue(0)); _planeNormal.setValue(1, -_planeNormal.getValue(1)); _planeNormal.setValue(2, -_planeNormal.getValue(2)); } } double Rover3DWheelFixedTriangleR::getID(){ return _id; } SiconosVector Rover3DWheelFixedTriangleR::computeWheelCenter(double* tags) { int index = _id % NUMOFWHEELS; SiconosVector wheelCenter(3); switch(index) { case 0: /*wheel RL*/ wheelCenter.setValue(0, tags[7]); wheelCenter.setValue(1, tags[51]); wheelCenter.setValue(2, tags[95]); break; case 1: /*wheel RR*/ wheelCenter.setValue(0, tags[8]); wheelCenter.setValue(1, tags[52]); wheelCenter.setValue(2, tags[96]); break; case 2: /*wheel CL*/ wheelCenter.setValue(0, tags[15]); wheelCenter.setValue(1, tags[59]); wheelCenter.setValue(2, tags[103]); break; case 3: /*wheel FL*/ wheelCenter.setValue(0, tags[16]); wheelCenter.setValue(1, tags[60]); wheelCenter.setValue(2, tags[104]); break; case 4: /*wheel CR*/ wheelCenter.setValue(0, tags[23]); wheelCenter.setValue(1, tags[67]); wheelCenter.setValue(2, tags[111]); break; case 5: /*wheel FR*/ wheelCenter.setValue(0, tags[24]); wheelCenter.setValue(1, tags[68]); wheelCenter.setValue(2, tags[112]); break; default: cout << "No such wheel" << endl; break; } return wheelCenter; } SiconosVector Rover3DWheelFixedTriangleR::projectOnMe(SiconosVector p) { /*projects a point on the triangle plane*/ SiconosVector pProjected(3); SiconosVector tmpVec(3); sub(p, _vert1, tmpVec); double projOnNormal = inner_prod(tmpVec, _planeNormal); scal(projOnNormal, _planeNormal, tmpVec); sub(p, tmpVec, pProjected); return pProjected; } void Rover3DWheelFixedTriangleR::computeNormalAndDistance(SiconosVector wheelCenter) { /*finding a normal based on where the wheel center projects*/ SiconosVector proj = projectOnMe(wheelCenter); /*vectors to hold vertices and edges*/ std::vector<Edge> edges; std::vector<Vertex> vertices; /*geometrical primitives*/ Triangle triangle(_vert1, _vert2, _vert3, _planeNormal, 1); Edge edge1(_vert1, _vert2, 2); Edge edge2(_vert1, _vert3, 3); Edge edge3(_vert2, _vert3, 4); Vertex vertex1(_vert1, 5); Vertex vertex2(_vert2, 6); Vertex vertex3(_vert3, 7); if(triangle.checkIfInsideMe(proj)){ _normal = triangle._n; _distance = triangle.computeDistance(wheelCenter) - _radius; return; } else if(edge1.checkIfInsideMe(proj) || edge2.checkIfInsideMe(proj) || edge3.checkIfInsideMe(proj)){ if(edge1.checkIfInsideMe(proj)){ edge1.computeDistance(wheelCenter); edge1.computeNormal(wheelCenter); edges.push_back(edge1); } if(edge2.checkIfInsideMe(proj)){ edge2.computeDistance(wheelCenter); edge2.computeNormal(wheelCenter); edges.push_back(edge2); } if(edge3.checkIfInsideMe(proj)){ edge3.computeDistance(wheelCenter); edge3.computeNormal(wheelCenter); edges.push_back(edge3); } std::sort(edges.begin(), edges.end(), sortEdges); _normal = edges.at(0)._n; _distance = edges.at(0)._d - _radius; return; } else{ vertex1.computeDistance(wheelCenter); vertex1.computeNormal(wheelCenter); vertices.push_back(vertex1); vertex2.computeDistance(wheelCenter); vertex2.computeNormal(wheelCenter); vertices.push_back(vertex2); vertex3.computeDistance(wheelCenter); vertex3.computeNormal(wheelCenter); vertices.push_back(vertex3); std::sort(vertices.begin(), vertices.end(), sortVertices); _normal = vertices.at(0)._n; _distance = vertices.at(0)._d - _radius; return; } } double Rover3DWheelFixedTriangleR::computeDistance(double* q) { //get the contact points in cartesian space double TT[132]; Tags(TT, q); SiconosVector wheelCnt = computeWheelCenter(TT); computeNormalAndDistance(wheelCnt); return this->_distance; } void Rover3DWheelFixedTriangleR::computeh(const double time, Interaction& inter) { double * stateQ = &(*inter.data(q0))(0); double yValue; for(int i = 0; i < 21; i++) { stateQ[i] = (*inter.data(q0))(i); } yValue = 100000; yValue = computeDistance(stateQ); SP::SiconosVector y = inter.y(0); y->setValue(0, yValue); } SimpleMatrix Rover3DWheelFixedTriangleR::getSkewMat(SiconosVector v) { SimpleMatrix skewMatrix(3, 3); skewMatrix.setValue(0, 0, 0); skewMatrix.setValue(0, 1, -v.getValue(2)); skewMatrix.setValue(0, 2, v.getValue(1)); skewMatrix.setValue(1, 0, v.getValue(2)); skewMatrix.setValue(1, 1, 0); skewMatrix.setValue(1, 2, -v.getValue(0)); skewMatrix.setValue(2, 0, -v.getValue(1)); skewMatrix.setValue(2, 1, v.getValue(0)); skewMatrix.setValue(2, 2, 0); return skewMatrix; } SimpleMatrix Rover3DWheelFixedTriangleR::computeGeomJac(SiconosVector norm, double* tags, double* qs) { //index - to know which wheel we're dealing with int index = _id % NUMOFWHEELS; /*checking for the wheel and computing the right jacobian of the contact point*/ /*for clarity's sake jacobian is divided into three parts following the document*/ /*first part - the identity, second the angular velocity part, third for joints*/ /*result of the function - full geometric jacobian in the contact point*/ SimpleMatrix geomJac(3, 21); /*to store the joints axes and centers and r vectors for joints during computations*/ SiconosVector jointAxis1(3); SiconosVector jointAxis2(3); SiconosVector wheelJointAxis(3); SiconosVector jointCenter1(3); SiconosVector jointCenter2(3); SiconosVector wheelJointCenter(3); SiconosVector rJointVector1(3); SiconosVector rJointVector2(3); SiconosVector rWheelJointVector(3); /*to store columns for the joints for the third part of the jacobian*/ SiconosVector jointColumn1(3); SiconosVector jointColumn2(3); SiconosVector wheelColumn(3); /*to store the base coordinates (obtained from qs)*/ SiconosVector baseCoords(3); /*r vector computation for base*/ baseCoords.setValue(0, qs[0]); baseCoords.setValue(1, qs[1]); baseCoords.setValue(2, qs[2]); /*to store the r vector for the base during computations (from base to wheel contact point)*/ SiconosVector rBaseVector(3); /*to store the r vector-based skew matrix during computations*/ SimpleMatrix rBaseSkew(3, 3); /*to store the E matrix (look in the jacobian document)*/ SimpleMatrix E(3, 3); /*get E matrix*/ E.setValue(0, 0, cos(qs[4])*cos(qs[5])); E.setValue(0, 1, -sin(qs[5])); E.setValue(0, 2, 0); E.setValue(1, 0, cos(qs[4])*sin(qs[5])); E.setValue(1, 1, cos(qs[5])); E.setValue(1, 2, 0); E.setValue(2, 0, -sin(qs[4])); E.setValue(2, 1, 0); E.setValue(2, 2, 1); /*to store the contact point*/ SiconosVector pcn(3); /*second part of the jacobian*/ SimpleMatrix angVelPart(3, 3); if(index == 0) { /*wheel RL*/ /*supporting joints - RBogieJoint, RLSteeringJoint, RLWheel*/ /*contact point computation*/ wheelJointCenter.setValue(0, tags[7]); wheelJointCenter.setValue(1, tags[51]); wheelJointCenter.setValue(2, tags[95]); pcn = wheelJointCenter - _radius*norm; /*r vector computation for base*/ rBaseVector = pcn - baseCoords; rBaseSkew = getSkewMat(rBaseVector); scal(-1,rBaseSkew,rBaseSkew); /*poduct of E and skewsym. matrix*/ prod(rBaseSkew, E, angVelPart); /*getting joints columns for the third part*/ /*RBogieJoint*/ jointCenter1.setValue(0, tags[1]); jointCenter1.setValue(1, tags[45]); jointCenter1.setValue(2, tags[89]); jointAxis1.setValue(0, tags[2]); jointAxis1.setValue(1, tags[46]); jointAxis1.setValue(2, tags[90]); jointAxis1 = jointAxis1 - jointCenter1; rJointVector1 = pcn - jointCenter1; cross_product(jointAxis1, rJointVector1, jointColumn1); /*RLSteeringJoint*/ jointCenter2.setValue(0, tags[3]); jointCenter2.setValue(1, tags[47]); jointCenter2.setValue(2, tags[91]); jointAxis2.setValue(0, tags[4]); jointAxis2.setValue(1, tags[48]); jointAxis2.setValue(2, tags[92]); jointAxis2 = jointAxis2 - jointCenter2; rJointVector2 = pcn - jointCenter2; cross_product(jointAxis2, rJointVector2, jointColumn2); /*RLWheelJoint*/ wheelJointAxis.setValue(0, tags[26]); wheelJointAxis.setValue(1, tags[70]); wheelJointAxis.setValue(2, tags[114]); wheelJointAxis = wheelJointAxis - wheelJointCenter; rWheelJointVector = pcn - wheelJointCenter; cross_product(wheelJointAxis, rWheelJointVector, wheelColumn); /*final composition of the jacobian matrix*/ geomJac.zero(); /*first part - identity*/ geomJac.setValue(0, 0, 1); geomJac.setValue(0, 1, 0); geomJac.setValue(0, 2, 0); geomJac.setValue(1, 0, 0); geomJac.setValue(1, 1, 1); geomJac.setValue(1, 2, 0); geomJac.setValue(2, 0, 0); geomJac.setValue(2, 1, 0); geomJac.setValue(2, 2, 1); /*second part - angular velocity part*/ geomJac.setValue(0, 3, angVelPart.getValue(0, 0)); geomJac.setValue(0, 4, angVelPart.getValue(0, 1)); geomJac.setValue(0, 5, angVelPart.getValue(0, 2)); geomJac.setValue(1, 3, angVelPart.getValue(1, 0)); geomJac.setValue(1, 4, angVelPart.getValue(1, 1)); geomJac.setValue(1, 5, angVelPart.getValue(1, 2)); geomJac.setValue(2, 3, angVelPart.getValue(2, 0)); geomJac.setValue(2, 4, angVelPart.getValue(2, 1)); geomJac.setValue(2, 5, angVelPart.getValue(2, 2)); /*third part - joints - q6, q7, q9*/ geomJac.setValue(0, 6, jointColumn1.getValue(0)); geomJac.setValue(1, 6, jointColumn1.getValue(1)); geomJac.setValue(2, 6, jointColumn1.getValue(2)); geomJac.setValue(0, 7, jointColumn2.getValue(0)); geomJac.setValue(1, 7, jointColumn2.getValue(1)); geomJac.setValue(2, 7, jointColumn2.getValue(2)); geomJac.setValue(0, 9, wheelColumn.getValue(0)); geomJac.setValue(1, 9, wheelColumn.getValue(1)); geomJac.setValue(2, 9, wheelColumn.getValue(2)); } else if(index == 1) { /*wheel RR*/ /*supporting joints - RBogieJoint, RRSteeringJoint, RRWheel*/ /*contact point computation*/ wheelJointCenter.setValue(0, tags[8]); wheelJointCenter.setValue(1, tags[52]); wheelJointCenter.setValue(2, tags[96]); pcn = wheelJointCenter - _radius*norm; /*r vector computation for base*/ rBaseVector = pcn - baseCoords; rBaseSkew = getSkewMat(rBaseVector); scal(-1,rBaseSkew,rBaseSkew); /*poduct of E and skewsym. matrix*/ prod(rBaseSkew, E, angVelPart); /*getting joints columns for the third part*/ /*RBogieJoint*/ jointCenter1.setValue(0, tags[1]); jointCenter1.setValue(1, tags[45]); jointCenter1.setValue(2, tags[89]); jointAxis1.setValue(0, tags[2]); jointAxis1.setValue(1, tags[46]); jointAxis1.setValue(2, tags[90]); jointAxis1 = jointAxis1 - jointCenter1; rJointVector1 = pcn - jointCenter1; cross_product(jointAxis1, rJointVector1, jointColumn1); /*RRSteeringJoint*/ jointCenter2.setValue(0, tags[5]); jointCenter2.setValue(1, tags[49]); jointCenter2.setValue(2, tags[93]); jointAxis2.setValue(0, tags[6]); jointAxis2.setValue(1, tags[50]); jointAxis2.setValue(2, tags[94]); jointAxis2 = jointAxis2 - jointCenter2; rJointVector2 = pcn - jointCenter2; cross_product(jointAxis2, rJointVector2, jointColumn2); /*RRWheelJoint*/ wheelJointAxis.setValue(0, tags[29]); wheelJointAxis.setValue(1, tags[73]); wheelJointAxis.setValue(2, tags[117]); wheelJointAxis = wheelJointAxis - wheelJointCenter; rWheelJointVector = pcn - wheelJointCenter; cross_product(wheelJointAxis, rWheelJointVector, wheelColumn); /*final composition of the jacobian matrix*/ geomJac.zero(); /*first part - identity*/ geomJac.setValue(0, 0, 1); geomJac.setValue(0, 1, 0); geomJac.setValue(0, 2, 0); geomJac.setValue(1, 0, 0); geomJac.setValue(1, 1, 1); geomJac.setValue(1, 2, 0); geomJac.setValue(2, 0, 0); geomJac.setValue(2, 1, 0); geomJac.setValue(2, 2, 1); /*second part - angular velocity part*/ geomJac.setValue(0, 3, angVelPart.getValue(0, 0)); geomJac.setValue(0, 4, angVelPart.getValue(0, 1)); geomJac.setValue(0, 5, angVelPart.getValue(0, 2)); geomJac.setValue(1, 3, angVelPart.getValue(1, 0)); geomJac.setValue(1, 4, angVelPart.getValue(1, 1)); geomJac.setValue(1, 5, angVelPart.getValue(1, 2)); geomJac.setValue(2, 3, angVelPart.getValue(2, 0)); geomJac.setValue(2, 4, angVelPart.getValue(2, 1)); geomJac.setValue(2, 5, angVelPart.getValue(2, 2)); /*third part - joints - q6, q8, q10*/ geomJac.setValue(0, 6, jointColumn1.getValue(0)); geomJac.setValue(1, 6, jointColumn1.getValue(1)); geomJac.setValue(2, 6, jointColumn1.getValue(2)); geomJac.setValue(0, 8, jointColumn2.getValue(0)); geomJac.setValue(1, 8, jointColumn2.getValue(1)); geomJac.setValue(2, 8, jointColumn2.getValue(2)); geomJac.setValue(0, 10, wheelColumn.getValue(0)); geomJac.setValue(1, 10, wheelColumn.getValue(1)); geomJac.setValue(2, 10, wheelColumn.getValue(2)); } else if(index == 2) { /*wheel CL*/ /*supporting joints - FLBogieJoint, CLSteeringJoint, CLWheel*/ /*contact point computation*/ wheelJointCenter.setValue(0, tags[15]); wheelJointCenter.setValue(1, tags[59]); wheelJointCenter.setValue(2, tags[103]); pcn = wheelJointCenter - _radius*norm; /*r vector computation for base*/ rBaseVector = pcn - baseCoords; rBaseSkew = getSkewMat(rBaseVector); scal(-1,rBaseSkew,rBaseSkew); /*poduct of E and skewsym. matrix*/ prod(rBaseSkew, E, angVelPart); /*getting joints columns for the third part*/ /*FLBogieJoint*/ jointCenter1.setValue(0, tags[9]); jointCenter1.setValue(1, tags[53]); jointCenter1.setValue(2, tags[97]); jointAxis1.setValue(0, tags[10]); jointAxis1.setValue(1, tags[54]); jointAxis1.setValue(2, tags[98]); jointAxis1 = jointAxis1 - jointCenter1; rJointVector1 = pcn - jointCenter1; cross_product(jointAxis1, rJointVector1, jointColumn1); /*CLSteeringJoint*/ jointCenter2.setValue(0, tags[11]); jointCenter2.setValue(1, tags[55]); jointCenter2.setValue(2, tags[99]); jointAxis2.setValue(0, tags[12]); jointAxis2.setValue(1, tags[56]); jointAxis2.setValue(2, tags[100]); jointAxis2 = jointAxis2 - jointCenter2; rJointVector2 = pcn - jointCenter2; cross_product(jointAxis2, rJointVector2, jointColumn2); /*CLWheelJoint*/ wheelJointAxis.setValue(0, tags[32]); wheelJointAxis.setValue(1, tags[76]); wheelJointAxis.setValue(2, tags[120]); wheelJointAxis = wheelJointAxis - wheelJointCenter; rWheelJointVector = pcn - wheelJointCenter; cross_product(wheelJointAxis, rWheelJointVector, wheelColumn); /*final composition of the jacobian matrix*/ geomJac.zero(); /*first part - identity*/ geomJac.setValue(0, 0, 1); geomJac.setValue(0, 1, 0); geomJac.setValue(0, 2, 0); geomJac.setValue(1, 0, 0); geomJac.setValue(1, 1, 1); geomJac.setValue(1, 2, 0); geomJac.setValue(2, 0, 0); geomJac.setValue(2, 1, 0); geomJac.setValue(2, 2, 1); /*second part - angular velocity part*/ geomJac.setValue(0, 3, angVelPart.getValue(0, 0)); geomJac.setValue(0, 4, angVelPart.getValue(0, 1)); geomJac.setValue(0, 5, angVelPart.getValue(0, 2)); geomJac.setValue(1, 3, angVelPart.getValue(1, 0)); geomJac.setValue(1, 4, angVelPart.getValue(1, 1)); geomJac.setValue(1, 5, angVelPart.getValue(1, 2)); geomJac.setValue(2, 3, angVelPart.getValue(2, 0)); geomJac.setValue(2, 4, angVelPart.getValue(2, 1)); geomJac.setValue(2, 5, angVelPart.getValue(2, 2)); /*third part - joints - q6, q7, q9*/ geomJac.setValue(0, 11, jointColumn1.getValue(0)); geomJac.setValue(1, 11, jointColumn1.getValue(1)); geomJac.setValue(2, 11, jointColumn1.getValue(2)); geomJac.setValue(0, 12, jointColumn2.getValue(0)); geomJac.setValue(1, 12, jointColumn2.getValue(1)); geomJac.setValue(2, 12, jointColumn2.getValue(2)); geomJac.setValue(0, 14, wheelColumn.getValue(0)); geomJac.setValue(1, 14, wheelColumn.getValue(1)); geomJac.setValue(2, 14, wheelColumn.getValue(2)); } else if(index == 3) { /*wheel FL*/ /*supporting joints - FLBogieJoint, FLSteeringJoint, FLWheel*/ /*contact point computation*/ wheelJointCenter.setValue(0, tags[16]); wheelJointCenter.setValue(1, tags[60]); wheelJointCenter.setValue(2, tags[104]); pcn = wheelJointCenter - _radius*norm; /*r vector computation for base*/ rBaseVector = pcn - baseCoords; rBaseSkew = getSkewMat(rBaseVector); scal(-1,rBaseSkew,rBaseSkew); /*poduct of E and skewsym. matrix*/ prod(rBaseSkew, E, angVelPart); /*getting joints columns for the third part*/ /*FLBogieJoint*/ jointCenter1.setValue(0, tags[9]); jointCenter1.setValue(1, tags[53]); jointCenter1.setValue(2, tags[97]); jointAxis1.setValue(0, tags[10]); jointAxis1.setValue(1, tags[54]); jointAxis1.setValue(2, tags[98]); jointAxis1 = jointAxis1 - jointCenter1; rJointVector1 = pcn - jointCenter1; cross_product(jointAxis1, rJointVector1, jointColumn1); /*FLSteeringJoint*/ jointCenter2.setValue(0, tags[13]); jointCenter2.setValue(1, tags[57]); jointCenter2.setValue(2, tags[101]); jointAxis2.setValue(0, tags[14]); jointAxis2.setValue(1, tags[58]); jointAxis2.setValue(2, tags[102]); jointAxis2 = jointAxis2 - jointCenter2; rJointVector2 = pcn - jointCenter2; cross_product(jointAxis2, rJointVector2, jointColumn2); /*FLWheelJoint*/ wheelJointAxis.setValue(0, tags[35]); wheelJointAxis.setValue(1, tags[79]); wheelJointAxis.setValue(2, tags[123]); wheelJointAxis = wheelJointAxis - wheelJointCenter; rWheelJointVector = pcn - wheelJointCenter; cross_product(wheelJointAxis, rWheelJointVector, wheelColumn); /*final composition of the jacobian matrix*/ geomJac.zero(); /*first part - identity*/ geomJac.setValue(0, 0, 1); geomJac.setValue(0, 1, 0); geomJac.setValue(0, 2, 0); geomJac.setValue(1, 0, 0); geomJac.setValue(1, 1, 1); geomJac.setValue(1, 2, 0); geomJac.setValue(2, 0, 0); geomJac.setValue(2, 1, 0); geomJac.setValue(2, 2, 1); /*second part - angular velocity part*/ geomJac.setValue(0, 3, angVelPart.getValue(0, 0)); geomJac.setValue(0, 4, angVelPart.getValue(0, 1)); geomJac.setValue(0, 5, angVelPart.getValue(0, 2)); geomJac.setValue(1, 3, angVelPart.getValue(1, 0)); geomJac.setValue(1, 4, angVelPart.getValue(1, 1)); geomJac.setValue(1, 5, angVelPart.getValue(1, 2)); geomJac.setValue(2, 3, angVelPart.getValue(2, 0)); geomJac.setValue(2, 4, angVelPart.getValue(2, 1)); geomJac.setValue(2, 5, angVelPart.getValue(2, 2)); /*third part - joints - q6, q7, q9*/ geomJac.setValue(0, 11, jointColumn1.getValue(0)); geomJac.setValue(1, 11, jointColumn1.getValue(1)); geomJac.setValue(2, 11, jointColumn1.getValue(2)); geomJac.setValue(0, 13, jointColumn2.getValue(0)); geomJac.setValue(1, 13, jointColumn2.getValue(1)); geomJac.setValue(2, 13, jointColumn2.getValue(2)); geomJac.setValue(0, 15, wheelColumn.getValue(0)); geomJac.setValue(1, 15, wheelColumn.getValue(1)); geomJac.setValue(2, 15, wheelColumn.getValue(2)); } else if(index == 4) { /*wheel CR*/ /*supporting joints - FRBogieJoint, CRSteeringJoint, CRWheel*/ /*contact point computation*/ wheelJointCenter.setValue(0, tags[23]); wheelJointCenter.setValue(1, tags[67]); wheelJointCenter.setValue(2, tags[111]); pcn = wheelJointCenter - _radius*norm; /*r vector computation for base*/ rBaseVector = pcn - baseCoords; rBaseSkew = getSkewMat(rBaseVector); scal(-1,rBaseSkew,rBaseSkew); /*poduct of E and skewsym. matrix*/ prod(rBaseSkew, E, angVelPart); /*getting joints columns for the third part*/ /*FRBogieJoint*/ jointCenter1.setValue(0, tags[17]); jointCenter1.setValue(1, tags[61]); jointCenter1.setValue(2, tags[105]); jointAxis1.setValue(0, tags[18]); jointAxis1.setValue(1, tags[62]); jointAxis1.setValue(2, tags[106]); jointAxis1 = jointAxis1 - jointCenter1; rJointVector1 = pcn - jointCenter1; cross_product(jointAxis1, rJointVector1, jointColumn1); /*CRSteeringJoint*/ jointCenter2.setValue(0, tags[19]); jointCenter2.setValue(1, tags[63]); jointCenter2.setValue(2, tags[107]); jointAxis2.setValue(0, tags[20]); jointAxis2.setValue(1, tags[64]); jointAxis2.setValue(2, tags[108]); jointAxis2 = jointAxis2 - jointCenter2; rJointVector2 = pcn - jointCenter2; cross_product(jointAxis2, rJointVector2, jointColumn2); /*CRWheelJoint*/ wheelJointAxis.setValue(0, tags[38]); wheelJointAxis.setValue(1, tags[82]); wheelJointAxis.setValue(2, tags[126]); wheelJointAxis = wheelJointAxis - wheelJointCenter; rWheelJointVector = pcn - wheelJointCenter; cross_product(wheelJointAxis, rWheelJointVector, wheelColumn); /*final composition of the jacobian matrix*/ geomJac.zero(); /*first part - identity*/ geomJac.setValue(0, 0, 1); geomJac.setValue(0, 1, 0); geomJac.setValue(0, 2, 0); geomJac.setValue(1, 0, 0); geomJac.setValue(1, 1, 1); geomJac.setValue(1, 2, 0); geomJac.setValue(2, 0, 0); geomJac.setValue(2, 1, 0); geomJac.setValue(2, 2, 1); /*second part - angular velocity part*/ geomJac.setValue(0, 3, angVelPart.getValue(0, 0)); geomJac.setValue(0, 4, angVelPart.getValue(0, 1)); geomJac.setValue(0, 5, angVelPart.getValue(0, 2)); geomJac.setValue(1, 3, angVelPart.getValue(1, 0)); geomJac.setValue(1, 4, angVelPart.getValue(1, 1)); geomJac.setValue(1, 5, angVelPart.getValue(1, 2)); geomJac.setValue(2, 3, angVelPart.getValue(2, 0)); geomJac.setValue(2, 4, angVelPart.getValue(2, 1)); geomJac.setValue(2, 5, angVelPart.getValue(2, 2)); /*third part - joints - q6, q7, q9*/ geomJac.setValue(0, 16, jointColumn1.getValue(0)); geomJac.setValue(1, 16, jointColumn1.getValue(1)); geomJac.setValue(2, 16, jointColumn1.getValue(2)); geomJac.setValue(0, 17, jointColumn2.getValue(0)); geomJac.setValue(1, 17, jointColumn2.getValue(1)); geomJac.setValue(2, 17, jointColumn2.getValue(2)); geomJac.setValue(0, 19, wheelColumn.getValue(0)); geomJac.setValue(1, 19, wheelColumn.getValue(1)); geomJac.setValue(2, 19, wheelColumn.getValue(2)); } else if(index == 5) { /*wheel FR*/ /*supporting joints - FRBogieJoint, FRSteeringJoint, FRWheel*/ /*contact point computation*/ wheelJointCenter.setValue(0, tags[24]); wheelJointCenter.setValue(1, tags[68]); wheelJointCenter.setValue(2, tags[112]); pcn = wheelJointCenter - _radius*norm; /*r vector computation for base*/ rBaseVector = pcn - baseCoords; rBaseSkew = getSkewMat(rBaseVector); scal(-1,rBaseSkew,rBaseSkew); /*poduct of E and skewsym. matrix*/ prod(rBaseSkew, E, angVelPart); /*getting joints columns for the third part*/ /*FRBogieJoint*/ jointCenter1.setValue(0, tags[17]); jointCenter1.setValue(1, tags[61]); jointCenter1.setValue(2, tags[105]); jointAxis1.setValue(0, tags[18]); jointAxis1.setValue(1, tags[62]); jointAxis1.setValue(2, tags[106]); jointAxis1 = jointAxis1 - jointCenter1; rJointVector1 = pcn - jointCenter1; cross_product(jointAxis1, rJointVector1, jointColumn1); /*FRSteeringJoint*/ jointCenter2.setValue(0, tags[21]); jointCenter2.setValue(1, tags[65]); jointCenter2.setValue(2, tags[109]); jointAxis2.setValue(0, tags[22]); jointAxis2.setValue(1, tags[66]); jointAxis2.setValue(2, tags[110]); jointAxis2 = jointAxis2 - jointCenter2; rJointVector2 = pcn - jointCenter2; cross_product(jointAxis2, rJointVector2, jointColumn2); /*FRWheelJoint*/ wheelJointAxis.setValue(0, tags[41]); wheelJointAxis.setValue(1, tags[85]); wheelJointAxis.setValue(2, tags[129]); wheelJointAxis = wheelJointAxis - wheelJointCenter; rWheelJointVector = pcn - wheelJointCenter; cross_product(wheelJointAxis, rWheelJointVector, wheelColumn); /*final composition of the jacobian matrix*/ geomJac.zero(); /*first part - identity*/ geomJac.setValue(0, 0, 1); geomJac.setValue(0, 1, 0); geomJac.setValue(0, 2, 0); geomJac.setValue(1, 0, 0); geomJac.setValue(1, 1, 1); geomJac.setValue(1, 2, 0); geomJac.setValue(2, 0, 0); geomJac.setValue(2, 1, 0); geomJac.setValue(2, 2, 1); /*second part - angular velocity part*/ geomJac.setValue(0, 3, angVelPart.getValue(0, 0)); geomJac.setValue(0, 4, angVelPart.getValue(0, 1)); geomJac.setValue(0, 5, angVelPart.getValue(0, 2)); geomJac.setValue(1, 3, angVelPart.getValue(1, 0)); geomJac.setValue(1, 4, angVelPart.getValue(1, 1)); geomJac.setValue(1, 5, angVelPart.getValue(1, 2)); geomJac.setValue(2, 3, angVelPart.getValue(2, 0)); geomJac.setValue(2, 4, angVelPart.getValue(2, 1)); geomJac.setValue(2, 5, angVelPart.getValue(2, 2)); /*third part - joints - q6, q7, q9*/ geomJac.setValue(0, 16, jointColumn1.getValue(0)); geomJac.setValue(1, 16, jointColumn1.getValue(1)); geomJac.setValue(2, 16, jointColumn1.getValue(2)); geomJac.setValue(0, 18, jointColumn2.getValue(0)); geomJac.setValue(1, 18, jointColumn2.getValue(1)); geomJac.setValue(2, 18, jointColumn2.getValue(2)); geomJac.setValue(0, 20, wheelColumn.getValue(0)); geomJac.setValue(1, 20, wheelColumn.getValue(1)); geomJac.setValue(2, 20, wheelColumn.getValue(2)); } _pcn = pcn; return geomJac; } void Rover3DWheelFixedTriangleR::computeJachq(const double time, Interaction& inter) { double tgs[132]; double *tmpQ = &(*inter.data(q0))(0); Tags(tgs, tmpQ); SimpleMatrix *g = (SimpleMatrix *)_jachq.get(); _orthoBase(0,0) = _normal.getValue(0); _orthoBase(0,1) = _normal.getValue(1); _orthoBase(0,2) = _normal.getValue(2); orthoBaseFromVector(&_orthoBase(0,0), &_orthoBase(0,1), &_orthoBase(0,2), &_orthoBase(1,0), &_orthoBase(1,1), &_orthoBase(1,2), &_orthoBase(2,0), &_orthoBase(2,1), &_orthoBase(2,2)); SimpleMatrix baseTrans(_orthoBase); SimpleMatrix Jac(3, 21); Jac = computeGeomJac(_normal, tgs, tmpQ); (*g) = Jac; prod(baseTrans, (*g), (*g)); } //EOF
[ "vincent.acary@inria.fr" ]
vincent.acary@inria.fr
034da379cc8d853ab740777c118d19f8065c8bbe
84b42092f4d5e58a77f73dd6829b427697143c53
/projectmiddle.ino
04468b12cca1744fa3d89cc31294771affeff16c
[]
no_license
asv0018/S3-Shock-Secures-Shop
e00d84ba8fe8787f7ba4578469912116a02565a1
dbcd266b16fd8c0d77be07852dd71c851ce818b6
refs/heads/master
2022-06-19T20:26:00.160149
2020-05-01T14:02:37
2020-05-01T14:02:37
260,472,203
0
0
null
null
null
null
UTF-8
C++
false
false
3,891
ino
#include<SoftwareSerial.h> SoftwareSerial gsm(2,3);//Tx,Rx; //pinmode declarations// #define irswitch A0 #define shock A1 #define led 4 /////contact number credentials///// char contactnumber="7795330913"; int i=0; int s=0; int ii=0; int var; void setup(){ pinMode(irswitch,INPUT); pinMode(shock,OUTPUT); Serial.begin(9600); gsm.begin(9600); Serial.println("initialising..."); gsm.println("AT");//checking handshake updateSerial(); gsm.println("AT+CSQ");//signal quality test value range 0 to 31 updateSerial(); gsm.println("AT+CCID");//read sim information to confirm wheather the sim is plugged... updateSerial(); gsm.println("AT+CREG?");//check weather it has registered in the network updateSerial(); gsm.print("ATE0"); gsm.print("\r"); delay(300); gsm.print("ATS0=1"); gsm.print("\r"); delay(300); } void loop(){ maine(); } void updateSerial(){ delay(500); while(Serial.available()) { gsm.write(Serial.read()); } while(gsm.available()) { Serial.write(gsm.read()); } } void pisms(){ gsm.println("AT"); //Once the handshake test is successful, it will back to OK updateSerial(); gsm.println("AT+CMGF=1"); // Configuring TEXT mode updateSerial(); gsm.println("AT+CMGS=\"+917795330913\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms updateSerial(); gsm.print("ALERT!!!someone tried to open your shop."); //text content //Serial.print("ALERT!!!someone tried to open your shop."); //text content updateSerial(); gsm.println("ATD+917795330913;");//automatic call dialing updateSerial(); gsm.write(26); updateSerial(); delay(3000); } void pulse_shock(){ if(i==0) pisms(); // Serial.println("shock"); digitalWrite(led , HIGH); digitalWrite(shock,HIGH); delay(50); digitalWrite(shock,LOW); delay(100); reset(); while((digitalRead(irswitch))==0) { prgm1(); } i=4; } void prgm1(){ while(1){ ii=0; i=0; s=0; if(s==0) sisms(); s=4; digitalWrite(shock,LOW); while((digitalRead(irswitch))==1){ pulse_shock(); } reset(); } } void prgm2(){ owsms(); while(1) { digitalWrite(shock,LOW); reset(); } } void owsms(){ gsm.println("AT"); //Once the handshake test is successful, it will back to OK updateSerial(); gsm.println("AT+CMGF=1"); // Configuring TEXT mode updateSerial(); gsm.println("AT+CMGS=\"+917795330913\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms updateSerial(); gsm.print("HURRAY!!!security suspended."); //text content //Serial.print("ALERT!!!someone tried to open your shop."); //text content updateSerial(); gsm.write(26); updateSerial(); delay(3000); } void reset(){ if(Serial.available()) { var=Serial.read(); while(var==51){ Serial.println("reset"); maine(); } } } void maine(){ while(1){ digitalWrite(led , LOW); while(Serial.available()>0) { var=Serial.read(); Serial.println(var); } switch(var) { case 49: Serial.println("one"); while(var==49) { var=Serial.read(); prgm1(); } break; case 50: Serial.println("two"); while(1) { prgm2(); } break; } } } void sisms(){ gsm.println("AT"); //Once the handshake test is successful, it will back to OK updateSerial(); gsm.println("AT+CMGF=1"); // Configuring TEXT mode updateSerial(); gsm.println("AT+CMGS=\"+917795330913\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms updateSerial(); gsm.print("Security system ACTIVATED"); //text content //Serial.print("ALERT!!!someone tried to open your shop."); //text content updateSerial(); gsm.write(26); updateSerial(); delay(2000); }
[ "noreply@github.com" ]
noreply@github.com
3cc4f002dc5f1c52bb5b43eb614daabf3dc2d4b5
e65e6b345e98633cccc501ad0d6df9918b2aa25e
/Codeforces/Regular/461/F.cpp
1addabd84bf62358a4c320ac35efdd45de42c678
[]
no_license
wcysai/CodeLibrary
6eb99df0232066cf06a9267bdcc39dc07f5aab29
6517cef736f1799b77646fe04fb280c9503d7238
refs/heads/master
2023-08-10T08:31:58.057363
2023-07-29T11:56:38
2023-07-29T11:56:38
134,228,833
5
2
null
null
null
null
UTF-8
C++
false
false
1,494
cpp
#include<bits/stdc++.h> #define MAXN 300005 #define MOD 1000000007 #define INF 1000000000 #define F first #define S second using namespace std; typedef long long ll; typedef pair<int,int> P; int prime[MAXN],d[MAXN]; bool is_prime[MAXN]; bool remov[MAXN]; vector<P> ans; bool cmp(P x,P y) { if(x.F!=y.F) return x.F>y.F; return x.S<y.S; } int sieve(int n) { int p=0; for(int i=0;i<=n;i++) is_prime[i]=true; is_prime[0]=is_prime[1]=false; for(int i=2;i<=n;i++) { if(is_prime[i]) { prime[p++]=i; for(int j=2*i;j<=n;j+=i) is_prime[j]=false; } for(int j=2*i;j<=n;j+=i) d[j]++; } return p; } int main() { int n,k; scanf("%d%d",&n,&k); for(int i=2;i<MAXN;i++) d[i]=1; d[1]=0; int p=sieve(n); int sum=0,t=-1; for(int i=1;i<=n;i++) { sum+=d[i]; if(sum>=k) {t=i; break;} } if(t==-1) { puts("No"); return 0; } puts("Yes"); for(int i=t/2+1;i<=t;i++) ans.push_back(P(d[i],i)); sort(ans.begin(),ans.end(),cmp); int dif=sum-k; memset(remov,false,sizeof(remov)); int res=t; for(int i=0;i<ans.size();i++) { if(dif==0) break; if(ans[i].F<=dif) { remov[ans[i].S]=true; res--; dif-=ans[i].F; } } assert(dif==0); printf("%d\n",res); for(int i=1;i<=t;i++) if(!remov[i]) printf("%d ",i); return 0; }
[ "wcysai@foxmail.com" ]
wcysai@foxmail.com
e0c55062b51269c618210a142760c2dc6fa3ed8b
52fa4e449cd1cd6ddbdf82ed89f581bda5ce250f
/스택(배열).cpp
7cdd50c136603abdd2b84e990154545f9c547b83
[]
no_license
lifeainteasy/data-structment-with-dsm
0b07464567b94f08a7fbcce75af6df7f6aa500aa
df1a485b803498eec7e8843081c7fff47b97c22c
refs/heads/master
2023-02-06T00:26:32.694694
2020-12-29T14:46:09
2020-12-29T14:46:09
null
0
0
null
null
null
null
UHC
C++
false
false
1,606
cpp
#include <stdio.h> int stack[10] = {0,}; int top = -1; void pop(){ stack[top--] = 0; printf("현재 TOP의 위치(pop 됨) : %d\n",top); } void push(int value){ if(top == 10){ printf("스택이 가득 찼습니다.\n"); return; } stack[++top] = value; printf("현재 TOP의 위치 (push 됨) : %d\n",top); } int main(){ push(1); for(int i = 0; i<10; i++) printf("%d",stack[i]); printf("\n"); push(2); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(3); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(4); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(5); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(6); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(7); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(8); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(9); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); push(10); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); pop(); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); pop(); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); pop(); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); pop(); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); pop(); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); pop(); for(int i = 0; i<10; i++) printf("%d",stack[i] ); printf("\n"); }
[ "zofqofhtltm2@gmail.com" ]
zofqofhtltm2@gmail.com
32db4b5b0a5c3d920bad3b28bf3e3600f3a8e832
6f1af84c34d01db2eb4e3d815c2139824c53635f
/save editor/SS_SaveEditor/src/preferencesdialog.cpp
c4fe6bbee4ddf4256442acfe5db31c0fa15fac89
[]
no_license
goldlord5567/skyward-sword-save-editor
5feac30880b4516917d80c91d595e7449da94c1d
921d9c9f94cad070b3718bf630750caca6a5efa4
refs/heads/master
2021-01-10T10:53:35.237197
2013-07-20T20:58:45
2013-07-20T20:58:45
52,488,185
0
0
null
null
null
null
UTF-8
C++
false
false
7,192
cpp
// This file is part of WiiKing2 Editor. // // WiiKing2 Editor is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Wiiking2 Editor 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 WiiKing2 Editor. If not, see <http://www.gnu.org/licenses/> #include "preferencesdialog.h" #include "ui_preferencesdialog.h" #include "wiikeys.h" #include "settingsmanager.h" #include <QDir> #include <QFileInfo> #include <QApplication> #include <QFileDialog> #include <QDebug> class HexValidator : public QValidator { public: HexValidator(QObject* parent = 0) : QValidator(parent) {} protected: QValidator::State validate(QString &input, int &pos) const { Q_UNUSED(pos) input = input.toUpper(); // match against needed regexp QRegExp rx("(?:[0-9a-fA-F]{2})*[0-9a-fA-F]{0,2}"); if (rx.exactMatch(input)) { return QValidator::Acceptable; } return QValidator::Invalid; } }; PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::PreferencesDialog) { m_ui->setupUi(this); // Key Settings m_ui->ngIDLineEdit->setValidator(new HexValidator(this)); m_ui->ngKeyIDLineEdit->setValidator(new HexValidator(this)); m_ui->ngSigPt1LineEdit->setValidator(new HexValidator(this)); m_ui->ngSigPt2LineEdit->setValidator(new HexValidator(this)); m_ui->ngPrivLineEdit->setValidator(new HexValidator(this)); m_ui->macAddrLineEdit->setValidator(new HexValidator(this)); connect(m_ui->ngSigPt1LineEdit, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString))); connect(m_ui->ngSigPt2LineEdit, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString))); connect(m_ui->loadKeysBtn, SIGNAL(clicked()), this, SLOT(onLoadKeys())); // Region Settings SettingsManager* settings = SettingsManager::instance(); switch(settings->defaultRegion()) { case SettingsManager::NTSCU: m_ui->ntscURB->setChecked(true); break; case SettingsManager::NTSCJ: m_ui->ntscJRB->setChecked(true); break; case SettingsManager::PAL: m_ui->palRB ->setChecked(true); break; } m_ui->ntscUNameLE->setText(settings->defaultPlayerNameForRegion(SettingsManager::NTSCU)); m_ui->ntscJNameLE->setText(settings->defaultPlayerNameForRegion(SettingsManager::NTSCJ)); m_ui->palNameLE ->setText(settings->defaultPlayerNameForRegion(SettingsManager::PAL )); } PreferencesDialog::~PreferencesDialog() { delete m_ui; } void PreferencesDialog::onTextChanged(QString string) { if (((m_ui->ngSigPt1LineEdit->isModified() && m_ui->ngSigPt1LineEdit->hasAcceptableInput()) || (m_ui->ngSigPt2LineEdit->isModified() && m_ui->ngSigPt2LineEdit->hasAcceptableInput())) && string.length() <= 120) { if (string.length() > 60) { m_ui->ngSigPt2LineEdit->setText(string.mid(60)); m_ui->ngSigPt1LineEdit->setText(string.remove(60, 60)); } } } void PreferencesDialog::accept() { if (m_ui->ngIDLineEdit->hasAcceptableInput() && m_ui->ngIDLineEdit->text().length() == 8) { quint32 id; bool ok; id = m_ui->ngIDLineEdit->text().toInt(&ok, 16); if (ok) WiiKeys::instance()->setNGID(id); } if (m_ui->ngKeyIDLineEdit->hasAcceptableInput() && m_ui->ngKeyIDLineEdit->text().length() == 8) { quint32 id; bool ok; id = m_ui->ngKeyIDLineEdit->text().toInt(&ok, 16); if (ok) WiiKeys::instance()->setNGKeyID(id); } if (m_ui->ngSigPt1LineEdit->hasAcceptableInput() && m_ui->ngSigPt2LineEdit->hasAcceptableInput() && m_ui->ngSigPt1LineEdit->text().length() == 60 && m_ui->ngSigPt1LineEdit->text().length() == 60) { QByteArray ngSig = QByteArray::fromHex(m_ui->ngSigPt1LineEdit->text().toAscii()); ngSig.append(QByteArray::fromHex(m_ui->ngSigPt2LineEdit->text().toAscii())); WiiKeys::instance()->setNGSig(ngSig); } if (m_ui->ngPrivLineEdit->hasAcceptableInput() && m_ui->ngPrivLineEdit->text().length() == 60) { QByteArray ngPriv = QByteArray::fromHex(m_ui->ngPrivLineEdit->text().toAscii()); WiiKeys::instance()->setNGPriv(ngPriv); } if (m_ui->macAddrLineEdit->hasAcceptableInput() && m_ui->macAddrLineEdit->text().length() == 12) { QByteArray macAddr = QByteArray::fromHex(m_ui->macAddrLineEdit->text().toAscii()); WiiKeys::instance()->setMacAddr(macAddr); } SettingsManager* settings = SettingsManager::instance(); QString regionBtn = m_ui->regionBtnGrp->checkedButton()->objectName(); settings->setDefaultRegion(regionBtn == "ntscURB" ? SettingsManager::NTSCU : (regionBtn == "ntscJRB" ? SettingsManager::NTSCJ : SettingsManager::PAL)); if (m_ui->ntscUNameLE->isModified() && !m_ui->ntscUNameLE->text().isEmpty()) settings->setDefaultPlayerNameForRegion(SettingsManager::NTSCU, m_ui->ntscUNameLE->text()); if (m_ui->ntscJNameLE->isModified() && !m_ui->ntscJNameLE->text().isEmpty()) settings->setDefaultPlayerNameForRegion(SettingsManager::NTSCJ, m_ui->ntscJNameLE->text()); if (m_ui->palNameLE->isModified() && !m_ui->palNameLE->text().isEmpty()) settings->setDefaultPlayerNameForRegion(SettingsManager::PAL, m_ui->palNameLE->text()); QDialog::accept(); } void PreferencesDialog::showEvent(QShowEvent *se) { m_ui->ngIDLineEdit->setText(QString(QByteArray::fromHex(QString::number(WiiKeys::instance()->NGID(), 16).toAscii()).toHex())); m_ui->ngKeyIDLineEdit->setText(QString(QByteArray::fromHex(QString::number(WiiKeys::instance()->NGKeyID(), 16).toAscii()).toHex())); m_ui->ngSigPt1LineEdit->setText(WiiKeys::instance()->NGSig().remove(30, 30).toHex()); m_ui->ngSigPt2LineEdit->setText(WiiKeys::instance()->NGSig().mid(30).toHex()); m_ui->ngPrivLineEdit->setText(WiiKeys::instance()->NGPriv().toHex()); m_ui->macAddrLineEdit->setText(WiiKeys::instance()->macAddr().toHex()); QDialog::showEvent(se); } void PreferencesDialog::onLoadKeys() { QFileInfo finfo(qApp->applicationDirPath() + "/keys.bin"); if (!finfo.exists()) { QString fileName = QFileDialog::getOpenFileName(this, "Load Keys", qApp->applicationDirPath(), "BootMii keys.bin (*.bin)"); if (!fileName.isEmpty()) { if (WiiKeys::instance()->open(fileName, true)) { this->hide(); this->show(); } } } }
[ "antidote.crk@gmail.com" ]
antidote.crk@gmail.com
69daa9be32da459dd1b0ce024768b26ae097066e
9c1971ad1e4ba01d7177a8e63fbb67203a0a03df
/problems/1552/solution.cpp
33082dd3a74091197cb750c7edd6814317817ee8
[]
no_license
virtyaluk/leetcode
cb5a7d0957be353125861b1b9d41606f4729248a
2a1496e5deaf45b28647e713a82b1f5b456888fa
refs/heads/master
2023-07-07T16:52:23.152194
2023-06-24T00:50:09
2023-06-24T00:50:09
166,505,868
1
0
null
null
null
null
UTF-8
C++
false
false
775
cpp
class Solution { public: int maxDistance(vector<int>& position, int m) { sort(begin(position), end(position)); int lo = 0, hi = position.back() - position.front(); while (lo <= hi) { int mid = lo + (hi - lo) / 2; if (count(position, mid) >= m) { lo = mid + 1; } else { hi = mid - 1; } } return lo - 1; } int count(vector<int>& position, int d) { int ans = 1, cur = position[0]; for (int i = 1; i < size(position); i++) { if (position[i] - cur >= d) { ans++; cur = position[i]; } } return ans; } };
[ "bohdan@modern-dev.com" ]
bohdan@modern-dev.com
74b254230f40eb28bcf27c2fab5e52d23f331ed4
26ad4cc35496d364b31396e43a863aee08ef2636
/SDK/SoT_Proposal_Merchant_Rank05_CargoRun_Extra_03_functions.cpp
ddd43f063cabf3a5fa841a8c4c3dd16675c05845
[]
no_license
cw100/SoT-SDK
ddb9b19ce6ae623299b2b02dee51c29581537ba1
3e6f12384c8e21ed83ef56f00030ca0506d297fb
refs/heads/master
2020-05-05T12:09:55.938323
2019-03-20T14:11:57
2019-03-20T14:11:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
379
cpp
// Sea of Thieves (1.4) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "SoT_Proposal_Merchant_Rank05_CargoRun_Extra_03_classes.hpp" namespace SDK { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "igromanru@yahoo.de" ]
igromanru@yahoo.de
3dcb09d356b89c2da51e9c5c8049441ea19c2dc4
d4025cc783199abbd53c9cf7155328f6a4819676
/codepro/0714_FireFighting.cpp
bb5773f26604996ab0a3f6a042457e9a76a9c295
[]
no_license
zwondd/Algorithm
da4522549dac385fa7c06869cb5f85d45483eced
1d5721575011fcd22d817e9d77f21b23b4a9834e
refs/heads/master
2023-01-22T00:05:55.212033
2023-01-15T03:22:10
2023-01-15T03:22:10
161,338,393
0
0
null
null
null
null
UTF-8
C++
false
false
4,621
cpp
#include <stdio.h> #include "./lib/DroneController.h" POS sensorTable[8] = { { 0,0 },{ 1,10 },{ 2,6 },{ 4,1 },{ 5,5 },{ 6,10 },{ 7,8 },{ 8,2 } }; /** * drone.h에는 대략적으로 아래와 같이 구현된 함수의 정의가 있다. * 구현 참고용이므로 본 주석을 풀어서 아래 코드를 사용해서는 안된다. (drone.h에 포함된 내용임) * 아래 주석을 해제하여 사용하는 경우 정상적으로 동작하지 않는다. */ /** * (y, x) 좌표를 표현하는 자료구조 * typedef struct pos { int y; int x; } POS; /** * 화재 감지 센서 인터페이스 * class FireSensor { public: /** * 현재 화재를 감지한 센서의 위치 값을 반환 * @return POS 타입의 (y, x) 좌표. 예를 들어, 1번 센서에서 화재를 감지한 경우 {1, 10}을 반환 * virtual POS getSensorPosition() = 0; }; /** * 드론 관제 시스템 (테스트 대상) * class DroneController { POS currentDrone1_ = { 0,0 }; POS currentDrone2_ = { 10,10 }; FireSensor* sensor_; ... public: DroneController(FireSensor* sensor) : sensor_(sensor) { ... } /** * 화재가 발생한 위치를 얻어와서 현재 드론과의 위치를 계산하여 가장 가까운 드론을 선택하는 함수 (테스트 대상) * 다음 위치 계산을 위해 선택된 드론의 위치를 저장해둔다. (선택된 드론이 해당 좌표로 이동함을 가정) * @return 화재가 발생한 곳과 가장 가까운 드론의 번호. 1 혹은 2 * int selectDrone() { POS sensed = sensor_->getSensorPosition(); // 화제를 감지한 센서의 위치 획득 int dx = currentDrone1_.x - sensed.x; int dy = currentDrone1_.y - sensed.y; int dist1 = dx*dx + dy*dy; dx = currentDrone2_.x - sensed.x; dy = currentDrone2_.y - sensed.y; int dist2 = dx*dx + dy*dy; if (dist2 >= dist1) { currentDrone1_ = sensed; return 1; } else { currentDrone2_ = sensed; return 2; } } ... } */ // 문제1. // 정답 배열의 Format - 화재감지 센서번호가 주어진 순서대로 감지 되었을 때, 출동하는 드론의 번호를 순서대로 기술 // 예를 들어, 드론이 1, 1, 2, 2, 1 순으로 출동한다면 { 1, 1, 2, 2, 1 }로 기록 int expectedResult_1_1[5] = {2,2,2,1,1}; //TODO: 문제 (1-1) 1, 2, 5, 3, 7 순으로 센서 감지 int expectedResult_1_2[5] = {1,2,2,1,1}; //TODO: 문제 (1-2) 7, 6, 5, 4, 3 순으로 센서 감지 // 문제 2. // 각 문제에 해당하는 TC를 설계 // TC배열의 Format : 주어진 순서대로 드론이 현장에 방문을 하기 위해 감지 되야 하는 화재센서의 번호를 순서대로 기술 // 예) 2, 2, 1, 2, 2번 순으로 드론이 현장에 방문하기 위해서는 1,2,3,4,5순으로 센서가 감지되어야 하므로 {1, 2, 3, 4, 5} 기입 int testInput_example[5] = { 1, 2, 3, 4, 5 }; int testInput_2_1[5] = { 2,1,4,3,7 }; //TODO: 문제 (2-1) 1, 1, 1, 1, 1 => 1번 드론만 출동하는 경우 int testInput_2_2[5] = { 1,2,5,6,4 }; //TODO: 문제 (2-2) 2, 2, 2, 2, 2 => 2번 드론만 출동하는 경우 int testInput_2_3[5] = { 2,4,5,6,3 }; //TODO: 문제 (2-3) 1, 1, 2, 2, 1 => 1, 2번 병행 출동하는 경우 int testInput_2_4[5] = { 2,6,5,1,4 }; //TODO: 문제 (2-4) 1, 2, 2, 1, 2 => 1, 2번 병행 출동하는 경우 // 문제 3. 테스트 코드 작성 class FakeFireSensor : public FireSensor { int * sensors_; int count_ = 0; public: FakeFireSensor (int * sensorNumbers) : sensors_(sensorNumbers) {} POS getSensorPosition() { return sensorTable[sensors_[count_++]]; } }; void test_3_1() { // TODO: 항목 3-1. // 화재 위치가 센서 1, 7, 2, 3, 5 순으로 감지되는 상황을 재현하는 테스트 코드 int fakeInput[] = { 1, 7, 2, 3, 5 }; FakeFireSensor sensor(fakeInput); DroneController controller(&sensor); for (int i = 0; i < 5; ++i) controller.selectDrone(); } void test_3_2() { // TODO: 항목 3-2. // 화재 위치가 센서 3, 1, 4, 6, 2 순으로 감지되는 상황을 재현하는 테스트 코드 int fakeInput[] = { 3, 1, 4, 6, 2 }; FakeFireSensor sensor(fakeInput); DroneController controller(&sensor); for (int i = 0; i < 5; ++i) controller.selectDrone(); } // 참고용으로 실행하고 싶은 코드가 있다면 아래 main()에 작성하여 활용할 수 있다. // main 함수의 코드는 채점과 관련이 없다. int main() { printInputResult("example", testInput_example); printInputResult("2-1", testInput_2_1); printInputResult("2-2", testInput_2_2); printInputResult("2-3", testInput_2_3); printInputResult("2-4", testInput_2_4); return 0; }
[ "zwondd@gmail.com" ]
zwondd@gmail.com
fbe3c85679da33ed53624a5ae9acf0291126efc3
3b1235ad1883d4a2daeb6cbbe26a3f032aafc716
/TSieve.cpp
a7582e2da48771807ebcf741e7000e518ac3894b
[]
no_license
Torukai/eratosfen
01269ce75be9ee41e9791eecccd0f54bb5cb93e2
0a6095f56bd4b32c038eaf057a4bbca30f34e762
refs/heads/master
2020-05-07T11:09:08.997477
2019-04-09T21:03:54
2019-04-09T21:03:54
180,449,040
0
0
null
null
null
null
UTF-8
C++
false
false
436
cpp
#include "TSieve.h" BitField sieve(const BitField& inpBF) { BitField outBF(inpBF); outBF.unload_bit(0); unsigned int startBit = 2; while ( startBit < (outBF.size() / 2 + 1 ) ) { if (outBF.getBit(startBit) ) { int pos = startBit; while ( pos < outBF.size() ) { pos += startBit; if ( pos < outBF.size() ) { outBF.unload_bit(pos); } } } ++startBit; } return outBF; }
[ "noreply@github.com" ]
noreply@github.com
7af0f5084f9097a08485f78b9a382e68161121ea
75b947e6a2a15385cf1d14c47e4ea3277c26e987
/LinuxC/day13/exam05/main.cpp
964dcdccc6ce77a27af434154f0c7ce26f109bc6
[]
no_license
fsxchen/CppStudy
828490de9841fd6299c7e19da41ebbc56568584a
9c33be2eb75d4238f803c8cfbc0b7f6d01487be4
refs/heads/master
2021-01-19T02:17:36.849741
2016-12-29T09:27:30
2016-12-29T09:27:30
26,864,021
0
0
null
null
null
null
UTF-8
C++
false
false
333
cpp
#include <QApplication> #include <QTextCodec> #include "logindlg.h" int main(int args, char **argv) { QApplication app(args, argv); QTextCodec *codec = QTextCodec::codecForName("utf-8"); QTextCodec::setCodecForTr(codec); LoginDialog dlg; dlg.resize(400, 300); dlg.setVisible(true); return app.exec(); }
[ "fsxchen@gmail.com" ]
fsxchen@gmail.com
05c708b08f86bedadb802fbde2b99bf7c675fd63
4a04f529f8c7f66e40b2bf556bd67ee9dcb403dd
/Classes/Model/Hero.h
59dc0ee00f941bd7f2b728f41380e28b2dfbb975
[]
no_license
woodpecker-3/bear-game
961bd02dd0dbfb5bd2d0f11902d6a896ffb5083e
7d5b59f40a3d1dc851bbb0c066158a8141cfad6d
refs/heads/master
2021-01-23T15:29:10.705021
2014-08-18T07:01:51
2014-08-18T07:01:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,158
h
#ifndef _HERO_H_ #define _HERO_H_ #include "cocos2d.h" #include "Box2D/Box2D.h" #define NUM_PREV_VELS 5 class Hero : public cocos2d::CCNode { public: enum { kHeroState_invalid = -1, kHeroState_normal = 0, kHeroState_belly, kHeroState_dead }; Hero(); ~Hero(); static Hero* create(b2World* world); bool init(b2World* world); bool initHero(); void update(float dt); void limitVelocity(); void wake(); void jump(); void damage(); public: int getState(){return _state;} void setState(int state); bool getAwake(){return _awake;} void setAwake(bool awake); b2Body* getBody(){return _body;} cocos2d::CCSprite* getSprite(){return _sprite;} protected: void createBox2dBody(); protected: cocos2d::CCSprite* _sprite; b2World* _world; b2Body* _body; b2Vec2 _prevVels[NUM_PREV_VELS]; int _nextVel; bool _awake; int _state; cocos2d::CCAnimation *_normalAnim; cocos2d::CCAction *_normalAnimate; cocos2d::CCAnimation *_bellyAnim; cocos2d::CCAction *_bellyAnimate; cocos2d::CCSprite* _dustSprite; cocos2d::CCAnimation *_dustAnim; cocos2d::CCAction *_dustAnimate; cocos2d::CCMotionStreak* _strike; }; #endif// _HERO_H_
[ "nolan.hee@gmail.com" ]
nolan.hee@gmail.com
07d6a4723acdbfa001a841f6d3cd29251818d74a
91bcf486e229ad67b2ff6dcbb99d071768fafbf9
/source/hud.h
81b46ec66539c202afdc87ee06ff523d2e8e7d48
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
Dessimat0r/ReboundDS
4f2f5f83705180cd26f47634884f45333379aa8a
87d42b5b92b74dbef55f808617e6cc5bf40d4900
refs/heads/master
2021-01-10T19:19:12.584299
2010-01-27T01:55:04
2010-01-27T01:55:04
490,154
0
1
null
null
null
null
UTF-8
C++
false
false
134
h
#ifndef __hud_h__ #define __hud_h__ class Game; class HUD { public: HUD(); ~HUD(); void update(); Game *pGame; }; #endif
[ "Dessimat0r@ntlworld.com" ]
Dessimat0r@ntlworld.com
2a293aed56bf4a67cde5a94542454b3b3fd45bd7
816fdda419bffb4b5a22916fa6fe806c6cd8efc6
/week15/cashregister/cashregister.cpp
0693f5d2b97cb98dff04f3dfa3c2a9beacfdedfe
[]
no_license
subaquatic-pierre/discover-cpp
4c2f081261d45e332cb17e020792ca706c84e32c
c08f4a7cc29c3113312dfdc2f4ced86736d20317
refs/heads/main
2023-05-01T09:24:51.356517
2021-04-29T08:53:38
2021-04-29T08:53:38
325,068,197
1
0
null
null
null
null
UTF-8
C++
false
false
1,495
cpp
#include <iostream> using namespace std; double calculateTax(double rate, double total); double calculateMemberPrice(char isMember, double total); double calculatePromo(double item1, double item2); int main() { double item1, item2, basePrice, afterPromoPrice, afterTax, afterMemberPrice, taxRate; char isMember; cout << "Enter price of the first item: "; cin >> item1; cout << "Enter price of the second item: "; cin >> item2; cout << "Does the customer have a club card? (Y/N): "; cin >> isMember; cout << "Enter tax rate, e.g. 5.5 for 5.5\% tax: "; cin >> taxRate; basePrice = item1 + item2; afterPromoPrice = calculatePromo(item1, item2); afterMemberPrice = calculateMemberPrice(isMember, afterPromoPrice); afterTax = calculateTax(taxRate, afterMemberPrice); printf("Base price %.2f\n", basePrice); printf("Price after discounts = %.2f\n", afterMemberPrice); printf("Total price = %.2f\n", afterTax); return 0; } double calculateTax(double rate, double total) { double vat = total * (rate / 100); return total + vat; } double calculatePromo(double item1, double item2) { if (item1 > item2) { item2 /= 2; } else { item1 /= 2; } return item1 + item2; } double calculateMemberPrice(char isMember, double total) { double discount = 0.00; if (isMember == 'Y' || isMember == 'y') { discount = total * 0.10; } return total - discount; }
[ "subaquatic.pierre@gmail.com" ]
subaquatic.pierre@gmail.com
27138ff7cb8cff08535f4352c67f40ca9691f073
d20dd18bc27babe23d6d23e0c7439967f3c46862
/DDOCP/BreakdownItemWeaponCriticalThreatRange.h
0045c4db3bf5f380f7ca43da45a7db83a6cacc1a
[]
no_license
Maetrim/DDOBuilder
0de2c53c43fa881d6884cfc13374ab549bbdbc1b
bcd2700eba09805eee86b94285a5767ec652f09f
refs/heads/master
2023-08-31T15:21:51.948242
2023-08-24T18:13:47
2023-08-24T18:13:47
97,280,896
83
31
null
2022-05-25T15:17:32
2017-07-14T23:58:46
C++
UTF-8
C++
false
false
1,546
h
// BreakdownItemWeaponCriticalThreatRange.h // #pragma once #include "BreakdownItem.h" class BreakdownItemWeaponCriticalThreatRange : public BreakdownItem { public: BreakdownItemWeaponCriticalThreatRange( BreakdownType type, MfcControls::CTreeListCtrl * treeList, HTREEITEM hItem); virtual ~BreakdownItemWeaponCriticalThreatRange(); // required overrides virtual CString Title() const override; virtual CString Value() const override; virtual void CreateOtherEffects() override; virtual bool AffectsUs(const Effect & effect) const override; // BreakdownObserver overrides virtual void UpdateFeatEffect(Character * pCharacater, const std::string & featName, const Effect & effect) override; virtual void UpdateFeatEffectRevoked(Character * pCharacater, const std::string & featName, const Effect & effect) override; virtual void UpdateItemEffect(Character * charData, const std::string & itemName, const Effect & effect) override; virtual void UpdateItemEffectRevoked(Character * charData, const std::string & itemName, const Effect & effect) override; virtual void UpdateEnhancementEffect(Character * charData, const std::string & enhancementName, const EffectTier & effect) override; virtual void UpdateEnhancementEffectRevoked(Character * charData, const std::string & enhancementName, const EffectTier & effect) override; private: size_t m_keenCount; };
[ "roger16568@yahoo.co.uk" ]
roger16568@yahoo.co.uk
c1090540e4405cf751f70ac95d9a10a2f84a74ea
59a9ffcebc15380044c006a2c92aded656fa419e
/week1/2841_alien_guitar_play/2841_alien_guitar_play_youngwoo.cpp
d65e867eb0800cadc69901c8f3bbebec1ab9bf9a
[]
no_license
s0metimes/aligothm
bbb3964d81681349bad25cd69e2c22f7c07022b1
3ea75be52093432db246d283e81dde279a77857c
refs/heads/master
2022-12-27T00:01:58.818618
2020-10-06T01:08:32
2020-10-06T01:08:32
280,074,388
0
2
null
null
null
null
UTF-8
C++
false
false
4,837
cpp
#include <stdio.h> #include <stack> using namespace std; int main(int argc, char const *argv[]) { stack<int> lines[7]; int N, P, line, flat; int cnt = 0; scanf("%d %d", &N, &P); for(; N > 0; N--) { scanf("%d %d", &line, &flat); if(lines[line].empty()) { // 만약 비어있다면, 즉, 해당 줄이 아무것도 안눌렸다면, lines[line].push(flat); cnt++; } else { // 하나라도 눌려있다면 while(!lines[line].empty()) { if(lines[line].top() > flat) { lines[line].pop(); cnt++; } else if(lines[line].top() <= flat) break; } if(lines[line].empty()) { lines[line].push(flat); cnt++; } else if(lines[line].top() < flat) { lines[line].push(flat); cnt++; } } } printf("%d\n", cnt); return 0; } // #include <stdio.h> // #include <stack> // using namespace std; // int main(int argc, char const *argv[]) // { // stack<int> lines[7]; // int N, P, line, flat; // int cnt = 0; // scanf("%d %d", &N, &P); // for(; N > 0; N--) { // scanf("%d %d", &line, &flat); // if(lines[line].empty()) { // 만약 비어있다면, 즉, 해당 줄이 아무것도 안눌렸다면, // lines[line].push(flat); // cnt++; // } else { // 하나라도 눌려있다면 // if(lines[line].top() < flat) { // 누를 flat이 기존보다 높다면 // lines[line].push(flat); // cnt++; // } else if(lines[line].top() > flat) { // 무언가 때야한다면, // while(!lines[line].empty() && lines[line].top() > flat) { // 탑이 가장 큰 값이므로, 큰것부터 뺀다. // lines[line].pop(); // cnt++; // } // if(lines[line].empty()) { // 전부다 뺐다면 // lines[line].push(flat); // cnt++; // } // else if(lines[line].top() != flat) { // flat보다 큰거 다 빼고나서 flat이 눌려있는지 체크 // lines[line].push(flat); // cnt++; // } // } // } // } // printf("%d\n", cnt); // return 0; // } // 2nd try // #include <stdio.h> // #define MAX 300000 // int isClick[7][MAX+1]; // int main(int argc, char const *argv[]) // { // int N, P, line, flat, i; // int cnt = 0; // scanf("%d %d", &N, &P); // for(; N > 0; N--) { // scanf("%d %d", &line, &flat); // int maxIdx = isClick[line][0]; // if(maxIdx < flat) { // isClick[line][0] = flat; // isClick[line][flat] = 1; // cnt++; // } else if(maxIdx > flat){ // for(i = maxIdx; i > flat; i--) { // if(isClick[line][i] == 1) { // isClick[line][i] = 0; // cnt++; // } // } // isClick[line][0] = flat; // if(isClick[line][flat] == 0) { // isClick[line][flat] = 1; // cnt++; // } // } // } // printf("%d\n", cnt); // return 0; // } // #include <stdio.h> // #define MAX 300000 // int isClick[6][MAX+1]; // int main(int argc, char const *argv[]) // { // int N, P, line, flat, i; // int cnt = 0; // scanf("%d %d", &N, &P); // for(; N > 0; N--) { // scanf("%d %d", &line, &flat); // int maxIdx = isClick[line][0]; // if(maxIdx < flat) { // isClick[line][0] = flat; // isClick[line][flat] = 1; // cnt++; // printf("%d line %d flat 누름. cnt : %d\n", line, flat, cnt); // } else if(maxIdx > flat){ // for(i = maxIdx; i > flat; i--) { // if(isClick[line][i] == 1) { // isClick[line][i] = 0; // cnt++; // printf("%d line %d flat 손가락 땜. cnt : %d\n", line, i, cnt); // } // } // isClick[line][0] = flat; // if(isClick[line][flat] == 0) { // isClick[line][flat] = 1; // cnt++; // printf("%d line %d flat is 누름. cnt : %d\n", line, flat, cnt); // } else { // printf("%d line %d flat is 이미눌려있음. cnt : %d\n", line, flat, cnt); // } // } else { // printf("%d line %d flat is 이미눌려있음. cnt : %d\n", line, flat, cnt); // } // } // printf("%d\n", cnt); // return 0; // }
[ "youngwoo9706@gmail.com" ]
youngwoo9706@gmail.com
823bea3d1d66653134707a9e33eadc6199a4c729
dd80a584130ef1a0333429ba76c1cee0eb40df73
/external/chromium_org/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h
614f24b7b091011b75871835da7db9700bfc6aea
[ "MIT", "BSD-3-Clause" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
C++
false
false
4,722
h
// Copyright (c) 2012 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. #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ #include <list> #include <set> #include <string> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "base/time/time.h" #include "content/public/browser/indexed_db_context.h" #include "url/gurl.h" class Profile; // BrowsingDataIndexedDBHelper is an interface for classes dealing with // aggregating and deleting browsing data stored in indexed databases. A // client of this class need to call StartFetching from the UI thread to // initiate the flow, and it'll be notified by the callback in its UI thread at // some later point. class BrowsingDataIndexedDBHelper : public base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper> { public: // Create a BrowsingDataIndexedDBHelper instance for the indexed databases // stored in |profile|'s user data directory. static BrowsingDataIndexedDBHelper* Create( content::IndexedDBContext* context); // Starts the fetching process, which will notify its completion via // callback. // This must be called only in the UI thread. virtual void StartFetching( const base::Callback<void(const std::list<content::IndexedDBInfo>&)>& callback) = 0; // Requests a single indexed database to be deleted in the IndexedDB thread. virtual void DeleteIndexedDB(const GURL& origin) = 0; protected: friend class base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper>; virtual ~BrowsingDataIndexedDBHelper() {} }; // This class is an implementation of BrowsingDataIndexedDBHelper that does // not fetch its information from the indexed database tracker, but gets them // passed as a parameter. class CannedBrowsingDataIndexedDBHelper : public BrowsingDataIndexedDBHelper { public: // Contains information about an indexed database. struct PendingIndexedDBInfo { PendingIndexedDBInfo(const GURL& origin, const base::string16& name); ~PendingIndexedDBInfo(); bool operator<(const PendingIndexedDBInfo& other) const; GURL origin; base::string16 name; }; CannedBrowsingDataIndexedDBHelper(); // Return a copy of the IndexedDB helper. Only one consumer can use the // StartFetching method at a time, so we need to create a copy of the helper // every time we instantiate a cookies tree model for it. CannedBrowsingDataIndexedDBHelper* Clone(); // Add a indexed database to the set of canned indexed databases that is // returned by this helper. void AddIndexedDB(const GURL& origin, const base::string16& name); // Clear the list of canned indexed databases. void Reset(); // True if no indexed databases are currently stored. bool empty() const; // Returns the number of currently stored indexed databases. size_t GetIndexedDBCount() const; // Returns the current list of indexed data bases. const std::set<CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo>& GetIndexedDBInfo() const; // BrowsingDataIndexedDBHelper methods. virtual void StartFetching( const base::Callback<void(const std::list<content::IndexedDBInfo>&)>& callback) OVERRIDE; virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE {} private: virtual ~CannedBrowsingDataIndexedDBHelper(); // Convert the pending indexed db info to indexed db info objects. void ConvertPendingInfo(); std::set<PendingIndexedDBInfo> pending_indexed_db_info_; // Access to |indexed_db_info_| is triggered indirectly via the UI thread and // guarded by |is_fetching_|. This means |indexed_db_info_| is only accessed // while |is_fetching_| is true. The flag |is_fetching_| is only accessed on // the UI thread. // In the context of this class |indexed_db_info_| is only accessed on the UI // thread. std::list<content::IndexedDBInfo> indexed_db_info_; // This only mutates on the UI thread. base::Callback<void(const std::list<content::IndexedDBInfo>&)> completion_callback_; // Indicates whether or not we're currently fetching information: // it's true when StartFetching() is called in the UI thread, and it's reset // after we notified the callback in the UI thread. // This only mutates on the UI thread. bool is_fetching_; DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); }; #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
3dafd28f79da5c91ffd5dc0f355b21f014135155
bda53a87b8428d697f89e3b539c4be0164cd19f1
/src/ast/This.hpp
be4e64d9b230733ced431c22ec0da2474be761db
[]
no_license
bmansfieldRIT/mini-java-compiler
162ffa2fc5e1f9a0b7d831de97ed94e7db18efcb
2388ebc6f16e37a0c1a761e08a7f20aaa5348dc4
refs/heads/master
2021-09-05T14:37:46.274067
2018-01-28T23:50:27
2018-01-28T23:50:27
110,643,181
2
0
null
null
null
null
UTF-8
C++
false
false
335
hpp
// // This.hpp // // // Created by Brian Mansfield on 3/23/17. // // #ifndef This_hpp #define This_hpp class Visitor; #include <stdio.h> #include <string> #include "Exp.hpp" using namespace std; class This : public Exp { public: int row, col; This(int r, int c); void accept(Visitor& v); }; #endif /* This_hpp */
[ "bmansfieldhfl@gmail.com" ]
bmansfieldhfl@gmail.com
cf0220376ceca88036304909c327132bfbe752c8
25ed24365edaf18d2346b06923f3f9d057641c81
/R10kSource/register_manager.h
c50410c399905aef9710d5848731cdb448987210
[]
no_license
wizard1990/R10K_Simulator
5a7708af1c9ce08eefb77b23bd53b50ba5f711b1
07ad5afeac3a97869980eb8a9fe9f7fe704a2753
refs/heads/master
2020-06-07T11:23:36.710196
2014-12-24T06:27:33
2014-12-24T06:27:33
28,438,065
1
0
null
null
null
null
UTF-8
C++
false
false
844
h
// // register_manager.h // R10K_Simulator // // Created by Yan Zhang on 12/13/14. // Copyright (c) 2014 Yan Zhang. All rights reserved. // #ifndef __R10K_Simulator__register_manager__ #define __R10K_Simulator__register_manager__ #include <vector> using namespace std; class register_manager { public: vector<int> register_mapping; // true for free, false for used bool free_list[64]; // true for ready, false for busy bool valid_bits[64]; register_manager(); int get_free_register(); void add_free_register(int rid); void set_valid_bit(int rid); void reset_valid_bit(int rid); bool get_valid_bit(int rid); void set_register_mapping(int logical_rid, int physical_rid); int get_phy_rid(int logical_rld); }; #endif /* defined(__R10K_Simulator__register_manager__) */
[ "wizard19900509@gmail.com" ]
wizard19900509@gmail.com
33f7f430caa47b817f9a72523cc60a9e6921096c
5025cad62f4c8d537f74ffd9b0536158d5db98e5
/cSkillActionWhirlwind.h
fedfa3d63fcf824e0b5063f1cb472fac10fb701e
[]
no_license
esl000/RpgPortfolio
492c3792a987d7be80daadcf3e5e8ca1e5239fa6
6288c6f3d06ffeaa788e297b5af6b595c2270075
refs/heads/master
2021-09-29T14:47:11.944228
2018-11-25T16:51:42
2018-11-25T16:51:42
159,050,551
0
0
null
null
null
null
UHC
C++
false
false
541
h
#pragma once //휠윈드 바까야됨 블레이드 스톰이 오래도는거임 #include "iUnitAction.h" #include "cEffectSword.h" class cSkillActionWhirlWind : public iUnitAction { protected: cSkinnedMesh* m_pOwnerMesh; cUnit* m_pTarget; cEffectSword* m_pEffect; float m_fTwirlCount; bool m_bIsHit; bool m_bShoundCheck; D3DXVECTOR3 m_vDir; SYNTHESIZE(DWORD, m_dwWhirlWindAnim, WhirlWindAnim); public: cSkillActionWhirlWind(); virtual ~cSkillActionWhirlWind(); virtual void Start(); virtual void Update(); };
[ "esl000@naver.com" ]
esl000@naver.com
8c1f44a46ae3f322ec2749a4ffd3f43e7d09a09f
fac5502956afed0a7b892b2c9896f26e2a46336b
/Source/Shooter/ShooterMatineeCameraShake.h
6aab16da71cf0d9a44ba3018e573ba919482ed27
[]
no_license
MisungKims/UE4_ShootingGame
335dce96bd0d532ce5d7c21ab5e591b5857c0d3d
0fc11ac8969400a9907c51b583897e5e415fb6a6
refs/heads/main
2023-07-27T12:15:15.418680
2021-09-06T15:03:50
2021-09-06T15:03:50
403,095,108
0
0
null
null
null
null
UTF-8
C++
false
false
381
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Camera/CameraShake.h" #include "ShooterMatineeCameraShake.generated.h" /** * */ UCLASS() class SHOOTER_API UShooterMatineeCameraShake : public UMatineeCameraShake { GENERATED_BODY() public: UShooterMatineeCameraShake(); };
[ "noreply@github.com" ]
noreply@github.com
5b354e3b1395db4c28480055940fbf69f643568d
d7db098f4b1d1cd7d32952ebde8106e1f297252e
/AtCoder/ABC/011/c.cpp
7a8781e77a6265e5242300b52402a284f76841e3
[]
no_license
monman53/online_judge
d1d3ce50f5a8a3364a259a78bb89980ce05b9419
dec972d2b2b3922227d9eecaad607f1d9cc94434
refs/heads/master
2021-01-16T18:36:27.455888
2019-05-26T14:03:14
2019-05-26T14:03:14
25,679,069
0
0
null
null
null
null
UTF-8
C++
false
false
677
cpp
// header {{{ #include <bits/stdc++.h> using namespace std; // {U}{INT,LONG,LLONG}_{MAX,MIN} #define ALPHABET (26) #define INF INT_MAX #define MOD (1000000007LL) using LL = long long; // }}} int main() { std::ios::sync_with_stdio(false); int n;cin >> n; int a, b, c;cin >> a >> b >> c; vector<int> dp(305, 105); dp[n] = 0; dp[a] = 200; dp[b] = 200; dp[c] = 200; for(int i=n;i>0;i--){ for(int j=1;j<=3;j++){ if(i-j < 0) continue; if(dp[i-j] == 200) continue; dp[i-j] = min(dp[i-j], dp[i]+1); } } cout << (dp[0] <= 100 ? "YES" : "NO") << endl; return 0; }
[ "monman.cs@gmail.com" ]
monman.cs@gmail.com
2477f2ff21a9c9b4077e1ee71a446111794263be
cb1a4e0d62850ae39156a2f98131095a46722998
/D3D12RaytracingSimpleLighting/Buffer.h
eba0ee1892050b0704d76ee0e1ea341d7f8b1fea
[]
no_license
ybyrzlll/simple_dxr_path_tracer
97fe55c1e69836e27b029f38e99a4317a9ddf6d6
016e1205bc6e89d722dc95707afcd5939946e6f2
refs/heads/master
2022-11-04T23:59:46.811465
2020-06-07T14:14:47
2020-06-07T14:14:47
258,963,355
0
0
null
null
null
null
UTF-8
C++
false
false
163
h
#pragma once namespace rtrt { class Buffer { public: Buffer(); ~Buffer(); ID3D12Resource* GetBuffer(); ID3D12Resource* buffer_; UINT size_; }; }
[ "a774565715@qq.com" ]
a774565715@qq.com
2ba268f8726a14226c51976cca6e73ead53e49fd
eb2f8b3271e8ef9c9b092fcaeff3ff8307f7af86
/Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day2程序包/answers/GD-0076/travel/travel.cpp
0eb9335ea19e00557b764bd80fef07d0e0556273
[]
no_license
Orion545/OI-Record
0071ecde8f766c6db1f67b9c2adf07d98fd4634f
fa7d3a36c4a184fde889123d0a66d896232ef14c
refs/heads/master
2022-01-13T19:39:22.590840
2019-05-26T07:50:17
2019-05-26T07:50:17
188,645,194
4
2
null
null
null
null
UTF-8
C++
false
false
1,495
cpp
#include<cstdio> #include<queue> using namespace std; const int N=5005; int n,m,fa[N],ans[N],now[N]; int head[N],to[N*2],nxt[N*2],tot; bool vis[N]; int read() { int rt=0; char ch=getchar(); while(ch<'0'||ch>'9'){ ch=getchar();} while(ch>='0'&&ch<='9'){rt=rt*10+ch-48;ch=getchar();} return rt; } void add(int u,int v) { to[++tot]=v; nxt[tot]=head[u]; head[u]=tot; } void qinkuangyi(int x) { printf("%d ",x); priority_queue<int,vector<int>,greater<int> >q; for(int i=head[x];i;i=nxt[i]){ if(to[i]==fa[x]) continue; fa[to[i]]=x; q.push(to[i]); } while(!q.empty()){ qinkuangyi(q.top()); q.pop(); } } void qinkuanger() { int now=1,xiao=1000000,da=-1,cnt=2,flag=0; vis[1]=1; printf("1 "); for(int i=head[now];i;i=nxt[i]){ if(to[i]>da) da=to[i]; if(to[i]<xiao) xiao=to[i]; } now=xiao; vis[now]=1; printf("%d ",xiao); while(cnt<n){ for(int i=head[now];i;i=nxt[i]){ if(vis[to[i]]==1) continue; if(flag==1){ now=to[i]; vis[now]=1; printf("%d ",now); cnt++; continue; } if(to[i]<da){ now=to[i]; vis[now]=1; printf("%d ",now); cnt++; } else{ flag=1; now=da; vis[now]=1; printf("%d ",now); cnt++; } } } } int main() { freopen("travel.in","r",stdin); freopen("travel.out","w",stdout); n=read(); m=read(); for(int i=1;i<=m;i++){ int uu,vv; uu=read(); vv=read(); add(uu,vv); add(vv,uu); } if(m==n-1){ qinkuangyi(1); return 0; } if(m==n){ qinkuanger(); } return 0; }
[ "orion545@qq.com" ]
orion545@qq.com
e1bda896359d5dd186fd3296f92fc9eca669d88e
508ca425a965615f67af8fc4f731fb3a29f4665a
/OldStuff/SPOJ/FRACTION.CPP
c2d350b2570da8aa4f768c4e3a345928aeedd7ab
[]
no_license
knakul853/ProgrammingContests
2a1b216dfc20ef81fb666267d78be355400549e9
3366b6a4447dd4df117217734880199e006db5b4
refs/heads/master
2020-04-14T23:37:02.641774
2015-09-06T09:49:12
2015-09-06T09:49:12
164,209,133
1
0
null
2019-01-05T11:34:11
2019-01-05T11:34:10
null
UTF-8
C++
false
false
890
cpp
/* Alfonso Alfonso Peterssen 30 - 11 - 2007 SPOJ #403 "Sort fractions" */ #include <cstdio> const int MAXFRAC = 7600459; typedef short int int16; int T, N, Q, count, pos; struct fraction { int16 num, den; } ls[MAXFRAC]; void find( int16 a, int16 b, int16 c, int16 d ) { if ( a + c > N || b + d > N ) return; find( a, b, a + c, b + d ); ls[count++] = ( fraction ) { a + c, b + d }; find( a + c, b + d, c, d ); } int main() { for ( scanf( "%d", &T ); T; T-- ) { scanf( "%d %d", &N, &Q ); count = 0; ls[count++] = ( fraction ) { 0, 1 }; find( 0, 1, 1, 1 ); ls[count++] = ( fraction ) { 1, 1 }; for ( ; Q; Q-- ) { scanf( "%d", &pos ); pos--; printf( "%d/%d\n", ls[pos].num, ls[pos].den ) ; } } return 0; }
[ "a2peterssen@gmail.com" ]
a2peterssen@gmail.com
32f5cd10c51077fb756c45fb7c8825eabc9b0d6b
2fe969227dcc313ca92c3c9520fe453c69b4e7d6
/src/BrokenPowerLaw.h
54a421de75e2e735589d07794b5f92dbf95c27ce
[ "BSD-3-Clause" ]
permissive
fermi-lat/optimizers
19dee3daa9fbf02dfeec811e502a5b1a3c7b1a0b
7bbdffe91bc0b2216e0f9359301a4d054c5b9dfe
refs/heads/master
2023-06-09T16:09:57.138209
2022-06-06T18:22:06
2022-06-06T18:22:06
103,187,030
0
1
BSD-3-Clause
2020-06-26T00:39:07
2017-09-11T20:52:39
C
UTF-8
C++
false
false
866
h
/** * @file BrokenPowerLaw.h * @brief Declaration for the BrokenPowerLaw Function class * @author J. Chiang * * $Header$ */ #ifndef optimizers_BrokenPowerLaw_h #define optimizers_BrokenPowerLaw_h #include "optimizers/Function.h" #include "optimizers/Arg.h" namespace optimizers { /** * @class BrokenPowerLaw * * @brief A broken power-law function * */ class BrokenPowerLaw : public Function { public: BrokenPowerLaw(double Prefactor=1., double Index1=-1.5, double Index2=-2.5, double BreakValue=1000.); virtual Function * clone() const { return new BrokenPowerLaw(*this); } protected: double value(const Arg & xarg) const; double derivByParamImp(const Arg & xarg, const std::string & paramName) const; }; } // namespace optimizers #endif // optimizers_BrokenPowerLaw_h
[ "" ]
b0941b0e6ec1b6a0f0a5bf2f41e0e06f8c42ab93
83fe309c502c3e7deee79f6c5aa91bc62d65367e
/src/generator.h
d0f0fd473913d1df6dc885565d18309b6d7be7ab
[]
no_license
Rotgar/Covers-in-grid
5d31e9fb0510f42e8fdd31a32aee9d54d628dded
e3c07c574172fee5a1c39880ecd164c7216cb806
refs/heads/master
2020-04-13T12:30:33.118235
2019-01-22T22:04:24
2019-01-22T22:04:24
163,204,345
0
0
null
null
null
null
UTF-8
C++
false
false
176
h
/* Mateusz Krawczyk AAL.12 - Stacje BTS */ #ifndef GENERATOR_H #define GENERATOR_H #include <string> std::string **generate(int n, int m, int k, int l); #endif //GENERATOR_H
[ "matk100.100@gmail.com" ]
matk100.100@gmail.com
fcacef139c7c5f9291bd68a73bbc311dd0d9d5c5
c62928597f3c68d945e2fc976d7300e9282acf1f
/ser/handler.cpp
ba3e466511fa001a2a93c050fc6fbcc4a09b8318
[]
no_license
luzhlon/game
a46cf651af49ef6ad7edc2e4e7d42ae99d15db45
fc70fde940a8078db14efbe98ac698ce41b0695f
refs/heads/master
2021-01-15T20:57:49.389750
2015-10-12T13:49:35
2015-10-12T13:49:35
40,189,010
0
1
null
null
null
null
UTF-8
C++
false
false
6,187
cpp
#include <QDebug> #include <QThread> #include "server.h" #include "room.h" #include "handler.h" namespace MESSAGE { const char *name[] = { "authentication", "room_list", //房间列表 1 "create_room", //创建房间 2 "join_room ", //加入房间 3 "quit_room ", //退出房间 4 "room_members", //房间成员信息 5 "start_game", //开始游戏 6 "set_ready", //设置准备状态 7 "set_team", //设置队伍 8 "update_state", // 9 "update_position", // 10 "update_angle", // 11 "update_speed", // 12 "update_blood", // 13 "action_move", // 14 "action_stop", // 15 "do_skill", // 16 "on_attacked", // 17 "update_grass", // 18 "add_goods", // 19 "dec_goods", // 20 "set_master", // 21 "game_over", // 22 "" }; } MsgHandler::MsgHandler(QTcpSocket *sock) { m_socket = sock; connect(m_socket, SIGNAL(disconnected()), this, SLOT(onDisconnected())); connect(m_socket, SIGNAL(readyRead()), this, SLOT(onReadyRead())); m_handlers = new Handler[MESSAGE::Max_number]; //分配处理器Vector for(int i = 0; i < MESSAGE::Max_number; i++) { m_handlers[i] = nullptr; } m_pkg_cache = new PackageCache([this](char *buf, int size) { auto pkg = &m_buf; memcpy(pkg, buf, size); // 处理包 if(pkg->msg < MESSAGE::Max_number) { auto handler = m_handlers[pkg->msg]; if(handler) handler(this, pkg); //交由子类处理器处理 } else { g_output("[Error] Unrecognizied message %d", pkg->msg); //break; } }); HANDLER(authentication) { // if(self->setMember(pkg->data, pkg->arg1)) { self->Reply(pkg, 1); g_output("[LOG] New member: %s", self->member()->name()); } else { if(self->member()) self->Reply(pkg, 0, self->error()); self->endHandle(true); } }; HANDLER(room_list) { //房间列表 auto p = pkg->data; for(auto name : Room::list()) { //枚举房间列表并发送 pkg->arg1 = 1; pkg->arg2 = strlen(p); self->Reply(pkg, name.toStdString().c_str()); } pkg->arg1 = 0; //枚举结束 self->Reply(pkg); }; HANDLER(create_room) { //创建房间 auto room = new Room(pkg->data); if(room->error()) { self->Reply(pkg, 0, room->error()); delete room; } else { self->Reply(pkg, 1); g_output("[LOG] Room: %s created by %s", room->name(), self->member()->name()); } //g_dialog->updateRoomList(); }; HANDLER(join_room) { //加入某个房间 if(self->member()->join_room(pkg->data)) { self->Reply(pkg, 1); } else { self->Reply(pkg, 0, self->member()->error()); } }; HANDLER(quit_room) { //退出房间 if(self->member()->quit_room()) { self->Reply(pkg, 1); } else { self->Reply(pkg, 0, self->member()->error()); } //g_dialog->updateRoomList(); }; HANDLER(room_members) { //获取房间成员列表 self->member()->room()->broad_members(); }; HANDLER(start_game) { //通知各客户端开始游戏 self->member()->room()->start_game(); }; HANDLER(set_ready) { //设置准备状态 auto room = self->member()->room(); if(!room) return; if(pkg->arg1) { self->member()->set_ready_1(); if(room->check_team_ready()) { //start game room->start_game(); } } else { self->member()->set_ready_0(); } room->broad_members(); }; HANDLER(set_team) { // auto room = self->member()->room(); if(!room) return; if(room->set_team(self->member(), pkg->arg1)) { self->Reply(pkg, 1); room->broad_members(); } else { self->Reply(pkg, 0, room->error()); } }; auto handler_update = [](MsgHandler *self, net_pkg *pkg) { auto m = self->member(); if(m && m->room()) m->room()->broadcast(pkg, pkg->len); }; m_handlers[MESSAGE::update_state] = handler_update; m_handlers[MESSAGE::update_speed] = handler_update; m_handlers[MESSAGE::update_blood] = handler_update; m_handlers[MESSAGE::update_position] = handler_update; m_handlers[MESSAGE::update_angle] = handler_update; m_handlers[MESSAGE::action_move] = handler_update; m_handlers[MESSAGE::action_stop] = handler_update; m_handlers[MESSAGE::do_skill] = handler_update; m_handlers[MESSAGE::on_attacked] = handler_update; m_handlers[MESSAGE::update_grass] = handler_update; m_handlers[MESSAGE::add_goods] = handler_update; m_handlers[MESSAGE::dec_goods] = handler_update; m_handlers[MESSAGE::set_master] = handler_update; m_handlers[MESSAGE::game_over] = handler_update; } MsgHandler::~MsgHandler() { if(m_member) delete m_member; delete[] m_handlers; delete m_pkg_cache; } void MsgHandler::onDisconnected() { g_output("[LOG] Connect: %s disconnected.", (m_member ? member()->name() : m_socket->peerName().toStdString().c_str())); if(m_member) m_member->quit_room(); delete this; } int MsgHandler::_Reply(net_pkg *p, int size) { p->len = size; int ret = m_socket->write((const char *)p, (qint64)size); m_socket->flush(); return ret; } //数据到达时调用 void MsgHandler::onReadyRead() { if(endHandle()) { m_socket->disconnectFromHost(); return; } char buf[10240]; int size = m_socket->read(buf, 10240); m_pkg_cache->write_data(buf, size); }
[ "luzhlon@126.com" ]
luzhlon@126.com
270dd37124c54c443821bc93ff28caacfa0e1381
d31aed88f751ec8f9dd0a51ea215dba4577b5a9b
/application/hedgehog_srv/sources/resources/hhs_resources.cpp
2947b67b1a0041ad33631131b5f656d5bb449bde
[]
no_license
valeriyr/Hedgehog
56a4f186286608140f0e4ce5ef962e9a10b123a8
c045f262ca036570416c793f589ba1650223edd9
refs/heads/master
2016-09-05T20:00:51.747169
2015-09-04T05:21:38
2015-09-04T05:21:38
3,336,071
0
0
null
null
null
null
UTF-8
C++
false
false
965
cpp
#include "hedgehog_srv/sources/ph/hhs_ph.hpp" #include "hedgehog_srv/sources/resources/hhs_resources.hpp" /*---------------------------------------------------------------------------*/ namespace Hedgehog { namespace Server { namespace Resources { /*---------------------------------------------------------------------------*/ const QString PluginsDirectoryName = "plugins"; const QString ServerPluginsDirectoryName = "server"; const QString ResourcesDirectoryName = "resources"; const QString ConfigsDirectoryName = "configs"; const QString ApplicationName = "Hedgehog Server"; /*---------------------------------------------------------------------------*/ const QString SystemMessengerPluginName = "logger"; /*---------------------------------------------------------------------------*/ } // namespace Resources } // namespace Server } // namespace Hedgehog /*---------------------------------------------------------------------------*/
[ "valeriy.reutov@gmail.com" ]
valeriy.reutov@gmail.com
8b6c0dca6ae1943a6835cd63ad941e33936b05bc
6d731b65d683efee80f7f6258394ccce03114ad4
/test/dummy_libs/devices/virt_disk/virt_disk.cpp
e9639400ee72dd8e9cc2f9f16017fb6ff5b2730e
[ "MIT" ]
permissive
martin-hughes/project_azalea
ea42bfab9476a8a1468258a2c9b3556f424bf54d
28aa0183cde350073cf0167df3f51435ea409c8b
refs/heads/master
2021-01-12T13:52:43.348262
2020-05-16T09:56:37
2020-05-16T09:56:37
68,834,754
13
6
null
2016-10-08T09:41:03
2016-09-21T16:09:36
C++
UTF-8
C++
false
false
3,507
cpp
/// @file /// @brief Dummy disk device that operates on virtual hard disk files. #define ENABLE_TRACING #include "test/test_core/test.h" #include "virt_disk.h" using namespace std; virtual_disk_dummy_device::virtual_disk_dummy_device(const char *filename, uint64_t block_size) : IBlockDevice{"Virtual disk", "vd"}, _block_size{block_size}, _num_blocks{0}, backing_filename{filename} { std::string fn(filename); set_device_status(DEV_STATUS::STOPPED); } virtual_disk_dummy_device::~virtual_disk_dummy_device() { } bool virtual_disk_dummy_device::start() { set_device_status(DEV_STATUS::STARTING); try { backing_device = std::unique_ptr<virt_disk::virt_disk>(virt_disk::virt_disk::create_virtual_disk(backing_filename)); } catch (std::fstream::failure &f) { // The device status has already been initialized as failed, so just bail out. set_device_status(DEV_STATUS::FAILED); return true; } _num_blocks = backing_device->get_length() / _block_size; set_device_status(DEV_STATUS::OK); return true; } bool virtual_disk_dummy_device::stop() { set_device_status(DEV_STATUS::STOPPED); return true; } bool virtual_disk_dummy_device::reset() { set_device_status(DEV_STATUS::STOPPED); return true; } uint64_t virtual_disk_dummy_device::num_blocks() { return this->_num_blocks; } uint64_t virtual_disk_dummy_device::block_size() { return this->_block_size; } ERR_CODE virtual_disk_dummy_device::read_blocks(uint64_t start_block, uint64_t num_blocks, void *buffer, uint64_t buffer_length) { ERR_CODE return_val = ERR_CODE::NO_ERROR; if ((start_block > this->_num_blocks) || ((start_block + num_blocks) > this->_num_blocks) || (buffer_length < (num_blocks * this->_block_size)) || (buffer == nullptr)) { return_val = ERR_CODE::INVALID_PARAM; } else if (get_device_status() != DEV_STATUS::OK) { return_val = ERR_CODE::DEVICE_FAILED; } else { try { backing_device->read(buffer, start_block * this->_block_size, num_blocks * this->_block_size, buffer_length); } catch (std::fstream::failure &f) { return_val = ERR_CODE::DEVICE_FAILED; } } return return_val; } // This function is a bit confusing because the parameters "start_block" and "num_blocks" refer to sectors on the // virtual disk, rather than the blocks used within the VDI. ERR_CODE virtual_disk_dummy_device::write_blocks(uint64_t start_block, uint64_t num_blocks, const void *buffer, uint64_t buffer_length) { ERR_CODE return_val = ERR_CODE::UNKNOWN; if ((start_block > this->_num_blocks) || ((start_block + num_blocks) > this->_num_blocks) || (buffer_length < (num_blocks * this->_block_size)) || (buffer == nullptr)) { return_val = ERR_CODE::INVALID_PARAM; } else if (get_device_status() != DEV_STATUS::OK) { return_val = ERR_CODE::DEVICE_FAILED; } else { try { backing_device->write(buffer, start_block * this->_block_size, num_blocks * this->_block_size, buffer_length); return_val = ERR_CODE::NO_ERROR; } catch(std::fstream::failure &f) { return_val = ERR_CODE::DEVICE_FAILED; } } return return_val; }
[ "martin-hughes@users.noreply.github.com" ]
martin-hughes@users.noreply.github.com
1b9bdbe1eae9a3ede13b2ffaf286919ff5b6b22f
e5614c36fd324f2e214ff05aaf2bf7230443e0b5
/LightOJ/1418 - Trees on My Island.cpp
864525dc1aad864e19adf945aaaa9787c4aa444f
[]
no_license
njrafi/Competitive-Programming-Solutions
a9cd3ceae430e6b672c02076f80ecb94065ff6d8
86d167c355813157b0a0a8382b6f8538f29d4599
refs/heads/master
2020-07-30T22:18:46.473308
2019-10-06T18:12:36
2019-10-06T18:12:36
210,377,979
0
0
null
null
null
null
UTF-8
C++
false
false
3,855
cpp
#include <bits/stdc++.h> #ifndef ONLINE_JUDGE #define gc getchar #define pc putchar #else #define gc getchar_unlocked #define pc putchar_unlocked #endif using namespace std; #define vi vector<int> #define si set<int> #define vs vector<string> #define pii pair<int, int> #define vpi vector<pii> #define pri priority_queue<int> #define rev_pri priority_queue<int, vector<int>, greater<int>> #define mpi map<int, int> #define i64 long long int #define endl '\n' #define pi acos(-1) #define all(v) v.begin(), v.end() #define pb push_back #define mp make_pair #define mod 1000000007 #define inf INT_MAX / 2 #define infll LLONG_MAX / 3 #define For(i, n) for (int i = 0; i < n; i++) #define Fre(i, a, b) for (int i = a; i < b; i++) #define sf(n) scanf("%d", &n) #define sff(a, b) scanf("%d %d", &a, &b) #define sfff(a, b, c) scanf("%d %d %d", &a, &b, &c) #define pfn(n) printf("%d\n", n) #define pfs(n) printf("%d ", n) #define eps 1e-8 #define ff first #define ss second #define mem(a, b) memset(a, b, sizeof(a)) #define READ freopen("in.txt", "r", stdin) #define WRITE freopen("out.txt", "w", stdout) #define sz size() #define dbg(i) printf("yo %d\n", i) #define foreach(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) #define sqr(a) (a) * (a) #define clr clear() #define CASE(a) printf("Case %d: ", a) //int dx[] = {0,1,0,-1,1,1,-1,-1}; //int dy[] = {1,0,-1,0,1,-1,-1,1}; i64 gcd(i64 a, i64 b) { if (!b) return a; return gcd(b, a % b); } inline void fastRead(int *a) { register char c = 0; bool neg = 0; while (c < 33) c = gc(); if (c == '-') { neg = 1; c = gc(); } *a = 0; while (c > 33) { *a = *a * 10 + c - '0'; c = gc(); } if (neg) *a *= -1; } inline void fastWrite(i64 a) { char snum[20]; int i = 0; do { snum[i++] = a % 10 + 48; a = a / 10; } while (a != 0); i = i - 1; while (i >= 0) pc(snum[i--]); pc('\n'); } //i64 bigmod(i64 num,i64 n){if(n==0)return 1;i64 x=bigmod(num,n/2);x=x*x%mod;if(n%2==1)x=x*num%mod;return x;} //i64 modinverse(i64 num){return bigmod(num,mod-2)%mod;} //i64 po(i64 a,i64 b){i64 ans=1;while(b--)ans *= a;return ans;} //i64 ncr(i64 n,i64 r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);} // bit manipulations //bool checkbit(int mask,int bit){return mask & (1<<bit);} //int setbit(int mask,int bit){ return mask (1<<bit) ; } //int clearbit(int mask,int bit){return mask & ~(1<<bit);} //int togglebit(int mask,int bit){return mask ^ (1<<bit);} vpi v; /// Gives us polygon area * 2 /// Points must be in clockwise or anti clockwise order i64 get_area() { i64 sum = 0; /// Adding the first point to the last v.pb(v[0]); For(i, v.sz - 1) sum += (i64)v[i].ff * v[i + 1].ss - (i64)v[i].ss * v[i + 1].ff; v.pop_back(); return abs(sum); } /// Point on the boundary of the polygon int get_bb() { /// Adding the first point to the last v.pb(v[0]); int ans = 0; For(i, v.sz - 1) { if (v[i].ss == v[i + 1].ss) ans += abs(v[i].ff - v[i + 1].ff) - 1; else if (v[i].ff == v[i + 1].ff) ans += abs(v[i].ss - v[i + 1].ss) - 1; else ans += gcd(abs(v[i].ff - v[i + 1].ff), abs(v[i].ss - v[i + 1].ss)) - 1; } v.pop_back(); return ans + v.sz; } int main() { int t, cs = 1, a, b, n; sf(t); while (t--) { v.clr; fastRead(&n); while (n--) { fastRead(&a); fastRead(&b); v.pb(mp(a, b)); } i64 area = get_area(); i64 bb = get_bb(); // cout << area << " " << bb << endl; CASE(cs++); fastWrite((area - bb + 2) / 2); } return 0; }
[ "njrafibd@gmail.com" ]
njrafibd@gmail.com
2cd273804c6680fb7f43e66faf5fc8ad8087903a
2cbe5aa318b15cad457d70361f35cbb1e18702a3
/lib/arduino/MP_NETPIE_VIRTUAL_SLIDER/MP_NETPIE_VIRTUAL_SLIDER.cpp
6e1acb492ef20937c38030c26f43c1dd50fd8eaa
[]
no_license
MakerPlayground/MakerPlayground_Library
ae27fb2b17d5784698d3623a419fc36430c83b9d
d427453f0a785e3be0282a25fb0b81b8b91ffcfe
refs/heads/master
2022-12-22T04:05:38.819260
2020-09-10T09:09:22
2020-09-10T09:09:22
143,995,795
0
2
null
null
null
null
UTF-8
C++
false
false
548
cpp
#include "MP_NETPIE_VIRTUAL_SLIDER.h" MP_NETPIE_VIRTUAL_SLIDER::MP_NETPIE_VIRTUAL_SLIDER(char* topic, MP_NETPIE* netpie) : topic(topic) , netpie(netpie) { } int MP_NETPIE_VIRTUAL_SLIDER::init() { netpie->subscribe(topic); return MP_ERR_OK; } void MP_NETPIE_VIRTUAL_SLIDER::printStatus() { Serial.print(F("Current value = ")); Serial.println(value); } void MP_NETPIE_VIRTUAL_SLIDER::update(unsigned long time) { value = netpie->getValue(topic); } double MP_NETPIE_VIRTUAL_SLIDER::getValue() { return value; }
[ "nuntipat@gmail.com" ]
nuntipat@gmail.com
71146dd1df34ebdec60e91fe4a7cdfea114d4229
01294239a4971c329313867e52ae44dc00a8e875
/Source/WebKit2/Shared/wpe/NativeWebMouseEventWPE.cpp
26454e156d36b6c5e39bdc0436eda25a675278d6
[]
no_license
DalavanCloud/WebKitForWayland
76eef56c99a6f873df7bbfc3b9ae4984eae57875
71d0d30c449b6b4d083ebc83e5880188010518db
refs/heads/master
2023-03-04T03:39:30.153729
2017-07-19T10:13:57
2017-07-19T16:17:40
168,880,432
1
0
null
2019-02-02T21:30:41
2019-02-02T21:30:41
null
UTF-8
C++
false
false
1,612
cpp
/* * Copyright (C) 2014 Igalia S.L. * * 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. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "config.h" #include "NativeWebMouseEvent.h" #include "WebEventFactory.h" namespace WebKit { NativeWebMouseEvent::NativeWebMouseEvent(struct wpe_input_pointer_event* event) : WebMouseEvent(WebEventFactory::createWebMouseEvent(event)) { } } // namespace WebKit
[ "zdobersek@igalia.com" ]
zdobersek@igalia.com
84cb39ac8d9849143f6cee40d20506e05dabcc93
34d076046b846fe32e009f35d2c73145dcf2fefd
/lambertian.h
0ac5a2876e5098f081b1732f4770e20f611e7403
[]
no_license
HLHui/ray-tracing-in-one-weekend
faa1a94f0463bed1e23beebd1b4c7646529a5dca
1b5f81ae80dad728f3acbc99ecba4e714fc46775
refs/heads/master
2020-12-31T00:10:18.053720
2018-04-25T09:47:16
2018-04-25T09:47:16
86,565,080
0
0
null
2017-04-05T09:42:15
2017-03-29T09:45:00
C++
UTF-8
C++
false
false
880
h
#pragma once #include"material.h" class lambertian :public material { public: lambertian(const vec3 &a) : albedo(a) {} virtual bool scatter(const ray &rIn, const hitRecord &rec, vec3 &attenuation, ray &scattered) const; private: vec3 albedo;//attenuation }; vec3 random_in_unit_sphere() { vec3 p(1, 1, 1); while (p.squaredLength() >= 1.0) { // Generate 3 random values between 0 and 1 (floating point) float ux = (rand() / (float)RAND_MAX); float uy = (rand() / (float)RAND_MAX); float uz = (rand() / (float)RAND_MAX); p = 2.0*vec3(ux, uy, uz) - vec3(1, 1, 1); } return p; } bool lambertian::scatter(const ray &rIn, const hitRecord &rec, vec3 &attenuation, ray &scattered) const { vec3 target = rec.p + rec.normal + random_in_unit_sphere(); scattered = ray(rec.p, target - rec.p); attenuation = albedo; return true; }
[ "noreply@github.com" ]
noreply@github.com
08a7700719d74d56da8372e5b84230920f22cd27
6c5d96297c10a29e4671894a3bf6cf1cf4dba489
/strFuncs.cpp
83d57074837784d96192a1606a5203523de56569
[]
no_license
Zonkman/lab08_zonkman
a95dee9c758c5208dfa68e52217dfc4677504c52
9782bb1089766e5da0761f7f339463e5767fb0d8
refs/heads/master
2020-04-29T05:02:20.626224
2019-03-15T17:56:41
2019-03-15T17:56:41
175,867,997
0
0
null
null
null
null
UTF-8
C++
false
false
2,121
cpp
#include <iostream> #include <string> #include <cstring> #include <algorithm> #include "strFuncs.h" using namespace std; void makeLower(string& s) { for (int i = 0; i < (int)s.length(); i++) { char currChr = s.at(i); if (currChr >= 'A' && currChr <= 'Z') { //this range is capital letters char lower = (char)(((int)currChr)+0x20); s.replace(i,1,1,lower); //switches the capital letter with lowercase } } } void lettersOnly(string& s) { for (int i = 0; i < (int)s.length(); i++) { char currChr = s.at(i); if ((currChr <= 'A' || currChr >= 'Z') && (currChr <= 'a' || currChr >= 'z')) { //letter ranges s.erase(i--,1); } } } bool isAnagramHelper(const string s1, const string s2) { int s1Len = (int)s1.length(); int s2Len = (int)s2.length(); if (s1Len == 0 || s2Len == 0) { return (s1Len == s2Len); } else { if (s1.at(0) == s2.at(0)) { return isAnagramHelper(s1.substr(1), s2.substr(1)); } } return false; } /* Precondition: Two valid strings s1 and s2, each containing a mix of alphabets, spaces and punctuations * Post condition: Return true if one string is an anagram of the other string. White spaces, punctuations and * the case for the letters (upper or lower) should not * affect your result. */ bool isAnagram(string s1, string s2){ makeLower(s1); makeLower(s2); lettersOnly(s1); lettersOnly(s2); sort(s1.begin(), s1.end()); sort(s2.begin(), s2.end()); return isAnagramHelper(s1,s2); } bool isPalindromeHelper(const string s1){ int sLen = (int)s1.length(); if (sLen < 2){ return true; } else if (s1.at(0) == s1.at(sLen-1)) { return isPalindrome(s1.substr(1,sLen-2)); } else { return false; } return false; //how to get here??? } /* Precondition: s1 is a valid string that may contain upper or lower case alphabets, no spaces or special characters * Postcondition: Returns true if s1 is a palindrome, false otherwise *You should provide a recursive solution*/ bool isPalindrome(const string s1){ string myStr = s1; makeLower(myStr); return isPalindromeHelper(myStr); }
[ "zonkman31@gmail.com" ]
zonkman31@gmail.com
893ae8e87317389890ff33bb4993ee632241a4bd
8f336b5391b0ae3cc1d377705bbd5d60927c5b2a
/Forest Rule/Forest Rule/Animal.cpp
2c1f717758f7f20b7676234b02c8f704e714d409
[]
no_license
GrapeTT/ForestRule
5b00f3b50ecf4de3ff9ef88eb528d37dbad5c5ee
699015c204491a5d46f70a2ec6d610dc1d8b6dc7
refs/heads/master
2021-09-21T12:09:33.308155
2018-08-26T15:21:48
2018-08-26T15:21:48
null
0
0
null
null
null
null
GB18030
C++
false
false
6,839
cpp
#include "Animal.h" CAnimal::CAnimal() { } void CAnimal::createAnimal()//生成动物(设置数量) { m_youngSheep = rand() % 11 + 10; m_adultSheep = rand() % 11 + 20; m_allSheep = m_youngSheep + m_adultSheep; m_youngDeer = rand() % 11 + 10; m_adultDeer = rand() % 11 + 20; m_allDeer = m_youngDeer + m_adultDeer; m_youngWolf = rand() % 2 + 1; m_adultWolf = rand() % 3 + 4; m_allWolf = m_youngWolf + m_adultWolf; m_youngTiger = rand() % 2 + 1; m_adultTiger = rand() % 3 + 3; m_allTiger = m_youngTiger + m_adultTiger; m_allAnimal = m_allSheep + m_allDeer + m_allWolf + m_allTiger; } int CAnimal::operateNumber(int key)//操作(改变并获得)种群编号:1羊 2鹿 3狼 4虎 { if (key == 1) { sheepNumber++; return sheepNumber; } if (key == 2) { deerNumber++; return deerNumber; } if (key == 3) { wolfNumber++; return wolfNumber; } if (key == 4) { tigerNumber++; return tigerNumber; } } void CAnimal::createPos(CAnimal *animal)//生成位置 { int x = 0, y = 0; if (type == 1 || type == 2)//产羊 { x = (rand() % 8) + 16; y = (rand() % 20) + 10; while (animal->getPos(x, y) > 0)//已存在动物,再次生成位置 { x = (rand() % 8) + 16; y = (rand() % 20) + 10; } pos_x = x; pos_y = y; if (type == 1) animal->updatePos(x, y, 1); else animal->updatePos(x, y, 2); return; } if (type == 3 || type == 4)//产鹿 { x = (rand() % 8) + 2; y = (rand() % 20) + 50; while (animal->getPos(x, y) > 0)//已存在动物,再次生成位置 { x = (rand() % 8) + 2; y = (rand() % 20) + 50; } pos_x = x; pos_y = y; if (type == 3) animal->updatePos(x, y, 3); else animal->updatePos(x, y, 4); return; } if (type == 5 || type == 6)//产狼 { x = (rand() % 4) + 4; y = (rand() % 5) + 17; while (animal->getPos(x, y) > 0)//已存在动物,再次生成位置 { x = (rand() % 4) + 4; y = (rand() % 5) + 17; } pos_x = x; pos_y = y; if (type == 5) animal->updatePos(x, y, 5); else animal->updatePos(x, y, 6); return; } if (type == 7 || type == 8)//产虎 { x = (rand() % 4) + 18; y = (rand() % 5) + 58; while (animal->getPos(x, y) > 0)//已存在动物,再次生成位置 { x = (rand() % 4) + 18; y = (rand() % 5) + 58; } pos_x = x; pos_y = y; if (type == 7) animal->updatePos(x, y, 7); else animal->updatePos(x, y, 8); return; } } void CAnimal::updatePos(int &i, int &j, int key)//更新位置信息 { m_pos[i][j] = key; } int CAnimal::breed(int key)//繁殖规则:1羊 2鹿 3狼 4虎 { if (key == 1) { if (m_allSheep < 100) return 1; return 0; } if (key == 2) { if (m_allDeer < 100) return 1; return 0; } if (key == 3) { if (m_allWolf < 13) return 1; return 0; } if (key == 4) { if (m_allTiger < 9) return 1; return 0; } } int CAnimal::die()//死亡规则 { if (type == 1 || type == 2)//羊 { if (energy <= 0) return 1; if (m_age > 25) return 2; return 0; } if (type == 3 || type == 4)//鹿 { if (energy <= 0) return 1; if (m_age > 28) return 2; return 0; } if (type == 5 || type == 6)//狼 { if (energy <= 0) return 1; if (m_age > 30) return 2; return 0; } if (type == 7 || type == 8)//虎 { if (energy <= 0) return 1; if (m_age > 35) return 2; return 0; } } int CAnimal::getPos(int &i, int &j)const//获得当前位置的信息 { return m_pos[i][j]; } void CAnimal::freeMove(CAnimal *animal)//自由移动:0向上 1斜右上 2向右 3斜右下 4向下 5斜左下 6向左 7斜左上 { } void CAnimal::toDrinking(CAnimal *animal)//去饮水 { } void CAnimal::backHome(CAnimal *animal)//返家 { } int CAnimal::feed(CAnimal *animal)//捕食规则 { return 0; } int CAnimal::searchPrey(CAnimal *animal)//寻找猎物 { return 0; } void CAnimal::catchPrey(CAnimal *animal)//追赶猎物 { } int CAnimal::searchEnemy(CAnimal *animal)//搜索敌人 { return 0; } void CAnimal::hideEnemy(CAnimal *animal)//躲避敌人 { } void CAnimal::changeAmount(int key, int value)//改变动物数量信息(key控制):1幼羊 2成年羊 3幼鹿 4成年鹿 5幼狼 6成年狼 7幼虎 8成年虎 { if (key == 1) { m_youngSheep += value; m_allSheep += value; m_allAnimal += value; return; } if (key == 2) { m_adultSheep += value; m_allSheep += value; m_allAnimal += value; return; } if (key == 3) { m_youngDeer += value; m_allDeer += value; m_allAnimal += value; return; } if (key == 4) { m_adultDeer += value; m_allDeer += value; m_allAnimal += value; return; } if (key == 5) { m_youngWolf += value; m_allWolf += value; m_allAnimal += value; return; } if (key == 6) { m_adultWolf += value; m_allWolf += value; m_allAnimal += value; return; } if (key == 7) { m_youngTiger += value; m_allTiger += value; m_allAnimal += value; return; } if (key == 8) { m_adultTiger += value; m_allTiger += value; m_allAnimal += value; return; } } int CAnimal::getInfo(int key)const//获得动物数量信息:1幼羊 2成年羊 3所有羊 4幼鹿 5成年鹿 6所有鹿 7幼狼 8成年狼 9所有狼 10幼虎 11成年虎 12所有虎 13所有动物 { if (key == 1) return m_youngSheep; if (key == 2) return m_adultSheep; if (key == 3) return m_allSheep; if (key == 4) return m_youngDeer; if (key == 5) return m_adultDeer; if (key == 6) return m_allDeer; if (key == 7) return m_youngWolf; if (key == 8) return m_adultWolf; if (key == 9) return m_allWolf; if (key == 10) return m_youngTiger; if (key == 11) return m_adultTiger; if (key == 12) return m_allTiger; if (key == 13) return m_allAnimal; } void CAnimal::printPos(int &i, int &j)const//输出动物 { if (m_pos[i][j] == 1)//输出幼羊 { cout << 'H'; return; } if (m_pos[i][j] == 2)//输出成年羊 { cout << 'S'; return; } if (m_pos[i][j] == 3)//输出幼鹿 { cout << 'R'; return; } if (m_pos[i][j] == 4)//输出成年鹿 { cout << 'D'; return; } if (m_pos[i][j] == 5)//输出幼狼 { cout << 'F'; return; } if (m_pos[i][j] == 6)//输出成年狼 { cout << 'W'; return; } if (m_pos[i][j] == 7)//输出幼虎 { cout << 'G'; return; } if (m_pos[i][j] == 8)//输出成年虎 { cout << 'T'; return; } cout << ' '; } void CAnimal::saveData(CAnimal *animal)//保存动物信息至文件 { } CAnimal::~CAnimal() { }
[ "noreply@github.com" ]
noreply@github.com
bdd24e05edd0ba836f22e022e48e75f514606fbb
304b690ca83b82ec52dae5f53146981860f799e1
/CCCC-GPLT/L1-068 调和平均.cpp
956a77f2e8cd31dbd5a54d84b1a2903a99b41c14
[]
no_license
liuchuo/PAT
53e6a01a5c54ebe0d8c575e10173d16b7d7cc91d
fe7a01b3ef233ac9f03b732b08947a85efe44a2a
refs/heads/master
2023-08-03T20:42:01.980531
2022-08-22T04:35:31
2022-08-22T04:35:31
49,113,721
3,713
1,168
null
2023-05-11T15:36:10
2016-01-06T05:06:34
C++
UTF-8
C++
false
false
237
cpp
#include <bits/stdc++.h> double n, temp, sum, ans; int main() { scanf("%lf", &n); for (int i = 0; i < n; i++) { scanf("%lf", &temp); sum += 1.0 / temp; } printf("%.2lf", n / sum); return 0; }
[ "11920560+liuchuo@users.noreply.github.com" ]
11920560+liuchuo@users.noreply.github.com
6f5db76c0c5173306396d78bbc5ee19bb13afd23
826c34195278680453adf69f01fcf4968161ae14
/libism/ISM/combinatorial_trainer/TestSetGenerator.cpp
ac9a0f2f22482b97a6f7f1067c7519834281e7e7
[ "BSD-3-Clause" ]
permissive
asr-ros/asr_lib_ism
b7cbcf6e5f6c8e83957f9fd61b8a1f6d890a59ba
3d565d031dd4b11eac7786ace73866bd950add8a
refs/heads/master
2021-03-27T19:58:58.676158
2020-01-06T13:07:10
2020-01-06T13:07:10
81,978,318
1
2
BSD-3-Clause
2019-11-03T14:57:09
2017-02-14T18:53:27
C++
UTF-8
C++
false
false
6,925
cpp
/** Copyright (c) 2016, Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "TestSetGenerator.hpp" #include <ctime> #include <algorithm> #include <math.h> #include <fstream> #include <sys/wait.h> #include <thread> #include <sys/time.h> #include <string> #include <chrono> #include <random> #include <boost/filesystem.hpp> #include <boost/filesystem/path.hpp> #include <boost/thread.hpp> #include <boost/functional/hash.hpp> #include <boost/random.hpp> #include <boost/random/variate_generator.hpp> #include <boost/random/uniform_real.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/normal_distribution.hpp> #include "utility/Util.hpp" #include "utility/GeometryHelper.hpp" #include "ImplicitShapeModel.hpp" namespace ISM { std::pair<std::vector<ObjectSetPtr>, std::vector<ObjectSetPtr>> TestSetGenerator::generateTestSets( const std::string &patternName, const TracksPtr& tracks, const IsmPtr ism, unsigned int testSetCount) { LogHelper::logMessage("Generating " + std::to_string(testSetCount) + " test sets for pattern " + patternName + ":"); std::vector<ObjectSetPtr> validTestSets; std::vector<ObjectSetPtr> invalidTestSets; mObjectSetValidator->setISM(ism); std::random_device rd; ENG eng; eng.seed(rd()); DIST dist(0,RAND_MAX); GEN gen(eng,dist); LogHelper::displayProgress(0); for (unsigned int i = 0; i < testSetCount; ++i) { ObjectSetPtr randomObjectSet = generateRandomObjectSetFromTracks(tracks, patternName, gen); if (mObjectSetValidator->isSetValid(randomObjectSet, patternName).first) { validTestSets.push_back(randomObjectSet); } else { invalidTestSets.push_back(randomObjectSet); } LogHelper::displayProgress(((double) i) / testSetCount); } LogHelper::displayProgress(1); LogHelper::logMessage("\nThe test sets for pattern " + patternName + " contain " + std::to_string(validTestSets.size()) + " valid and " + std::to_string(invalidTestSets.size()) + " invalid object sets.\n"); return std::make_pair(validTestSets, invalidTestSets); } ObjectSetPtr TestSetGenerator::generateRandomObjectSetFromTracks(const TracksPtr& allTracks, const std::string& pattern, GEN &gen) { ObjectSetPtr randomObjectSet(new ObjectSet()); ObjectPtr referenceObject; unsigned int tries = 0; const unsigned int maxTries = (allTracks->tracks.size() + allTracks->tracks[0]->objects.size()) * 100; while(!referenceObject && tries < maxTries) { unsigned randomRefTrack = gen() % allTracks->tracks.size(); unsigned randomRefPos = gen() % allTracks->tracks[randomRefTrack]->objects.size(); referenceObject = allTracks->tracks[randomRefTrack]->objects[randomRefPos]; ++tries; } if(!referenceObject) { std::cerr << "TestSetGenerator::generateTestSetsIterative couldnt find referenceObject. Increase maxTries?" << std::endl; throw std::runtime_error("TestSetGenerator::generateTestSetsIterative couldnt find referenceObject. Increase maxTries?"); } randomObjectSet->insert(referenceObject); for (std::vector<TrackPtr>::iterator track = allTracks->tracks.begin(); track != allTracks->tracks.end(); ++track) { if ((*track)->type == referenceObject->type && (*track)->observedId == referenceObject->observedId) { continue; } const ObjectRelations& allRelations = this->mAllObjectRelationsPerPattern.at(pattern); for (const std::pair<unsigned int, ObjectRelationPtr>& relation : allRelations) { if ( (relation.second->getVotesFromAForReferencePoseB().size() > 0 || relation.second->getVotesFromBForReferencePoseA().size() > 0) && relation.second->containsObject(referenceObject->type, referenceObject->observedId) == true && relation.second->containsObject((*track)->type, (*track)->observedId) == true) { PosePtr randomRelativePose; //if objects dont occur together size = 0 if (relation.second->getVotesFromBForReferencePoseA().size() > 0 && relation.second->getObjectTypeA() == referenceObject->type && relation.second->getObjectIdA() == referenceObject->observedId) { unsigned randomTimeStep = gen() % relation.second->getVotesFromBForReferencePoseA().size(); VoteSpecifierPtr randomVote = relation.second->getVotesFromBForReferencePoseA()[randomTimeStep]; PointPtr randomRelativePoint = GeometryHelper::getSourcePoint(referenceObject->pose, randomVote->refToObjectQuat, randomVote->radius); randomRelativePose = GeometryHelper::getSourcePose(referenceObject->pose, randomRelativePoint, randomVote->refToObjectPoseQuat); } else if(relation.second->getVotesFromAForReferencePoseB().size() > 0) { unsigned randomTimeStep = gen() % relation.second->getVotesFromAForReferencePoseB().size(); VoteSpecifierPtr randomVote = relation.second->getVotesFromAForReferencePoseB()[randomTimeStep]; PointPtr randomRelativePoint = GeometryHelper::getSourcePoint(referenceObject->pose, randomVote->refToObjectQuat, randomVote->radius); randomRelativePose = GeometryHelper::getSourcePose(referenceObject->pose, randomRelativePoint, randomVote->refToObjectPoseQuat); } ObjectPtr fittingObject(new Object((*track)->type, randomRelativePose, (*track)->observedId)); randomObjectSet->insert(fittingObject); break; } } } return randomObjectSet; } }
[ "ujdhi@student.kit.edu" ]
ujdhi@student.kit.edu
2390f7ed826fa276842f981880d8c647d11472f4
cdc4c6eb3807898acd8eb3618c0441279ca73534
/follow_quad/FollowControll.cpp
32eccf5b7c736d45b8cff4b676d9accf7d226955
[]
no_license
Manmeeth/Vision-based-Human-Track-and-Follow
e828fd9a82f1bd4d903c569248cb3320bdb8404d
f27c0ef2ab651f7c4db278e7276027af4f099615
refs/heads/master
2020-09-28T20:54:03.948121
2018-05-13T10:06:47
2018-05-13T10:06:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,443
cpp
#include "FollowControll.h" // FollowControll::FollowControll(): set_reference_target_width_height(false), flight_mode(TRACKING), controller_rate(100) // { // _sub_tracked_object = _n.subscribe("/boundingbox", 1000, &FollowControll::tracked_object_cb, this); // _model_subscriber = _n.subscribe("/gazebo/model_states", 10, &FollowControll::ModelStatecallback, this); // _pub_cmd_vel = _n.advertise<geometry_msgs::Twist>("cmd_vel",1); // _pub_tracking_error = _n.advertise<geometry_msgs::Point>("tracking_error",1); // ROS_INFO("Publishing from thesis"); // f = boost::bind(&FollowControll::dyn_recon_callback,this, _1, _2); // srv.setCallback(f); // _pid = new Controller(); // fovx = 70; // fovy = 38; // controller_rate = 100; // _tracker_rect_reference.set_point.x = _tracker_rect_reference.set_point.y = _tracker_rect_reference.set_point.yaw = 1/2.0; // } // void FollowControll::tracked_object_cb(const tld_msgs::BoundingBox &msg) // { // if( (msg.width> 1 || msg.height > 1) && (msg.confidence*100)>_min_fly_confidance) // { // _found_tracked_object = true; // _tracked_rect.set(msg.x,msg.y,msg.width,msg.height,0); // _tracked_rect.apply_pitch_degrees(navdata_telemetry.rotY,fovy); // // _tracker_rect_reference.set(FRONTCAM_RESOLUTION_WIDTH/2-msg.width/2,FRONTCAM_RESOLUTION_HEIGHT/2-msg.height/2,msg.width,msg.height,1/2.0); // _tracker_rect_reference.set(FRONTCAM_RESOLUTION_WIDTH/2,FRONTCAM_RESOLUTION_HEIGHT/2,48,78,1/2.0); // // _tracker_rect_reference.set_point.z = (48*78); // float max_x_error = 2.0/fovx; // float x_error = _tracker_rect_reference.set_point.x-_tracked_rect.set_point.x; // // if(fabs(x_error)>max_x_error){ // _tracked_rect.set_point.yaw =(x_error>0)?_tracked_rect.set_point.x+max_x_error:_tracked_rect.set_point.x-max_x_error; // // } // // else // // _tracked_rect.set_point.yaw =0.5; // geometry_msgs::Point tracking_error; // tracking_error.x = _tracked_rect.set_point.x - _tracker_rect_reference.set_point.x; // tracking_error.y = _tracked_rect.set_point.y - _tracker_rect_reference.set_point.y; // tracking_error.z = _tracked_rect.set_point.z - _tracker_rect_reference.set_point.z; // _pub_tracking_error.publish(tracking_error); // // ============================================================================================= // } // else // { // _found_tracked_object = false; // } // } // void FollowControll::follow() // { // ros::Rate loop_rate(controller_rate); // double time_ms = ((double)(1.0/((double)controller_rate)))*1000.0; // while (ros::ok()) // { // if((!_tracker_rect_reference.set_point.is_zero() && flight_mode == TRACKING)) // { // // if( (msg.width> 1 || msg.height > 1) && (msg.confidence*100)>_min_fly_confidance) // // { // // _found_tracked_object = true; // ROS_INFO("TRACKING IS ON, FLIGHT MODE: %d",flight_mode); // set_reference_target_width_height = true; // if(!_found_tracked_object) // ROS_WARN("Object to track NOT found!!"); // if(_found_tracked_object) // { // _error_pid = _pid->get_pid(_tracker_rect_reference.set_point,_tracked_rect.set_point,time_ms); // // ROS_INFO("pid vals : %s, %s, %s", _pid->cX.cP, _pid->cX.cI, _pid->cX.cD); // publish_command(); // }else{ // // _error_pid = 0; // // _pid->reset_I(); // // publish_command(); // geometry_msgs::Twist cmd; // cmd.linear.x = 0.0; // cmd.linear.y = 0.0; // cmd.linear.z = 0.0; // cmd.angular.x = 0.0; // cmd.angular.y = 0.0; // cmd.angular.z = 0.0; // _pub_cmd_vel.publish(cmd); // } // } // else // { // ROS_INFO("TRACKING IS OFF, FLIGHT MODE: %d",flight_mode); // geometry_msgs::Twist cmd; // cmd.linear.x = 0.0; // cmd.linear.y = 0.0; // cmd.linear.z = 0.0; // cmd.angular.x = 0.0; // cmd.angular.y = 0.0; // cmd.angular.z = 0.0; // _pub_cmd_vel.publish(cmd); // cv::waitKey(1000); // } // ros::spinOnce(); // loop_rate.sleep(); // } // } // void FollowControll::publish_command() // { // // use gazebo model states for actual positions // geometry_msgs::Twist cmd; // cmd.linear.x = -_error_pid.z; // cmd.linear.y = -_error_pid.x; // cmd.linear.z = _error_pid.y; // if (_error_pid.x == 0){ // cmd.angular.z = 0; // } // else{ // cmd.angular.z = _error_pid.x;//cmd.linear.y>0?cmd.linear.y/10:-cmd.linear.y/10; // } // cmd.angular.x = cmd.angular.y = (flight_mode == TRACKING)?1:0; // _pub_cmd_vel.publish(cmd); // } // void FollowControll::recon_callback() // { // // double kp=1, ki=1, kd=1, pLim =1, iLim =1, lpf=1; //for all x,y,range,yaw // Const_PID x{1.3e+5,0,0.05,50,0}; // Const_PID y{0.5e+5,0,0.0,50,0}; // Const_PID range{0.05e+5,0,0,50,0}; // Const_PID yaw{0.0,0,0.0,50,0}; // _pid->set_k_pid(x,y,range,yaw,_pid->set_d_lpf_alpha(20,(double)1.0/controller_rate)); // _min_fly_confidance = 10; // } // void FollowControll::ModelStatecallback(const gazebo_msgs::ModelStates::ConstPtr& msg) // { // // double x = (msg->pose[1].position.x); // } // void FollowControll::dyn_recon_callback(follow_quad::pidParamConfig &config, uint32_t level) // { // ROS_INFO("Reconfigure request XY: %f, %f, %f", // config.groups.pid_x.kPx,config.groups.pid_x.kDx,config.groups.pid_x.pMaxX); // ROS_INFO("Reconfigure request Range: %f, %f, %f", // config.groups.pid_range.kPrange,config.groups.pid_range.kDrange,config.groups.pid_range.pMaxRange); // ROS_INFO("Reconfigure request Yaw: %f, %f, %f", // config.groups.pid_yaw.kPyaw,config.groups.pid_yaw.kDyaw,config.groups.pid_yaw.pMaxYaw); // ROS_INFO("LPF: %f", // config.LPF); // Const_PID x{config.groups.pid_x.kPx,0,config.groups.pid_x.kDx,config.groups.pid_x.pMaxX,0}; // Const_PID y{config.groups.pid_y.kPy,0,config.groups.pid_y.kDy,config.groups.pid_y.pMaxY,0}; // Const_PID range{ config.groups.pid_range.kPrange,0,config.groups.pid_range.kDrange,config.groups.pid_range.pMaxRange,0}; // Const_PID yaw{config.groups.pid_yaw.kPyaw,0,config.groups.pid_yaw.kDyaw,config.groups.pid_yaw.pMaxYaw,0}; // _pid->set_k_pid(x,y,range,yaw,_pid->set_d_lpf_alpha(config.LPF,(double)1.0/controller_rate)); // _min_fly_confidance = config.min_confidance; // } FollowControll::FollowControll(): set_reference_target_width_height(false), flight_mode(TRACKING), controller_rate(100) { _sub_tracked_object = _n.subscribe("tld_tracked_object", 1000, &FollowControll::tracked_object_cb, this); // _sub_tracked_fps = _n.subscribe("tld_fps",1000,&FollowControll::tracked_fps_cb,this); // _sub_center_view = _n.subscribe("tld_center_camera",1000,&FollowControll::center_view_cb,this); // _sub_nav_data = _n.subscribe("ardrone/navdata",1000,&FollowControll::navdata_cb,this); _pub_cmd_vel = _n.advertise<geometry_msgs::Twist>("cmd_vel",1); // _pub_cmd_tld = _n.advertise<std_msgs::Char>("tld_gui_cmds", 1000, true); // _pub_followed_object_width_height = _n.advertise<geometry_msgs::Point>("followed_object",1); _pub_tracking_error = _n.advertise<geometry_msgs::Point>("tracking_error",1); // _srv_controll_cmd = _n.advertiseService("controller_cmd",&FollowControll::controller_cmd,this); ROS_INFO("Publishing from follow_controll"); _pid = new Controller(); std_msgs::Char cmd; cmd.data = 'v'; _pub_cmd_tld.publish(cmd); // f = boost::bind(&FollowControll::dyn_recon_callback,this, _1, _2); // srv.setCallback(f); // float cam_mat[9]= CAMERA_MATRIX; // cv::Mat camera_matrix = cv::Mat(3, 3, CV_32F, cam_mat); // cv::Point2d principle; // cv::calibrationMatrixValues(camera_matrix,cv::Size(FRONTCAM_RESOLUTION_HEIGHT,FRONTCAM_RESOLUTION_WIDTH), // FRONTCAM_RESOLUTION_WIDTH,FRONTCAM_RESOLUTION_HEIGHT, // fovx,fovy,focalLength,principle,aspectRatio); // float m[12]= PROJECTION_MATRIX; // cv::Mat projection_matrix = cv::Mat(3, 4, CV_32FC1, m); // std::cout<<projection_matrix<<std::endl; // cv::Vec4f v(0/2,0/2,1,1); // cv::Mat vec =camera_matrix * projection_matrix*cv::Mat(v); // std::cout<<vec<<std::endl; // ROS_INFO("fovx:%g,fovy:%g",fovx,fovy); _tracker_rect_reference.set_point.x = _tracker_rect_reference.set_point.y = _tracker_rect_reference.set_point.yaw = 1/2.0; } void FollowControll::tracked_object_cb(const tld_msgs::BoundingBox & msg) { if( (msg.width> 1 || msg.height > 1) && (msg.confidence*100)>_min_fly_confidance) { _found_tracked_object = true; // Imaginary data fovx = 70; fovy = 38; _tracked_rect.set(msg.x,msg.y,msg.width,msg.height,0); _tracked_rect.apply_pitch_degrees(navdata_telemetry.rotY,fovy); if(set_reference_target_width_height){ set_reference_target_width_height = false; _tracker_rect_reference.set(FRONTCAM_RESOLUTION_WIDTH/2-msg.width/2,FRONTCAM_RESOLUTION_HEIGHT/2-msg.height/2,msg.width,msg.height,1/2.0); geometry_msgs::Point p; p.x = msg.width; p.y = msg.height; _pub_followed_object_width_height.publish(p); } float max_x_error = 2.0/fovx; float x_error = _tracker_rect_reference.set_point.x-_tracked_rect.set_point.x; if(fabs(x_error)>max_x_error){ _tracked_rect.set_point.yaw =(x_error>0)?_tracked_rect.set_point.x+max_x_error:_tracked_rect.set_point.x-max_x_error; } else _tracked_rect.set_point.yaw =0.5; geometry_msgs::Point tracking_error; tracking_error.x = _tracked_rect.set_point.x - _tracker_rect_reference.set_point.x; tracking_error.y = _tracked_rect.set_point.y - _tracker_rect_reference.set_point.y; tracking_error.z = _tracked_rect.set_point.z - _tracker_rect_reference.set_point.z; _pub_tracking_error.publish(tracking_error); } else { _found_tracked_object = false; } } // void FollowControll::center_view_cb(const geometry_msgs::Point &p) // { // // _camera_view_reference.x = p.x/FRONTCAM_RESOLUTION_WIDTH; // // _camera_view_reference.y = p.y/FRONTCAM_RESOLUTION_HEIGHT; // } // bool FollowControll::controller_cmd(object_follow::controller_cmd::Request &reg, // object_follow::controller_cmd::Response &res) // { // if (reg.str=="follow_and_track") // { // if(reg.mode == 1){ // set_reference_target_width_height = true; // flight_mode = TRACKING; // } // else{ // flight_mode = HOVER; // _error_pid = 0; // _pid->reset_I(); // publish_command(); // } // res.res = true; // } // return true; // } // void FollowControll::tracked_fps_cb(const std_msgs::Float32 &msg) // { // _tracke_fps = msg.data; // } // void FollowControll::navdata_cb(const ardrone_autonomy::Navdata &msg){ // navdata_telemetry = msg; // } void FollowControll::follow() { ros::Rate loop_rate(controller_rate); double time_ms = ((double)(1.0/((double)controller_rate)))*1000.0; while (ros::ok()) { if((!_tracker_rect_reference.set_point.is_zero() && flight_mode == TRACKING)) { if(_found_tracked_object) { _error_pid = _pid->get_pid(_tracker_rect_reference.set_point,_tracked_rect.set_point,time_ms); }else{ _error_pid = 0; } publish_command(); } else { ROS_INFO("TRACKING IS OFF, FLIGHT MODE: %d",flight_mode); cv::waitKey(1000); // if(_camera_view_reference.x<2 && _camera_view_reference.y<2){ // std_msgs::Char cmd; // cmd.data = 'v'; // _pub_cmd_tld.publish(cmd); // } geometry_msgs::Point p; p.x = 0; p.y = 0; _pub_followed_object_width_height.publish(p); } ros::spinOnce(); loop_rate.sleep(); } } void FollowControll::publish_command() { geometry_msgs::Twist cmd; cmd.linear.x = -_error_pid.z; cmd.linear.z = _error_pid.y; cmd.angular.z = _error_pid.x;//cmd.linear.y>0?cmd.linear.y/10:-cmd.linear.y/10; // cmd.angular.x = cmd.angular.y = (flight_mode == TRACKING)?1:0; _pub_cmd_vel.publish(cmd); } void FollowControll::dyn_recon_callback(follow_quad::pidParamConfig &config, uint32_t level) { ROS_INFO("Reconfigure request XY: %f, %f, %f", config.groups.pid_x.kPx,config.groups.pid_x.kDx,config.groups.pid_x.pMaxX); ROS_INFO("Reconfigure request Range: %f, %f, %f", config.groups.pid_range.kPrange,config.groups.pid_range.kDrange,config.groups.pid_range.pMaxRange); ROS_INFO("Reconfigure request Yaw: %f, %f, %f", config.groups.pid_yaw.kPyaw,config.groups.pid_yaw.kDyaw,config.groups.pid_yaw.pMaxYaw); ROS_INFO("LPF: %f", config.LPF); Const_PID x{config.groups.pid_x.kPx,0,config.groups.pid_x.kDx,config.groups.pid_x.pMaxX,0}; Const_PID y{config.groups.pid_y.kPy,0,config.groups.pid_y.kDy,config.groups.pid_y.pMaxY,0}; Const_PID range{ config.groups.pid_range.kPrange,0,config.groups.pid_range.kDrange,config.groups.pid_range.pMaxRange,0}; Const_PID yaw{config.groups.pid_yaw.kPyaw,0,config.groups.pid_yaw.kDyaw,config.groups.pid_yaw.pMaxYaw,0}; _pid->set_k_pid(x,y,range,yaw,_pid->set_d_lpf_alpha(config.LPF,(double)1.0/controller_rate)); _min_fly_confidance = config.min_confidance; } void FollowControll::recon_callback() { // double kp=1, ki=1, kd=1, pLim =1, iLim =1, lpf=1; //for all x,y,range,yaw Const_PID x{1.3,0,0.05,50,0}; Const_PID y{0.5,0,0.0,50,0}; Const_PID range{0.05,0,0,50,0}; Const_PID yaw{0.0,0,0.0,50,0}; _pid->set_k_pid(x,y,range,yaw,_pid->set_d_lpf_alpha(20,(double)1.0/controller_rate)); _min_fly_confidance = 10; }
[ "harshsin@iitk.ac.in" ]
harshsin@iitk.ac.in
e77cddd4ac1f09f468efb5704dd985ce8f6c9aa5
36183993b144b873d4d53e7b0f0dfebedcb77730
/GameDevelopment/Game Programming Gems 4/03 Physics/03 Porcino/source/CollisionEngine.h
49c3cc3a03ba827a7054c8b792e96a0723a3861f
[]
no_license
alecnunn/bookresources
b95bf62dda3eb9b0ba0fb4e56025c5c7b6d605c0
4562f6430af5afffde790c42d0f3a33176d8003b
refs/heads/master
2020-04-12T22:28:54.275703
2018-12-22T09:00:31
2018-12-22T09:00:31
162,790,540
20
14
null
null
null
null
UTF-8
C++
false
false
2,669
h
/** @file CollisionEngine.h */ /* --------------------------------------------------------------------------------------------------- Meshula Physics Demo Created for Games Programming Gems IV Copyright (c) 2003 Nick Porcino, http://meshula.net The MIT License: http://www.opensource.org/licenses/mit-license.php Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------------------------- */ #ifndef _COLLISIONENGINE_H_ #define _COLLISIONENGINE_H_ #include <vector> #include <list> #include "PhysicsEngineDef.h" #include "PMath.h" /** @namespace CollisionEngine * Collision Engine namespace */ namespace Collision { /// EngineAux tracks hidden implementation details, such as the Contact free pool class EngineAux; class Contact; /** @class Engine Manages collision */ class Engine { public: Engine(); ~Engine(); /// set the number of contacts that can be managed by the physics engine void SetCapacity(int maxContacts); /// call to indicate beginning of collision phase void Begin(); /// first the physics engine has to submit all pairs of bodies for testing for collision Contact* TestCollision(Physics::RigidBody* pBodyA, Physics::RigidBody* pBodyB); // returns a Contact if in contact, 0 otherwise /// clear a contact void Clear(Contact*); /// resolve an existing contact void Resolve(Contact*); /// call to indicate end of collision phase void End(); /// between a Begin and End call, this vector contains all the detected contacts std::vector<Contact*> m_Contacts; std::list<Contact*> m_FreePool; }; } // namespace Collision #endif
[ "alec.nunn@gmail.com" ]
alec.nunn@gmail.com
875c942103caac1f44753088356c0d78f24909e1
fe8c855646d91323bc93cd3622fae7766892cf0d
/include/canonicalMC.h
d43fe50c054d5f2d1d84eedb6b84ea6c857496f5
[]
no_license
grhvaring/labsim
4e1ed16a3bb1fef8bd88ac012456463d98606174
a2359bae22c407b5e7952f8c76dcb7b43159cd0e
refs/heads/master
2023-06-09T00:30:45.819764
2021-07-03T11:17:16
2021-07-03T11:17:16
374,907,189
1
0
null
null
null
null
UTF-8
C++
false
false
2,051
h
/**************************************************************** definition of the class canonicalMC, that simulates the canonical ensemble of statistical physics using Monte Carlo methods *****************************************************************/ #ifndef __canonicalMC__ #define __canonicalMC__ #include "experiment.h" #include "libsim.h" using namespace std; struct mcSystem { int npart; double temperature, density, rcut, volume, side; double vtail, wtail; // tail corrections for potential energy and virial vector<array<double, 3>> positions, new_positions; }; double periodic_bc(double, double); array<double, 3> periodic_bc(array<double, 3>, double); class canonicalMC : public Experiment { protected: mcSystem _system; vector<double> _g; int _nbins; double _delta; bool _restart; int _accepted, _attempted; map<string, string> _names; public: canonicalMC(vector<string> files, int *seed, bool restart = false); // setup void initialize(bool restart = false); void extract_names(); void read_input(); string check_phase() const; void reset_histogram(); void read_positions(string file = "config.0"); void calculate_tail_corrections(); // simulation void run(); // internal processing to perform before the measurements void measure(); // measurements (inside the block) void calculate_g(int runs, int nblocks, map<string, ofstream> &out); void average_g(double); // output void starting_message(); void output_g(map<string, ofstream> &); void final_output(map<string, ofstream> &); // other methods void move(int); int random_index() { return int(_system.npart * _random.Rannyu()); } double boltzmann_weight(double dE) { return exp(-dE / _system.temperature); } double energy(int index, bool new_position = false); double potential_energy() const; double virial() const; double pressure() const; void fill_g(); double periodic_bc(double) const; array<double, 3> periodic_bc(const array<double, 3> &) const; }; #endif // __mcmoldyn__
[ "grhvaring@gmail.com" ]
grhvaring@gmail.com
a2b6fabe69764cbebfb78e74327fe0a7438cc878
31ac07ecd9225639bee0d08d00f037bd511e9552
/externals/OCCTLib/inc/CDF_Application.hxx
cd438696a1d1e14b3e3ea052de6568e96393582a
[]
no_license
litao1009/SimpleRoom
4520e0034e4f90b81b922657b27f201842e68e8e
287de738c10b86ff8f61b15e3b8afdfedbcb2211
refs/heads/master
2021-01-20T19:56:39.507899
2016-07-29T08:01:57
2016-07-29T08:01:57
64,462,604
1
0
null
null
null
null
UTF-8
C++
false
false
9,053
hxx
// This file is generated by WOK (CPPExt). // Please do not edit this file; modify original file instead. // The copyright and license terms as defined for the original file apply to // this header file considered to be the "object code" form of the original source. #ifndef _CDF_Application_HeaderFile #define _CDF_Application_HeaderFile #ifndef _Standard_HeaderFile #include <Standard.hxx> #endif #ifndef _Standard_DefineHandle_HeaderFile #include <Standard_DefineHandle.hxx> #endif #ifndef _Handle_CDF_Application_HeaderFile #include <Handle_CDF_Application.hxx> #endif #ifndef _TCollection_ExtendedString_HeaderFile #include <TCollection_ExtendedString.hxx> #endif #ifndef _PCDM_ReaderStatus_HeaderFile #include <PCDM_ReaderStatus.hxx> #endif #ifndef _CDM_Application_HeaderFile #include <CDM_Application.hxx> #endif #ifndef _Handle_CDM_Document_HeaderFile #include <Handle_CDM_Document.hxx> #endif #ifndef _CDM_CanCloseStatus_HeaderFile #include <CDM_CanCloseStatus.hxx> #endif #ifndef _Standard_Boolean_HeaderFile #include <Standard_Boolean.hxx> #endif #ifndef _CDF_TypeOfActivation_HeaderFile #include <CDF_TypeOfActivation.hxx> #endif #ifndef _Handle_PCDM_Reader_HeaderFile #include <Handle_PCDM_Reader.hxx> #endif #ifndef _Standard_ExtString_HeaderFile #include <Standard_ExtString.hxx> #endif #ifndef _Handle_CDM_MetaData_HeaderFile #include <Handle_CDM_MetaData.hxx> #endif #ifndef _Standard_Integer_HeaderFile #include <Standard_Integer.hxx> #endif class Standard_NoSuchObject; class CDF_Session; class Standard_GUID; class CDM_Document; class TCollection_ExtendedString; class TColStd_SequenceOfExtendedString; class PCDM_Reader; class CDM_MetaData; class CDF_Application : public CDM_Application { public: //! plugs an application. <br> //! Open is used <br> //! - for opening a Document that has been created in an application <br> //! - for opening a Document from the database <br> //! - for opening a Document from a file. <br> //! The Open methods always add the document in the session directory and <br> //! calls the virtual Activate method. The document is considered to be <br> //! opened until Close is used. To be storable, a document must be <br> //! opened by an application since the application resources are <br> //! needed to store it. <br> //! <br> //! <br> //! <br> //! <br> Standard_EXPORT static Handle_CDF_Application Load(const Standard_GUID& aGUID) ; //! puts the document in the current session directory <br> //! and calls the virtual method Activate on it. <br> Standard_EXPORT void Open(const Handle(CDM_Document)& aDocument) ; Standard_EXPORT CDM_CanCloseStatus CanClose(const Handle(CDM_Document)& aDocument) ; //! removes the document of the current session directory <br> //! and closes the document; <br> Standard_EXPORT void Close(const Handle(CDM_Document)& aDocument) ; //! This method retrieves a document from the database. <br> //! If the Document references other documents which have <br> //! been updated, the latest version of these documents will <br> //! be used if {UseStorageConfiguration} is Standard_True. <br> //! The content of {aFolder}, {aName} and {aVersion} depends on <br> //! the Database Manager system. If the DBMS is only based on <br> //! the OS, {aFolder} is a directory and {aName} is the name of a <br> //! file. In this case the use of the syntax with {aVersion} <br> //! has no sense. For example: <br> //! <br> //! Handle(CDM_Document) theDocument=myApplication->Retrieve("/home/cascade","box.dsg"); <br> //! If the DBMS is EUCLID/Design Manager, {aFolder}, {aName} <br> //! have the form they have in EUCLID/Design Manager. For example: <br> //! <br> //! Handle(CDM_Document) theDocument=myApplication->Retrieve("|user|cascade","box"); <br> //! <br> //! Since the version is not specified in this syntax, the latest wil be used. <br> //! A link is kept with the database through an instance of CDM_MetaData <br> Standard_EXPORT Handle_CDM_Document Retrieve(const TCollection_ExtendedString& aFolder,const TCollection_ExtendedString& aName,const Standard_Boolean UseStorageConfiguration = Standard_True) ; //! This method retrieves a document from the database. <br> //! If the Document references other documents which have <br> //! been updated, the latest version of these documents <br> //! will be used if {UseStorageConfiguration} is <br> //! Standard_True. -- If the DBMS is only based on the <br> //! OS, this syntax should not be used. <br> //! <br> //! If the DBMS is EUCLID/Design Manager, {aFolder}, {aName} <br> //! and {aVersion} have the form they have in <br> //! EUCLID/Design Manager. For example: <br> //! <br> //! Handle(CDM_Document) theDocument=myApplication->Retrieve("|user|cascade","box","2"); <br> //! A link is kept with the database through an instance <br> //! of CDM_MetaData <br> Standard_EXPORT Handle_CDM_Document Retrieve(const TCollection_ExtendedString& aFolder,const TCollection_ExtendedString& aName,const TCollection_ExtendedString& aVersion,const Standard_Boolean UseStorageConfiguration = Standard_True) ; Standard_EXPORT PCDM_ReaderStatus CanRetrieve(const TCollection_ExtendedString& aFolder,const TCollection_ExtendedString& aName) ; Standard_EXPORT PCDM_ReaderStatus CanRetrieve(const TCollection_ExtendedString& aFolder,const TCollection_ExtendedString& aName,const TCollection_ExtendedString& aVersion) ; Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) = 0; //! Checks status after Retrieve <br> PCDM_ReaderStatus GetRetrieveStatus() const; Standard_EXPORT Standard_Boolean FindReader(const TCollection_ExtendedString& aFileName) ; Standard_EXPORT Handle_PCDM_Reader Reader(const TCollection_ExtendedString& aFileName) ; Standard_EXPORT Standard_Boolean FindReaderFromFormat(const TCollection_ExtendedString& aFormat) ; Standard_EXPORT Handle_PCDM_Reader ReaderFromFormat(const TCollection_ExtendedString& aFormat) ; //! try to retrieve a Format directly in the file or in <br> //! application resource by using extension. returns <br> //! True if found; <br> Standard_EXPORT Standard_Boolean Format(const TCollection_ExtendedString& aFileName,TCollection_ExtendedString& theFormat) ; Standard_EXPORT Standard_ExtString DefaultFolder() ; Standard_EXPORT Standard_Boolean SetDefaultFolder(const Standard_ExtString aFolder) ; Standard_EXPORT Standard_ExtString DefaultExtension() ; friend class CDF_Session; DEFINE_STANDARD_RTTI(CDF_Application) protected: Standard_EXPORT CDF_Application(); PCDM_ReaderStatus myRetrievableStatus; private: //! Informs the application that aDocument has been <br> //! activated. A document is activated when it is created or <br> //! retrieved. <br> //! aTypeOfActivation will be: <br> //! - CDF_TOA_New if the document is a new one <br> //! (even empty or retrieved from the database for <br> //! the first time). <br> //! - CDF_TOA_Unchanged if the document was already <br> //! retrieved but had no changes since the previous retrieval. <br> //! - CDF_TOA_Modified if the document was already <br> //! retrieved and modified since the previous retrieval. <br> //! You do not need to call <Activate>, but you should redefine <br> //! this method to implement application specific behavior. <br> Standard_EXPORT virtual void Activate(const Handle(CDM_Document)& aDocument,const CDF_TypeOfActivation aTypeOfActivation) ; Standard_EXPORT Handle_CDM_Document Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration) ; Standard_EXPORT Handle_CDM_Document Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration,const Standard_Boolean IsComponent) ; Standard_EXPORT Standard_Integer DocumentVersion(const Handle(CDM_MetaData)& theMetaData) ; Standard_EXPORT Standard_Boolean FindReader(const TCollection_ExtendedString& aFileName,Standard_GUID& PluginIn,TCollection_ExtendedString& ResourceName) ; Standard_EXPORT Standard_Boolean FindReaderFromFormat(const TCollection_ExtendedString& aFormat,Standard_GUID& PluginIn,TCollection_ExtendedString& ResourceName) ; Standard_EXPORT CDF_TypeOfActivation TypeOfActivation(const Handle(CDM_MetaData)& aMetaData) ; Standard_EXPORT PCDM_ReaderStatus CanRetrieve(const Handle(CDM_MetaData)& aMetaData) ; TCollection_ExtendedString myDefaultFolder; }; #include <CDF_Application.lxx> // other Inline functions and methods (like "C++: function call" methods) #endif
[ "litao1009@gmail.com" ]
litao1009@gmail.com
f5d88bd88bd8c54501810660ffe72264f1bbb55a
ff3cec11db662140a0f2e448319fca84d8d126b5
/src/sim/simSet.h
5ed658011672014e3f9e3cd8710af338a384e389
[ "MIT" ]
permissive
dtbinh/Torque6
17021fd446d0a57d6402640622b6599f6a4e184e
ed773a7e54a2256bc63f1c61ef9bcc852634ce4e
refs/heads/master
2021-01-16T23:21:57.065205
2015-09-01T23:57:30
2015-09-01T23:57:30
41,794,593
1
0
null
2015-09-02T10:14:30
2015-09-02T10:14:30
null
UTF-8
C++
false
false
9,942
h
//----------------------------------------------------------------------------- // Copyright (c) 2013 GarageGames, LLC // // 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. //----------------------------------------------------------------------------- // [tom, 3/9/2007] To avoid having to change pretty much every source file, this // header is included from simBase.h where the original definitions of SimSet and // SimGroup were. simSet.h should not be included directly. Include dependencies // are hell. #ifndef _SIMSET_H_ #define _SIMSET_H_ #ifndef _SIM_OBJECT_H_ #include "sim/simObject.h" #endif #ifndef _SIM_OBJECT_LIST_H_ #include "sim/SimObjectList.h" #endif #ifndef _FIND_ITERATOR_H_ #include "collection/findIterator.h" #endif #ifndef _SIMDICTIONARY_H_ #include "sim/simDictionary.h" #endif #ifndef _TAML_CHILDREN_H_ #include "persistence/taml/tamlChildren.h" #endif //--------------------------------------------------------------------------- /// A set of SimObjects. /// /// It is often necessary to keep track of an arbitrary set of SimObjects. /// For instance, Torque's networking code needs to not only keep track of /// the set of objects which need to be ghosted, but also the set of objects /// which must <i>always</i> be ghosted. It does this by working with two /// sets. The first of these is the RootGroup (which is actually a SimGroup) /// and the second is the GhostAlwaysSet, which contains objects which must /// always be ghosted to the client. /// /// Some general notes on SimSets: /// - Membership is not exclusive. A SimObject may be a member of multiple /// SimSets. /// - A SimSet does not destroy subobjects when it is destroyed. /// - A SimSet may hold an arbitrary number of objects. /// /// Using SimSets, the code to work with these two sets becomes /// relatively straightforward: /// /// @code /// // (Example from netObject.cc) /// // To iterate over all the objects in the Sim: /// for (SimSetIterator obj(Sim::getRootGroup()); *obj; ++obj) /// { /// NetObject* nobj = dynamic_cast<NetObject*>(*obj); /// /// if (nobj) /// { /// // ... do things ... /// } /// } /// /// // (Example from netGhost.cc) /// // To iterate over the ghostAlways set. /// SimSet* ghostAlwaysSet = Sim::getGhostAlwaysSet(); /// SimSet::iterator i; /// /// U32 sz = ghostAlwaysSet->size(); /// S32 j; /// /// for(i = ghostAlwaysSet->begin(); i != ghostAlwaysSet->end(); i++) /// { /// NetObject *obj = (NetObject *)(*i); /// /// /// ... do things with obj... /// } /// @endcode /// class SimSet: public SimObject, public TamlChildren { typedef SimObject Parent; typedef SimObject Children; protected: SimObjectList objectList; void *mMutex; public: SimSet() { VECTOR_SET_ASSOCIATION(objectList); mMutex = Mutex::createMutex(); } ~SimSet() { lock(); unlock(); Mutex::destroyMutex(mMutex); mMutex = NULL; } /// @name STL Interface /// @{ /// typedef SimObjectList::iterator iterator; typedef SimObjectList::value_type value; SimObject* front() { return objectList.front(); } SimObject* first() { return objectList.first(); } SimObject* last() { return objectList.last(); } bool empty() { return objectList.empty(); } S32 size() const { return objectList.size(); } iterator begin() { return objectList.begin(); } iterator end() { return objectList.end(); } value operator[] (S32 index) { return objectList[U32(index)]; } inline iterator find( iterator first, iterator last, SimObject *obj ) { return ::find(first, last, obj); } inline iterator find( SimObject *obj ) { return ::find(begin(), end(), obj); } template <typename T> inline bool containsType( void ) { for( iterator itr = begin(); itr != end(); ++itr ) { if ( dynamic_cast<T*>(*itr) != NULL ) return true; } return false; } virtual bool reOrder( SimObject *obj, SimObject *target=0 ); SimObject* at(S32 index) const { return objectList.at(index); } void deleteObjects( void ); void clear(); /// @} virtual void onRemove(); virtual void onDeleteNotify(SimObject *object); /// @name Set Management /// @{ virtual void addObject(SimObject*); ///< Add an object to the set. virtual void removeObject(SimObject*); ///< Remove an object from the set. virtual void pushObject(SimObject*); ///< Add object to end of list. /// /// It will force the object to the end of the list if it already exists /// in the list. virtual void popObject(); ///< Remove an object from the end of the list. void bringObjectToFront(SimObject* obj) { reOrder(obj, front()); } void pushObjectToBack(SimObject* obj) { reOrder(obj, NULL); } /// @} virtual U32 getTamlChildCount( void ) const { return (U32)size(); } virtual SimObject* getTamlChild( const U32 childIndex ) const { // Sanity! AssertFatal( childIndex < (U32)size(), "SimSet::getTamlChild() - Child index is out of range." ); // For when the assert is not used. if ( childIndex >= (U32)size() ) return NULL; return at( childIndex ); } virtual void addTamlChild( SimObject* pSimObject ) { // Sanity! AssertFatal( pSimObject != NULL, "SimSet::addTamlChild() - Cannot add a NULL child object." ); addObject( pSimObject ); } void callOnChildren( const char * method, S32 argc, const char *argv[], bool executeOnChildGroups = true ); virtual void write(Stream &stream, U32 tabStop, U32 flags = 0); virtual SimObject *findObject(const char *name); SimObject* findObjectByInternalName(const char* internalName, bool searchChildren = false); virtual bool writeObject(Stream *stream); virtual bool readObject(Stream *stream); inline void lock() { #ifdef TORQUE_MULTITHREAD Mutex::lockMutex(mMutex); #endif } inline void unlock() { #ifdef TORQUE_MULTITHREAD Mutex::unlockMutex(mMutex); #endif } DECLARE_CONOBJECT(SimSet); #ifdef TORQUE_DEBUG inline void _setVectorAssoc( const char *file, const U32 line ) { objectList.setFileAssociation( file, line ); } #endif }; #ifdef TORQUE_DEBUG # define SIMSET_SET_ASSOCIATION( x ) x._setVectorAssoc( __FILE__, __LINE__ ) #else # define SIMSET_SET_ASSOCIATION( x ) #endif /// Iterator for use with SimSets /// /// @see SimSet class SimSetIterator { protected: struct Entry { SimSet* set; SimSet::iterator itr; }; class Stack: public Vector<Entry> { public: void push_back(SimSet*); }; Stack stack; public: SimSetIterator(SimSet*); SimObject* operator++(); SimObject* operator*() { return stack.empty()? 0: *stack.last().itr; } }; //--------------------------------------------------------------------------- /// A group of SimObjects. /// /// A SimGroup is a stricter form of SimSet. SimObjects may only be a member /// of a single SimGroup at a time. /// /// The SimGroup will automatically enforce the single-group-membership rule. /// /// @code /// // From engine/sim/simPath.cc - getting a pointer to a SimGroup /// SimGroup* pMissionGroup = dynamic_cast<SimGroup*>(Sim::findObject("MissionGroup")); /// /// // From game/trigger.cc:46 - iterating over a SimObject's group. /// SimObject* trigger = ...; /// SimGroup* pGroup = trigger->getGroup(); /// for (SimGroup::iterator itr = pGroup->begin(); itr != pGroup->end(); itr++) /// { /// // do something with *itr /// } /// @endcode class SimGroup: public SimSet { private: friend class SimManager; friend class SimObject; typedef SimSet Parent; SimNameDictionary nameDictionary; public: ~SimGroup(); /// Add an object to the group. virtual void addObject(SimObject*); void addObject(SimObject*, SimObjectId); void addObject(SimObject*, const char *name); /// Remove an object from the group. virtual void removeObject(SimObject*); virtual void onRemove(); /// Find an object in the group. virtual SimObject* findObject(const char* name); bool processArguments(S32 argc, const char **argv); DECLARE_CONOBJECT(SimGroup); }; inline void SimGroup::addObject(SimObject* obj, SimObjectId id) { obj->mId = id; addObject( obj ); } inline void SimGroup::addObject(SimObject *obj, const char *name) { addObject( obj ); obj->assignName(name); } class SimGroupIterator: public SimSetIterator { public: SimGroupIterator(SimGroup* grp): SimSetIterator(grp) {} SimObject* operator++(); }; #endif // _SIMSET_H_
[ "andrewmac@gmail.com" ]
andrewmac@gmail.com
8ae3eb5b191b9b144be45e5eaf1575ccdea7f2d0
0edd280fc5114400c5868a014f2e8de4e20135fb
/big_homework/pointcolor.cpp
5402ade7962731c745602ccde5765a9b1a3f60f5
[ "MIT" ]
permissive
caozhangjie/Graph-Visualization-System
b172284da5e9c627896143271421717c153b14c4
1b66ac9ea7662eddd33542039f66b75f480d2d0a
refs/heads/master
2021-01-19T14:46:43.157487
2017-03-29T23:19:16
2017-03-29T23:19:16
86,636,990
0
0
null
null
null
null
UTF-8
C++
false
false
542
cpp
#include "pointcolor.h" void PointColor::setColor(int level, int type, int alpha) { switch(type) { case PAPERCOLOR: r = 255; g = 190 - level * 1.6; b = 190 - level * 1.6; a = alpha; break; case CONFERENCECOLOR: b = 255; g = 190 - level * 5; r = 190 - level * 5; a = alpha; break; case AUTHORCOLOR: g = 255; r = 190 - level * 5; b = 190 - level * 5; a = alpha; break; } }
[ "caozj14@qq.com" ]
caozj14@qq.com
1973eecae94147f875859b42f1a804636c76a53b
a7dc87259ed3af64b13ae23b4ec4ad046f7051e2
/Leetcode - top 100 liked question/101. Symmetric Tree.cpp
c1979dbe2c734efaf5da549c02806a73c5e7770f
[]
no_license
vikas436/DSA
a3039b3603a9eb05734064805d55f4b4b8afa1cd
9f902b8ea40151ce8757d45a5b31a86bd3354d0e
refs/heads/master
2021-08-07T18:42:31.521708
2021-06-19T07:08:41
2021-06-19T07:08:41
160,209,346
1
0
null
null
null
null
UTF-8
C++
false
false
837
cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * }; */ class Solution { public: bool isSymmetric(TreeNode* root) { if(root==NULL) return true; return symmetricRec(root->left, root->right); } bool symmetricRec(TreeNode* root1, TreeNode* root2) { if(root1==NULL && root2==NULL) return true; if(root1==NULL || root2==NULL) return false; if(root1->val!=root2->val) return false; return symmetricRec(root1->left, root2->right) && symmetricRec(root1->right, root2->left); } };
[ "noreply@github.com" ]
noreply@github.com
4da925f16f985ea95dc008992c3a8a454d9296fc
77e27b77795159808583ca3a4e4d16249d4bab1b
/Chapter2/Number12.cpp
0f80caebf29539c902c3a630c9e29dd9e889b8da
[]
no_license
doodayev/GaddisChallenges
8c7debda40f8fb70377dbb066f828ec3da75b751
a60717d95f1db389dba6c377034589d2fc621a6d
refs/heads/master
2022-12-04T14:19:47.734570
2020-07-10T09:25:01
2020-07-10T09:25:01
265,373,565
1
0
null
null
null
null
UTF-8
C++
false
false
287
cpp
#include <iostream> #include <iomanip> using namespace std; int main() { int acre=43560; int landGiven=391875; double AmountOfAcres=landGiven/acre; cout << "The land given is a total of " << setprecision(2) << fixed << AmountOfAcres << " acres. \n"; return 0; }
[ "noreply@github.com" ]
noreply@github.com
5f6cad29bed7dca0be46dd9920933cb22f536678
35f1a5786058a214cf98ca8168917520500ab027
/cg/sm/src/RadiationBoundaryCondition.h
34ac2ada9fa7f2904c1f1923496f0001961041e1
[ "BSD-3-Clause" ]
permissive
unifem/overtureframework
171abf69c879eae5a0560f462bbbe7fa8f6fc0b5
0f913a14eb58aa51b85c219823b7cbcfe6ebb112
refs/heads/master
2021-09-25T02:09:14.077517
2018-04-05T10:43:33
2018-04-05T10:43:33
114,717,087
2
2
null
2018-04-05T10:43:34
2017-12-19T03:56:55
Fortran
UTF-8
C++
false
false
1,035
h
#ifndef RADIATION_BOUNDARY_CONDITION #define RADIATION_BOUNDARY_CONDITION #include "Overture.h" class RadiationKernel; class OGFunction; class RadiationBoundaryCondition { public: RadiationBoundaryCondition(int orderOfAccuracy=4); ~RadiationBoundaryCondition(); int initialize( MappedGrid & mg, int side, int axis, int nc1=0, int nc2=0, real c_=1., real period_=-1., int numberOfModes_=-1, int orderOfTimeStepping_=-1, int numberOfPoles_=-1 ); int assignBoundaryConditions( realMappedGridFunction & u, real t, real dt, realMappedGridFunction & u2 ); int setOrderOfAccuracy(int orderOfAccuracy ); static int debug; static real cpuTime; OGFunction *tz; protected: RadiationKernel *radiationKernel; int nc1,nc2,numberOfGridPoints, numberOfModes, orderOfTimeStepping, numberOfPoles; double period, c, radius; int rside,raxis; // apply BC on this face int orderOfAccuracy,numberOfDerivatives,numberOfTimeLevels,currentTimeLevel; real currentTime; RealArray uSave, uxSave; }; #endif
[ "wdhenshaw@gmail.com" ]
wdhenshaw@gmail.com
75207f20a3f05858bcb79944d226f5ee7d2e321c
15db67d2678c2dc9236a0fc258e1f83ccd42a399
/Network Flow/二分匹配/gopherIIuva10080.cpp
7e8206539b8b36e15be12fa6aaf5901930f22a44
[]
no_license
fanshuoshuo/algorithms
5dcd8fb12188fc8f508ef4eef4cf60782b8a2086
89b594caa28e89de48e00696c86e0d3c07b2adcc
refs/heads/master
2020-04-18T05:52:04.509428
2017-12-22T03:04:14
2017-12-22T03:04:14
67,682,900
0
0
null
null
null
null
UTF-8
C++
false
false
2,030
cpp
#include <iostream> #include <vector> #include <string> #include <cstring> #include <cstdio> #include <map> #include <algorithm> #include <cmath> #include <queue> #include <sstream> #define MAX 10000 using namespace std; double computeringDis(double x1,double x2,double y1,double y2){ return sqrt( (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) ); } class GopherII{ private: int n,m,s,v; int match; vector< vector<int> > graf; double dis; int link[MAX]; bool vis[MAX]; public: void initial(int ,int ,int ,int); void readcase(); void computering(); void outResult(); bool crosspath(int k); }; bool GopherII::crosspath(int k){ for (int i=0;i<graf[k].size();i++){ int j=graf[k][i]; if (!vis[j]) { vis[j]=true; if (link[j]==-1 || crosspath(link[j])) { link[j]=k; return true; } } } return false; } void GopherII::initial(int n,int m,int s,int v){ this->n=n; this->m=m; this->s=s; this->v=v; dis=s*v; graf.clear(); graf.resize(n); match=0; memset(vis,0,sizeof(vis)); memset(link,-1,sizeof(link)); } void GopherII::readcase(){ double x,y; double gopher[1000][2]; double hole[1000][2]; for(int i=0;i<n;i++){ cin>>gopher[i][0]>>gopher[i][1]; } for(int i=0;i<m;i++){ cin>>hole[i][0]>>hole[i][1]; } const double eps=1e-10; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if( computeringDis(gopher[i][0],hole[j][0],gopher[i][1],hole[j][1])<=(double)dis ) { graf[i].push_back(j); } } } } void GopherII::computering(){ for (int i=0;i<n;i++){ if (crosspath(i)){ match++; memset(vis,0,sizeof(vis)); } } cout<<n-match<<endl; } void GopherII::outResult(){ } int main(){ GopherII d; int n,m,s,v; while(cin>>n>>m>>s>>v){ d.initial(n,m,s,v); d.readcase(); d.computering(); d.outResult(); } system("pause"); return 0; }
[ "1065777269@qq.com" ]
1065777269@qq.com
0db1011437c37ef81f22f237af6f17b6ea2b2f55
c8700a08e903322385a8c53485a43377da0ce37e
/jni/libil2cpp-v24/os/Posix/MemoryMappedFile.cpp
9e478176c421a8193ee518e533acad844f4bb77e
[ "MIT" ]
permissive
battlesteed/IL2CPPDumper-1
73e20e8c1a45f9d7c2ef78af44ce11fd17bff16f
877d21fbb82f08d64287e27e96491772c0b35e60
refs/heads/master
2023-08-07T00:18:59.652455
2021-10-01T01:58:12
2021-10-01T01:58:12
266,036,140
0
0
MIT
2020-05-22T06:31:40
2020-05-22T06:31:39
null
UTF-8
C++
false
false
1,437
cpp
#include "il2cpp-config.h" #if !IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE && IL2CPP_TARGET_POSIX #include <sys/mman.h> #include <map> #include "os/File.h" #include "os/MemoryMappedFile.h" #include "os/Mutex.h" #include "FileHandle.h" namespace il2cpp { namespace os { static FastMutex s_Mutex; static std::map<void*, int64_t> s_MappedAddressToMappedLength; void* MemoryMappedFile::Map(FileHandle* file, size_t length, size_t offset) { os::FastAutoLock lock(&s_Mutex); if (length == 0) { int error = 0; length = File::GetLength(file, &error); if (error != 0) return NULL; } void* address = mmap(NULL, length, PROT_READ, MAP_FILE | MAP_PRIVATE, file->fd, offset); if ((intptr_t)address == -1) return NULL; s_MappedAddressToMappedLength[address] = length; return address; } void MemoryMappedFile::Unmap(void* address, size_t length) { os::FastAutoLock lock(&s_Mutex); if (length == 0) { std::map<void*, int64_t>::iterator entry = s_MappedAddressToMappedLength.find(address); if (entry != s_MappedAddressToMappedLength.end()) length = entry->second; } int error = munmap(address, length); IL2CPP_ASSERT(error == 0); (void)error; // Avoid an unused variable warning } } } #endif
[ "patel.kuldip91@gmail.com" ]
patel.kuldip91@gmail.com
218b637d41eb8cfe2c1fa80b73e0d19efa983c3a
f8447aeb36e7b88845d8ae599ee5f846e428f5f4
/testgraph.cpp
ac1eead9ae344cb6fc38eaac6de7fe12fdc57232
[]
no_license
alexis-matuk/GraphVisualization
2513768799d2cabb67ad10cde22cb0d05d52b430
429c6d67adf6e1a5ea105efc9966ab20dc418960
refs/heads/master
2021-01-10T14:21:53.387165
2015-10-30T05:42:25
2015-10-30T05:42:25
45,231,424
1
0
null
null
null
null
UTF-8
C++
false
false
2,970
cpp
#include <fstream> #include <iomanip> #include <locale> #include <sstream> #include <string> #include <iostream> #include "stdafx.h" #include "GEFXParser.h" #include "GraphMLParser.h" #include "GDFParser.h" #include "GraphSONParser.h" int main(int argc, char* argv[]) { std::cout << "Exporting to GraphML..." << std::endl; PUNGraph Graph = TUNGraph::New(); Graph = TSnap::LoadEdgeList<PUNGraph>("p2p-Gnutella08.txt",0,1); GraphMLParser graphMl("CollabRelativityGraphMl"); graphMl.initializeGraph("directed"); for(SnapNode NI = Graph->BegNI(); NI!=Graph->EndNI(); NI++) graphMl.writeNode(NI); for(SnapEdge EI = Graph->BegEI(); EI!=Graph->EndEI(); EI++) graphMl.writeEdge(EI); graphMl.endGraph(); std::cout << "File: CollabRelativityGSON.graphml created in ./ directory" << std::endl; std::cout << "Finished exporting to GraphML" << std::endl; std::cout << "Exporting to GEXF..." << std::endl; GEFXParser gfx("CollabRelativityGEXF"); gfx.initializeGraph("directed"); gfx.initNodes(); for(SnapNode NI = Graph->BegNI(); NI!=Graph->EndNI(); NI++) gfx.writeNode(NI); gfx.closeNodes(); gfx.initEdges(); for(SnapEdge EI = Graph->BegEI(); EI!=Graph->EndEI(); EI++) gfx.writeEdge(EI); gfx.closeEdges(); gfx.endGraph(); std::cout << "File: CollabRelativityGSON.gexf created in ./ directory" << std::endl; std::cout << "Finished exporting to GEXF" << std::endl; std::cout << "Exporting to GDF..." << std::endl; GDFParser gdf("CollabRelativityGDF"); gdf.initNodes(); for(SnapNode NI = Graph->BegNI(); NI!=Graph->EndNI(); NI++) gdf.writeNode(NI); gdf.initEdges(); for(SnapEdge EI = Graph->BegEI(); EI!=Graph->EndEI(); EI++) gdf.writeEdge(EI); std::cout << "File: CollabRelativityGSON.gdf created in ./ directory" << std::endl; std::cout << "Finished exporting to GDF" << std::endl; std::cout << "Exporting to GraphSON..." << std::endl; GraphSONParser gson("CollabRelativityGSON"); int nodeCounter = 0; int edgeCounter = 0; gson.initGraph(); gson.initNodes(); for(SnapNode NI = Graph->BegNI(); NI!=Graph->EndNI(); NI++) { nodeCounter++; if(nodeCounter == Graph->GetNodes()) gson.writeNode(NI, true); else gson.writeNode(NI, false); } gson.closeNodes(); gson.initEdges(); for(SnapEdge EI = Graph->BegEI(); EI!=Graph->EndEI(); EI++) { edgeCounter++; if(edgeCounter == Graph->GetEdges()) gson.writeEdge(EI, true); else gson.writeEdge(EI, false); } gson.closeEdges(); gson.endGraph(); std::cout << "File: CollabRelativityGSON.graphson created in ./ directory" << std::endl; std::cout << "Finished exporting to GraphSON" << std::endl; }
[ "alexis.matuk@gmail.com" ]
alexis.matuk@gmail.com
9bd51b9994e5cb8ee355c4f83b52149ce35b2a8d
6330e17f1ad6b2c371830e500382782fed38a0fa
/src/operator/tensor/elemwise_sum.cc
b31dbb2598f087b33bf44f3beda69d79ee955362
[ "BSD-3-Clause", "Zlib", "BSD-2-Clause-Views", "Apache-2.0", "BSD-2-Clause" ]
permissive
CaiWeibo/p3
0f832ec8b6c8a0afc4febce3fbf27f0d3dc5c030
d406d5aba4710560a4694ae6704c8bce6f794770
refs/heads/master
2022-12-14T12:34:09.286519
2020-09-18T12:45:41
2020-09-18T12:45:41
296,343,215
0
0
Apache-2.0
2020-09-17T13:59:10
2020-09-17T13:59:10
null
UTF-8
C++
false
false
6,014
cc
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /*! * Copyright (c) 2015 by Contributors * \file elemwise_sum.cc * \brief elementwise sum operator */ #include "./elemwise_sum.h" #include "../../ndarray/ndarray_function.h" namespace mxnet { namespace op { struct ElementWiseSumParam : public dmlc::Parameter<ElementWiseSumParam> { int num_args; DMLC_DECLARE_PARAMETER(ElementWiseSumParam) { DMLC_DECLARE_FIELD(num_args).set_lower_bound(1) .describe("Number of inputs to be summed."); } }; DMLC_REGISTER_PARAMETER(ElementWiseSumParam); std::vector<nnvm::NodeEntry> ElementWiseSumGrad( const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) { // identity constraints in the beginning for easier shape inference. const nnvm::Op* copy_op = nnvm::Op::Get("identity"); CHECK_EQ(ograds.size(), 1); std::vector<nnvm::NodeEntry> ret; nnvm::NodeEntry n_out{n, 0, 0}; for (size_t i = 0; i < n->inputs.size(); i++) { nnvm::NodePtr id_node = nnvm::Node::Create(); id_node->attrs.op = copy_op; id_node->inputs = {ograds[0]}; ret.push_back(nnvm::NodeEntry{id_node, 0, 0}); } return ret; } bool ElementWiseSumShape(const nnvm::NodeAttrs& attrs, std::vector<TShape> *in_attrs, std::vector<TShape> *out_attrs) { CHECK_EQ(out_attrs->size(), 1); return ElemwiseAttr<TShape, shape_is_none, shape_assign, true, shape_string>( attrs, in_attrs, out_attrs, TShape()); } bool ElementWiseSumType(const nnvm::NodeAttrs& attrs, std::vector<int> *in_attrs, std::vector<int> *out_attrs) { CHECK_EQ(out_attrs->size(), 1); return ElemwiseAttr<int, type_is_none, type_assign, true, type_string>( attrs, in_attrs, out_attrs, -1); } bool ElementWiseSumForwardInferStorageType(const nnvm::NodeAttrs& attrs, const int dev_mask, DispatchMode* dispatch_mode, std::vector<int> *in_attrs, std::vector<int> *out_attrs) { CHECK(!in_attrs->empty()); CHECK_EQ(out_attrs->size(), 1U); return ElemwiseStorageAttr<false, true, false>(attrs, dev_mask, dispatch_mode, in_attrs, out_attrs); } void ElementWiseSumComputeExCPU(const nnvm::NodeAttrs& attrs, const OpContext& ctx, const std::vector<NDArray>& inputs, const std::vector<OpReqType>& req, const std::vector<NDArray>& outputs) { CHECK(!inputs.empty()); CHECK_EQ(outputs.size(), 1U); CHECK_EQ(req.size(), 1U); if (req[0] == kNullOp) return; CHECK_EQ(req[0], kWriteTo) << "ElementWiseSumComputeExCPU only supports req = kWriteTo"; if (inputs[0].storage_type() == kRowSparseStorage) { mshadow::Stream<cpu>* s = ctx.get_stream<cpu>(); Resource rsc = ResourceManager::Get()->Request(ctx.run_ctx.get_ctx(), ResourceRequest(ResourceRequest::kTempSpace)); NDArray out_nd = outputs[0]; mxnet::ndarray::ElementwiseSum<cpu>(s, rsc, inputs, &out_nd); } else { LogUnimplementedOp(attrs, ctx, inputs, req, outputs); } } NNVM_REGISTER_OP(add_n) MXNET_ADD_SPARSE_OP_ALIAS(add_n) MXNET_ADD_SPARSE_OP_ALIAS(ElementWiseSum) .add_alias("ElementWiseSum") .describe(R"doc(Adds all input arguments element-wise. .. math:: add\_n(a_1, a_2, ..., a_n) = a_1 + a_2 + ... + a_n ``add_n`` is potentially more efficient than calling ``add`` by `n` times. The storage type of ``add_n`` output depends on storage types of inputs - add_n(row_sparse, row_sparse, ..) = row_sparse - otherwise, ``add_n`` generates output with default storage )doc" ADD_FILELINE) .set_attr_parser(ParamParser<ElementWiseSumParam>) .set_num_inputs([](const nnvm::NodeAttrs& attrs) { uint32_t ret = dmlc::get<ElementWiseSumParam>(attrs.parsed).num_args; return ret; }) .set_attr<nnvm::FListInputNames>("FListInputNames", [](const NodeAttrs& attrs) { uint32_t num_args = dmlc::get<ElementWiseSumParam>(attrs.parsed).num_args; std::vector<std::string> ret; for (uint32_t i = 0; i < num_args; ++i) { ret.push_back(std::string("arg") + std::to_string(i)); } return ret; }) .set_attr<std::string>("key_var_num_args", "num_args") .set_attr<FCompute>("FCompute<cpu>", ElementWiseSumCompute<cpu>) .set_attr<FComputeEx>("FComputeEx<cpu>", ElementWiseSumComputeExCPU) .set_attr<nnvm::FInplaceOption>( "FInplaceOption", [](const NodeAttrs& attrs) { return std::vector<std::pair<int, int> >{{0, 0}}; }) .set_attr<FResourceRequest>("FResourceRequest", [](const NodeAttrs& attrs) { return std::vector<ResourceRequest>{ResourceRequest::kTempSpace}; }) .set_attr<nnvm::FInferShape>("FInferShape", ElementWiseSumShape) .set_attr<nnvm::FInferType>("FInferType", ElementWiseSumType) .set_attr<FInferStorageType>("FInferStorageType", ElementWiseSumForwardInferStorageType) .set_attr<nnvm::FGradient>("FGradient", ElementWiseSumGrad) .add_argument("args", "NDArray-or-Symbol[]", "Positional input arguments"); } // namespace op } // namespace mxnet
[ "anandj@cs.ubc.ca" ]
anandj@cs.ubc.ca
649a3ab182d3c45f3694e720b20b6c3e687dbbb7
871a15655f0ae7922016bdce88c995ddd16900d4
/src/cpp/core/A.cpp
82907de2492ad6220e5a41a03e4c2601dbf18124
[ "MIT", "BSL-1.0", "BSD-3-Clause" ]
permissive
practicalci/rock
f0f7a51f2b5c89819f2dae4ac53fb06688bb7ed0
cb7eca3e2645f8d85a499dfda52251d2abf6719c
refs/heads/master
2020-04-24T08:57:46.280349
2019-03-12T09:48:18
2019-03-12T09:48:18
171,847,572
0
0
null
null
null
null
UTF-8
C++
false
false
1,174
cpp
/* * Copyright (C) 2019 Eyeware Tech SA * */ #include <string> #include "org/rock/core/A.h" namespace org { namespace rock { namespace core { // constructors A::A() { } A::A(std::string name) : m_name(name) { } // copy constructor A::A(const A& other) : m_name(other.m_name) { } // copy assignment operator A& A::operator=(const A& other) { if(this != &other) { m_name = other.m_name; } return *this; } // destructor A::~A() { } // getter const std::string A::get_name() const { return m_name; } // functions that use another class B void A::passByValue(B b) { } void A::passByReference(const B& b) { } void A::passByPointer(B* b) { } B A::returnValue() { return B(); } B& A::returnReference(B& b) { return b; } B* A::returnRawPointer() { B* raw_pointer_to_B = new B(); // allocate storage on the heap return raw_pointer_to_B; } std::shared_ptr<B> A::returnSharedPointer() { return std::make_shared<B>(); } // non-member function to get the name of an A object const std::string get_name_of_other(const A& other) { return other.get_name(); } } // namespace core } // namespace rock } // namespace org
[ "mario.silva.costa@gmail.com" ]
mario.silva.costa@gmail.com
e51e119057244f4502a90eef9fba1f38af86a789
ace7c2d71bd133ecdfbf1690d17f936891c4f45b
/assignment 2.cpp
347acd4ef0e0d6d50d360f33f2e4c7cda3b1b4eb
[]
no_license
damiangene/UNISA-assignment-2
1d3a3f555f583aa7b14e72b0a819f630a8277e5e
97e005edb8336faded8d241c2a5a291eeb8c6ac6
refs/heads/master
2020-05-04T21:52:13.347021
2019-04-26T10:02:56
2019-04-26T10:02:56
179,491,506
0
0
null
null
null
null
UTF-8
C++
false
false
8,117
cpp
#include <iostream> #include <iomanip> #include <string> using namespace std; //declaration of functions string welcome(); void print_seats(string flight[]); void populate_seats(string (&flight_arr)[5][52]); bool validate_flight(string a); bool validate_seat(string a, string (&flight_arr)[5][52], int b); bool validate_book(string a); void print_ticket(string passenger[], string (&flight_arr)[5][52], int &i); //Const for economy class price const int ECONOMY_CLASS = 1600; int main(){ //Initialising all variables that are needed in the program //2D array for storing seat numbers and passenger details string flights [5][52]; string passengers [4][250]; string seat, flight, book = "y"; int int_flight, p = 0, j = 0; int seat_number, seat_price; populate_seats(flights); //while loop that repeats the booking process while the user wants to continue booking. while (book == "y" || book == "Y"){ passengers[p][0] = (welcome()); cout << "\nThe available travel times for flights are:" << endl; cout << " Depart\tArrive" << endl; //Checks whether all the flights are fully booked, //If so, it ends the whole program. for (int i = 0; i < 5; i++){ if (flights[i][51] != "50"){ cout << i + 1 << ". " << flights[i][0] << endl; } else if (j < 4){ j++; } else{ cout << "\nAll flights are booked" << endl; return 0; } } //Flight selection. cout << "Choose the time by enetering the option number from the displayed list:" << endl; do{ cin >> flight; } while(!validate_flight(flight)); //Converts the flight selection string to an int. //So that the index can be selected when printing out the seats and flight time. int_flight = stoi(flight) - 1; //Prompts user to select seat number and accesses flight time from flights array cout << "\nThe available seats for " << flights[int_flight][0].substr(0,5) << " are as follows:" << endl; //Displays the seating layout for the chosen flight. print_seats(flights[int_flight]); cout << "Please key in a seat number to choose a seat (eg:A2)" << endl; //Seat selection. do{ cin >> seat; } while (!validate_seat(seat, flights, int_flight)); //Changes the booked seat number to ** for (int i = 0; i < 51; i++){ if (flights[int_flight][i] == seat){ flights[int_flight][i] = "**"; seat_number = i; break; } } //checks whether the seat was booked in first or economy class //Sets the seat price for the passengers array if (seat_number < 25){ seat_price = ECONOMY_CLASS*1.2; passengers[p][4] = "First class"; } else{ seat_price = ECONOMY_CLASS; passengers[p][4] = "Economy class"; } //Adds flight, seat and seat price information to passenger array passengers[p][1] = flight; passengers[p][2] = seat; passengers[p][3] = to_string(seat_price); //Keeps track of the number of seats booked on each flight flights[int_flight][51] = to_string(stoi(flights[int_flight][51]) + 1); print_ticket(passengers[p], flights, int_flight); //Checks whether the user wants to book for another flight. cout << "\nWould you like to book another seat? Y/N: " ; do{ cin >> book; cin.get(); }while(!validate_book(book)); //Keeps track of how many passengers have been booked. //Allows the program to move to the next index in the passengers array. p++; cout << endl; } //Prints out the number of bookings for each flight for (int i = 0; i < 5; i++){ cout << "Number of bookings made for " << flights[i][0].substr(0,5); cout << ": " << flights[i][51] << endl; } return 0; } //Welcome message and passenger name capture string welcome(){ string passenger; cout << "Welcome to the COS1511 Flight Booking System\n" << endl; cout << "Enter Full Name" << endl; getline(cin,passenger); return passenger; } //Prints out seats with the correct layout void print_seats(string flight[]){ int k = 0; cout << "First class(1920.00)" << endl; for (int j = 0; j < 9; j++){ if (k == 24){ cout << "Economy class(1600.00)" << endl; } cout << "|"; for (int i = 0; i < 3; i++){ cout << flight[k+1] << "|"; k++; if (k > 49){ cout << endl; return; } } cout << "----"; for (int i = 0; i < 3; i++){ cout << "|" << flight[k+1]; k++; } cout << "|" << endl; } } //Seat generation for all 5 flights void populate_seats(string (&flight_arr)[5][52]){ //Setting index 0 for all flights to the flights time flight_arr[0][0] = "07:00\t09:30"; flight_arr[1][0] = "09:00\t11:30"; flight_arr[2][0] = "11:00\t13:30"; flight_arr[3][0] = "13:00\t15:30"; flight_arr[4][0] = "15:00\t17:30"; for (int a = 0; a < 5; a++){ int b = 0; for (int i = 17; i < 26; i++){ for ( int j = 1; j < 7; j++){ if (i == 25 && j > 2){ break; } //Converting i into an ascii character to form the letters string seat = char('0' + i) + to_string(j); flight_arr[a][b+1] = seat; b++; } flight_arr[a][b+1] = "0"; } } } //Prints out the ticket for the passenger using setw for formatting void print_ticket(string passenger[], string (&flight_arr)[5][52], int &i){ int name = passenger[0].length(); cout << "\n***************************" << endl; cout << "Travel Ticket for Flight " << i + 1 << endl; cout << "***************************" << endl; cout << left << setw(15) << "Name " << ": " << passenger[0]; cout << setw(13) << "" << "Travel Ticket Class " << ": " << passenger[4] << endl; cout << setw(31 + name) << "" << setw(20) << "Seat No." << ": " << passenger[2] << endl; cout << setw(15) << "Departure" << ": " << setw(13 + name) << "Johannesburg"; cout << setw(20) << "Departure Time" << ": " << flight_arr[i][0].substr(0,5) << endl; cout << setw(15) << "Destination" << ": " << setw(13 + name) << "Cape Town"; cout << setw(20) << "Arrival Time" << ": " << flight_arr[i][0].substr(6,10) << endl; cout << "\n***************************" << endl; cout << "Amount: R" << passenger[3] << endl; cout << "Thank you for booking with COS 1511 Booking System." << endl; cout << "Your travel agent is Damian Jacobs" << endl; cout << "***************************" << endl; } //Validates flight selection entry bool validate_flight(string a){ for (int i = 1; i < 6; i++){ if (a == to_string(i)){ return true; } } cout << "Incorrect option! Please choose from 1-5." << endl; return false; } //Validates seat selection entry bool validate_seat(string a, string (&flight_arr)[5][52], int b){ for (int i = 0; i < 51; i++){ if (flight_arr[b][i] == a){ return true; } } cout << "Please select an available seat number." << endl; return false ; } //validates whether the user would like to make another booking bool validate_book(string a){ while(a != "y" && a != "n" & a != "Y" && a != "N"){ cout << "Enter a valid option: Y/N:"; return false; } return true; }
[ "damiangene1992@gmail.com" ]
damiangene1992@gmail.com
f00340c02893999a3cb3c03f01254976e8a66495
a792fc8994bcb66790e862c2bbc163fd88fc2513
/DCEPC501.cpp
17ff0066f3f6b1a094e5838d88bce30c2fcf3b14
[]
no_license
darrylys/spoj
428e547942a3f6329370a99095d90dff90c481ac
55305bb11667526dfa7f40dc7a8c1605032b7115
refs/heads/master
2020-08-31T21:19:37.337016
2019-10-31T14:36:05
2019-10-31T14:36:05
218,788,626
0
0
null
null
null
null
UTF-8
C++
false
false
1,654
cpp
#include<stdio.h> #define ll long long ll dp[100010][3]; int pc[100010]; ll max(ll a, ll b) { return (a>b)?a:b; } ll max3(ll a, ll b, ll c) { return max(a, max(b,c)); } ll getdp(int n, int k) { if (n<0) return 0; else return dp[n][k]; } int main() { int t, n; scanf("%d", &t); while(t--){ scanf("%d", &n); for (int i=0; i<n; ++i) { scanf("%d", &pc[i]); } dp[0][0] = pc[0]; if (1<n) { dp[0][1] = pc[0]+pc[1]; } else { dp[0][1] = 0; } if (2<n) { dp[0][2] = pc[0]+pc[1]+pc[2]; } else { dp[0][2] = 0; } //printf("%d] %lld %lld %lld\n", 0, dp[0][0], dp[0][1], dp[0][2]); ll _max=max3(dp[0][0], dp[0][1], dp[0][2]); for (int i=2; i<n; i+=2) { ll amax = max3(getdp(i-2, 0), getdp(i-4, 1), getdp(i-6, 2)); dp[i][0] = pc[i] + amax; _max=max(dp[i][0], _max); if (i+1<n) { dp[i][1] = pc[i] + pc[i+1] + amax; _max=max(dp[i][1], _max); } if (i+2<n) { dp[i][2] = pc[i] + pc[i+1] + pc[i+2] + amax; _max=max(dp[i][2], _max); } //printf("%d] %lld %lld %lld\n", i, dp[i][0], dp[i][1], dp[i][2]); } printf("%lld\n", _max); /*if (n&1) { printf("%lld\n", max3(dp[n-1][0], dp[n-1][1], dp[n-1][2])); } else { printf("%lld\n", max3(dp[n-2][0], dp[n-2][1], dp[n-2][2])); }*/ } }
[ "darryl.sulistyan@gmail.com" ]
darryl.sulistyan@gmail.com
d88920cfbce0d898f38f2d767165144e51dbbafc
59afa66e933067caa5b9986951660bd8cafc5f94
/Computer_Science/1_DSA_Fundamentals/p04_lowest_common_multiple.cpp
c6bd7e3cdd69693c636bf4414678d3cecb1afcbe
[ "MIT" ]
permissive
Soumya14022002/Algos-for-all-Amigos
f9d95f52a94dbbc93db78054194b38228d95934f
89ba4a29560ff9db8f49e14d42e07699c56373e7
refs/heads/master
2023-08-12T00:29:58.883753
2021-10-15T20:20:48
2021-10-15T20:20:48
417,616,617
0
0
MIT
2021-10-15T20:20:48
2021-10-15T19:44:19
null
UTF-8
C++
false
false
783
cpp
#include <iostream> #include <algorithm> long long int maxm(long long int a, long long int b){ if (a>b){ return a; } else{ return b; } } /*Computing gcd by euclidean algorithm */ long long int gcd_pro(long long int a,long long int b){ long long int maxi = maxm(a,b); long long int mini = a+b-maxi; long long int div = mini; while (div!=0){ long long int rem = maxi%div; maxi = div; div = rem; } return maxi; } /*Computing lcm by using property : lcm = (a*b)/gcd */ long long int lcm_pro(long long int a,long long int b){ long long int product = a*b; long long int hcf = gcd_pro(a,b); return (product/hcf); } int main() { int a, b; std::cin >> a >> b; std::cout << lcm_pro(a, b) << std::endl; return 0; }
[ "chasmiccoder@gmail.com" ]
chasmiccoder@gmail.com
41a9936699861420304a2d27ff716e66f777be31
f83ef53177180ebfeb5a3e230aa29794f52ce1fc
/ACE/ACE_wrappers/TAO/tao/RTCORBA/RT_ORBInitializer.cpp
6e1c7c1f07415318ece48fb781cd1f2b0d20b52f
[ "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
10,387
cpp
#include "tao/RTCORBA/RT_ORBInitializer.h" #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 #define TAO_RTCORBA_SAFE_INCLUDE #include "tao/RTCORBA/RTCORBAC.h" #undef TAO_RTCORBA_SAFE_INCLUDE #include "tao/RTCORBA/RT_Policy_i.h" #include "tao/RTCORBA/RT_PolicyFactory.h" #include "tao/RTCORBA/RT_Protocols_Hooks.h" #include "tao/RTCORBA/Priority_Mapping_Manager.h" #include "tao/RTCORBA/Network_Priority_Mapping_Manager.h" #include "tao/RTCORBA/RT_ORB_Loader.h" #include "tao/RTCORBA/RT_Stub_Factory.h" #include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h" #include "tao/RTCORBA/Continuous_Priority_Mapping.h" #include "tao/RTCORBA/Linear_Priority_Mapping.h" #include "tao/RTCORBA/Direct_Priority_Mapping.h" #include "tao/RTCORBA/Linear_Network_Priority_Mapping.h" #include "tao/RTCORBA/RT_ORB.h" #include "tao/RTCORBA/RT_Current.h" #include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h" #include "tao/RTCORBA/RT_Service_Context_Handler.h" #include "tao/Exception.h" #include "tao/ORB_Core.h" #include "tao/PI/ORBInitInfo.h" #include "tao/debug.h" #include "ace/Service_Repository.h" #include "ace/Svc_Conf.h" #include "ace/Sched_Params.h" static const char rt_poa_factory_name[] = "TAO_RT_Object_Adapter_Factory"; static const ACE_TCHAR rt_poa_factory_directive[] = ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE( "TAO_RT_Object_Adapter_Factory", "TAO_RTPortableServer", TAO_VERSION, "_make_TAO_RT_Object_Adapter_Factory", ""); TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_RT_ORBInitializer::TAO_RT_ORBInitializer (int priority_mapping_type, int network_priority_mapping_type, int ace_sched_policy, long sched_policy, long scope_policy, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan lifespan, ACE_Time_Value const &dynamic_thread_time) : priority_mapping_type_ (priority_mapping_type), network_priority_mapping_type_ (network_priority_mapping_type), ace_sched_policy_ (ace_sched_policy), sched_policy_ (sched_policy), scope_policy_ (scope_policy), lifespan_ (lifespan), dynamic_thread_time_ (dynamic_thread_time) { } void TAO_RT_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info) { // // Register all of the RT related services. // // Narrow to a TAO_ORBInitInfo object to get access to the // orb_core() TAO extension. TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info); if (CORBA::is_nil (tao_info.in ())) { if (TAO_debug_level > 0) TAOLIB_ERROR ((LM_ERROR, "(%P|%t) TAO_RT_ORBInitializer::pre_init:\n" "(%P|%t) Unable to narrow " "\"PortableInterceptor::ORBInitInfo_ptr\" to\n" "(%P|%t) \"TAO_ORBInitInfo *.\"\n")); throw ::CORBA::INTERNAL (); } // Bind the service context handler for RTCORBA TAO_RT_Service_Context_Handler* h = 0; ACE_NEW (h, TAO_RT_Service_Context_Handler()); tao_info->orb_core ()->service_context_registry ().bind (IOP::RTCorbaPriority, h); // Set the name of the Protocol_Hooks to be RT_Protocols_Hooks. tao_info->orb_core ()->orb_params ()->protocols_hooks_name ("RT_Protocols_Hooks"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Protocols_Hooks); // Set the name of the stub factory to be RT_Stub_Factory. tao_info->orb_core ()->orb_params ()->stub_factory_name ("RT_Stub_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Stub_Factory); // Set the name of the endpoint selector factory to be RT_Endpoint_Selector_Factory. tao_info->orb_core ()->orb_params ()->endpoint_selector_factory_name ("RT_Endpoint_Selector_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_RT_Endpoint_Selector_Factory); // Set the name of the thread lane resources manager to be RT_Thread_Lane_Resources_Manager. tao_info->orb_core ()->orb_params ()->thread_lane_resources_manager_factory_name ("RT_Thread_Lane_Resources_Manager_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Thread_Lane_Resources_Manager_Factory); // If the application resolves the root POA, make sure we load the RT POA. tao_info->orb_core ()->orb_params ()->poa_factory_name (rt_poa_factory_name); tao_info->orb_core ()->orb_params ()->poa_factory_directive (rt_poa_factory_directive); // Create the initial priority mapping instance. TAO_Priority_Mapping *pm = 0; switch (this->priority_mapping_type_) { case TAO_PRIORITY_MAPPING_CONTINUOUS: ACE_NEW (pm, TAO_Continuous_Priority_Mapping (this->ace_sched_policy_)); break; case TAO_PRIORITY_MAPPING_LINEAR: ACE_NEW (pm, TAO_Linear_Priority_Mapping (this->ace_sched_policy_)); break; default: case TAO_PRIORITY_MAPPING_DIRECT: ACE_NEW (pm, TAO_Direct_Priority_Mapping (this->ace_sched_policy_)); break; } // Set the Priority_Mapping_Manager TAO_Priority_Mapping_Manager *manager = 0; ACE_NEW_THROW_EX (manager, TAO_Priority_Mapping_Manager (pm), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); TAO_Priority_Mapping_Manager_var safe_manager = manager; info->register_initial_reference ("PriorityMappingManager", manager); // Create the initial priority mapping instance. TAO_Network_Priority_Mapping *npm = 0; switch (this->network_priority_mapping_type_) { default: case TAO_NETWORK_PRIORITY_MAPPING_LINEAR: ACE_NEW (npm, TAO_Linear_Network_Priority_Mapping (this->ace_sched_policy_)); break; } // Set the Priority_Mapping_Manager TAO_Network_Priority_Mapping_Manager * network_manager = 0; // @@ There is a potential memory leak here. If the new() below // throws an exception, the memory for the network priority // mapping allocated above will be leaked. Use an auto_ptr<> or // the appropriate memory management tool. ACE_NEW_THROW_EX (network_manager, TAO_Network_Priority_Mapping_Manager (npm), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); TAO_Network_Priority_Mapping_Manager_var safe_network_manager = network_manager; info->register_initial_reference ("NetworkPriorityMappingManager", network_manager); // Create the RT_ORB. CORBA::Object_ptr rt_orb = CORBA::Object::_nil (); ACE_NEW_THROW_EX (rt_orb, TAO_RT_ORB (tao_info->orb_core (), lifespan_, dynamic_thread_time_), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); CORBA::Object_var safe_rt_orb = rt_orb; info->register_initial_reference (TAO_OBJID_RTORB, rt_orb); // Create the RT_Current. CORBA::Object_ptr current = CORBA::Object::_nil (); ACE_NEW_THROW_EX (current, TAO_RT_Current (tao_info->orb_core ()), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); CORBA::Object_var safe_rt_current = current; info->register_initial_reference (TAO_OBJID_RTCURRENT, current); tao_info->orb_core ()->orb_params ()->scope_policy (this->scope_policy_); tao_info->orb_core ()->orb_params ()->sched_policy (this->sched_policy_); tao_info->orb_core ()->orb_params ()->ace_sched_policy (this->ace_sched_policy_); } void TAO_RT_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info) { this->register_policy_factories (info); } void TAO_RT_ORBInitializer::register_policy_factories ( PortableInterceptor::ORBInitInfo_ptr info) { // The RTCorba policy factory is stateless and reentrant, so share a // single instance between all ORBs. if (CORBA::is_nil (this->policy_factory_.in ())) { PortableInterceptor::PolicyFactory_ptr policy_factory; ACE_NEW_THROW_EX (policy_factory, TAO_RT_PolicyFactory, CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); this->policy_factory_ = policy_factory; } // Bind the same policy factory to all RTCORBA related policy // types since a single policy factory is used to create each of // the different types of RTCORBA policies. static CORBA::PolicyType const type[] = { RTCORBA::PRIORITY_MODEL_POLICY_TYPE, RTCORBA::THREADPOOL_POLICY_TYPE, RTCORBA::SERVER_PROTOCOL_POLICY_TYPE, RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE, RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE, RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE }; const CORBA::PolicyType *end = type + sizeof (type) / sizeof (type[0]); for (CORBA::PolicyType const * i = type; i != end; ++i) { try { info->register_policy_factory (*i, this->policy_factory_.in ()); } catch (const ::CORBA::BAD_INV_ORDER& ex) { if (ex.minor () == (CORBA::OMGVMCID | 16)) { // The factory is already there, it happens because the // magic initializer in PortableServer.cpp registers // with the ORB multiple times. This is an indication // that we should do no more work in this // ORBInitializer. return; } throw; } } } TAO_END_VERSIONED_NAMESPACE_DECL #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
[ "lihuibin705@163.com" ]
lihuibin705@163.com
d1328fdf17eddcc2f904ddfb9a3d16b4c5fd8e17
bf4c54db52dc90b8845095a2dbf4faa66c0de2ae
/atcoder/AGC/agc043/a/main.cpp
6a39910a34a647389f9e3ede4e9f914366e502a5
[]
no_license
wumpusn/programming_contest
3e429930adc17d8c65485bb3582cc546289d30f8
99f2077aac1aef85abfe242022fde97c79aa5625
refs/heads/master
2022-11-29T02:18:05.135810
2020-08-16T02:35:48
2020-08-16T02:35:48
215,290,632
0
0
null
null
null
null
UTF-8
C++
false
false
1,197
cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); ++i) using Graph = vector<vector<int>>; const int dx[2] = {1, 0}; const int dy[2] = {0, 1}; const int INF = -1; int H, W; vector<string> field; Graph cnt; void dfs(int h, int w){ for(int dir = 0; dir < 2; ++dir){ int nh = h + dx[dir]; int nw = w + dy[dir]; if(nh >= H || nw >= W) continue; if(cnt[nh][nw] == INF){ if(field[nh][nw] == '#'){ cnt[nh][nw] = cnt[h][w] + 1; } else{ cnt[nh][nw] = cnt[h][w]; } } else{ if(field[nh][nw] == '#'){ cnt[nh][nw] = min(cnt[nh][nw], cnt[h][w] + 1); } else { cnt[nh][nw] = min(cnt[nh][nw], cnt[h][w]); } } dfs(nh, nw); } } int main(){ cin >> H >> W; field.resize(H); rep(i, H) cin >> field[i]; cnt.assign(H, vector<int>(W, INF)); if(field[0][0] == '#') cnt[0][0] = 1; else cnt[0][0] = 0; dfs(0,0); cout << cnt[H-1][W-1] << endl; }
[ "yuta.takata24@gmail.com" ]
yuta.takata24@gmail.com
d88bd259dc9f992e5bff02f04e6aae07d6aff315
7e6764389a9052b692cd830ce4b4baa59b8ae32d
/ex2_src/ObjectClassifier.h
953549398c119e4c5babdb99a0655c953aa05c09
[]
no_license
IdanZimbler/Soldiers-Game-Project
132d9e5a0a2550f8bdde5489f58d06725bb99991
36db47d986b9a2b6009f7d3480646da1f6e388f2
refs/heads/master
2022-09-19T03:51:57.027966
2018-02-18T15:15:24
2018-02-18T15:15:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
801
h
#pragma once #include "AOnBoard.h" #include "Soldier.h" #include "AItem.h" #include "ASolidItem.h" #include "AArmor.h" #include "AWeapon.h" #include "Missle.h" #include "M16.h" #include "UZI.h" #include "BodyArmor.h" #include "ShieldArmor.h" #include "ParamedicSoldier.h" // Class to classify objects with boolean methods class ObjectClassifier { public: bool isSoldier(AOnBoard* pointer); bool isParamedic(AOnBoard* pointer); bool isAItem(AOnBoard* pointer); bool isASolidItem(AOnBoard* pointer); bool isAArmor(AOnBoard* pointer); bool isAWeapon(AOnBoard* pointer); bool isMissle(AOnBoard* pointer); bool isM16(AOnBoard* pointer); bool isUZI(AOnBoard* pointer); bool isShieldArmor(AOnBoard* pointer); bool isBodyArmor(AOnBoard* pointer); bool isACollectAbleItem(AOnBoard * pointer); };
[ "idanqwe@gmail.com" ]
idanqwe@gmail.com
2d760fdca1e4a60763266994cfc52c18eb1f7a38
92060efadb51cd041a1bcb2194c5dd85f601db56
/src/SparseLSTMCRFMLTagger/model/HyperParams.h
6a0ff3e846a821852def3b522cd7d5b6e3e642bc
[]
no_license
3cQScbrOnly1/NNPOSTTagging
bd9e59b8b700d88223beae4da66ef83bd11a7f81
21954460fda5c1de18c2bfe641ccd7c2c0676af6
refs/heads/master
2020-06-30T23:30:16.210578
2016-11-27T01:32:09
2016-11-27T01:32:09
74,345,989
0
0
null
null
null
null
UTF-8
C++
false
false
1,040
h
#ifndef SRC_HyperParams_H_ #define SRC_HyperParams_H_ #include "N3L.h" #include "Example.h" #include "Options.h" using namespace nr; using namespace std; struct HyperParams{ // must assign dtype dropProb; int rnnHiddenSize; int charHiddenSize; int hiddenSize; int charContext; int wordContext; //auto generated int linearFeatSize; int charWindow; int wordWindow; int wordDim; int charDim; int inputSize; int labelSize; // for optimization dtype nnRegular, adaAlpha, adaEps; public: HyperParams(){ bAssigned = false; } void setReqared(Options& opt){ rnnHiddenSize = opt.rnnHiddenSize; charContext = opt.charcontext; wordContext = opt.wordcontext; charHiddenSize = opt.charhiddenSize; hiddenSize = opt.hiddenSize; dropProb = opt.dropProb; nnRegular = opt.regParameter; adaAlpha = opt.adaAlpha; adaEps = opt.adaEps; bAssigned = true; } void clear(){ bAssigned = false; } bool bVaild(){ return bAssigned; } void print(){} private: bool bAssigned; }; #endif /*SRC_HyperParams_H_*/
[ "510727367@qq.com" ]
510727367@qq.com
6dc7712747ac3fd1668bde2eb3f7d9e130428255
cc3af5b307ffaa99ec2a8945e3b72acd07b0a132
/src/coins.cpp
dc79a35040293f8458d84bd415c8ad9a18412d04
[ "MIT" ]
permissive
taeany/WorkPlaceCoin
fbe9dc1b1745963b3a45e66ed88c9cd3d6c199c9
bddfa6ab39a532d10c413542f616482e92749511
refs/heads/master
2020-05-21T15:27:14.595486
2019-04-28T15:46:38
2019-04-28T15:46:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,726
cpp
// Copyright (c) 2012-2014 The Bitcoin developers // Copyright (c) 2015-2018 The PIVX developers // Copyright (c) 2019 The WorkPlaceCoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coins.h" #include "random.h" #include <assert.h> /** * calculate number of bytes for the bitmask, and its number of non-zero bytes * each bit in the bitmask represents the availability of one output, but the * availabilities of the first two outputs are encoded separately */ void CCoins::CalcMaskSize(unsigned int& nBytes, unsigned int& nNonzeroBytes) const { unsigned int nLastUsedByte = 0; for (unsigned int b = 0; 2 + b * 8 < vout.size(); b++) { bool fZero = true; for (unsigned int i = 0; i < 8 && 2 + b * 8 + i < vout.size(); i++) { if (!vout[2 + b * 8 + i].IsNull()) { fZero = false; continue; } } if (!fZero) { nLastUsedByte = b + 1; nNonzeroBytes++; } } nBytes += nLastUsedByte; } bool CCoins::Spend(const COutPoint& out, CTxInUndo& undo) { if (out.n >= vout.size()) return false; if (vout[out.n].IsNull()) return false; undo = CTxInUndo(vout[out.n]); vout[out.n].SetNull(); Cleanup(); if (vout.size() == 0) { undo.nHeight = nHeight; undo.fCoinBase = fCoinBase; undo.fCoinStake = fCoinStake; undo.nVersion = this->nVersion; } return true; } bool CCoins::Spend(int nPos) { CTxInUndo undo; COutPoint out(0, nPos); return Spend(out, undo); } bool CCoinsView::GetCoins(const uint256& txid, CCoins& coins) const { return false; } bool CCoinsView::HaveCoins(const uint256& txid) const { return false; } uint256 CCoinsView::GetBestBlock() const { return uint256(0); } bool CCoinsView::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) { return false; } bool CCoinsView::GetStats(CCoinsStats& stats) const { return false; } CCoinsViewBacked::CCoinsViewBacked(CCoinsView* viewIn) : base(viewIn) {} bool CCoinsViewBacked::GetCoins(const uint256& txid, CCoins& coins) const { return base->GetCoins(txid, coins); } bool CCoinsViewBacked::HaveCoins(const uint256& txid) const { return base->HaveCoins(txid); } uint256 CCoinsViewBacked::GetBestBlock() const { return base->GetBestBlock(); } void CCoinsViewBacked::SetBackend(CCoinsView& viewIn) { base = &viewIn; } bool CCoinsViewBacked::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) { return base->BatchWrite(mapCoins, hashBlock); } bool CCoinsViewBacked::GetStats(CCoinsStats& stats) const { return base->GetStats(stats); } CCoinsKeyHasher::CCoinsKeyHasher() : salt(GetRandHash()) {} CCoinsViewCache::CCoinsViewCache(CCoinsView* baseIn) : CCoinsViewBacked(baseIn), hasModifier(false), hashBlock(0) {} CCoinsViewCache::~CCoinsViewCache() { assert(!hasModifier); } CCoinsMap::const_iterator CCoinsViewCache::FetchCoins(const uint256& txid) const { CCoinsMap::iterator it = cacheCoins.find(txid); if (it != cacheCoins.end()) return it; CCoins tmp; if (!base->GetCoins(txid, tmp)) return cacheCoins.end(); CCoinsMap::iterator ret = cacheCoins.insert(std::make_pair(txid, CCoinsCacheEntry())).first; tmp.swap(ret->second.coins); if (ret->second.coins.IsPruned()) { // The parent only has an empty entry for this txid; we can consider our // version as fresh. ret->second.flags = CCoinsCacheEntry::FRESH; } return ret; } bool CCoinsViewCache::GetCoins(const uint256& txid, CCoins& coins) const { CCoinsMap::const_iterator it = FetchCoins(txid); if (it != cacheCoins.end()) { coins = it->second.coins; return true; } return false; } CCoinsModifier CCoinsViewCache::ModifyCoins(const uint256& txid) { assert(!hasModifier); std::pair<CCoinsMap::iterator, bool> ret = cacheCoins.insert(std::make_pair(txid, CCoinsCacheEntry())); if (ret.second) { if (!base->GetCoins(txid, ret.first->second.coins)) { // The parent view does not have this entry; mark it as fresh. ret.first->second.coins.Clear(); ret.first->second.flags = CCoinsCacheEntry::FRESH; } else if (ret.first->second.coins.IsPruned()) { // The parent view only has a pruned entry for this; mark it as fresh. ret.first->second.flags = CCoinsCacheEntry::FRESH; } } // Assume that whenever ModifyCoins is called, the entry will be modified. ret.first->second.flags |= CCoinsCacheEntry::DIRTY; return CCoinsModifier(*this, ret.first); } const CCoins* CCoinsViewCache::AccessCoins(const uint256& txid) const { CCoinsMap::const_iterator it = FetchCoins(txid); if (it == cacheCoins.end()) { return NULL; } else { return &it->second.coins; } } bool CCoinsViewCache::HaveCoins(const uint256& txid) const { CCoinsMap::const_iterator it = FetchCoins(txid); // We're using vtx.empty() instead of IsPruned here for performance reasons, // as we only care about the case where a transaction was replaced entirely // in a reorganization (which wipes vout entirely, as opposed to spending // which just cleans individual outputs). return (it != cacheCoins.end() && !it->second.coins.vout.empty()); } uint256 CCoinsViewCache::GetBestBlock() const { if (hashBlock == uint256(0)) hashBlock = base->GetBestBlock(); return hashBlock; } void CCoinsViewCache::SetBestBlock(const uint256& hashBlockIn) { hashBlock = hashBlockIn; } bool CCoinsViewCache::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlockIn) { assert(!hasModifier); for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) { if (it->second.flags & CCoinsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization). CCoinsMap::iterator itUs = cacheCoins.find(it->first); if (itUs == cacheCoins.end()) { if (!it->second.coins.IsPruned()) { // The parent cache does not have an entry, while the child // cache does have (a non-pruned) one. Move the data up, and // mark it as fresh (if the grandparent did have it, we // would have pulled it in at first GetCoins). assert(it->second.flags & CCoinsCacheEntry::FRESH); CCoinsCacheEntry& entry = cacheCoins[it->first]; entry.coins.swap(it->second.coins); entry.flags = CCoinsCacheEntry::DIRTY | CCoinsCacheEntry::FRESH; } } else { if ((itUs->second.flags & CCoinsCacheEntry::FRESH) && it->second.coins.IsPruned()) { // The grandparent does not have an entry, and the child is // modified and being pruned. This means we can just delete // it from the parent. cacheCoins.erase(itUs); } else { // A normal modification. itUs->second.coins.swap(it->second.coins); itUs->second.flags |= CCoinsCacheEntry::DIRTY; } } } CCoinsMap::iterator itOld = it++; mapCoins.erase(itOld); } hashBlock = hashBlockIn; return true; } bool CCoinsViewCache::Flush() { bool fOk = base->BatchWrite(cacheCoins, hashBlock); cacheCoins.clear(); return fOk; } unsigned int CCoinsViewCache::GetCacheSize() const { return cacheCoins.size(); } const CTxOut& CCoinsViewCache::GetOutputFor(const CTxIn& input) const { const CCoins* coins = AccessCoins(input.prevout.hash); assert(coins && coins->IsAvailable(input.prevout.n)); return coins->vout[input.prevout.n]; } CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const { if (tx.IsCoinBase()) return 0; //todo are there any security precautions to take here? if (tx.IsZerocoinSpend()) return tx.GetZerocoinSpent(); CAmount nResult = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) nResult += GetOutputFor(tx.vin[i]).nValue; return nResult; } bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const { if (!tx.IsCoinBase() && !tx.IsZerocoinSpend()) { for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint& prevout = tx.vin[i].prevout; const CCoins* coins = AccessCoins(prevout.hash); if (!coins || !coins->IsAvailable(prevout.n)) { return false; } } } return true; } double CCoinsViewCache::GetPriority(const CTransaction& tx, int nHeight) const { if (tx.IsCoinBase() || tx.IsCoinStake()) return 0.0; double dResult = 0.0; for (const CTxIn& txin: tx.vin) { const CCoins* coins = AccessCoins(txin.prevout.hash); assert(coins); if (!coins->IsAvailable(txin.prevout.n)) continue; if (coins->nHeight < nHeight) { dResult += coins->vout[txin.prevout.n].nValue * (nHeight - coins->nHeight); } } return tx.ComputePriority(dResult); } CCoinsModifier::CCoinsModifier(CCoinsViewCache& cache_, CCoinsMap::iterator it_) : cache(cache_), it(it_) { assert(!cache.hasModifier); cache.hasModifier = true; } CCoinsModifier::~CCoinsModifier() { assert(cache.hasModifier); cache.hasModifier = false; it->second.coins.Cleanup(); if ((it->second.flags & CCoinsCacheEntry::FRESH) && it->second.coins.IsPruned()) { cache.cacheCoins.erase(it); } }
[ "49657239+WorkPLaceCoin@users.noreply.github.com" ]
49657239+WorkPLaceCoin@users.noreply.github.com
e1cba4f09097d1ae3179454784f3cc0ca53236d8
73489c707219cf3ef5369e3ca77a059141c87e6d
/Afficheur.h
49cf545d1a2b8c468015af5008e0ae84fbb6267c
[]
no_license
MrEon/Robot
fdea33e7bf88ac5cdcbf8f7b2bb9460a34e69f84
4f3a7a20f0f712b59ab40232056b997db56939cd
refs/heads/master
2020-07-24T15:39:39.796244
2017-01-04T12:58:40
2017-01-04T12:58:40
73,786,498
0
0
null
null
null
null
UTF-8
C++
false
false
226
h
// // Created by user on 04/01/17. // #ifndef ROBOT_AFFICHEUR_H #define ROBOT_AFFICHEUR_H #include "Robot.h" class Afficheur { protected: Robot robot; public: virtual void update(); }; #endif //ROBOT_AFFICHEUR_H
[ "paul.a.lafaurie@gmail.com" ]
paul.a.lafaurie@gmail.com
dc7e61a85fc259b33a795c2f06c34d03f1f8b146
491260949fc7f77854d1c4e3ce438515841df802
/Leet/Balanced Binary Tree.cc
4bd65666e4ec04e458b0d761fa61b62479a4d7c4
[]
no_license
Da-Huang/Top-S
7812fc9dcf5ebce80dec3011d56a7a73f0e4842a
143a4fed1e7b5e179b8068a5f31dd701be648f3a
refs/heads/master
2020-05-17T22:18:55.563191
2015-12-09T13:49:46
2015-12-09T13:49:46
24,177,444
2
0
null
null
null
null
UTF-8
C++
false
false
336
cc
int __isBalance(TreeNode *root) { if (root == NULL) return 0; int ansl = __isBalance(root->left); if (ansl < 0) return -1; int ansr = __isBalance(root->right); if (ansr < 0) return -1; if (abs(ansl - ansr) > 1) return -1; return max(ansl, ansr) + 1; } bool isBalanced(TreeNode* root) { return __isBalance(root) >= 0; }
[ "dhuang.cn@gmail.com" ]
dhuang.cn@gmail.com
35c7b69339c2239f473ec10e3766b2570f38c0ca
a48af61e00af9f60795490ef35bcadf8ddadaeba
/software_development/c++/c++_primer_5th-lippman_etc/ch_02/solution_16.cpp
c911eafbb0a4b3476ae458822728471e8b797806
[]
no_license
HatlessFox/self-study
3fcc8a559d5dad389ef1617fda5f86e70a8fe9f6
0246781ecccf946e697e0b077d9c80d287cd33b9
refs/heads/master
2022-03-23T14:48:24.679273
2019-11-17T16:26:58
2019-11-17T16:26:58
44,395,118
1
0
null
null
null
null
UTF-8
C++
false
false
427
cpp
/* * Exercise 2.16, p. 51 * * Which of the following assignements are invalid? */ #include <iostream> int main(int, char**) { int i = 0, &r1 = i; double d = 0, &r2 = d; r2 = 3.14159; // (a) - valid r2 = r1; // (b) - valid, _values_ are convertible i = r2; // (c) - valid r1 = d; // (d) - valid, _values_ are convertible std::cout << i << " " << r1 << " " << d << " " << r2 << std::endl; }
[ "hatless.fox@gmail.com" ]
hatless.fox@gmail.com
e01ca1d2509ae27b061f10bc7eafa0d9c7b9604c
314609125e587610353ad0fe67f58bdf45b0c6e1
/Game/Player/Hero.h
2d0bd8a3496cc1e4a274a81bdac5f64a3c145f34
[]
no_license
Epidilius/ZeldaStyleAdventureGame
1e1b71cf2914c1ca5ea1ff803bf10d172e74b562
bd2bbc89f5acf07c8c89f6301aef326fdeead238
refs/heads/master
2021-01-10T17:15:54.039969
2015-09-27T22:31:38
2015-09-27T22:31:38
43,267,623
0
0
null
null
null
null
UTF-8
C++
false
false
4,078
h
// // Hero.h // GameDev2D // // Created by Bradley Flood on 2014-10-14. // Copyright (c) 2014 Algonquin College. All rights reserved. // #ifndef __GameDev2D__Hero__ #define __GameDev2D__Hero__ #include "Player.h" //#include "World.h" #include "../World.h" #include "../../Source/Input/KeyCodes.h" namespace GameDev2D { //Enum to help manage the hero's internal state enum HeroState { HeroIdle = 0, HeroWalking, HeroAttacking, HeroUnknown }; //Local constants const string HERO_WALKING_ATLAS_KEY_1[] = {"LinkUp-1", "LinkDown-1", "LinkLeft-1", "LinkRight-1"}; const string HERO_WALKING_ATLAS_KEY_2[] = {"LinkUp-2", "LinkDown-2", "LinkLeft-2", "LinkRight-2"}; const string HERO_ATTACKING_ATLAS_KEY[] = {"LinkAttack-Up", "LinkAttack-Down", "LinkAttack-Left", "LinkAttack-Right"}; const vec2 HERO_ATTACKING_ANCHOR_POINT[] = {vec2(0.5f, 0.3f), vec2(0.5f, 0.675f), vec2(0.7f, 0.5f), vec2(0.3f, 0.5f)}; const double HERO_ATTACK_TIME = 0.2; const float HERO_WALKING_SPEED = 200.0f; const float HERO_WALKING_ANIMATION_FRAME_SPEED = 8.0f; const unsigned int HERO_INITIAL_HEALTH = 6; const unsigned int HERO_INITIAL_HEALTH_CAPACITY = 6; const unsigned char HERO_MAX_BOMBS = 6; const vec2 HERO_SWORD_RANGE = vec2(70.0f, 68.0f); const double HERO_INVINCIBILITY_DURATION = 0.65; const float HERO_COLLISION_ZONE = 20.0f; const bool HERO_HAS_SWORD_BY_DEFAULT = false; //Forward Declarations class Sprite; class Tile; class Audio; class Circle; class Enemy; //enum Doors; //The Hero class is controlled by keyboard input class Hero : public Player, EventHandler { public: Hero(World* world, Tile* spawnTile); ~Hero(); //Update method, used to determine if an enemy has been attacked void Update(double delta); //Used to reset the hero void Reset(); //Pure virtual function used to manage the hero's internal state void SetState(unsigned int state); //Returns wether the hero has his sword or not bool HasSword(); //Call this method when the hero picks up a sword, allows the //hero to now be able to swing his sword and attack with it void PickedUpSword(); //Adds rupees to the hero's rupee stock-pile void AddRupees(unsigned short rupees); void AddBombs(unsigned short bombs); //Returns the number of rupees the hero has unsigned short GetRupees(); unsigned short GetBombs(); //Returns wether the hero is invincible or not bool IsInvincible(); //Applies damage to the hero void ApplyDamage(unsigned int attackDamage); // Add a certain amount of health to the hero void AddHealth(unsigned int health); private: //Called when the Hero has ceased to exist void HasDied(); //Methods to handle hero input void HandleEvent(Event* event); void HandleKeyDown(KeyCode keyCode); void HandleKeyUp(KeyCode keyCode); //Method used to stop attacking, called from a delayed method void StopAttacking(); void HasChangedTiles(Tile* newTile, Tile* oldTile); void GetYourPickups(Tile* aTileToGetThingsFrom); void TeleportToCave(); //Member variables Sprite* m_AttackingSprite[4]; HeroState m_HeroState; unsigned short m_Rupees; unsigned short m_Bombs; bool m_HasSword; World::Doors m_LastDoor; Timer* m_InvincibilityTimer; Audio* m_LowHealthAudio; Audio* m_HeroDeathAudio; Audio* m_AttackingAudio; Audio* m_HeartPickupAudio; Audio* m_RupeePickupAudio; Audio* m_ItemPickupAudio; Audio* m_SwordPickupAudio; Audio* m_FirstTimeToCaveAudio; vector<Enemy*> m_Enemies; }; } #endif /* defined(__GameDev2D__Hero__) */
[ "joel.cright@gmail.com" ]
joel.cright@gmail.com
911b2a1b0df1ae8c8f7da09d61ef3f5ad1d6de4a
3982cc0a73455f8ce32dba330581b4a809988a17
/native/WinLauncher/WinLauncher/WinLauncher.cpp
66d515ffd567edfe6f6cf473b98ea7afdc14a896
[ "Apache-2.0" ]
permissive
lshain-android-source/tools-idea
56d754089ebadd689b7d0e6400ef3be4255f6bc6
b37108d841684bcc2af45a2539b75dd62c4e283c
refs/heads/master
2016-09-05T22:31:43.471772
2014-07-09T07:58:59
2014-07-09T07:58:59
16,572,470
3
2
null
null
null
null
UTF-8
C++
false
false
18,516
cpp
/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "stdafx.h" #include "WinLauncher.h" typedef JNIIMPORT jint (JNICALL *JNI_createJavaVM)(JavaVM **pvm, JNIEnv **env, void *args); HINSTANCE hInst; // current instance char jvmPath[_MAX_PATH]; JavaVMOption* vmOptions = NULL; int vmOptionCount = 0; bool bServerJVM = false; HMODULE hJVM = NULL; JNI_createJavaVM pCreateJavaVM = NULL; JavaVM* jvm = NULL; JNIEnv* env = NULL; volatile bool terminating = false; HANDLE hFileMapping; HANDLE hEvent; HANDLE hSingleInstanceWatcherThread; const int FILE_MAPPING_SIZE = 16000; #ifdef _M_X64 bool need64BitJRE = true; #else bool need64BitJRE = false; #endif std::string LoadStdString(int id) { wchar_t *buf = NULL; int len = LoadStringW(hInst, id, reinterpret_cast<LPWSTR>(&buf), 0); if (len) { int cbANSI = WideCharToMultiByte(CP_ACP, 0, buf, len, NULL, 0, NULL, NULL); char* ansiBuf = new char[cbANSI]; WideCharToMultiByte(CP_ACP, 0, buf, len, ansiBuf, cbANSI, NULL, NULL); std::string result(ansiBuf, cbANSI); delete[] ansiBuf; return result; } return std::string(); } bool FileExists(const std::string& path) { return GetFileAttributesA(path.c_str()) != INVALID_FILE_ATTRIBUTES; } bool IsValidJRE(const char* path) { std::string dllPath(path); if (dllPath[dllPath.size()-1] != '\\') { dllPath += "\\"; } return FileExists(dllPath + "bin\\server\\jvm.dll") || FileExists(dllPath + "bin\\client\\jvm.dll"); } bool Is64BitJRE(const char* path) { std::string cfgPath(path); cfgPath += "\\lib\\amd64\\jvm.cfg"; return FileExists(cfgPath); } bool FindValidJVM(const char* path) { if (IsValidJRE(path)) { strcpy_s(jvmPath, _MAX_PATH-1, path); return true; } char jrePath[_MAX_PATH]; strcpy_s(jrePath, path); if (jrePath[strlen(jrePath)-1] != '\\') { strcat_s(jrePath, "\\"); } strcat_s(jrePath, _MAX_PATH-1, "jre"); if (IsValidJRE(jrePath)) { strcpy_s(jvmPath, jrePath); return true; } return false; } std::string GetAdjacentDir(const char* suffix) { char libDir[_MAX_PATH]; GetModuleFileNameA(NULL, libDir, _MAX_PATH-1); char* lastSlash = strrchr(libDir, '\\'); if (!lastSlash) return ""; *lastSlash = '\0'; lastSlash = strrchr(libDir, '\\'); if (!lastSlash) return ""; strcpy(lastSlash+1, suffix); strcat_s(libDir, "\\"); return std::string(libDir); } bool FindJVMInEnvVar(const char* envVarName, bool& result) { char envVarValue[_MAX_PATH]; if (GetEnvironmentVariableA(envVarName, envVarValue, _MAX_PATH-1)) { if (FindValidJVM(envVarValue)) { if (Is64BitJRE(jvmPath) != need64BitJRE) return false; result = true; } else { char buf[_MAX_PATH]; sprintf_s(buf, "The environment variable %s (with the value of %s) does not point to a valid JVM installation.", envVarName, envVarValue); MessageBoxA(NULL, buf, "Error Launching IntelliJ Platform", MB_OK); result = false; } return true; } return false; } bool FindJVMInRegistryKey(const char* key, bool wow64_32) { HKEY hKey; int flags = KEY_READ; if (wow64_32) flags |= KEY_WOW64_32KEY; if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hKey) != ERROR_SUCCESS) return false; char javaHome[_MAX_PATH]; DWORD javaHomeSize = _MAX_PATH-1; bool success = false; if (RegQueryValueExA(hKey, "JavaHome", NULL, NULL, (LPBYTE) javaHome, &javaHomeSize) == ERROR_SUCCESS) { success = FindValidJVM(javaHome); } RegCloseKey(hKey); return success; } bool FindJVMInRegistryWithVersion(const char* version, bool wow64_32) { const char* keyName = LoadStdString(IDS_JDK_ONLY) == std::string("true") ? "Java Development Kit" : "Java Runtime Environment"; char buf[_MAX_PATH]; sprintf_s(buf, "Software\\JavaSoft\\%s\\%s", keyName, version); return FindJVMInRegistryKey(buf, wow64_32); } bool FindJVMInRegistry() { #ifndef _M_X64 if (FindJVMInRegistryWithVersion("1.7", true)) return true; if (FindJVMInRegistryWithVersion("1.6", true)) return true; #endif if (FindJVMInRegistryWithVersion("1.7", false)) return true; if (FindJVMInRegistryWithVersion("1.6", false)) return true; return false; } bool LocateJVM() { bool result; if (FindJVMInEnvVar(LoadStdString(IDS_JDK_ENV_VAR).c_str(), result)) { return result; } std::string jreDir = GetAdjacentDir("jre"); if (FindValidJVM(jreDir.c_str()) && Is64BitJRE(jvmPath) == need64BitJRE) { return true; } if (FindJVMInRegistry()) { return true; } if (FindJVMInEnvVar("JAVA_HOME", result)) { return result; } MessageBoxA(NULL, "No JVM installation found. Please reinstall the product or install a JDK.", "Error Launching IntelliJ Platform", MB_OK); return false; } void TrimLine(char* line) { char *p = line + strlen(line) - 1; if (p >= line && *p == '\n') { *p-- = '\0'; } while(p >= line && (*p == ' ' || *p == '\t')) { *p-- = '\0'; } } bool LoadVMOptionsFile(const TCHAR* path, std::vector<std::string>& vmOptionLines) { FILE *f = _tfopen(path, _T("rt")); if (!f) return false; char line[_MAX_PATH]; while(fgets(line, _MAX_PATH-1, f)) { TrimLine(line); if (line[0] == '#') continue; if (strcmp(line, "-server") == 0) { bServerJVM = true; } else if (strlen(line) > 0) { vmOptionLines.push_back(line); } } fclose(f); return true; } std::string FindToolsJar() { std::string toolsJarPath = jvmPath; size_t lastSlash = toolsJarPath.rfind('\\'); if (lastSlash != std::string::npos) { toolsJarPath = toolsJarPath.substr(0, lastSlash+1) + "lib\\tools.jar"; if (FileExists(toolsJarPath)) { return toolsJarPath; } } return ""; } std::string CollectLibJars(const std::string& jarList) { std::string libDir = GetAdjacentDir("lib"); if (libDir.size() == 0 || !FileExists(libDir)) { return ""; } std::string result; int pos = 0; while(pos < jarList.size()) { int delimiterPos = jarList.find(';', pos); if (delimiterPos == std::string::npos) { delimiterPos = jarList.size(); } if (result.size() > 0) { result += ";"; } result += libDir; result += jarList.substr(pos, delimiterPos-pos); pos = delimiterPos+1; } return result; } std::string BuildClassPath() { std::string classpathLibs = LoadStdString(IDS_CLASSPATH_LIBS); std::string result = CollectLibJars(classpathLibs); std::string toolsJar = FindToolsJar(); if (toolsJar.size() > 0) { result += ";"; result += toolsJar; } return result; } bool AddClassPathOptions(std::vector<std::string>& vmOptionLines) { std::string classPath = BuildClassPath(); if (classPath.size() == 0) return false; vmOptionLines.push_back(std::string("-Djava.class.path=") + classPath); std::string bootClassPathLibs = LoadStdString(IDS_BOOTCLASSPATH_LIBS); std::string bootClassPath = CollectLibJars(bootClassPathLibs); if (bootClassPath.size() > 0) { vmOptionLines.push_back(std::string("-Xbootclasspath/a:") + bootClassPath); } return true; } void AddPredefinedVMOptions(std::vector<std::string>& vmOptionLines) { std::string vmOptions = LoadStdString(IDS_VM_OPTIONS); while(vmOptions.size() > 0) { int pos = vmOptions.find(' '); if (pos == std::string::npos) pos = vmOptions.size(); vmOptionLines.push_back(vmOptions.substr(0, pos)); while(pos < vmOptions.size() && vmOptions[pos] == ' ') pos++; vmOptions = vmOptions.substr(pos); } } bool LoadVMOptions() { TCHAR optionsFileName[_MAX_PATH]; if (LoadString(hInst, IDS_VM_OPTIONS_PATH, optionsFileName, _MAX_PATH-1)) { TCHAR fullOptionsFileName[_MAX_PATH]; ExpandEnvironmentStrings(optionsFileName, fullOptionsFileName, _MAX_PATH-1); if (GetFileAttributes(fullOptionsFileName) == INVALID_FILE_ATTRIBUTES) { GetModuleFileName(NULL, fullOptionsFileName, _MAX_PATH-1); _tcscat_s(fullOptionsFileName, _T(".vmoptions")); } std::vector<std::string> vmOptionLines; if (LoadVMOptionsFile(fullOptionsFileName, vmOptionLines)) { if (!AddClassPathOptions(vmOptionLines)) return false; AddPredefinedVMOptions(vmOptionLines); vmOptionCount = vmOptionLines.size(); vmOptions = (JavaVMOption*) malloc(vmOptionCount * sizeof(JavaVMOption)); for(int i=0; i<vmOptionLines.size(); i++) { vmOptions[i].optionString = _strdup(vmOptionLines[i].c_str()); vmOptions[i].extraInfo = 0; } return true; } } MessageBox(NULL, _T("Cannot find VM options file"), _T("Error launching IntelliJ Platform"), MB_OK); return false; } bool LoadJVMLibrary() { std::string dllName(jvmPath); std::string binDir = dllName + "\\bin"; std::string serverDllName = binDir + "\\server\\jvm.dll"; std::string clientDllName = binDir + "\\client\\jvm.dll"; if ((bServerJVM && FileExists(serverDllName)) || !FileExists(clientDllName)) { dllName = serverDllName; } else { dllName = clientDllName; } SetCurrentDirectoryA(binDir.c_str()); // ensure that we can find msvcr100.dll which is located in jre/bin directory hJVM = LoadLibraryA(dllName.c_str()); if (hJVM) { pCreateJavaVM = (JNI_createJavaVM) GetProcAddress(hJVM, "JNI_CreateJavaVM"); } if (!pCreateJavaVM) { char buf[_MAX_PATH]; sprintf(buf, "Failed to load JVM DLL %s", dllName.c_str()); MessageBoxA(NULL, buf, "Error Launching IntelliJ Platform", MB_OK); return false; } return true; } bool CreateJVM() { JavaVMInitArgs initArgs; initArgs.version = JNI_VERSION_1_2; initArgs.options = vmOptions; initArgs.nOptions = vmOptionCount; initArgs.ignoreUnrecognized = JNI_FALSE; int result = pCreateJavaVM(&jvm, &env, &initArgs); for(int i=0; i<vmOptionCount; i++) { free(vmOptions[i].optionString); } free(vmOptions); vmOptions = NULL; if (result != JNI_OK) { TCHAR buf[_MAX_PATH]; _stprintf_s(buf, _T("Failed to create JVM: error code %d"), result); MessageBox(NULL, buf, _T("Error launching IntelliJ Platform"), MB_OK); } return result == JNI_OK; } jobjectArray PrepareCommandLine() { int numArgs; LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &numArgs); jclass stringClass = env->FindClass("java/lang/String"); jobjectArray args = env->NewObjectArray(numArgs-1, stringClass, NULL); for(int i=1; i<numArgs; i++) { const wchar_t* arg = argv[i]; env->SetObjectArrayElement(args, i-1, env->NewString((const jchar *) arg, wcslen(argv[i]))); } return args; } bool RunMainClass() { std::string mainClassName = LoadStdString(IDS_MAIN_CLASS); jclass mainClass = env->FindClass(mainClassName.c_str()); if (!mainClass) { char buf[_MAX_PATH]; sprintf_s(buf, "Could not find main class %s", mainClassName.c_str()); MessageBoxA(NULL, buf, "Error Launching IntelliJ Platform", MB_OK); return false; } jmethodID mainMethod = env->GetStaticMethodID(mainClass, "main", "([Ljava/lang/String;)V"); if (!mainMethod) { MessageBoxA(NULL, "Could not find main method", "Error Launching IntelliJ Platform", MB_OK); return false; } jobjectArray args = PrepareCommandLine(); env->CallStaticVoidMethod(mainClass, mainMethod, args); jthrowable exc = env->ExceptionOccurred(); if (exc) { MessageBox(NULL, _T("Error invoking main method"), _T("Error launching IntelliJ Platform"), MB_OK); } return true; } void CallCommandLineProcessor(const std::wstring& curDir, const std::wstring& args) { JNIEnv *env; JavaVMAttachArgs attachArgs; attachArgs.version = JNI_VERSION_1_2; attachArgs.name = "WinLauncher external command processing thread"; attachArgs.group = NULL; jvm->AttachCurrentThread((void**) &env, &attachArgs); std::string processorClassName = LoadStdString(IDS_COMMAND_LINE_PROCESSOR_CLASS); jclass processorClass = env->FindClass(processorClassName.c_str()); if (processorClass) { jmethodID processMethodID = env->GetStaticMethodID(processorClass, "processWindowsLauncherCommandLine", "(Ljava/lang/String;Ljava/lang/String;)V"); if (processMethodID) { jstring jCurDir = env->NewString((const jchar *) curDir.c_str(), curDir.size()); jstring jArgs = env->NewString((const jchar *) args.c_str(), args.size()); env->CallStaticVoidMethod(processorClass, processMethodID, jCurDir, jArgs); jthrowable exc = env->ExceptionOccurred(); if (exc) { MessageBox(NULL, _T("Error sending command line to existing instance"), _T("Error"), MB_OK); } } } jvm->DetachCurrentThread(); } DWORD WINAPI SingleInstanceThread(LPVOID args) { while(true) { WaitForSingleObject(hEvent, INFINITE); if (terminating) break; wchar_t *view = static_cast<wchar_t *>(MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0)); if (!view) continue; std::wstring command(view); int pos = command.find('\n'); if (pos >= 0) { std::wstring curDir = command.substr(0, pos); std::wstring args = command.substr(pos+1); CallCommandLineProcessor(curDir, args); } UnmapViewOfFile(view); } return 0; } void SendCommandLineToFirstInstance() { wchar_t curDir[_MAX_PATH]; GetCurrentDirectoryW(_MAX_PATH-1, curDir); std::wstring command(curDir); command += _T("\n"); command += GetCommandLineW(); void *view = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (view) { memcpy(view, command.c_str(), (command.size()+1) * sizeof(wchar_t)); UnmapViewOfFile(view); } SetEvent(hEvent); } bool CheckSingleInstance() { char moduleFileName[_MAX_PATH]; GetModuleFileNameA(NULL, moduleFileName, _MAX_PATH-1); for(char *p = moduleFileName; *p; p++) { if (*p == ':' || *p == '\\') *p = '_'; } std::string mappingName = std::string("IntelliJLauncherMapping.") + moduleFileName; std::string eventName = std::string("IntelliJLauncherEvent.") + moduleFileName; hEvent = CreateEventA(NULL, FALSE, FALSE, eventName.c_str()); hFileMapping = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, mappingName.c_str()); if (!hFileMapping) { hFileMapping = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, FILE_MAPPING_SIZE, mappingName.c_str()); return true; } else { SendCommandLineToFirstInstance(); CloseHandle(hFileMapping); CloseHandle(hEvent); return false; } } void DrawSplashImage(HWND hWnd) { HBITMAP hSplashBitmap = (HBITMAP) GetWindowLongPtr(hWnd, GWLP_USERDATA); PAINTSTRUCT ps; HDC hDC = BeginPaint(hWnd, &ps); HDC hMemDC = CreateCompatibleDC(hDC); HBITMAP hOldBmp = (HBITMAP) SelectObject(hMemDC, hSplashBitmap); BITMAP splashBitmap; GetObject(hSplashBitmap, sizeof(splashBitmap), &splashBitmap); BitBlt(hDC, 0, 0, splashBitmap.bmWidth, splashBitmap.bmHeight, hMemDC, 0, 0, SRCCOPY); SelectObject(hMemDC, hOldBmp); DeleteDC(hMemDC); EndPaint(hWnd, &ps); } LRESULT CALLBACK SplashScreenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_PAINT: DrawSplashImage(hWnd); break; } return DefWindowProc(hWnd, uMsg, wParam, lParam); } const TCHAR splashClassName[] = _T("IntelliJLauncherSplash"); void RegisterSplashScreenWndClass() { WNDCLASSEX wcx; wcx.cbSize = sizeof(wcx); wcx.style = 0; wcx.lpfnWndProc = SplashScreenWndProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hInst; wcx.hIcon = 0; wcx.hCursor = LoadCursor(NULL, IDC_WAIT); wcx.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH); wcx.lpszMenuName = 0; wcx.lpszClassName = splashClassName; wcx.hIconSm = 0; RegisterClassEx(&wcx); } HWND ShowSplashScreenWindow(HBITMAP hSplashBitmap) { RECT workArea; SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0); BITMAP splashBitmap; GetObject(hSplashBitmap, sizeof(splashBitmap), &splashBitmap); int x = workArea.left + ((workArea.right - workArea.left) - splashBitmap.bmWidth) / 2; int y = workArea.top + ((workArea.bottom - workArea.top) - splashBitmap.bmHeight) / 2; HWND splashWindow = CreateWindowEx(WS_EX_TOOLWINDOW, splashClassName, splashClassName, WS_POPUP, x, y, splashBitmap.bmWidth, splashBitmap.bmHeight, NULL, NULL, NULL, NULL); SetWindowLongPtr(splashWindow, GWLP_USERDATA, (LONG_PTR) hSplashBitmap); ShowWindow(splashWindow, SW_SHOW); UpdateWindow(splashWindow); return splashWindow; } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { static DWORD currentProcId = GetCurrentProcessId(); DWORD procId = 0; GetWindowThreadProcessId(hWnd, &procId); if(currentProcId == procId) { TCHAR className[_MAX_PATH]; GetClassName(hWnd, className, _MAX_PATH-1); if (_tcscmp(className, splashClassName) != 0) { WINDOWINFO wi; wi.cbSize = sizeof(WINDOWINFO); GetWindowInfo(hWnd, &wi); if((wi.dwStyle & WS_VISIBLE) != 0) { HWND *phNewWindow = (HWND *) lParam; *phNewWindow = hWnd; return FALSE; } } } return TRUE; } DWORD WINAPI SplashScreenThread(LPVOID args) { HBITMAP hSplashBitmap = static_cast<HBITMAP>(args); RegisterSplashScreenWndClass(); HWND splashWindow = ShowSplashScreenWindow(hSplashBitmap); MSG msg; while(true) { while (PeekMessage(&msg, splashWindow, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } Sleep(50); HWND hNewWindow = NULL; EnumWindows(EnumWindowsProc, (LPARAM) &hNewWindow); if (hNewWindow) { BringWindowToTop(hNewWindow); DeleteObject(hSplashBitmap); DestroyWindow(splashWindow); } } return 0; } int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); hInst = hInstance; if (!CheckSingleInstance()) return 1; HANDLE hSplashBitmap = static_cast<HBITMAP>(LoadImage(hInst, MAKEINTRESOURCE(IDB_SPLASH), IMAGE_BITMAP, 0, 0, 0)); if (hSplashBitmap) { CreateThread(NULL, 0, SplashScreenThread, hSplashBitmap, 0, NULL); } if (!LocateJVM()) return 1; if (!LoadVMOptions()) return 1; if (!LoadJVMLibrary()) return 1; if (!CreateJVM()) return 1; hSingleInstanceWatcherThread = CreateThread(NULL, 0, SingleInstanceThread, NULL, 0, NULL); if (!RunMainClass()) return 1; jvm->DestroyJavaVM(); terminating = true; SetEvent(hEvent); WaitForSingleObject(hSingleInstanceWatcherThread, INFINITE); CloseHandle(hEvent); CloseHandle(hFileMapping); return 0; }
[ "lshain.gyh@gmail.com" ]
lshain.gyh@gmail.com
b6e9761edcaa72c7e4cd8e7f9d67d5777bc4a0f7
8ff2ea9e811a710fbdf4722cf079ffb43f9ef9f0
/APS/Assign/Assign5/prob4.cpp
8740e42af727ae5dd5a09e421dbb0d25979f01c0
[]
no_license
mridul2101/CollegeCode
3281d6e73566b6148ecf4d399386ed8cf97fdcdf
43ad3343fadfd9d23a9454e2747fdabaea5a7361
refs/heads/master
2020-03-18T15:03:31.139459
2018-06-04T20:49:03
2018-06-04T20:49:03
134,884,563
0
0
null
null
null
null
UTF-8
C++
false
false
845
cpp
#include<iostream> using namespace std; int main() { int n; cin>>n; int a[n+1]; for(int i=0;i<n+1;i++) a[i]=0; if(n==1) {cout<<"0\n";return(0);} int p=2; a[1]=0; for(int i=0;i<n-1;i++) { if(((p%3)==0)&&((p%2)==0)) { int a1,a2,a3; a1=p/3; a2=p/2; a3=p-1; if((a[a1]<a[a2])) { if(a[a1]<a[a3]) a[p]=a[a1]+1; else a[p]=a[a3]+1; } else { if(a[a2]<a[a3]) a[p]=a[a2]+1; else a[p]=a[a3]+1; } } else { if(p%3==0) { int a1,a2; a1=p/3; a2=p-1; if(a[a1]<a[a2]) a[p]=a[a1]+1; else a[p]=a[a2]+1; } else{ if(p%2==0) { int a1,a2; a1=p/2; a2=p-1; if(a[a1]<a[a2]) {a[p]=a[a1]+1;} else a[p]=a[a2]+1; } else {a[p]=a[p-1]+1;}} } p++; } cout<<a[n]<<endl; }
[ "window.buy@gmail.com" ]
window.buy@gmail.com
0b6bfeb1e761c9c785edb7e6d0c03944c17fd387
ae1e4075d955d345429c2943174b9998eedeb6c0
/Lista6/zad2.cpp
f9152c31d39f9f5ae5f13ef4e6168e0336ced9b5
[]
no_license
RaronRarenberg/AiSD_Krzysztof_Mindowicz
98d4ad0668340268d3ff16532e15ec54cdcfee58
d281944eddf06f31686dba41ec9ef5b18dc49cf8
refs/heads/master
2021-04-01T18:25:10.068014
2020-06-16T13:21:41
2020-06-16T13:21:41
248,206,534
0
0
null
null
null
null
UTF-8
C++
false
false
2,302
cpp
#include <iostream> #include <vector> #include <string> #include <forward_list> //lista pojedynczo linkowana struct Hashowanie { size_t operator()(const std::string& s) const //funktor czyli wywolujemy obiekt jak funkcje {//przy okazji uzywam funkcji z zadania 1 unsigned int h, i; h = 0; for (i = 0; i < s.length(); i++) h = 2 * h + 1 - (s[i] & 1); return h % 10; } }; template<typename T, typename HashFunkcja = std::hash<T> > //elementy dowolnego typu T przechowam w kubelkach nizej class HashLancuch { public: HashLancuch(size_t rozmiar_kubelka, HashFunkcja hash) :kubelki(rozmiar_kubelka), hash_funkcja{hash} { } ~HashLancuch() = default; void wstaw(const T& wstawiany_elem) { auto indeks_hashowania = hash_funkcja(wstawiany_elem) % kubelki.size();//hash_funkcja korzysta z przeciazonego operatora kubelki[indeks_hashowania].push_front(wstawiany_elem); } const T* znajdz(const T& szukany_elem) const //zwracamy adres elementu lub nullptr { auto indeks_hashowania = hash_funkcja(szukany_elem) % kubelki.size(); auto const& lista = kubelki[indeks_hashowania]; for (const auto& element : lista) { if (element == szukany_elem) return &element; } return nullptr; } void usun(const T& usuwany_elem) { auto indeks_hashowania = hash_funkcja(usuwany_elem) % kubelki.size(); kubelki[indeks_hashowania].remove(usuwany_elem); } private: std::vector<std::forward_list<T>> kubelki; const HashFunkcja hash_funkcja; //czyli tak naprawdę std::hash<T> hash_funkcja }; template <typename T, typename HashFunkcja> void sprawdz(const HashLancuch<T, HashFunkcja>& tablica, const std::string& sprawdzana_wartosc, bool spodziewana_wartosc) { auto wskaznik = tablica.znajdz(sprawdzana_wartosc); if ((wskaznik == nullptr && spodziewana_wartosc == false) || (wskaznik != nullptr && spodziewana_wartosc != false)) std::cout << "Zgadza się\n"; else std::cout << "Nie zgadza się\n"; } int main() { HashLancuch<std::string, Hashowanie> tablica(1001, Hashowanie());//pusty nawias to zamiana klasy w objekt for (int i = 0; i < 1000; i++) { tablica.wstaw(std::to_string(i)); } for (int i = 300; i < 500; i++) { tablica.usun(std::to_string(i)); } sprawdz(tablica, "299", true); sprawdz(tablica, "500", true); sprawdz(tablica, "300", false); }
[ "301486@uwr.edu.pl" ]
301486@uwr.edu.pl
6fc4cf0f2f3656d71fd92af604672bb49da79dd8
e7fd6e826803342b86f85baaf4685de9eb1e68f1
/PokemonGo/Juego.h
93399fd07eaf8c17989afd32121184213c7a1e78
[]
no_license
nsoberon/PokemonGoAlgorithms2
dd3735928aae5b2bbcaddd6235625207139fe0d3
9d764e0fc072a5907cca6962b851479d2c126316
refs/heads/master
2021-06-09T21:55:23.685349
2016-11-30T15:43:26
2016-11-30T15:43:26
73,032,138
1
0
null
null
null
null
UTF-8
C++
false
false
8,224
h
#ifndef JUEGO_H #define JUEGO_H #include "TiposJuego.h" #include "Mapa.h" #include "DiccString.hpp" #include "ColaPrior.hpp" #include "aed2/Vector.h" class Juego{ private: struct JugadorEsperando{ Jugador jugador; aed2::Nat cantidadPokemonsAtrapados; JugadorEsperando(){} JugadorEsperando(Jugador j, aed2::Nat c){ jugador = j; cantidadPokemonsAtrapados = c; } bool operator < (const JugadorEsperando & c) const{ return this->cantidadPokemonsAtrapados < c.cantidadPokemonsAtrapados; } bool operator > (const JugadorEsperando & c) const{ return this->cantidadPokemonsAtrapados > c.cantidadPokemonsAtrapados; } void operator = (const JugadorEsperando & c){ this->jugador = c.jugador; this->cantidadPokemonsAtrapados = c.cantidadPokemonsAtrapados; } bool operator == (const JugadorEsperando & c) const{ bool res = false; res = this->jugador == c.jugador; res = res && this->cantidadPokemonsAtrapados == c.cantidadPokemonsAtrapados; return res; } }; struct DatosPokemonSalvaje{ Pokemon pokemon; Coordenada posicion; ColaPrior<Juego::JugadorEsperando> jugadoresEsperando; aed2::Nat cantidadMovimientos; aed2::Conj<Coordenada>::Iterador referenciaPosiciones; // ESTO NO ESTA EN EL DISEÑO DatosPokemonSalvaje(Pokemon p, Coordenada c, ColaPrior<Juego::JugadorEsperando> cp, aed2::Conj<Coordenada>::Iterador itConj){ pokemon = p; posicion = c; jugadoresEsperando = cp; cantidadMovimientos = 0; referenciaPosiciones = itConj; } void operator = (const DatosPokemonSalvaje & c){ this->pokemon = c.pokemon; this->posicion = c.posicion; this->jugadoresEsperando = c.jugadoresEsperando; this->cantidadMovimientos = c.cantidadMovimientos; this->referenciaPosiciones = c.referenciaPosiciones; } bool operator == (const DatosPokemonSalvaje & c){ bool res = false; res = this->pokemon == c.pokemon; res = res && this->posicion == c.posicion; res = res && this->jugadoresEsperando == c.jugadoresEsperando; res = res && this->cantidadMovimientos == c.cantidadMovimientos; res = res && this->referenciaPosiciones == c.referenciaPosiciones; return res; } }; struct DatosJugador { aed2::Nat id; aed2::Nat sanciones; Coordenada posicion; bool conectado; DiccString<aed2::Nat> pokemonsCapturados; aed2::Nat cantidadPokemonsAtrapados; bool banneado; ColaPrior<Juego::JugadorEsperando>::Iterador esperandoParaCapturar; aed2::Conj<aed2::Nat>::Iterador referenciaConjunto; aed2::Conj<Juego::DatosJugador*>::Iterador referenciaMapa; // NO ESTABA EN EL DISEÑO, SE AGREGA PARA CONTEMPLAR QUE HAYA MAS DE UN JUGADOR EN LA MISMA POS DatosJugador(){}; DatosJugador(aed2::Nat i, aed2::Conj<aed2::Nat>::Iterador refConj){ id = i; sanciones = 0; Coordenada c; c.crearCoor(0,0); posicion = c; conectado = false; DiccString<aed2::Nat> pokeCap; pokeCap.vacio(); pokemonsCapturados = pokeCap; cantidadPokemonsAtrapados = 0; banneado = false; ColaPrior<Juego::JugadorEsperando> colaPoke; colaPoke.Vacia(); ColaPrior<Juego::JugadorEsperando>::Iterador itColaPoke = colaPoke.CrearIterador(NULL); esperandoParaCapturar = itColaPoke; referenciaConjunto = refConj; } void operator = (const DatosJugador & c){ this->id = c.id; this->sanciones = c.sanciones; this->posicion = c.posicion; this->conectado = c.conectado; this->cantidadPokemonsAtrapados = c.cantidadPokemonsAtrapados; this->pokemonsCapturados = c.pokemonsCapturados; this->banneado = c.banneado; this->esperandoParaCapturar = c.esperandoParaCapturar; this->referenciaConjunto = c.referenciaConjunto; } bool operator == (const DatosJugador & c){ bool res = false; res = this->id == c.id; res = res && this->sanciones == c.sanciones; res = res && this->posicion == c.posicion; res = res && this->conectado == c.conectado; res = res && this->pokemonsCapturados == c.pokemonsCapturados; res = res && this->banneado == c.banneado; res = res && this->referenciaConjunto == c.referenciaConjunto; return res; } }; struct JugadorPokemonEnMapa{ aed2::Conj<Juego::DatosJugador*> jugadores; // NO ESTABA EN EL DISEÑO, SE AGREGA PARA CONTEMPLAR QUE HAYA MAS DE UN JUGADOR EN LA MISMA POS Juego::DatosPokemonSalvaje* pokemon; JugadorPokemonEnMapa(aed2::Conj<Juego::DatosJugador*> j, Juego::DatosPokemonSalvaje* p){ jugadores = j; pokemon = p; } void operator = (const JugadorPokemonEnMapa & c){ this->jugadores = c.jugadores; this->pokemon = c.pokemon; } bool operator == (const JugadorPokemonEnMapa & c){ bool res = this->jugadores == c.jugadores; res = res && this->pokemon == c.pokemon; return res; } }; aed2::Vector<Juego::DatosJugador> jugadoresVector; aed2::Conj<aed2::Nat> jugadoresConjunto; aed2::Conj<Coordenada> posicionesPokemons; DiccString<aed2::Nat> pokemonsCantidades; aed2::Arreglo<Juego::JugadorPokemonEnMapa> jugadoresPokemonsMapa; aed2::Lista<Juego::DatosPokemonSalvaje> pokemonsSalvajes; Mapa mapaJuego; aed2::Nat cantidadTotalPokemons; aed2::Nat cantidadFilas; aed2::Nat cantidadColumnas; aed2::Lista<Juego::DatosJugador> jugadoresADistancia(aed2::Nat, Coordenada) const; aed2::Lista<Coordenada> pokemonsADistancia(aed2::Nat, Coordenada) const; aed2::Conj<Jugador> expulsadosAux(aed2::Vector<Juego::DatosJugador>); aed2::Conj<Jugador> jugadoresAux(aed2::Vector<Juego::DatosJugador>); public: Juego(); ~Juego(); void EliminarJuego(); void crearJuego(Mapa); void agregarPokemon(Pokemon, Coordenada); aed2::Nat agregarJugador(); void conectarse(Jugador, Coordenada); void desconectarse(Jugador); void moverse(Jugador, Coordenada); Mapa mapa() const; aed2::Conj<Jugador>::const_Iterador jugadores() const; bool estaConectado(Jugador) const; aed2::Nat sanciones(Jugador) const; Coordenada posicion(Jugador) const; DiccString<aed2::Nat>::const_Iterador pokemons(Jugador) const; aed2::Conj<Jugador> expulsados() const; aed2::Conj<Coordenada> posConPokemons() const; Pokemon pokemonsEnPos(Coordenada) const; aed2::Nat cantidadMovimientosParaCapturar(Coordenada) const; bool puedoAgregarPokemon(Coordenada) const; bool hayPokemonCercano(Coordenada) const; Coordenada posPokemonCercano(Coordenada) const; aed2::Conj<Jugador> entrenadoresPosibles(Coordenada) const; aed2::Nat indiceRareza(Pokemon) const; aed2::Nat cantPokemonsTotales() const; aed2::Nat cantMismaEspecie(Pokemon) const; }; #endif // JUEGO_H
[ "nico.soberon@gmail.com" ]
nico.soberon@gmail.com
0d2743d730877951b5bcc3c8d45c030a20a76cd0
a06348bb95587c3caaa29ce1a374918b4f37d837
/libmesh-sedimentation/include/io/xdmf.h
9c6492c1acca185b2e6f8e844e4ab294d1a22dc9
[]
no_license
hpcdb/workflow-sedimentation
b7eb42d5ca96c2a724f7974323fda2782cd831e2
e1b8094aa5fd983a9d5f179bd8c78e3f95379971
refs/heads/master
2022-12-16T04:42:32.188626
2020-03-31T12:54:12
2020-03-31T12:54:12
180,198,155
0
0
null
2022-12-07T23:54:16
2019-04-08T17:20:20
C++
UTF-8
C++
false
false
1,520
h
/* * File: xdmf.h * Author: camata * * Created on June 3, 2016, 2:13 PM */ #ifndef XDMF_H #define XDMF_H #include <string> #include "libmesh/libmesh_common.h" #include "libmesh/mesh.h" using namespace std; namespace libMesh { class EquationSystems; class MeshBase; class System; class XDMFWriter { public: XDMFWriter(const Mesh& mesh); void set_file_name(std::string filename); void set_dir_path(std::string path); void set_file_id(int n_time_file) {n_timestep = n_time_file; } int get_file_id() { return n_timestep; } string* write_time_step(EquationSystems &es, double time); void mesh_changed_on(); virtual ~XDMFWriter(); private: void libMesh_to_xdmf(std::vector<double> &coords, std::vector<int> &conn); void get_variable_solution(EquationSystems& es, int sys, int ivar, std::vector<double> &solution); void write_spatial_collection(EquationSystems& es, double time); void write_temporal_collection(); bool is_mesh_changed; // mapping between global and local ids std::map<dof_id_type, dof_id_type> g2l; std::string basename; std::string dir; int n_timestep; ElemType elemtype; int n_local_nodes; int n_local_elem; const Mesh & mesh; int processor_id; int n_processors; }; } #endif /* XDMF_H */
[ "vitor.silva.sousa@gmail.com" ]
vitor.silva.sousa@gmail.com
0d57902f3ea41d6d8af402d3bdf49aed1a2683de
d0d23abed4d599cd956e602f000d59cc182c22e0
/Game/Game Engine Components/NavigationPath.h
f92b56176ab0ffa3b79def91ca6729f4694c54d1
[]
no_license
marnold831/Mini-Golf
076cc5450f97f7e438cad0f452a0f6b717e207db
d0929405b09b4c1fa7c93fb013da1965f32d90d5
refs/heads/master
2021-01-03T00:54:11.377061
2020-02-13T16:54:17
2020-02-13T16:54:17
239,844,945
0
1
null
null
null
null
UTF-8
C++
false
false
853
h
#pragma once #include "../../Common/Vector3.h" #include "../..//Common/Vector4.h" #include "Debug.h" #include <vector> namespace NCL { using namespace NCL::Maths; namespace CSC8503 { class NavigationPath { public: NavigationPath() {} ~NavigationPath() {} void Clear() { waypoints.clear(); } void PushWaypoint(const Vector3& wp) { waypoints.emplace_back(wp); } bool PopWaypoint(Vector3& waypoint) { if (waypoints.empty()) { return false; } waypoint = waypoints.back(); waypoints.pop_back(); return true; } void DrawLines() { for (auto i : waypoints) { (i, i + Vector3(0, 40, 0), Vector4(1, 1, 1, 1)); } } bool IsEmpty() { return waypoints.empty(); } Vector3 GetFirst() { return waypoints[0]; } protected: std::vector <Vector3> waypoints; }; } }
[ "b6015505@newcastle.ac.uk" ]
b6015505@newcastle.ac.uk
cd5bcf7fbada74165877596b29713690acf482f8
b19f30140cef064cbf4b18e749c9d8ebdd8bf27f
/D3DGame_180731_007_HeightMap/stdafx.h
60299b6aa1ac7b2132ed9f0d07cee5228854247c
[]
no_license
evehour/SGADHLee
675580e199991916cf3134e7c61749b0a0bfa070
0ebbedf5d0692b782e2e5f9a372911c65f98ddc4
refs/heads/master
2020-03-25T13:22:42.597811
2019-01-03T07:05:54
2019-01-03T07:05:54
143,822,128
0
0
null
null
null
null
UTF-8
C++
false
false
1,690
h
#pragma once #include <Windows.h> #include <assert.h> //STL #include <string> #include <vector> #include <list> #include <map> #include <unordered_map> #include <functional> using namespace std; //Direct3D #include <dxgi1_2.h> #include <d3dcommon.h> #include <d3dcompiler.h> #include <d3d11shader.h> #include <d3d11.h> #include <d3dx10math.h> #include <d3dx11async.h> #pragma comment(lib, "dxgi.lib") #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "d3dx9.lib") #pragma comment(lib, "d3dx10.lib") #pragma comment(lib, "d3dx11.lib") #pragma comment(lib, "d3dcompiler.lib") #pragma comment(lib, "dxguid.lib") //ImGui #include <imgui.h> #include <imguiDx11.h> #pragma comment(lib, "imgui.lib") //Json Cpp #include <json/json.h> #pragma comment(lib, "jsoncpp.lib") #pragma warning( disable : 4996 ) //DirectXTex #include <DirectXTex.h> #pragma comment(lib, "directxtex.lib") const wstring Shaders = L"../_Shaders/"; const wstring Contents = L"../_Contents/"; const wstring Textures = L"../_Contents/Textures/"; #define SAFE_RELEASE(p){ if(p){ (p)->Release(); (p) = NULL; } } #define SAFE_DELETE(p){ if(p){ delete (p); (p) = NULL; } } #define SAFE_DELETE_ARRAY(p){ if(p){ delete [] (p); (p) = NULL; } } #include "./Systems/D3D.h" #include "./Systems/Keyboard.h" #include "./Systems/Mouse.h" #include "./Systems/Time.h" #include "./Renders/VertexLayouts.h" #include "./Renders/States.h" #include "./Renders/Shader.h" #include "./Renders/ShaderBuffer.h" #include "./Renders/GlobalBuffers.h" #include "./Renders/Texture.h" #include "./Executes/Execute.h" #include "./Utilities/Math.h" #include "./Utilities/Json.h" #include "./Utilities/String.h" #include "./Utilities/Path.h"
[ "evehour@naver.com" ]
evehour@naver.com
897a12ceb3bdc8a38128b6650cf4c1f480de9489
049ce80210dfb9e45d2d05ce6dc8a3a8066650fa
/Arduino/Serial_OLED/Serial_OLED.ino
53296fc6cc56ab26f19360d867b44c96e79f75ff
[]
no_license
ArcherHuang/VideoDHTCloud
d91eee54f57840d74711fd4958ad0d73bee0d86b
89d8a2cd40b1ddd06d9a11de38302227eef7cfb4
refs/heads/master
2020-07-01T08:11:16.144423
2017-02-09T15:07:02
2017-02-09T15:07:02
74,091,390
0
0
null
null
null
null
UTF-8
C++
false
false
1,301
ino
// OLED #include <Wire.h> //載入I2C函式庫 #include <SeeedOLED.h> //載入SeeedOLED函式庫 // Buffer to store incoming commands from serial port String inData; void setup() { // put your setup code here, to run once: Serial.begin(115200); // open serial connection to USB Serial //port(connected to your computer) Serial1.begin(57600); // open internal serial connection to MT7688 // OLED Wire.begin(); SeeedOled.init(); SeeedOled.clearDisplay(); //清除螢幕 SeeedOled.setNormalDisplay(); //設定螢幕為正常模式(非反白) SeeedOled.setPageMode(); //設定尋址模式頁模式 SeeedOled.setTextXY(0,0); //設定啟始坐標 } void loop() { // put your main code here, to run repeatedly: while (Serial1.available() > 0){ char recieved = Serial1.read(); inData += recieved; // Process message when new line character is recieved if (recieved == '\n') { Serial.print("Arduino Received: "); Serial.print(inData); // OLED char *p = const_cast<char*>(inData.c_str()); SeeedOled.clearDisplay(); //清除螢幕 SeeedOled.setTextXY(1,0); //設定啟始坐標 SeeedOled.putString(p); inData = ""; // Clear recieved buffer } } }
[ "archerhuang@iii.org.tw" ]
archerhuang@iii.org.tw
f4c4d0a2ff0f111b346462221ec4765b17d6bba4
4c23be1a0ca76f68e7146f7d098e26c2bbfb2650
/3WeekTutorial/day1/elbow_quad_refined/48/phi
d9d127a361fae8fbfb229250669fa8f013e32953
[]
no_license
labsandy/OpenFOAM_workspace
a74b473903ddbd34b31dc93917e3719bc051e379
6e0193ad9dabd613acf40d6b3ec4c0536c90aed4
refs/heads/master
2022-02-25T02:36:04.164324
2019-08-23T02:27:16
2019-08-23T02:27:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
170,770
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class surfaceScalarField; location "48"; object phi; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 3 -1 0 0 0 0]; internalField nonuniform List<scalar> 17370 ( -0.0900006 0.0898547 0.289157 -0.0714629 0.0537589 0.364479 -0.0381276 0.0277025 0.426593 -0.0196538 0.0146218 0.504284 -0.0107788 0.00828655 0.601894 -0.00628544 0.00490916 0.720434 -0.00374717 0.00290851 0.863745 -0.00216835 0.00160963 1.03601 -0.00109332 0.000681514 1.24291 -0.000274691 -0.000114794 1.49158 0.00049221 -0.00089839 1.4916 0.00129313 -0.0017822 1.24318 0.00231424 -0.00302818 1.03635 0.00384939 -0.00500009 0.864057 0.00637084 -0.0083672 0.721054 0.0108539 -0.0146898 0.60305 0.0197154 -0.0277574 0.507481 0.0381769 -0.0538009 0.431792 0.0714972 -0.0898775 0.365156 0.0900139 0.198997 -0.128129 0.0882073 0.0399221 -0.364588 0.353399 -0.0746947 0.0858841 -0.446476 0.454315 -0.0843929 0.0765535 -0.521185 0.529893 -0.0684653 0.0597579 -0.612783 0.621558 -0.0515726 0.0427971 -0.72689 0.734152 -0.0353411 0.0280789 -0.867473 0.872578 -0.0224867 0.017382 -1.03847 1.04191 -0.0135807 0.0101379 -1.2446 1.24703 -0.00753157 0.00510304 -1.49263 1.4946 -0.00316009 0.0011895 -1.4925 1.49422 0.000493103 -0.00221316 -1.24398 1.24586 0.00411372 -0.00599568 -1.03751 1.04005 0.00835274 -0.0108882 -0.866104 0.869841 0.014253 -0.0179901 -0.724396 0.729944 0.0230361 -0.0285836 -0.608702 0.616118 0.0358023 -0.0432187 -0.5149 0.523047 0.0519509 -0.0600977 -0.439858 0.447914 0.0687649 -0.0768209 -0.375305 0.376746 0.0846248 -0.0860658 -0.257334 0.222486 0.0748187 -0.0399706 -0.0685023 0.0586746 0.00982773 -0.0518473 0.0584414 -0.374115 0.367521 -0.0575342 0.0537874 -0.453588 0.457335 -0.0487018 0.0447523 -0.527936 0.531886 -0.0409156 0.037281 -0.621549 0.625184 -0.0331858 0.0291189 -0.735332 0.739399 -0.0245596 0.02041 -0.874321 0.878471 -0.0160738 0.0123875 -1.04347 1.04716 -0.00865887 0.00549314 -1.24855 1.25171 -0.00217181 -0.00089793 -1.49665 1.49972 0.00394323 -0.00720356 -1.49721 1.50047 0.0102812 -0.0138902 -1.25008 1.25369 0.0174583 -0.0216633 -1.04594 1.05014 0.0257011 -0.0301519 -0.877776 0.882227 0.0341325 -0.0381423 -0.739915 0.743924 0.0417024 -0.0454602 -0.62679 0.630547 0.0493419 -0.054363 -0.534825 0.539846 0.0580414 -0.0588618 -0.457492 0.458312 0.052167 -0.0319694 -0.335783 0.315585 0.00987986 -0.0683588 0.0584789 -0.0529196 0.0489182 0.00400135 -0.0331984 0.0437597 -0.358074 0.347513 -0.0474726 0.0468558 -0.459265 0.459881 -0.0438104 0.0404669 -0.535781 0.539125 -0.0367051 0.0334109 -0.628502 0.631796 -0.029984 0.0269627 -0.742615 0.745637 -0.0237155 0.020619 -0.881979 0.885076 -0.0171001 0.0137316 -1.05073 1.0541 -0.00995085 0.00642228 -1.25514 1.25867 -0.00246326 -0.00132669 -1.50323 1.50702 0.00508663 -0.0089556 -1.50414 1.50801 0.012363 -0.0159813 -1.25744 1.26106 0.0191866 -0.0225208 -1.05395 1.05728 0.0254553 -0.0285408 -0.885728 0.888813 0.0314319 -0.0347314 -0.747196 0.750495 0.0379176 -0.0415677 -0.634344 0.637994 0.0448148 -0.0477509 -0.544167 0.547103 0.0482536 -0.0443802 -0.456609 0.452735 0.0336276 -0.0162003 -0.29624 0.278813 0.00406583 -0.0526657 0.0485999 -0.0458351 0.0433331 0.00250202 -0.022852 0.0332538 -0.336806 0.326404 -0.0390973 0.0401297 -0.459556 0.458523 -0.0389546 0.0366794 -0.541836 0.544111 -0.0340257 0.031443 -0.634835 0.637418 -0.0283962 0.0255128 -0.748668 0.751552 -0.0222662 0.0192877 -0.888013 0.890991 -0.0159984 0.0129128 -1.05722 1.0603 -0.009402 0.00600691 -1.26211 1.26551 -0.00205786 -0.00181544 -1.51089 1.51476 0.00564965 -0.0094818 -1.51191 1.51574 0.0127193 -0.0160197 -1.26451 1.26781 0.0188933 -0.0219396 -1.06039 1.06344 0.0247005 -0.0277256 -0.89188 0.894905 0.0304284 -0.0332996 -0.753714 0.756585 0.0357353 -0.0382398 -0.641074 0.643578 0.0403862 -0.0413917 -0.548922 0.549927 0.0401835 -0.0340834 -0.447476 0.441376 0.0234015 -0.0102111 -0.26362 0.25043 0.00258144 -0.0454449 0.0428634 -0.0412518 0.0394775 0.00177434 -0.0167991 0.0260794 -0.316527 0.307247 -0.0327152 0.0348779 -0.456908 0.454745 -0.0344774 0.0328234 -0.546077 0.547731 -0.0306602 0.0285816 -0.639707 0.641785 -0.0261699 0.0237915 -0.754177 0.756555 -0.0209553 0.0181867 -0.893864 0.896633 -0.0149746 0.0119281 -1.06333 1.06637 -0.00846174 0.00515496 -1.26881 1.27211 -0.00133658 -0.00238879 -1.51854 1.52227 0.00606453 -0.00973491 -1.51949 1.52316 0.0128421 -0.0160412 -1.27107 1.27427 0.0188177 -0.02172 -1.06647 1.06937 0.024209 -0.0267574 -0.89774 0.900288 0.0288995 -0.0310819 -0.759051 0.761234 0.0329716 -0.0349429 -0.645748 0.647719 0.0364102 -0.0365815 -0.550464 0.550635 0.0341494 -0.0271393 -0.434742 0.427732 0.0174832 -0.00737505 -0.238932 0.228824 0.00187123 -0.0406944 0.0388231 -0.037948 0.0366106 0.00133739 -0.0128457 0.0208256 -0.298624 0.290644 -0.0276136 0.0305655 -0.452164 0.449212 -0.0307954 0.0296965 -0.549146 0.550245 -0.0277219 0.0258242 -0.643802 0.6457 -0.0236474 0.0215333 -0.75877 0.760884 -0.0190459 0.016589 -0.899177 0.901634 -0.0136769 0.0108254 -1.06928 1.07213 -0.00749221 0.00427519 -1.27535 1.27856 -0.000548412 -0.00306664 -1.52591 1.52952 0.00662045 -0.0101626 -1.52676 1.53031 0.0131318 -0.016134 -1.27741 1.28041 0.0186512 -0.0211782 -1.07211 1.07464 0.0232852 -0.0254089 -0.902602 0.904725 0.0272216 -0.0291048 -0.763241 0.765124 0.0307644 -0.0325088 -0.649556 0.651301 0.0333357 -0.032784 -0.550454 0.549902 0.0294468 -0.0221473 -0.420523 0.413224 0.0136861 -0.00570262 -0.219881 0.211898 0.00145522 -0.0371871 0.0357318 -0.0354413 0.034408 0.00103334 -0.0100557 0.0168092 -0.283306 0.276552 -0.023337 0.0267473 -0.446016 0.442605 -0.0275629 0.0268894 -0.551126 0.5518 -0.0251572 0.0233976 -0.647571 0.649331 -0.0213568 0.0193683 -0.762926 0.764915 -0.0170282 0.0147303 -0.903938 0.906236 -0.0120251 0.00937234 -1.07481 1.07747 -0.00624966 0.00319455 -1.28166 1.28472 0.000389642 -0.0038857 -1.53306 1.53655 0.00730659 -0.0106637 -1.53376 1.53712 0.0134136 -0.0161283 -1.28329 1.286 0.0183694 -0.0206 -1.07702 1.07925 0.0224646 -0.0243518 -0.906737 0.908624 0.0259637 -0.0276372 -0.7669 0.768574 0.0291 -0.030512 -0.652898 0.65431 0.0308446 -0.0295788 -0.549005 0.547739 0.0256386 -0.0184398 -0.405952 0.398753 0.0110836 -0.00458886 -0.20473 0.198235 0.00117653 -0.0344332 0.0332567 -0.0334996 0.0326919 0.000807709 -0.0079892 0.0136746 -0.270365 0.26468 -0.0197236 0.0233373 -0.439089 0.435475 -0.0246362 0.0242146 -0.552386 0.552807 -0.0227528 0.0211056 -0.651083 0.652731 -0.019163 0.017265 -0.766847 0.768745 -0.0150256 0.0128259 -0.908412 0.910612 -0.0102372 0.00770574 -1.07998 1.08251 -0.00473556 0.00183308 -1.28764 1.29054 0.00156765 -0.00487931 -1.53994 1.54325 0.00809774 -0.0112194 -1.54035 1.54348 0.0137473 -0.0162165 -1.28861 1.29108 0.0182418 -0.0202472 -1.08139 1.08339 0.0219143 -0.0235959 -0.910428 0.91211 0.0250289 -0.0265164 -0.770155 0.771643 0.0277935 -0.0288444 -0.655517 0.656568 0.0288166 -0.0268998 -0.546151 0.544234 0.0225831 -0.015677 -0.391697 0.384791 0.0092448 -0.00381302 -0.192323 0.186891 0.000981855 -0.032191 0.0312092 -0.0319813 0.0313486 0.000632702 -0.00639476 0.0111683 -0.259481 0.254708 -0.0166334 0.0202552 -0.431863 0.428241 -0.0218875 0.0217017 -0.553155 0.553341 -0.0204843 0.0189036 -0.654394 0.655975 -0.0170276 0.0151885 -0.7706 0.77244 -0.0130165 0.010881 -0.912697 0.914832 -0.00836644 0.0059121 -1.08492 1.08738 -0.00304501 0.000262612 -1.29333 1.29611 0.00296862 -0.00608643 -1.54642 1.54954 0.00909145 -0.0119842 -1.54647 1.54936 0.0143129 -0.0165728 -1.29347 1.29573 0.0184122 -0.0202168 -1.08532 1.08713 0.0217014 -0.023189 -0.913717 0.915205 0.0244544 -0.0257647 -0.773055 0.774365 0.0268966 -0.0275444 -0.657399 0.658047 0.0271584 -0.0247028 -0.542063 0.539607 0.0201659 -0.013621 -0.378077 0.371532 0.00792697 -0.00326404 -0.181884 0.177221 0.000844696 -0.0303079 0.0294633 -0.0307946 0.0303035 0.000491076 -0.00511114 0.00909773 -0.250356 0.246369 -0.0139326 0.0174118 -0.424702 0.421223 -0.0192365 0.0192523 -0.553476 0.55346 -0.0182409 0.0167074 -0.657603 0.659136 -0.0148655 0.0130519 -0.774249 0.776063 -0.010912 0.00881513 -0.916855 0.918952 -0.00635615 0.00396485 -1.08971 1.0921 -0.00118099 -0.00150669 -1.29878 1.30147 0.00460482 -0.00756376 -1.55254 1.5555 0.0103862 -0.0130721 -1.55214 1.55483 0.0152062 -0.017247 -1.2979 1.29994 0.0188844 -0.0204722 -1.08886 1.09045 0.0217714 -0.0230782 -0.91663 0.917937 0.0241984 -0.0253548 -0.775613 0.77677 0.0262983 -0.0265966 -0.658491 0.658789 0.025833 -0.0229347 -0.536942 0.534044 0.0182857 -0.0121028 -0.365189 0.359006 0.00698342 -0.00287751 -0.172871 0.168765 0.000749524 -0.028678 0.0279284 -0.0298792 0.0295071 0.000372142 -0.00403818 0.00733407 -0.242753 0.239457 -0.0115289 0.0147588 -0.417887 0.414657 -0.0166536 0.0168365 -0.553424 0.553241 -0.0159137 0.0144619 -0.660712 0.662163 -0.0126242 0.010805 -0.777859 0.779678 -0.00866197 0.00657142 -0.920937 0.923027 -0.00413217 0.00177401 -1.09437 1.09673 0.000953387 -0.00356526 -1.30405 1.30666 0.00654833 -0.00936288 -1.55834 1.56115 0.0120118 -0.0144968 -1.5574 1.55988 0.0164411 -0.0182738 -1.3019 1.30373 0.0197246 -0.021112 -1.09198 1.09337 0.0222335 -0.0233589 -0.919189 0.920314 0.0243279 -0.0253163 -0.77787 0.778858 0.026014 -0.0260212 -0.658944 0.658952 0.0248679 -0.0215879 -0.530964 0.527684 0.0168788 -0.0110114 -0.35301 0.347143 0.00632439 -0.00261426 -0.16489 0.16118 0.000686797 -0.0272227 0.0265359 -0.0291952 0.0289291 0.000266074 -0.00309709 0.00576907 -0.236494 0.233822 -0.00932394 0.0122226 -0.411616 0.408717 -0.0140781 0.014362 -0.553081 0.552797 -0.0135054 0.0121154 -0.663676 0.665066 -0.010269 0.00841833 -0.781484 0.783334 -0.00623444 0.00411147 -0.925013 0.927136 -0.00164955 -0.000710559 -1.09897 1.10133 0.00341523 -0.00597928 -1.30916 1.31173 0.00887513 -0.0115692 -1.56385 1.56655 0.0140605 -0.0163498 -1.56224 1.56453 0.0181014 -0.0197166 -1.30548 1.3071 0.0209721 -0.0221544 -1.09471 1.09589 0.0230975 -0.0240454 -0.9214 0.922348 0.0248674 -0.025687 -0.779775 0.780595 0.0261209 -0.025869 -0.658818 0.658566 0.0242917 -0.0206492 -0.524244 0.520602 0.0158907 -0.0102679 -0.341438 0.335815 0.00588937 -0.00244748 -0.157638 0.154197 0.000649588 -0.0258817 0.0252321 -0.0287204 0.0285554 0.000164984 -0.00222404 0.00431009 -0.231463 0.229377 -0.00722031 0.00971696 -0.406052 0.403555 -0.0114213 0.0117201 -0.552597 0.552298 -0.0108852 0.00951104 -0.666553 0.667927 -0.00762306 0.0057155 -0.78517 0.787077 -0.00346939 0.00129806 -0.929143 0.931314 0.0012049 -0.00358943 -1.10358 1.10596 0.00630079 -0.00884561 -1.31419 1.31673 0.0116789 -0.0142672 -1.56913 1.57172 0.0166095 -0.018708 -1.5667 1.5688 0.0202708 -0.0216683 -1.30863 1.31003 0.0227177 -0.0236672 -1.09703 1.09798 0.0243997 -0.0251361 -0.923247 0.923984 0.0257915 -0.0264617 -0.781326 0.781996 0.0266062 -0.02602 -0.65809 0.657504 0.0240437 -0.0200722 -0.516842 0.512871 0.0152588 -0.00980434 -0.330329 0.324874 0.0056301 -0.00235573 -0.150876 0.147602 0.000632074 -0.024607 0.023975 -0.0284473 0.0283847 6.25506e-05 -0.00137168 0.00288515 -0.227597 0.226084 -0.00513427 0.00716478 -0.401329 0.399299 -0.00861853 0.00885728 -0.552139 0.5519 -0.00800551 0.0066155 -0.669431 0.670821 -0.00465164 0.00265506 -0.788971 0.790967 -0.000303137 -0.00196034 -0.93337 0.935634 0.00455223 -0.00700026 -1.10824 1.11069 0.00975237 -0.0122976 -1.31918 1.32172 0.015078 -0.0175572 -1.57418 1.57666 0.0197386 -0.0216276 -1.57076 1.57265 0.0229838 -0.0241474 -1.31133 1.31249 0.0249839 -0.0256988 -1.0989 1.09962 0.0262154 -0.0267339 -0.924695 0.925214 0.0272185 -0.0276897 -0.782517 0.782988 0.0275557 -0.0265834 -0.656655 0.655683 0.0241868 -0.0198669 -0.508799 0.504479 0.0149598 -0.00958625 -0.319526 0.314152 0.00552161 -0.00232861 -0.14441 0.141217 0.000631956 -0.0233608 0.0227289 -0.0283791 0.0284255 -4.63661e-05 -0.000488993 0.00142001 -0.224881 0.22395 -0.00297527 0.00447067 -0.397575 0.39608 -0.00557017 0.00566708 -0.551866 0.551769 -0.00475085 0.0033003 -0.672378 0.673829 -0.001241 -0.000874265 -0.792948 0.795063 0.00336971 -0.00576247 -0.937783 0.940176 0.00848376 -0.0110288 -1.11303 1.11557 0.013855 -0.0164298 -1.32417 1.32674 0.019189 -0.0215851 -1.57903 1.58142 0.0236195 -0.0252993 -1.57439 1.57607 0.0264367 -0.0273449 -1.31355 1.31446 0.0279406 -0.0283879 -1.10031 1.10076 0.0286629 -0.0289366 -0.92571 0.925983 0.0292233 -0.0294192 -0.783189 0.783385 0.029019 -0.0275717 -0.654421 0.652974 0.0247204 -0.0200291 -0.500084 0.495393 0.0149798 -0.00959609 -0.308854 0.303471 0.00555141 -0.00236071 -0.138074 0.134883 0.000647752 -0.0221089 0.0214612 -0.028529 0.0286924 -0.000163402 0.000442479 -0.000131528 -0.223342 0.223031 -0.000681742 0.00156535 -0.394927 0.394044 -0.00219938 0.00205524 -0.551958 0.552102 -0.000994387 -0.000586525 -0.675503 0.677084 0.00279169 -0.00506708 -0.79716 0.799435 0.00774449 -0.0102962 -0.942443 0.944995 0.0131785 -0.0158526 -1.11801 1.12069 0.0187909 -0.0214239 -1.32922 1.33186 0.0241805 -0.0264917 -1.58369 1.58601 0.0283673 -0.0298169 -1.57759 1.57904 0.0307172 -0.0313382 -1.31524 1.31586 0.0316652 -0.0318218 -1.10117 1.10133 0.031832 -0.0318339 -0.926223 0.926225 0.0319007 -0.031772 -0.783225 0.783096 0.0310446 -0.0290493 -0.65127 0.649275 0.0257044 -0.0205896 -0.49064 0.485525 0.0153242 -0.00982803 -0.298125 0.292629 0.00571368 -0.00244939 -0.13171 0.128445 0.000678841 -0.0208201 0.0201413 -0.028935 0.0292409 -0.000305881 0.00145959 -0.00180083 -0.223079 0.22342 0.00183648 -0.00166843 -0.393526 0.393358 0.00162246 -0.00210462 -0.552627 0.553109 0.00336739 -0.00512531 -0.678937 0.680695 0.00754473 -0.010035 -0.801689 0.80418 0.0129557 -0.0157246 -0.947421 0.95019 0.0188315 -0.0216863 -1.12326 1.12612 0.0247801 -0.0274985 -1.33439 1.33711 0.0302625 -0.0324857 -1.58819 1.59041 0.0341779 -0.0353546 -1.58031 1.58149 0.0359866 -0.0362781 -1.31632 1.31661 0.0363035 -0.0361413 -1.10141 1.10124 0.0358638 -0.0355656 -0.926161 0.925863 0.0353978 -0.0348409 -0.782519 0.781962 0.0337015 -0.0310807 -0.647087 0.644466 0.0271742 -0.0215602 -0.480352 0.474738 0.0159927 -0.0102766 -0.287135 0.281419 0.00600309 -0.00259144 -0.125169 0.121757 0.000724067 -0.0194647 0.0187407 -0.0296182 0.0300959 -0.00047762 0.00272781 -0.00381668 -0.224147 0.225236 0.00474611 -0.00539079 -0.393573 0.394218 0.00606108 -0.00697885 -0.554112 0.55503 0.00852561 -0.010523 -0.682784 0.684781 0.0132282 -0.0160001 -0.806646 0.809418 0.019239 -0.0222904 -0.952845 0.955897 0.0256835 -0.0287637 -1.12888 1.13196 0.0320485 -0.0348764 -1.33973 1.34256 0.0376672 -0.0397988 -1.59249 1.59462 0.0412834 -0.0421412 -1.58245 1.58331 0.0424351 -0.0423512 -1.31671 1.31663 0.0420311 -0.0415078 -1.10093 1.10041 0.0409074 -0.0402655 -0.925437 0.924795 0.0397715 -0.0387412 -0.780903 0.779873 0.0370711 -0.0337393 -0.641713 0.638381 0.0291879 -0.0229765 -0.469069 0.462857 0.0170014 -0.0109458 -0.275667 0.269612 0.00641934 -0.00278576 -0.118305 0.114672 0.000782736 -0.0180152 0.0172325 -0.0306533 0.0313464 -0.000693108 0.00420959 -0.00618882 -0.226768 0.228748 0.0081704 -0.00970908 -0.395289 0.396828 0.0112246 -0.0127333 -0.55665 0.558159 0.0147339 -0.0170838 -0.68718 0.68953 0.0201785 -0.0233079 -0.81216 0.81529 0.0269328 -0.0303215 -0.958836 0.962225 0.034059 -0.0374158 -1.13495 1.13831 0.0409393 -0.0438953 -1.34528 1.34823 0.0466982 -0.0486955 -1.59657 1.59857 0.0499165 -0.050409 -1.58392 1.58441 0.0502962 -0.0497855 -1.3163 1.31579 0.0490587 -0.0481069 -1.09965 1.0987 0.0471291 -0.0460893 -0.923952 0.922912 0.0451516 -0.0436122 -0.778312 0.776772 0.0412938 -0.0371417 -0.634956 0.630804 0.0318319 -0.0248877 -0.45658 0.449636 0.0183759 -0.0118461 -0.263477 0.256947 0.00696543 -0.00303183 -0.110968 0.107034 0.00085416 -0.0164447 0.0155906 -0.0321192 0.0330982 -0.000979056 0.00609253 -0.00914794 -0.231188 0.234244 0.0123661 -0.0149573 -0.398956 0.401547 0.0174429 -0.0196555 -0.56054 0.562753 0.0222437 -0.0250599 -0.692363 0.695179 0.0286638 -0.0322517 -0.818393 0.82198 0.0363662 -0.0401784 -0.965511 0.969323 0.0443406 -0.0480246 -1.14158 1.14526 0.0518126 -0.0548965 -1.35106 1.35415 0.0576819 -0.0594937 -1.60035 1.60216 0.0603823 -0.0604153 -1.58461 1.58464 0.05984 -0.0587951 -1.31495 1.3139 0.0575928 -0.056137 -1.09741 1.09595 0.0547182 -0.0532204 -0.921575 0.920077 0.0517574 -0.0496097 -0.774675 0.772528 0.0465217 -0.0413928 -0.626573 0.621444 0.0351742 -0.0273309 -0.442613 0.43477 0.0201314 -0.0129763 -0.250294 0.243139 0.00763403 -0.00332313 -0.103003 0.0986925 0.000935517 -0.0147295 0.013794 -0.0341499 0.0355247 -0.00137485 0.00857538 -0.0129579 -0.237756 0.242139 0.0176556 -0.0214721 -0.404917 0.408734 0.0250824 -0.0281395 -0.566079 0.569137 0.0314797 -0.0349094 -0.698567 0.701996 0.0391752 -0.0433525 -0.825547 0.829724 0.0480917 -0.0524339 -0.973059 0.977401 0.0571044 -0.0611542 -1.14886 1.15291 0.0652012 -0.0683655 -1.35707 1.36023 0.0710386 -0.0725414 -1.60368 1.60518 0.0729562 -0.0723832 -1.58428 1.58371 0.0712416 -0.0695575 -1.31241 1.31073 0.0678177 -0.0657966 -1.09405 1.09203 0.0638832 -0.0618761 -0.918182 0.916175 0.0597769 -0.0569128 -0.769775 0.766911 0.0528964 -0.0465962 -0.616249 0.609949 0.0392836 -0.0303341 -0.426838 0.417888 0.0222655 -0.014317 -0.235819 0.22787 0.00840329 -0.00364508 -0.0942626 0.0895043 0.00102122 -0.0128526 0.0118313 -0.0369443 0.0388884 -0.0019441 0.0119812 -0.0180634 -0.246947 0.253029 0.0245432 -0.0297873 -0.41366 0.418904 0.0347227 -0.0388251 -0.573653 0.577755 0.0431552 -0.0474217 -0.706116 0.710382 0.0525676 -0.0574824 -0.833886 0.838801 0.0629542 -0.0678765 -0.98167 0.986592 0.0730617 -0.0774402 -1.15684 1.16122 0.0816636 -0.0847945 -1.36316 1.36629 0.0871978 -0.088222 -1.6063 1.60732 0.0879964 -0.0866502 -1.58267 1.58132 0.0847863 -0.0823455 -1.30851 1.30607 0.0799698 -0.0773286 -1.08941 1.08677 0.0748971 -0.0722742 -0.913628 0.911006 0.0695049 -0.0657177 -0.763336 0.759549 0.0605849 -0.0528734 -0.603581 0.59587 0.0442284 -0.0339129 -0.408842 0.398526 0.02476 -0.0158306 -0.219723 0.210794 0.00923517 -0.00397301 -0.0846168 0.0793547 0.00110182 -0.0108099 0.00970813 -0.0408191 0.0436407 -0.00282163 0.0169286 -0.0252421 -0.259479 0.267792 0.0339057 -0.0408505 -0.42584 0.432785 0.047376 -0.0527652 -0.583758 0.589148 0.0583564 -0.06373 -0.715471 0.720844 0.0700035 -0.0757914 -0.843687 0.849474 0.0820588 -0.0875494 -0.991419 0.99691 0.0931666 -0.0977404 -1.16539 1.16996 0.101936 -0.104806 -1.36906 1.37193 0.106655 -0.106932 -1.60782 1.6081 0.105821 -0.103494 -1.57939 1.57707 0.100757 -0.0974034 -1.30299 1.29963 0.0942689 -0.0909023 -1.08334 1.07998 0.0878831 -0.0845424 -0.907621 0.90428 0.0810785 -0.0761898 -0.754935 0.750047 0.0697092 -0.0602909 -0.588059 0.57864 0.0500296 -0.038044 -0.388119 0.376134 0.0275586 -0.0174458 -0.201658 0.191545 0.0100673 -0.00427075 -0.073974 0.0681775 0.00116425 -0.00861788 0.00745363 -0.0463358 0.0506356 -0.00429981 0.0245916 -0.0359258 -0.276495 0.28783 0.0474027 -0.0566203 -0.442457 0.451675 0.065129 -0.0720344 -0.596989 0.603894 0.0791661 -0.0859851 -0.727078 0.733897 0.0934314 -0.100032 -0.855162 0.861762 0.106946 -0.112795 -1.00221 1.00806 0.118533 -0.122964 -1.17416 1.17859 0.126723 -0.128952 -1.37422 1.37645 0.129834 -0.129005 -1.60763 1.6068 0.126697 -0.123118 -1.574 1.57042 0.11932 -0.114906 -1.29556 1.29114 0.110908 -0.106729 -1.07567 1.07149 0.103063 -0.0989227 -0.899953 0.895814 0.0946383 -0.0883761 -0.744148 0.737886 0.0802652 -0.0688004 -0.569035 0.55757 0.0566098 -0.0426201 -0.36408 0.350091 0.030534 -0.0190402 -0.181277 0.169783 0.010806 -0.00449012 -0.0623168 0.0560009 0.00119234 -0.00631845 0.00512612 -0.0545537 0.0618966 -0.00734292 0.0379457 -0.0537224 -0.300106 0.315883 0.0691726 -0.081515 -0.465137 0.477479 0.0921174 -0.100382 -0.613773 0.622037 0.109048 -0.117145 -0.741251 0.749348 0.125522 -0.132515 -0.868058 0.875052 0.13949 -0.145103 -1.01345 1.01907 0.150314 -0.154002 -1.18234 1.18603 0.156707 -0.157726 -1.3778 1.37882 0.157087 -0.154669 -1.60496 1.60254 0.150762 -0.145619 -1.56593 1.56078 0.140532 -0.134885 -1.28591 1.28027 0.129907 -0.124837 -1.06622 1.06115 0.120493 -0.115584 -0.890403 0.885494 0.110214 -0.102256 -0.730398 0.72244 0.0921189 -0.0781247 -0.545689 0.531695 0.0636126 -0.0473418 -0.336048 0.319777 0.0334538 -0.0204741 -0.158333 0.145353 0.0113675 -0.00459317 -0.0497782 0.0430039 0.00116538 -0.0039834 0.00281801 -0.0687465 0.0728348 -0.00408832 0.0288815 -0.0426484 -0.33423 0.347997 0.0564288 -0.0677694 -0.49525 0.506591 0.0778471 -0.0872387 -0.633787 0.643178 0.0977075 -0.1073 -0.756835 0.766427 0.117876 -0.127159 -0.88105 0.890334 0.136927 -0.145484 -1.02375 1.03231 0.154258 -0.161562 -1.18861 1.19591 0.1685 -0.173599 -1.37861 1.3837 0.177446 -0.178951 -1.59883 1.60033 0.178064 -0.175323 -1.55451 1.55177 0.171596 -0.166719 -1.2737 1.26882 0.162191 -0.156892 -1.05479 1.04949 0.152351 -0.14692 -0.878668 0.873237 0.14021 -0.129041 -0.712799 0.70163 0.114387 -0.0948396 -0.517062 0.497514 0.0753053 -0.05398 -0.303281 0.281956 0.0366785 -0.0214245 -0.132861 0.117607 0.011309 -0.00430161 -0.0367671 0.0297597 0.00097891 -0.00169545 0.000716543 -0.080151 0.0782264 0.00192461 0.00755322 -0.0163938 -0.364491 0.373331 0.0268198 -0.0349875 -0.522517 0.530685 0.0431188 -0.05093 -0.655137 0.662948 0.0604954 -0.0693933 -0.775504 0.784402 0.0788407 -0.0873742 -0.89902 0.907554 0.0963249 -0.103816 -1.04056 1.04805 0.111658 -0.11779 -1.20297 1.2091 0.123511 -0.127354 -1.38838 1.39222 0.12958 -0.12965 -1.60085 1.60093 0.12738 -0.12324 -1.54813 1.54399 0.118071 -0.111691 -1.2633 1.25692 0.105701 -0.0990212 -1.0429 1.03622 0.0928173 -0.0857708 -0.863767 0.856721 0.0786056 -0.0689587 -0.686564 0.676917 0.058042 -0.0449271 -0.476404 0.463289 0.0330711 -0.0217922 -0.26064 0.249361 0.0136918 -0.00742489 -0.103 0.0967329 0.00366351 -0.00129221 -0.0229879 0.0206166 0.000243886 0.000537173 -0.000781059 -0.0815489 0.0787112 0.00283764 -0.00120114 -0.0038205 -0.384974 0.389996 0.010691 -0.0166753 -0.542684 0.548669 0.0227373 -0.0294657 -0.673196 0.679925 0.0377705 -0.0454895 -0.792363 0.800082 0.0538888 -0.0613147 -0.915288 0.922714 0.0688561 -0.07553 -1.05536 1.06204 0.0823027 -0.0876699 -1.21478 1.22014 0.0922101 -0.0949926 -1.39537 1.39815 0.0963727 -0.0954679 -1.60023 1.59933 0.0922237 -0.0871011 -1.53911 1.53398 0.0811529 -0.0741295 -1.25017 1.24315 0.0671643 -0.0596571 -1.0284 1.02089 0.0527156 -0.045027 -0.84712 0.839431 0.0380452 -0.0297748 -0.663654 0.655384 0.0216961 -0.0133168 -0.44836 0.439981 0.00739718 -0.00322357 -0.237305 0.233131 0.00107639 -4.58219e-05 -0.0900541 0.0890236 -0.000249538 0.000202017 -0.0178286 0.0178762 -0.000109111 0.00137552 -0.00126641 -0.0803714 0.0776432 0.00272819 -0.00484705 0.0023409 -0.398569 0.401076 0.00209046 -0.00659683 -0.55774 0.562246 0.0117199 -0.0173707 -0.68806 0.693711 0.0245244 -0.0311662 -0.807125 0.813767 0.038351 -0.0447281 -0.929592 0.93597 0.0515882 -0.0572562 -1.06827 1.07394 0.0631787 -0.067417 -1.2251 1.22934 0.071249 -0.0734383 -1.40069 1.40288 0.0740272 -0.0722461 -1.59791 1.59613 0.0685813 -0.0631165 -1.52819 1.52272 0.0569156 -0.0493259 -1.23576 1.22817 0.0422144 -0.0344983 -1.01261 1.00489 0.0271685 -0.0194532 -0.829826 0.822111 0.0124253 -0.00549559 -0.643929 0.637 -0.000339997 0.00481731 -0.430037 0.42556 -0.00668512 0.00673863 -0.226671 0.226617 -0.00583302 0.00412077 -0.0870063 0.0887185 -0.00265083 0.00122214 -0.0173303 0.018759 -0.000379472 0.00155094 -0.00117147 -0.0789608 0.0765756 0.00238516 -0.0059572 0.00498165 -0.407737 0.408713 -0.00164402 -0.00172607 -0.569827 0.573198 0.00585081 -0.0109907 -0.700562 0.705702 0.0170269 -0.0228915 -0.819681 0.825545 0.0291524 -0.0347395 -0.941908 0.947495 0.0406808 -0.04578 -1.07949 1.08459 0.0508381 -0.0547687 -1.23344 1.23738 0.0580328 -0.0597765 -1.40469 1.40644 0.0599629 -0.0579418 -1.59416 1.59214 0.0541899 -0.0485885 -1.51662 1.51102 0.0425306 -0.0352525 -1.22057 1.21329 0.0282322 -0.020301 -0.996538 0.988606 0.0129447 -0.00508331 -0.812653 0.804792 -0.00150064 0.0073687 -0.627208 0.62134 -0.0114774 0.0138155 -0.418409 0.416071 -0.013839 0.0119486 -0.223674 0.225564 -0.00956071 0.00664611 -0.0894133 0.0923279 -0.00413603 0.00185088 -0.0197246 0.0220098 -0.000544879 0.00107302 -0.000528145 -0.0776954 0.0756775 0.00201782 -0.00581438 0.00528638 -0.414129 0.414657 -0.00326349 0.000486924 -0.579221 0.581998 0.00358215 -0.0080156 -0.7112 0.715633 0.0132397 -0.018363 -0.830604 0.835727 0.0239743 -0.0290277 -0.952753 0.957806 0.0345423 -0.0390822 -1.08944 1.09398 0.0437063 -0.0473004 -1.24104 1.24464 0.0502115 -0.0517113 -1.40793 1.40943 0.0517262 -0.050083 -1.59009 1.58844 0.0464444 -0.0412193 -1.50508 1.49986 0.0353793 -0.0283196 -1.20589 1.19883 0.0217047 -0.0138678 -0.980347 0.97251 0.00676331 0.000505083 -0.795985 0.788717 -0.00653562 0.0117158 -0.612729 0.607549 -0.0150399 0.0167961 -0.410683 0.408927 -0.016065 0.0135042 -0.2244 0.226961 -0.0107577 0.0074359 -0.0942508 0.0975726 -0.00459363 0.00207225 -0.0237243 0.0262456 -0.000609663 0.000182999 0.000426664 -0.0767912 0.0752404 0.00155089 -0.00490032 0.00466491 -0.419002 0.419237 -0.00294757 0.000817704 -0.587509 0.589639 0.00302155 -0.0070883 -0.720484 0.724551 0.0120872 -0.0165409 -0.840458 0.844912 0.0215216 -0.02606 -0.962846 0.967384 0.0313615 -0.0355488 -1.09857 1.10276 0.0397324 -0.0432041 -1.24807 1.25155 0.0463523 -0.0478025 -1.41097 1.41242 0.0480201 -0.0464513 -1.58647 1.58491 0.043316 -0.0380976 -1.49446 1.48924 0.0326553 -0.0260506 -1.19162 1.18502 0.0196904 -0.0126318 -0.964692 0.957633 0.00614215 0.000609081 -0.780699 0.773948 -0.00588915 0.0108178 -0.599851 0.594922 -0.0138781 0.0154075 -0.404384 0.402854 -0.0150371 0.0129585 -0.226398 0.228476 -0.0103744 0.00718757 -0.0997324 0.102919 -0.00447115 0.00205013 -0.0280468 0.0304679 -0.000617965 -0.000811253 0.00142922 -0.0764066 0.075213 0.0011936 -0.00378839 0.00365117 -0.422986 0.423123 -0.00200862 -2.83051e-05 -0.594797 0.596834 0.00368296 -0.00738181 -0.728895 0.732594 0.0117121 -0.0160373 -0.849327 0.853652 0.0206872 -0.0254099 -0.971743 0.976466 0.0300311 -0.0340781 -1.10706 1.11111 0.0384439 -0.0417465 -1.25492 1.25822 0.0445108 -0.0464648 -1.41382 1.41577 0.0469746 -0.0457753 -1.58343 1.58223 0.0428429 -0.0382305 -1.48422 1.4796 0.0331943 -0.0271115 -1.17817 1.17209 0.0214411 -0.0151518 -0.95057 0.94428 0.00940212 -0.00341595 -0.766912 0.760925 -0.00192178 0.00681253 -0.587935 0.583044 -0.00985777 0.0115883 -0.398653 0.396922 -0.0116792 0.010164 -0.22793 0.229446 -0.00823917 0.00576785 -0.104499 0.10697 -0.00364043 0.0017037 -0.0319606 0.0338974 -0.000534657 -0.00177195 0.00230661 -0.0765715 0.0755771 0.000994458 -0.00249207 0.00209293 -0.426639 0.427038 -0.000610643 -0.00147884 -0.601561 0.603651 0.00485105 -0.00845807 -0.736786 0.740393 0.0126467 -0.0166022 -0.857792 0.861748 0.0214033 -0.0253649 -0.98062 0.984582 0.0299899 -0.0339021 -1.11533 1.11924 0.0382013 -0.041748 -1.26152 1.26506 0.0448832 -0.0467156 -1.41753 1.41936 0.0476582 -0.0469232 -1.58098 1.58024 0.0447164 -0.0405766 -1.47494 1.4708 0.0362226 -0.0309256 -1.1663 1.161 0.0260349 -0.0204465 -0.937956 0.932367 0.0153291 -0.00952555 -0.754362 0.748558 0.00425633 0.000853419 -0.576421 0.571311 -0.00429815 0.00614191 -0.392649 0.390806 -0.00674266 0.00610341 -0.228413 0.229052 -0.00508012 0.00360499 -0.107769 0.109244 -0.00231855 0.0011355 -0.0347883 0.0359713 -0.000373912 -0.00253258 0.00290649 -0.0770322 0.0763434 0.000688784 -0.00135074 0.000482814 -0.430412 0.43128 0.000814012 -0.00305853 -0.607617 0.609861 0.00615734 -0.00967155 -0.744202 0.747717 0.0137095 -0.0178135 -0.865585 0.869689 0.0220243 -0.0261715 -0.988762 0.992909 0.0307863 -0.0345217 -1.12358 1.12732 0.0389644 -0.0425296 -1.26844 1.272 0.0457978 -0.0482373 -1.42163 1.42407 0.0497563 -0.0494244 -1.57959 1.57926 0.0476387 -0.044509 -1.46697 1.46384 0.041043 -0.0365077 -1.15583 1.15129 0.0321499 -0.0272295 -0.926791 0.921871 0.0219631 -0.0163215 -0.742113 0.736472 0.0109884 -0.0056356 -0.565021 0.559668 0.00202429 0.000427731 -0.386129 0.383677 -0.00154524 0.00190463 -0.227451 0.227091 -0.00175713 0.00133048 -0.109094 0.109521 -0.000933622 0.000506469 -0.0361683 0.0365954 -0.00019028 -0.00297689 0.00316717 -0.0778937 0.0773667 0.000527038 -0.000393516 -0.000413651 -0.43444 0.435247 0.0022775 -0.0043873 -0.613787 0.615897 0.00769665 -0.0111087 -0.751166 0.754578 0.0150071 -0.0187298 -0.873483 0.877206 0.0230871 -0.0269429 -0.997064 1.00092 0.0315322 -0.0357368 -1.13152 1.13572 0.0398725 -0.0438198 -1.27564 1.27958 0.0475832 -0.0501898 -1.42644 1.42904 0.0521797 -0.0527681 -1.57921 1.5798 0.0516709 -0.0494789 -1.46076 1.45857 0.0465135 -0.0426622 -1.14697 1.14312 0.0387699 -0.0338742 -0.916484 0.911588 0.0287199 -0.0228742 -0.729905 0.72406 0.0174514 -0.0119225 -0.55325 0.547721 0.00795649 -0.00501733 -0.378984 0.376045 0.00311165 -0.001881 -0.224707 0.223476 0.00109371 -0.000507902 -0.108404 0.107818 0.000122368 8.98649e-05 -0.0361574 0.0359452 -9.38304e-05 -0.00307274 0.00316657 -0.07903 0.0786788 0.000351123 0.000648926 -0.00164597 -0.43861 0.439607 0.00338507 -0.00580182 -0.619589 0.622005 0.00907264 -0.0123458 -0.757923 0.761197 0.0163345 -0.0199238 -0.880922 0.884511 0.0241422 -0.0281364 -1.00526 1.00925 0.0326607 -0.0368626 -1.13979 1.144 0.0412641 -0.0452911 -1.28347 1.2875 0.0493 -0.0527136 -1.43196 1.43538 0.0552437 -0.0562854 -1.58041 1.58145 0.0560791 -0.0544374 -1.45642 1.45478 0.0521559 -0.0488418 -1.13928 1.13596 0.0448805 -0.039953 -0.906266 0.901338 0.0347408 -0.0287037 -0.717495 0.711458 0.0233837 -0.0178197 -0.541603 0.536039 0.0137152 -0.0101395 -0.371162 0.367586 0.00761145 -0.00544279 -0.220268 0.218099 0.00364944 -0.0020945 -0.105833 0.104278 0.00102118 -0.000285079 -0.0348841 0.034148 -4.44776e-06 -0.002904 0.00290844 -0.0803877 0.0801573 0.000230438 0.00145582 -0.00255578 -0.442963 0.444063 0.00440434 -0.00687488 -0.625469 0.627939 0.0100258 -0.0133971 -0.764674 0.768045 0.0172112 -0.0208793 -0.888121 0.891789 0.0249423 -0.0290616 -1.01308 1.0172 0.0334659 -0.0379645 -1.14828 1.15278 0.0423312 -0.0467433 -1.2915 1.29592 0.0512182 -0.0547387 -1.43856 1.44208 0.0578884 -0.0599043 -1.58283 1.58485 0.0601675 -0.0594297 -1.45334 1.4526 0.0575451 -0.054184 -1.13245 1.12909 0.0503437 -0.0454013 -0.89602 0.891077 0.0402276 -0.0343254 -0.704997 0.699094 0.0289587 -0.0235434 -0.529829 0.524414 0.019048 -0.0148311 -0.362444 0.358227 0.0115327 -0.00838006 -0.214109 0.210956 0.00585854 -0.00346719 -0.101425 0.099034 0.00180789 -0.000610883 -0.0326078 0.0314108 8.97878e-05 -0.00257601 0.00248622 -0.0818407 0.0818158 2.48777e-05 0.0017863 -0.00314544 -0.447412 0.448771 0.00527386 -0.00798186 -0.631408 0.634116 0.0112467 -0.014457 -0.771367 0.774577 0.0178489 -0.021359 -0.8955 0.89901 0.0256958 -0.029646 -1.02134 1.02529 0.0344329 -0.0387721 -1.15692 1.16126 0.043668 -0.0479977 -1.30029 1.30462 0.0526325 -0.0567472 -1.44576 1.44987 0.0603699 -0.0630641 -1.58667 1.58937 0.0642586 -0.0638212 -1.45178 1.45135 0.0622847 -0.0592666 -1.12559 1.12257 0.0553487 -0.0503079 -0.885564 0.880523 0.0451639 -0.0392692 -0.692708 0.686813 0.0339589 -0.0284591 -0.518258 0.512758 0.0237194 -0.0189175 -0.352793 0.347991 0.0148945 -0.0108238 -0.206317 0.202246 0.00760323 -0.00454515 -0.0954846 0.0924265 0.00240553 -0.000881983 -0.0294454 0.0279219 0.000174834 -0.00210919 0.00193435 -0.0834214 0.0835153 -9.39033e-05 0.00228128 -0.00375585 -0.45205 0.453525 0.00596928 -0.00861638 -0.637114 0.639761 0.0119406 -0.0149613 -0.777982 0.781003 0.0184162 -0.0221162 -0.902626 0.906326 0.0259646 -0.0300802 -1.02938 1.03349 0.0347016 -0.0391349 -1.16573 1.17016 0.0442786 -0.0490849 -1.30927 1.31408 0.0539688 -0.0583344 -1.45417 1.45854 0.0627429 -0.0657998 -1.5922 1.59525 0.067812 -0.0679032 -1.45123 1.45132 0.0665737 -0.06352 -1.11937 1.11632 0.0598378 -0.0547707 -0.875137 0.87007 0.0496659 -0.0438847 -0.680375 0.674594 0.038475 -0.0327677 -0.506405 0.500697 0.0276706 -0.0222304 -0.342124 0.336684 0.0176042 -0.0127851 -0.196845 0.192026 0.00883941 -0.00524281 -0.0882569 0.0846603 0.00275791 -0.00101475 -0.0257483 0.0240051 0.000215722 -0.00155262 0.0013369 -0.0850889 0.0852297 -0.000140764 0.0025511 -0.00430398 -0.456619 0.458372 0.00675915 -0.00928134 -0.642803 0.645325 0.0124625 -0.0152975 -0.78438 0.787215 0.0188196 -0.0224312 -0.909652 0.913263 0.0264454 -0.0305858 -1.0373 1.04145 0.0347824 -0.0393784 -1.17472 1.17932 0.044695 -0.0496754 -1.31869 1.32367 0.0549596 -0.0596479 -1.46301 1.4677 0.0644721 -0.0682298 -1.59875 1.60251 0.0704852 -0.071427 -1.4514 1.45234 0.070397 -0.0676797 -1.11323 1.11051 0.0640215 -0.0590284 -0.864661 0.859668 0.0539801 -0.0479609 -0.668121 0.662102 0.0423251 -0.036252 -0.494163 0.48809 0.030567 -0.0246458 -0.330212 0.324291 0.0193078 -0.013909 -0.185983 0.180584 0.0094677 -0.00552649 -0.080103 0.0761618 0.002889 -0.00106907 -0.0217607 0.0199408 0.00022817 -0.000968937 0.000740767 -0.0867314 0.0869303 -0.000198883 0.00280501 -0.00461723 -0.461497 0.463309 0.00697368 -0.00968016 -0.648303 0.65101 0.0124165 -0.0156763 -0.790233 0.793493 0.0189889 -0.0224332 -0.916691 0.920135 0.0264216 -0.0303049 -1.0455 1.04938 0.0350791 -0.0395752 -1.18386 1.18836 0.0447433 -0.0499708 -1.32849 1.33372 0.055184 -0.0604063 -1.4728 1.47803 0.0657175 -0.0700022 -1.60655 1.61083 0.0729569 -0.0743093 -1.45302 1.45437 0.0737117 -0.0713886 -1.1078 1.10548 0.0680229 -0.0632228 -0.854488 0.849688 0.0580633 -0.0518127 -0.65559 0.649339 0.045722 -0.0387745 -0.481148 0.4742 0.0326112 -0.025867 -0.317244 0.3105 0.0198594 -0.013966 -0.173963 0.16807 0.00927931 -0.00528436 -0.071494 0.0674991 0.00271165 -0.000988341 -0.0177934 0.0160701 0.000212989 -0.000410122 0.000197134 -0.0884747 0.0886424 -0.000167638 0.00304244 -0.00457274 -0.46649 0.468021 0.00712229 -0.00955864 -0.653806 0.656242 0.0126726 -0.0154298 -0.796558 0.799315 0.0189192 -0.0221822 -0.923661 0.926924 0.0264227 -0.0301936 -1.05355 1.05732 0.0349227 -0.0390338 -1.19335 1.19746 0.0446578 -0.0496971 -1.3388 1.34384 0.0552349 -0.0606989 -1.48316 1.48863 0.0664815 -0.0713353 -1.61557 1.62042 0.0750492 -0.0769067 -1.45578 1.45763 0.076653 -0.0747625 -1.1031 1.10121 0.0717591 -0.0670819 -0.844423 0.839746 0.0618986 -0.0553066 -0.642413 0.635821 0.0486188 -0.0407729 -0.466345 0.458499 0.0334617 -0.0255271 -0.302461 0.294527 0.0187263 -0.0123385 -0.161124 0.154737 0.00767629 -0.00407261 -0.0630598 0.0594561 0.00195329 -0.00069092 -0.0142227 0.0129604 0.000153047 7.28083e-05 -0.000225855 -0.0900389 0.0902561 -0.000217189 0.0028472 -0.00490261 -0.470928 0.472984 0.00740856 -0.00996756 -0.659132 0.661691 0.01254 -0.0154448 -0.802286 0.805191 0.0186708 -0.0220734 -0.930403 0.933805 0.0256649 -0.0296562 -1.06117 1.06516 0.0340842 -0.0386631 -1.20223 1.2068 0.0439293 -0.0492087 -1.34905 1.35433 0.054956 -0.0605465 -1.49417 1.49976 0.0666826 -0.0721279 -1.62545 1.6309 0.0763954 -0.0786426 -1.45989 1.46213 0.0792705 -0.0781207 -1.09932 1.09817 0.0751917 -0.070797 -0.83489 0.830495 0.0658383 -0.0588991 -0.628582 0.621642 0.0513948 -0.0423066 -0.44941 0.440322 0.0333417 -0.0235459 -0.285119 0.275323 0.0152963 -0.00774422 -0.14725 0.139698 0.00281095 0.000405426 -0.0556615 0.0524451 -0.00158374 0.00135775 -0.0120144 0.0122404 -0.000529675 0.000294609 0.000235066 -0.0917056 0.0919524 -0.000246856 0.00293453 -0.00491537 -0.47551 0.47749 0.00733416 -0.00973944 -0.664221 0.666626 0.0123891 -0.0149364 -0.808276 0.810823 0.0184781 -0.0213721 -0.937051 0.939945 0.0253157 -0.0290513 -1.069 1.07273 0.0332867 -0.0378834 -1.21131 1.21591 0.0430804 -0.0481538 -1.35943 1.3645 0.05435 -0.0599532 -1.50557 1.51118 0.0666226 -0.0723967 -1.63652 1.6423 0.0769857 -0.080263 -1.46509 1.46837 0.0813353 -0.0807722 -1.09685 1.09629 0.0786493 -0.0746035 -0.826129 0.822083 0.0696556 -0.0627074 -0.614042 0.607093 0.054564 -0.0438289 -0.42992 0.419185 0.033071 -0.0205117 -0.263557 0.250998 0.00943874 0.00153693 -0.130201 0.119226 -0.00970929 0.0163832 -0.0481223 0.0414483 -0.0193227 0.0176242 -0.0136766 0.0153752 -0.0108894 -0.00283478 0.0137242 -0.0931958 0.0934718 -0.000276017 0.00307137 -0.00491778 -0.480015 0.481861 0.00753495 -0.00977719 -0.66939 0.671633 0.0124522 -0.0150476 -0.813767 0.816362 0.0182265 -0.0216543 -0.943076 0.946504 0.0255546 -0.0291051 -1.07692 1.08047 0.0337912 -0.0387219 -1.22042 1.22535 0.0441906 -0.0498139 -1.36991 1.37553 0.0567518 -0.0632019 -1.51735 1.5238 0.0705337 -0.0777372 -1.64825 1.65545 0.0835429 -0.0880455 -1.47202 1.47652 0.0905219 -0.091148 -1.09582 1.09645 0.0896774 -0.0859636 -0.818052 0.814338 0.0809893 -0.0736177 -0.599153 0.591782 0.0644681 -0.0516058 -0.407605 0.394743 0.0378183 -0.020973 -0.236185 0.21934 0.00481126 0.0134003 -0.104913 0.0867017 -0.0244387 0.0243434 -0.0308784 0.0309737 -0.00515098 -0.0465788 -0.0177448 0.0694746 0.140575 -0.302513 -0.0358801 0.197819 -0.0946616 0.0949492 -0.000287609 0.0030479 -0.00492687 -0.484522 0.486401 0.00715823 -0.00946665 -0.6742 0.676508 0.012222 -0.0146719 -0.819407 0.821857 0.018141 -0.0213249 -0.949796 0.95298 0.0251872 -0.0289786 -1.08469 1.08849 0.0336961 -0.0385934 -1.22987 1.23477 0.0445103 -0.0501161 -1.38154 1.38715 0.0573848 -0.0645179 -1.5306 1.53773 0.0727566 -0.0806261 -1.66265 1.67052 0.0878167 -0.0937021 -1.48187 1.48775 0.0976209 -0.0997433 -1.09725 1.09937 0.0992468 -0.0960945 -0.811094 0.807942 0.0915437 -0.0844316 -0.583432 0.576319 0.0751818 -0.0616643 -0.381292 0.367774 0.0462515 -0.0278523 -0.200234 0.181835 0.0196639 -0.04017 -0.0754639 0.09597 0.115364 -0.308906 -0.0838769 0.277419 0.568564 -0.841139 -0.277189 0.549764 1.03002 -1.16471 -0.45546 0.590149 -0.0960597 0.0962534 -0.000193661 0.00293916 -0.00478041 -0.488825 0.490666 0.00685551 -0.00943261 -0.678902 0.681479 0.0120714 -0.0143387 -0.82483 0.827097 0.0175551 -0.0208401 -0.956255 0.95954 0.0246013 -0.0285355 -1.09274 1.09668 0.0333507 -0.0384107 -1.23989 1.24495 0.0446469 -0.0505186 -1.39353 1.3994 0.0581018 -0.0656039 -1.54516 1.55266 0.0750137 -0.0837574 -1.67883 1.68757 0.0921881 -0.0995998 -1.49456 1.50197 0.10501 -0.109192 -1.10196 1.10615 0.110165 -0.107645 -0.805354 0.802834 0.103592 -0.0967286 -0.567598 0.560735 0.0881127 -0.0763363 -0.355015 0.343238 0.0708031 -0.103798 -0.175663 0.208658 0.223459 -0.508172 -0.211754 0.496468 0.806729 -1.02987 -0.592473 0.815613 1.14999 -1.23259 -0.704052 0.786646 1.27391 -1.30083 -0.651178 0.678106 -0.0971049 0.0966597 0.000445145 0.00237486 -0.0049534 -0.493126 0.495704 0.00668104 -0.00880085 -0.683528 0.685648 0.0119689 -0.0134185 -0.830153 0.831603 0.0175086 -0.0194401 -0.962528 0.964459 0.0247733 -0.0274789 -1.10029 1.103 0.0331885 -0.037886 -1.2499 1.2546 0.0445208 -0.0502014 -1.40572 1.4114 0.0589811 -0.0663232 -1.56048 1.56782 0.0771655 -0.0862568 -1.69669 1.70578 0.0967473 -0.105071 -1.50984 1.51817 0.112899 -0.118452 -1.11041 1.11596 0.122978 -0.120428 -0.800958 0.798408 0.116538 -0.109812 -0.55141 0.544684 0.105986 -0.127177 -0.338809 0.359999 0.24358 -0.502212 -0.346107 0.604739 0.809869 -1.04033 -0.828774 1.05923 1.14426 -1.20755 -0.932932 0.996223 1.23962 -1.26149 -0.825165 0.847033 1.27483 -1.28806 -0.692763 0.705993 -0.0975689 0.0474494 -0.0035526 0.0536721 0.499381 0.00433517 -0.00470916 -0.499007 0.688702 0.00718278 -0.00819482 -0.68769 0.836683 0.0105907 -0.0136387 -0.833635 0.969855 0.0158196 -0.0196026 -0.966072 1.10981 0.0229617 -0.0275408 -1.10524 1.43895 -0.143088 -0.0372492 -1.25862 1.59847 -0.131094 -0.0502195 -1.41715 1.75702 -0.114603 -0.0673768 -1.57504 1.89537 -0.0912965 -0.0890473 -1.71503 1.70952 -0.0720181 -0.110999 -1.52651 1.30343 -0.0544461 -0.127782 -1.1212 0.970504 -0.0311297 -0.139706 -0.799668 0.532138 0.130865 -0.120732 -0.542272 0.604099 0.18357 -0.302816 -0.484853 1.26297 0.614084 -0.94973 -0.927321 1.24446 1.08542 -1.15006 -1.17982 1.0567 1.18347 -1.20655 -1.03362 0.880771 1.22242 -1.23933 -0.863853 0.72774 1.25258 -1.26364 -0.716678 -0.115433 0.113457 0.00197583 -0.493699 0.496727 0.00331027 -0.0063383 -0.690304 0.692536 0.00850777 -0.0107395 -0.844347 0.845606 0.0142825 -0.0155415 -0.981707 0.983038 0.0206476 -0.0219782 -1.12472 1.12678 0.0280117 -0.0300718 -1.27962 1.28314 0.0373066 -0.040823 -1.44369 1.44891 0.0497301 -0.0549435 -1.60965 1.61653 0.0664866 -0.0733734 -1.75911 1.76891 0.0883755 -0.0981738 -1.57263 1.5829 0.115147 -0.125414 -1.15897 1.16688 0.14157 -0.149481 -0.818084 0.828519 0.162038 -0.172473 -0.681633 0.818903 0.224104 -0.361374 -1.20898 1.4995 0.588892 -0.879421 -1.49228 1.58056 1.00197 -1.09025 -1.31185 1.34138 1.12156 -1.15109 -1.0942 1.11498 1.17033 -1.19111 -0.90928 0.927302 1.20539 -1.22341 0.904513 -0.333151 1.42022 -1.24923 -0.742346 -0.11093 0.109626 0.00130384 -0.499441 0.502597 0.00336538 -0.00652123 -0.694597 0.697315 0.0089099 -0.0116283 -0.847373 0.850395 0.0143342 -0.0173559 -0.985332 0.988714 0.0207869 -0.0241692 -1.1298 1.13409 0.0284614 -0.0327464 -1.28768 1.29286 0.0384839 -0.0436701 -1.45455 1.4617 0.0515356 -0.0586909 -1.62458 1.63404 0.0689196 -0.0783835 -1.77958 1.79252 0.0923339 -0.105272 -1.59496 1.60987 0.121239 -0.136149 -1.17726 1.19133 0.151273 -0.165344 -0.852472 0.895079 0.179756 -0.222363 -1.01282 1.24729 0.336483 -0.570954 -1.71932 1.87326 0.821412 -0.97536 -1.63509 1.67737 1.04071 -1.08299 -1.36912 1.39487 1.10972 -1.13547 -1.13798 1.15719 1.15786 -1.17707 -0.944394 0.962452 1.18963 -1.20769 0.909091 -0.318071 -0.770195 1.41721 -1.23804 -0.107848 0.107197 0.000650523 -0.505328 0.508219 0.00399923 -0.00688983 -0.700264 0.702926 0.00954194 -0.0122043 -0.852936 0.856261 0.0151487 -0.0184743 -0.992257 0.995821 0.021905 -0.0254687 -1.13868 1.14344 0.0300554 -0.0348144 -1.29888 1.30489 0.0404019 -0.0464047 -1.46935 1.47772 0.0537846 -0.0621584 -1.64433 1.65533 0.072264 -0.0832606 -1.8065 1.82171 0.0968925 -0.112106 -1.6263 1.64432 0.128183 -0.146207 -1.20587 1.22266 0.162208 -0.178999 -0.956692 1.04754 0.209407 -0.300251 -1.51993 1.79935 0.489017 -0.768433 -1.97178 2.04528 0.919969 -0.993469 -1.70977 1.74052 1.03229 -1.06304 -1.42221 1.44967 1.08961 -1.11706 -1.18187 1.20785 1.14066 -1.16664 -0.984296 1.00184 1.18767 -1.20521 0.914566 -0.300806 -0.805554 1.41642 -1.22462 -0.105956 0.105889 6.76139e-05 -0.510822 0.51384 0.00428367 -0.00730214 -0.705836 0.708927 0.010076 -0.0131676 -0.8593 0.862662 0.0162632 -0.019626 -0.999656 1.00357 0.0230126 -0.0269285 -1.148 1.15308 0.0316243 -0.0367025 -1.31111 1.31735 0.0426869 -0.0489339 -1.48577 1.4945 0.0568669 -0.0655908 -1.66647 1.67796 0.0760638 -0.0875502 -1.83721 1.85334 0.102238 -0.11837 -1.66256 1.68217 0.135744 -0.155346 -1.24203 1.26856 0.172968 -0.199505 -1.17498 1.33278 0.255349 -0.413158 -2.0479 2.25393 0.653779 -0.859807 -2.10282 2.14876 0.936261 -0.9822 -1.76848 1.79579 1.01054 -1.03785 -1.47675 1.5088 1.067 -1.09905 -1.23697 1.25483 1.12275 -1.14061 -1.00995 1.0155 1.14976 -1.15531 0.893473 -0.264055 -0.822258 1.36727 -1.17443 -0.105171 0.105592 -0.000421429 -0.516257 0.519383 0.00474332 -0.00786933 -0.711826 0.715139 0.0105239 -0.0138366 -0.865789 0.8692 0.0172901 -0.0207016 -1.00752 1.01131 0.0246463 -0.0284302 -1.15786 1.16331 0.0333776 -0.0388253 -1.3242 1.3305 0.0451164 -0.0514215 -1.5029 1.51169 0.0599205 -0.0687073 -1.68975 1.70178 0.0796958 -0.0917242 -1.86986 1.88654 0.107485 -0.124165 -1.70174 1.72292 0.143068 -0.164241 -1.29917 1.3415 0.185508 -0.227837 -1.52273 1.73599 0.327636 -0.540898 -2.40535 2.51706 0.764226 -0.875937 -2.18712 2.22156 0.925136 -0.959578 -1.82452 1.85423 0.983284 -1.01299 -1.53307 1.55341 1.03863 -1.05898 -1.26056 1.25578 1.07032 -1.06554 -0.976605 0.908013 1.03782 -0.969231 0.776746 -0.156693 -0.779938 1.02343 -0.86354 -0.105316 0.106121 -0.000805408 -0.521946 0.524975 0.00530328 -0.00833282 -0.71794 0.721195 0.0114308 -0.0146859 -0.872535 0.876139 0.0183069 -0.0219108 -1.01551 1.01991 0.0255769 -0.029975 -1.16809 1.17332 0.0348934 -0.0401248 -1.33717 1.34374 0.0467946 -0.0533676 -1.52031 1.52929 0.0618292 -0.0708091 -1.71347 1.72579 0.081911 -0.0942375 -1.90321 1.92033 0.109729 -0.126846 -1.74312 1.76469 0.145799 -0.16737 -1.38904 1.45244 0.193991 -0.257389 -1.96489 2.20276 0.393156 -0.631031 -2.59572 2.65827 0.775945 -0.838497 -2.24908 2.27477 0.870495 -0.896182 -1.88234 1.90585 0.920116 -0.943631 -1.56595 1.56213 0.955814 -0.951994 -1.22288 1.13735 0.922796 -0.837264 -0.733831 0.408965 0.668432 -0.343567 -0.0378504 -0.0462767 0.0841271 -0.105888 0.106918 -0.00103046 -0.527661 0.530693 0.00575702 -0.00878924 -0.724467 0.727814 0.0121159 -0.0154638 -0.879637 0.8832 0.0195146 -0.0230775 -1.0244 1.02867 0.0274921 -0.0317619 -1.17899 1.18443 0.0375496 -0.042985 -1.35099 1.35822 0.050089 -0.057319 -1.53907 1.54861 0.066559 -0.076095 -1.73883 1.75227 0.0887412 -0.102175 -1.93893 1.95794 0.119698 -0.138704 -1.78784 1.81368 0.159928 -0.185762 -1.53297 1.63609 0.224234 -0.327356 -2.45092 2.67566 0.509835 -0.734571 -2.71308 2.75926 0.8223 -0.868485 -2.29955 2.32443 0.896504 -0.921379 -1.92343 1.93283 0.940705 -0.950106 -1.53653 1.47483 0.936027 -0.874334 -0.960942 0.654722 0.731493 -0.425272 -0.112792 -0.0170464 0.140418 -0.0105791 0.0487802 -0.0377103 -0.0110699 -0.106841 0.108006 -0.00116529 -0.533041 0.536766 0.00568218 -0.00940693 -0.730899 0.734646 0.0129521 -0.0166986 -0.887138 0.891227 0.0204823 -0.0245716 -1.03333 1.03814 0.0291293 -0.03394 -1.19062 1.19681 0.0394208 -0.0456132 -1.36593 1.37428 0.0530449 -0.0613975 -1.55919 1.56982 0.0710115 -0.0816417 -1.7667 1.78132 0.0955705 -0.110185 -1.97878 2.00015 0.129529 -0.150896 -1.8416 1.87378 0.174838 -0.207018 -1.7621 1.90773 0.263759 -0.409389 -2.88202 3.04819 0.630331 -0.796501 -2.80077 2.83637 0.854817 -0.890409 -2.34811 2.36762 0.913076 -0.932581 -1.93062 1.90537 0.939495 -0.914244 -1.34786 1.13524 0.828604 -0.615986 -0.309352 0.07714 0.287023 -0.0548112 0.0631874 -0.0713046 -0.00288619 0.0110034 0.0304583 -0.0245675 -0.00589082 -0.107753 0.108869 -0.00111538 -0.538906 0.542291 0.00588437 -0.00926893 -0.738014 0.741724 0.0132631 -0.0169723 -0.89536 0.899194 0.0215308 -0.0253641 -1.04314 1.04814 0.0304833 -0.0354911 -1.20313 1.20968 0.0417336 -0.0482913 -1.38235 1.3909 0.0562643 -0.0648079 -1.58124 1.5925 0.0756613 -0.0869268 -1.79737 1.81325 0.102215 -0.118091 -2.02284 2.0464 0.139353 -0.162911 -1.90993 1.95235 0.190388 -0.232813 -2.07782 2.26774 0.317355 -0.507275 -3.18506 3.29051 0.724864 -0.830317 -2.8695 2.89767 0.873275 -0.901443 -2.38323 2.389 0.919349 -0.925116 -1.8459 1.73256 0.896746 -0.783409 -0.803739 0.437716 0.55494 -0.188917 0.0249853 -0.0707635 0.0393387 0.00643948 0.0691119 -0.0653843 -0.0121544 0.00842679 0.0199463 -0.0167717 -0.00317458 -0.108522 0.109586 -0.00106401 -0.54457 0.547892 0.00584608 -0.00916827 -0.745018 0.749188 0.0131563 -0.0173267 -0.903705 0.908329 0.0217143 -0.0263375 -1.05367 1.05882 0.0315707 -0.0367123 -1.21659 1.22329 0.0434091 -0.0501049 -1.40004 1.40907 0.0592488 -0.0682728 -1.60501 1.61723 0.0797161 -0.0919409 -1.83025 1.84779 0.107999 -0.125543 -2.07155 2.09725 0.148658 -0.174358 -2.00045 2.05752 0.206177 -0.263251 -2.47999 2.70747 0.380671 -0.608144 -3.37723 3.44677 0.77997 -0.84951 -2.92307 2.94477 0.879719 -0.901418 -2.38055 2.34926 0.905638 -0.874346 -1.55632 1.29697 0.767819 -0.508472 -0.150549 0.00419068 0.162721 -0.0163627 0.0845965 -0.0876166 -0.0125573 0.0155775 0.0605617 -0.0547764 -0.012725 0.00693965 0.0142158 -0.0118113 -0.0024045 -0.108928 0.109809 -0.000880689 -0.550199 0.553612 0.00549852 -0.00891216 -0.752501 0.756713 0.013124 -0.0173359 -0.912669 0.917338 0.0218437 -0.0265128 -1.06482 1.07016 0.0321606 -0.0374963 -1.23092 1.23803 0.0447376 -0.0518435 -1.41876 1.42846 0.0610006 -0.0706955 -1.63074 1.64382 0.0830305 -0.0961077 -1.86637 1.88505 0.113455 -0.132137 -2.12468 2.153 0.156613 -0.184934 -2.12159 2.19941 0.222521 -0.30034 -2.95251 3.1933 0.448048 -0.688842 -3.50572 3.55351 0.802822 -0.850612 -2.96289 2.97023 0.873743 -0.881085 -2.28771 2.1886 0.856574 -0.757464 -0.949043 0.563855 0.54687 -0.161682 0.0618804 -0.0948591 0.0297434 0.0032353 0.0883875 -0.0881922 -0.00889405 0.00869874 0.0507168 -0.0477082 -0.00620613 0.00319756 0.0105148 -0.00947953 -0.0010353 -0.108845 0.109481 -0.000635292 -0.555531 0.558727 0.004966 -0.00816229 -0.760124 0.764326 0.0122117 -0.016414 -0.921851 0.926503 0.0212396 -0.0258916 -1.07612 1.08194 0.0318649 -0.0376859 -1.24571 1.2533 0.0446343 -0.0522296 -1.4387 1.44892 0.0615532 -0.0717701 -1.65782 1.672 0.0848751 -0.0990498 -1.90454 1.92406 0.117435 -0.136951 -2.18263 2.21275 0.16316 -0.193288 -2.286 2.39009 0.239398 -0.34349 -3.42953 3.64186 0.517059 -0.729393 -3.59163 3.62295 0.803625 -0.834946 -2.97264 2.95694 0.848934 -0.83324 -2.04115 1.8448 0.761515 -0.56516 -0.239841 0.054864 0.217 -0.0320234 0.105418 -0.111952 -0.00229729 0.00883147 0.0866224 -0.0849226 -0.00954019 0.00784035 0.0454818 -0.0428303 -0.0053276 0.00267611 0.00887607 -0.00797769 -0.000898389 -0.107993 0.108359 -0.000365673 -0.560129 0.563221 0.00353336 -0.00662561 -0.767178 0.77154 0.0105884 -0.0149507 -0.931225 0.935815 0.0200572 -0.024647 -1.08802 1.09379 0.0302542 -0.0360214 -1.26116 1.26876 0.0435123 -0.0511065 -1.45985 1.47013 0.0611529 -0.071439 -1.68673 1.70114 0.0855267 -0.0999328 -1.94485 1.96557 0.118884 -0.139607 -2.24493 2.27749 0.166993 -0.199553 -2.50251 2.62695 0.254318 -0.378753 -3.83555 3.99454 0.577335 -0.736325 -3.64877 3.67133 0.782979 -0.80554 -2.92707 2.87333 0.803744 -0.750009 -1.59422 1.28139 0.607973 -0.295151 0.0296284 -0.0768149 0.0559533 -0.00876688 0.116851 -0.125613 -0.00680487 0.0155671 0.0830522 -0.0814552 -0.0189843 0.0173873 0.0391506 -0.0330548 -0.0127086 0.00661284 0.00680313 -0.00459793 -0.00220519 -0.106243 0.10607 0.000173183 -0.56385 0.566469 0.00189736 -0.00451571 -0.774349 0.778393 0.00799509 -0.0120394 -0.940345 0.945075 0.0169766 -0.021706 -1.10011 1.10603 0.027129 -0.033047 -1.27716 1.28497 0.0403856 -0.0481949 -1.48104 1.49175 0.0581923 -0.0689067 -1.71651 1.73145 0.0830095 -0.0979482 -1.98717 2.00814 0.117551 -0.138521 -2.31181 2.34764 0.166996 -0.202829 -2.75745 2.90037 0.266538 -0.409454 -4.12488 4.22912 0.60924 -0.713479 -3.6896 3.70264 0.745034 -0.758076 -2.80183 2.7021 0.734556 -0.634825 -0.939055 0.592456 0.430545 -0.0839464 0.116653 -0.14571 0.0226296 0.00642756 0.136407 -0.143305 -0.0187121 0.0256106 0.0800228 -0.0768052 -0.0278973 0.0246797 0.0250553 -0.016264 -0.0180109 0.00921963 0.00178771 0.00109358 -0.0028813 -0.10327 0.10269 0.00057994 -0.565892 0.567873 -0.000361229 -0.00161921 -0.780784 0.784543 0.00407929 -0.007839 -0.949635 0.954059 0.0124393 -0.0168631 -1.11221 1.11783 0.0222961 -0.0279202 -1.29269 1.30059 0.0349745 -0.0428734 -1.50287 1.51344 0.0526422 -0.0632107 -1.74679 1.76156 0.077452 -0.0922164 -2.02982 2.05141 0.111757 -0.133348 -2.38469 2.42319 0.162107 -0.200613 -3.04581 3.19905 0.274653 -0.42789 -4.31236 4.38064 0.599434 -0.667714 -3.71163 3.71278 0.691201 -0.692352 -2.5838 2.43207 0.641877 -0.490148 -0.308799 0.134126 0.217204 -0.0425316 0.157804 -0.173443 0.00599147 0.00964792 0.149841 -0.15814 -0.0205469 0.0288463 0.0738346 -0.0699028 -0.0311961 0.0272644 0.00798381 0.00160149 -0.019731 0.0101457 -0.00360858 0.00687301 -0.00326444 -0.0988217 0.0975912 0.00123041 -0.565954 0.566606 -0.0038943 0.00324243 -0.786343 0.788918 -0.0012074 -0.00136818 -0.958172 0.96212 0.00563357 -0.00958194 -1.12374 1.12859 0.0145475 -0.0193992 -1.30833 1.31552 0.0263174 -0.0335095 -1.52401 1.5348 0.0428667 -0.0536594 -1.77669 1.79132 0.0668577 -0.0814955 -2.07301 2.09382 0.100852 -0.121662 -2.46221 2.50267 0.149939 -0.190396 -3.34824 3.50098 0.270226 -0.422966 -4.43417 4.48062 0.553956 -0.600405 -3.70885 3.6982 0.620128 -0.609481 -2.27248 2.08555 0.53795 -0.351023 -0.0423833 -0.01236 0.0832073 -0.028464 0.199327 -0.228321 -0.0128327 0.0418271 0.167727 -0.176072 -0.0568864 0.0652317 0.0646091 -0.0540873 -0.0630605 0.0525387 -0.0148609 0.0324221 -0.0384356 0.0208744 -0.0122646 0.0196213 -0.00735676 -0.09246 0.0906434 0.0018166 -0.562231 0.56161 -0.00836365 0.00898412 -0.790135 0.791504 -0.00876455 0.00739604 -0.96527 0.968483 -0.00455047 0.00133666 -1.13403 1.13862 0.00291948 -0.00750428 -1.32279 1.32969 0.0130942 -0.0199891 -1.54453 1.55435 0.0286818 -0.0385083 -1.80579 1.81931 0.0508869 -0.0644093 -2.11416 2.13428 0.0824968 -0.102615 -2.54118 2.57965 0.129741 -0.16821 -3.64474 3.78754 0.244212 -0.387006 -4.51708 4.54824 0.475232 -0.506392 -3.68585 3.67291 0.521501 -0.508555 -1.90816 1.71667 0.43264 -0.241145 0.0633679 -0.148278 0.0814267 0.00348391 0.26018 -0.301749 -0.0590508 0.100619 0.183458 -0.183798 -0.12429 0.12463 0.0381186 -0.0118067 -0.106213 0.0799007 -0.0553132 0.0820443 -0.054338 0.0276069 -0.0286268 0.0377943 -0.00916749 -0.0838924 0.0814367 0.0024557 -0.55444 0.551258 -0.0136225 0.0168041 -0.790739 0.79035 -0.0192099 0.0195986 -0.970459 0.972611 -0.0187 0.0165479 -1.14306 1.14648 -0.0132161 0.00979922 -1.33628 1.34139 -0.00479015 -0.000319436 -1.56326 1.57181 0.00806356 -0.0166131 -1.83236 1.8446 0.0274807 -0.0397248 -2.15329 2.17071 0.0560767 -0.0735024 -2.61462 2.64876 0.0981723 -0.132321 -3.90798 4.01989 0.197666 -0.309577 -4.56775 4.58233 0.363632 -0.378207 -3.66033 3.64606 0.382321 -0.36805 -1.58341 1.45131 0.310683 -0.178587 0.245553 -0.348184 0.11041 -0.00777922 0.352195 -0.398854 -0.056118 0.102777 0.176455 -0.162834 -0.11844 0.104819 -0.0177311 0.0462476 -0.081797 0.0532806 -0.108785 0.129281 -0.0280891 0.00759322 -0.0450755 0.0444842 0.00059129 -0.0726809 0.0698328 0.0028481 -0.540478 0.53332 -0.0207904 0.0279477 -0.787402 0.784623 -0.0336641 0.0364427 -0.973611 0.973852 -0.0380141 0.0377723 -1.14972 1.15216 -0.0363996 0.0339603 -1.34672 1.3511 -0.0303699 0.025987 -1.57933 1.58632 -0.0204186 0.0134267 -1.85541 1.8653 -0.00407436 -0.00581727 -2.18705 2.20153 0.0182404 -0.0327152 -2.67713 2.70477 0.053134 -0.0807771 -4.0974 4.16306 0.125976 -0.191633 -4.58763 4.58604 0.217086 -0.215497 -3.61936 3.5747 0.194329 -0.149671 -1.40969 1.37167 0.0941716 -0.0561538 0.429928 -0.479377 0.0266782 0.0227708 0.434977 -0.445065 -0.0492759 0.0593646 0.145774 -0.111347 -0.0422914 0.00786475 -0.0764906 0.0982264 0.0208654 -0.0426011 -0.132777 0.119954 0.0444316 -0.0316087 -0.0328344 0.0187426 0.0140918 -0.0587728 0.0541397 0.00463309 -0.517454 0.504907 -0.0314569 0.0440039 -0.778582 0.772363 -0.053732 0.0599501 -0.973402 0.971298 -0.0643538 0.0664575 -1.1541 1.15485 -0.0669561 0.0662088 -1.35427 1.3568 -0.0645401 0.0620094 -1.5918 1.59672 -0.0582406 0.0533201 -1.87369 1.88117 -0.0466533 0.0391782 -2.21278 2.22247 -0.0296387 0.0199508 -2.72378 2.74049 -0.0068843 -0.00982011 -4.18539 4.20646 0.0317221 -0.0527872 -4.56883 4.54413 0.0481793 -0.0234787 -3.5127 3.42861 -0.0296549 0.113749 -1.38216 1.33229 -0.193372 0.243251 0.485646 -0.468754 -0.288982 0.27209 0.425235 -0.371345 -0.228857 0.174968 0.0685999 -0.00919211 -0.122323 0.0629147 -0.111346 0.132289 -0.0237829 0.00284006 -0.107315 0.104354 0.00173195 0.00122877 -0.0128502 0.015307 -0.00245673 -0.0429664 0.0369955 0.00597087 -0.481311 0.461454 -0.0450055 0.0648628 -0.76121 0.750625 -0.0818113 0.0923963 -0.968719 0.963792 -0.09979 0.104717 -1.15553 1.15423 -0.108095 0.1094 -1.35826 1.35893 -0.109636 0.108959 -1.6 1.6024 -0.1074 0.104999 -1.88678 1.89126 -0.101118 0.0966307 -2.22989 2.23651 -0.0902822 0.0836587 -2.74683 2.75394 -0.0768585 0.0697507 -4.18908 4.16725 -0.0734209 0.0952486 -4.51201 4.50242 -0.111583 0.121168 -3.38066 3.36152 -0.129381 0.148521 -1.25486 1.14884 -0.180609 0.286624 0.393939 -0.251843 -0.182091 0.0399955 0.308224 -0.288291 0.0298241 -0.0497568 -0.0332894 -0.0143117 0.010931 0.0366702 -0.153155 0.151627 -0.0493377 0.0508654 -0.117268 0.132695 -0.0441669 0.0287405 -0.0255706 0.0367926 -0.0112221 -0.0263938 0.0204092 0.0059846 -0.428298 0.397918 -0.058946 0.0893258 -0.731361 0.713198 -0.116445 0.134608 -0.956804 0.949073 -0.14774 0.155471 -1.15209 1.14809 -0.161871 0.165866 -1.35808 1.35661 -0.167881 0.169351 -1.60262 1.60255 -0.17056 0.170634 -1.89374 1.89524 -0.170489 0.168989 -2.2411 2.24455 -0.166625 0.163171 -2.74978 2.74892 -0.157815 0.158676 -4.11559 4.07752 -0.18222 0.220289 -4.50431 4.5413 -0.227974 0.19099 -3.43828 3.56041 -0.119275 -0.00285213 -1.13655 1.28384 0.109087 -0.256383 -0.0442676 0.27477 0.516938 -0.747441 0.288862 -0.20326 0.882228 -0.967831 0.21005 -0.362281 0.943165 -0.790935 -0.0363302 -0.222656 0.578031 -0.319045 -0.136852 0.0157855 0.126675 -0.00560871 -0.0578762 0.0745879 -0.0167117 -0.0115415 0.0067982 0.00474333 -0.349281 0.303004 -0.0651597 0.111436 -0.683173 0.653032 -0.155333 0.185474 -0.936055 0.922751 -0.208015 0.221318 -1.14234 1.13545 -0.231022 0.237903 -1.35335 1.35012 -0.242829 0.246059 -1.59986 1.59665 -0.249366 0.252576 -1.89356 1.89057 -0.256278 0.259269 -2.24369 2.24188 -0.261539 0.26335 -2.74637 2.74508 -0.264572 0.265864 -3.97546 3.84869 -0.304065 0.430842 -4.5755 4.58739 -0.483513 0.47162 -3.70993 3.81189 -0.431012 0.329052 -1.54304 1.77672 -0.149235 -0.0844357 -0.548751 0.707596 0.236957 -0.395802 0.0466467 0.0558019 0.547212 -0.649661 0.421918 -0.3676 0.721453 -0.77577 0.476865 -0.558564 0.768358 -0.686659 0.265314 -0.499493 0.534829 -0.30065 -0.0464028 -0.0459836 0.0923865 -0.000737446 -0.0022391 0.00297654 -0.239646 0.181489 -0.0554822 0.11364 -0.603854 0.550767 -0.184286 0.237373 -0.900012 0.876595 -0.277301 0.300718 -1.12621 1.11638 -0.316966 0.326793 -1.34522 1.33931 -0.335386 0.341296 -1.59088 1.58464 -0.347535 0.353779 -1.88422 1.87656 -0.361477 0.369137 -2.23462 2.22459 -0.379274 0.389307 -2.7252 2.69575 -0.403623 0.433075 -3.63499 3.39559 -0.50079 0.740194 -4.5065 4.35926 -0.962959 1.1102 -3.88344 3.84178 -1.18758 1.22924 -2.23067 2.66954 -1.13772 0.698858 -0.858689 1.08683 -0.355944 0.127802 -0.119602 0.211782 -0.00488982 -0.0872899 0.333197 -0.298284 0.151145 -0.186058 0.563225 -0.544476 0.207264 -0.226013 0.612854 -0.650753 0.2238 -0.1859 0.200243 -0.304723 0.10448 -0.00700118 0.00546236 0.00153882 -0.115892 0.0688722 -0.0332508 0.0802709 -0.468276 0.380414 -0.167971 0.255833 -0.836067 0.787292 -0.333235 0.382011 -1.10059 1.08296 -0.414523 0.432146 -1.32969 1.31903 -0.44532 0.455981 -1.5751 1.56576 -0.465085 0.474421 -1.86458 1.85111 -0.487405 0.500878 -2.20669 2.18216 -0.520009 0.544535 -2.65038 2.60006 -0.580471 0.630791 -3.08851 2.83331 -0.732149 0.987345 -4.08803 3.66093 -1.50889 1.936 -3.68137 3.64044 -2.2188 2.25974 -2.78467 2.73356 -2.39894 2.45005 -1.42518 1.64104 -2.28493 2.06907 -0.504575 0.810434 -1.8015 1.49564 0.0946754 0.175358 -1.23513 0.965093 0.427761 -0.20711 -0.743114 0.522462 0.580282 -0.407718 -0.345951 0.173386 0.351789 -0.297684 -0.0541048 0.0122839 -0.0153143 -4.09902e-05 0.00307136 -0.0287135 0.00388698 -0.0140732 0.0388997 -0.271295 0.177229 -0.0982512 0.192318 -0.716991 0.6329 -0.307497 0.391588 -1.0634 1.03506 -0.450032 0.478379 -1.31632 1.31211 -0.49167 0.495877 -1.56796 1.56873 -0.498062 0.497285 -1.8487 1.84564 -0.497688 0.500748 -2.17107 2.1638 -0.504796 0.512062 -2.57261 2.54099 -0.531765 0.563394 -2.69749 2.59975 -0.613408 0.711152 -3.27147 2.96357 -0.924145 1.23204 -3.5287 3.33187 -1.38473 1.58156 -2.73005 2.70847 -1.66287 1.68445 -1.85163 1.95954 -1.6624 1.55448 -1.005 1.20444 -1.40107 1.20164 -0.373174 0.573054 -1.01278 0.8129 0.0471813 0.129587 -0.639492 0.462724 0.2797 -0.139032 -0.31326 0.172591 0.235125 -0.165031 -0.0700942 0.0170367 -0.0183475 -8.75661e-06 0.00131952 0.0117635 -0.0222252 -0.00626307 0.0167248 -0.106769 0.0595178 -0.0410563 0.0883078 -0.539134 0.441797 -0.185628 0.282965 -0.997575 0.951053 -0.36513 0.411653 -1.30573 1.29613 -0.437402 0.447009 -1.5677 1.5656 -0.451186 0.45328 -1.84263 1.84054 -0.453308 0.455394 -2.15729 2.15036 -0.461248 0.468183 -2.51005 2.4839 -0.482173 0.508321 -2.53072 2.477 -0.548774 0.602493 -2.66659 2.44178 -0.688423 0.913229 -3.18373 3.04853 -1.13596 1.27116 -2.68134 2.65852 -1.3131 1.33592 -2.03714 2.10338 -1.32243 1.2562 -1.37191 1.5101 -1.16048 1.02229 -0.763497 0.931945 -0.876593 0.708146 -0.302951 0.454897 -0.557039 0.405093 0.00845676 0.112855 -0.282373 0.161061 0.0906607 -0.0252653 -0.0653954 0.019103 -0.018817 0.000449202 -0.000735162 0.0295591 -0.0347551 -0.000691404 0.00588739 -0.0275542 0.00342002 -0.0186573 0.0427915 -0.348102 0.264209 -0.0977221 0.181615 -0.896006 0.834716 -0.273168 0.334459 -1.28333 1.26704 -0.37349 0.389773 -1.56318 1.56082 -0.395491 0.397844 -1.83883 1.83768 -0.397901 0.399054 -2.14344 2.13717 -0.40372 0.40999 -2.46333 2.4467 -0.420767 0.437389 -2.43069 2.39064 -0.468026 0.508075 -2.29734 2.20446 -0.557091 0.649973 -2.92149 2.80621 -0.80983 0.925105 -2.64841 2.65243 -0.965011 0.960997 -2.16038 2.20379 -0.94302 0.899612 -1.62303 1.71624 -0.833635 0.740427 -1.07393 1.19092 -0.643278 0.526284 -0.586187 0.696465 -0.419051 0.308773 -0.2188 0.312372 -0.21676 0.123187 -0.0298917 0.0775976 -0.0477059 0.016925 -0.0137232 0.00246275 -0.00566453 0.0383119 -0.0415656 0.00681514 -0.00356146 0.0161605 -0.0327713 -0.00584188 0.0224527 -0.194053 0.13773 -0.0538869 0.11021 -0.769851 0.704513 -0.193495 0.258833 -1.24813 1.22822 -0.303953 0.323857 -1.55863 1.55708 -0.330808 0.332356 -1.83757 1.83853 -0.33235 0.33139 -2.13111 2.12475 -0.335378 0.341738 -2.43227 2.4195 -0.350996 0.363766 -2.36068 2.3384 -0.379774 0.402049 -2.14287 2.09782 -0.430549 0.47559 -2.70444 2.62325 -0.551733 0.63293 -2.66316 2.66498 -0.66344 0.661625 -2.23851 2.2701 -0.641206 0.60962 -1.78939 1.84427 -0.572784 0.517907 -1.28497 1.35941 -0.454039 0.3796 -0.787586 0.862323 -0.310556 0.235819 -0.395709 0.469178 -0.168497 0.095029 -0.119162 0.15399 -0.0348279 0.0109191 -0.0118954 0.00218962 -0.00121331 0.0481106 -0.0631701 -0.0080174 0.0230768 0.0484102 -0.0669799 -0.042134 0.0607038 -0.0969941 0.0766695 -0.0776101 0.0979348 -0.643843 0.593513 -0.152762 0.203093 -1.20896 1.1937 -0.238396 0.25366 -1.55624 1.55621 -0.258003 0.258039 -1.84014 1.84134 -0.257783 0.25659 -2.1179 2.11118 -0.25837 0.265089 -2.40855 2.40001 -0.272963 0.281498 -2.3222 2.3118 -0.289815 0.300223 -2.06459 2.03878 -0.314361 0.34017 -2.56396 2.52168 -0.377013 0.419298 -2.665 2.66572 -0.437333 0.43661 -2.29702 2.3196 -0.423501 0.400918 -1.88643 1.91915 -0.375521 0.342807 -1.41848 1.46494 -0.306567 0.260105 -0.923676 0.974662 -0.215519 0.164533 -0.532957 0.588014 -0.11549 0.0604333 -0.181078 0.199729 -0.0186509 0.0209615 -0.0417055 -0.00572376 0.0264678 0.0901864 -0.126342 -0.0642633 0.100419 0.0905331 -0.110021 -0.136976 0.156463 -0.0751672 0.0853945 -0.155863 0.145636 -0.559368 0.546109 -0.14093 0.154189 -1.18421 1.17933 -0.168498 0.173381 -1.55757 1.55889 -0.172763 0.171439 -1.84112 1.83881 -0.17211 0.174422 -2.1053 2.10029 -0.177216 0.182227 -2.39356 2.38808 -0.18997 0.195459 -2.30566 2.30227 -0.201064 0.204452 -2.01692 2.0004 -0.208144 0.22467 -2.49077 2.46373 -0.250364 0.277402 -2.67135 2.67741 -0.284823 0.278761 -2.33778 2.35358 -0.266864 0.251066 -1.94394 1.96381 -0.234716 0.214845 -1.50133 1.53001 -0.193055 0.164372 -1.0167 1.05101 -0.135899 0.101583 -0.634582 0.672935 -0.0669106 0.0285569 -0.210397 0.214947 -0.00455025 0.0745353 -0.113857 -0.0194877 0.0588093 0.16425 -0.195387 -0.103693 0.134831 0.116657 -0.112299 -0.151288 0.14693 -0.103325 0.125004 -0.132983 0.111304 -0.552177 0.571639 -0.0802749 0.0608128 -1.17841 1.17901 -0.0520024 0.0514033 -1.55719 1.55022 -0.0564178 0.0633804 -1.83369 1.82459 -0.071753 0.0808553 -2.09474 2.08671 -0.0909696 0.0989944 -2.38251 2.37668 -0.107454 0.113282 -2.3012 2.30235 -0.114172 0.113013 -1.99332 1.99224 -0.110633 0.111713 -2.43503 2.40229 -0.127032 0.159774 -2.6796 2.67826 -0.17471 0.17605 -2.36636 2.3751 -0.171318 0.16258 -1.98107 1.9948 -0.151722 0.137989 -1.5531 1.57165 -0.123643 0.105094 -1.07976 1.10504 -0.0854331 0.0601602 -0.703734 0.729373 -0.0343825 0.00874394 -0.215389 0.212931 0.00245825 0.149027 -0.171288 -0.0208621 0.0431239 0.212341 -0.212842 -0.0575683 0.0580687 0.100804 -0.0819802 -0.0434389 0.0246156 -0.151026 0.181203 0.00120662 -0.0313829 -0.598338 0.628729 0.0716121 -0.102002 -1.17703 1.16934 0.115689 -0.107998 -1.53597 1.51402 0.0854792 -0.0635289 -1.80991 1.78827 0.0399705 -0.0183269 -2.07459 2.05776 -0.00432544 0.0211483 -2.37036 2.36297 -0.0346433 0.0420363 -2.30522 2.30953 -0.042778 0.0384656 -1.99284 1.99865 -0.0316242 0.0258092 -2.36226 2.30669 -0.0337622 0.0893313 -2.67616 2.67149 -0.111556 0.116223 -2.38143 2.3873 -0.113396 0.107528 -2.0041 2.01105 -0.101319 0.0943651 -1.58606 1.5986 -0.0863495 0.0738059 -1.12714 1.1471 -0.0588159 0.0388581 -0.751805 0.770235 -0.0188525 0.000422944 -0.208982 0.204454 0.00452775 0.180461 -0.175204 -0.00504573 -0.000211845 0.196569 -0.16888 0.0206034 -0.0482924 0.054295 -0.0186165 0.0838413 -0.11952 -0.217028 0.257292 0.161595 -0.201858 -0.658635 0.687791 0.244255 -0.273411 -1.15316 1.12852 0.275277 -0.250638 -1.48386 1.44714 0.212542 -0.175825 -1.75976 1.7259 0.136235 -0.102377 -2.03662 2.0119 0.0697154 -0.0449943 -2.35353 2.34111 0.0245373 -0.0121161 -2.31241 2.31362 0.00728657 -0.00850085 -2.00898 2.02057 0.0156662 -0.0272516 -2.24781 2.19359 0.0193727 0.0348457 -2.66039 2.64268 -0.0720859 0.0897898 -2.39318 2.3978 -0.0921944 0.087571 -2.01863 2.02692 -0.0806843 0.0723967 -1.61122 1.62381 -0.0639375 0.0513518 -1.16607 1.18442 -0.0369333 0.018579 -0.783997 0.795381 -0.00151947 -0.00986501 -0.198112 0.190583 0.00752888 0.155377 -0.126446 0.0131206 -0.0420513 0.131578 -0.0873449 0.0851141 -0.129347 -0.0243606 0.0719308 0.180626 -0.228196 -0.300633 0.342568 0.279213 -0.321149 -0.709049 0.717255 0.355241 -0.363447 -1.09808 1.06748 0.347665 -0.317063 -1.40677 1.36591 0.275694 -0.234835 -1.68898 1.65106 0.191229 -0.153307 -1.98467 1.95596 0.11677 -0.0880612 -2.32545 2.30777 0.0622333 -0.0445445 -2.31298 2.3102 0.0329236 -0.0301399 -2.02988 2.03704 0.0314362 -0.0385936 -2.14709 2.11136 0.0380332 -0.00230325 -2.62185 2.60012 -0.0418597 0.0635911 -2.40013 2.40184 -0.0688488 0.0671411 -2.03436 2.04163 -0.0621603 0.0548915 -1.63569 1.64718 -0.0470445 0.0355557 -1.20187 1.21864 -0.0218184 0.00504034 -0.805017 0.809719 0.00803294 -0.0127347 -0.183677 0.177305 0.00637128 0.0927077 -0.0582262 0.0198928 -0.0543744 0.0404112 0.00549737 0.101397 -0.147306 -0.11997 0.165529 0.198576 -0.244135 -0.379644 0.412728 0.289529 -0.322612 -0.719659 0.721562 0.344416 -0.346319 -1.03922 1.01377 0.329244 -0.303788 -1.32792 1.2947 0.270451 -0.237234 -1.61427 1.58047 0.200351 -0.166544 -1.92708 1.89883 0.132622 -0.10438 -2.28843 2.2677 0.0775254 -0.0567916 -2.30453 2.29555 0.0399668 -0.0309832 -2.04226 2.04409 0.0299944 -0.0318287 -2.08484 2.06647 0.0330677 -0.0146941 -2.57811 2.55583 -0.0230851 0.0453623 -2.40511 2.40926 -0.050966 0.0468201 -2.04995 2.05996 -0.0389422 0.028938 -1.65859 1.6701 -0.0195312 0.00802462 -1.2344 1.24811 0.00429166 -0.0179931 -0.809302 0.805308 0.0260269 -0.0220326 -0.170146 0.162075 0.00807096 0.0257974 0.00264615 0.015972 -0.0444155 -0.0479664 0.0854337 0.0829628 -0.12043 -0.206608 0.242519 0.16164 -0.197551 -0.441217 0.465634 0.232317 -0.256734 -0.723798 0.725989 0.272098 -0.274288 -0.993389 0.978851 0.264994 -0.250457 -1.26657 1.24384 0.228979 -0.206249 -1.55057 1.52464 0.179028 -0.153101 -1.87226 1.84765 0.125724 -0.101107 -2.24599 2.22409 0.0753965 -0.0535001 -2.28314 2.26879 0.0362803 -0.0219308 -2.04407 2.04217 0.0166528 -0.0147493 -2.05476 2.0496 0.0155205 -0.0103606 -2.53475 2.51901 -0.00653551 0.0222767 -2.41367 2.41827 -0.0255061 0.0209042 -2.07094 2.0818 -0.0130685 0.00220612 -1.68163 1.69233 0.00781489 -0.0185117 -1.25966 1.26896 0.0287479 -0.0380566 -0.796804 0.783131 0.0374314 -0.0237579 -0.154158 0.146862 0.00729622 -0.0261062 0.0444943 0.00951867 -0.0279068 -0.117432 0.143924 0.0543041 -0.0807955 -0.273108 0.298716 0.110163 -0.135771 -0.486547 0.50445 0.160674 -0.178577 -0.728938 0.733114 0.191032 -0.195208 -0.969152 0.963342 0.193241 -0.187431 -1.22639 1.21328 0.176405 -0.163296 -1.50286 1.48494 0.145679 -0.127755 -1.82537 1.80585 0.107241 -0.0877181 -2.20218 2.18029 0.065473 -0.0435884 -2.2527 2.23466 0.025294 -0.00725806 -2.03642 2.02512 -0.00619756 0.0175011 -2.05182 2.06248 -0.019764 0.00910587 -2.51152 2.51143 -0.00858116 0.00866393 -2.4242 2.43364 -0.00391595 -0.00552328 -2.09262 2.10434 0.0161628 -0.0278838 -1.70183 1.7103 0.0374695 -0.0459335 -1.27484 1.27645 0.0522275 -0.0538334 -0.765188 0.743678 0.0453356 -0.0238258 -0.13994 0.133204 0.00673621 -0.0583418 0.0684007 0.00463664 -0.0146955 -0.165363 0.18236 0.0305546 -0.0475522 -0.319873 0.337233 0.067094 -0.0844538 -0.51971 0.532779 0.10176 -0.114829 -0.738235 0.74391 0.125202 -0.130877 -0.960626 0.960126 0.133522 -0.133023 -1.20383 1.19729 0.128843 -0.122299 -1.4707 1.45955 0.11194 -0.100791 -1.7886 1.77363 0.0865819 -0.0716086 -2.15918 2.13914 0.0529858 -0.032943 -2.21398 2.19062 0.0130122 0.0103476 -2.00821 1.9877 -0.0336059 0.0541192 -2.0815 2.10675 -0.0581835 0.0329282 -2.51818 2.53475 -0.0101719 -0.00638988 -2.44666 2.46079 0.0206622 -0.0347985 -2.11668 2.1278 0.0470033 -0.0581264 -1.7176 1.72258 0.0660113 -0.0709904 -1.27419 1.26779 0.0718992 -0.0654914 -0.719456 0.694111 0.0479948 -0.02265 -0.126539 0.120105 0.00643429 -0.0754693 0.0802422 0.00189042 -0.00666333 -0.195612 0.205725 0.0151934 -0.0253067 -0.351415 0.362943 0.0377735 -0.0493018 -0.543954 0.553525 0.06125 -0.0708202 -0.749784 0.755626 0.0793108 -0.085153 -0.961148 0.963258 0.089599 -0.0917094 -1.19313 1.19083 0.0915201 -0.0892237 -1.45122 1.44515 0.0840573 -0.077995 -1.76079 1.75053 0.0692188 -0.05896 -2.12118 2.10489 0.0440289 -0.0277347 -2.16539 2.13985 0.00736425 0.0181695 -1.96553 1.94446 -0.0436316 0.0647015 -2.13737 2.17396 -0.0642527 0.0276672 -2.55948 2.5877 0.011474 -0.0396921 -2.47442 2.48816 0.0557846 -0.0695273 -2.13707 2.14379 0.0789409 -0.0856575 -1.72461 1.72321 0.0884296 -0.0870383 -1.25679 1.24152 0.081199 -0.0659311 -0.66892 0.644864 0.0438322 -0.0197764 -0.113969 0.10813 0.00583872 -0.0833023 0.0851147 0.000538539 -0.00235085 -0.213277 0.218754 0.00629477 -0.0117709 -0.372259 0.379779 0.0193494 -0.0268692 -0.561714 0.568768 0.0351091 -0.0421623 -0.761288 0.766697 0.0490444 -0.0544537 -0.96611 0.969459 0.0593696 -0.0627182 -1.19008 1.19046 0.064823 -0.0652073 -1.4411 1.43874 0.0637351 -0.0613752 -1.74246 1.7366 0.0569634 -0.0511093 -2.09097 2.07933 0.0415004 -0.0298659 -2.11633 2.09605 0.0143008 0.00598427 -1.9248 1.91201 -0.0241121 0.0368975 -2.21496 2.25555 -0.0277142 -0.0128758 -2.61638 2.64424 0.0524 -0.0802555 -2.50115 2.51096 0.094535 -0.104343 -2.14774 2.14761 0.10713 -0.107008 -1.71829 1.70909 0.103171 -0.0939684 -1.22251 1.20079 0.0802591 -0.058538 -0.622507 0.602679 0.0361256 -0.016298 -0.102547 0.0974141 0.00513344 -0.0860321 0.0863155 -6.08095e-05 -0.000222634 -0.222578 0.225106 0.00153326 -0.00406119 -0.385787 0.390575 0.00833597 -0.0131241 -0.574865 0.580155 0.0188254 -0.0241155 -0.77186 0.776791 0.0297932 -0.0347241 -0.97316 0.977117 0.0396856 -0.0436425 -1.19187 1.1941 0.0471123 -0.0493397 -1.43801 1.43871 0.050652 -0.0513511 -1.73301 1.73175 0.0509705 -0.0497091 -2.07126 2.06697 0.0465438 -0.0422471 -2.0819 2.07431 0.0360975 -0.0285078 -1.90583 1.9073 0.023625 -0.0250897 -2.29417 2.32955 0.0404466 -0.0758222 -2.66879 2.6862 0.109651 -0.127066 -2.51533 2.51376 0.130953 -0.129379 -2.14328 2.13457 0.123104 -0.114391 -1.69569 1.67887 0.10274 -0.0859106 -1.17768 1.15471 0.0669292 -0.043956 -0.585613 0.571664 0.0255778 -0.0116281 -0.0928259 0.0889786 0.00384728 -0.0862152 0.0858619 -0.000290054 0.000643378 -0.226629 0.227409 -0.000709148 -7.0778e-05 -0.39434 0.397247 0.00216939 -0.00507633 -0.584776 0.588793 0.00901138 -0.0130284 -0.781502 0.786019 0.0177765 -0.0222935 -0.981259 0.985559 0.0272164 -0.0315165 -1.19713 1.2007 0.0358564 -0.03943 -1.44085 1.44405 0.0428554 -0.0460475 -1.73243 1.7351 0.0494105 -0.0520788 -2.06705 2.0715 0.0554512 -0.0599086 -2.07449 2.0817 0.0650742 -0.0722868 -1.91457 1.92695 0.0807551 -0.0931415 -2.35875 2.37799 0.106592 -0.125833 -2.69464 2.69586 0.145655 -0.146876 -2.50728 2.49666 0.142581 -0.131966 -2.12228 2.10718 0.119038 -0.103939 -1.65937 1.63899 0.0872034 -0.0668244 -1.13303 1.1136 0.0474042 -0.0279718 -0.560492 0.552054 0.0153925 -0.00695436 -0.0858806 0.0835765 0.0023041 -0.0853478 0.0847813 -0.000311623 0.000878129 -0.227643 0.227559 -0.00146405 0.00154807 -0.399471 0.401109 -0.000752786 -0.000885173 -0.592324 0.595405 0.00356629 -0.00664737 -0.790293 0.794352 0.0106266 -0.0146861 -0.989916 0.994274 0.0193854 -0.0237438 -1.20471 1.20898 0.0284581 -0.0327363 -1.44806 1.45277 0.0374547 -0.0421712 -1.73993 1.74618 0.0478331 -0.0540861 -2.07964 2.09128 0.0627479 -0.0743964 -2.09576 2.11468 0.0894664 -0.10838 -1.94188 1.95931 0.126513 -0.143935 -2.38487 2.37923 0.149118 -0.143475 -2.69399 2.68818 0.148156 -0.142338 -2.48291 2.46583 0.131159 -0.114078 -2.08976 2.07203 0.0978441 -0.0801153 -1.61855 1.59958 0.0628254 -0.0438574 -1.09703 1.08403 0.0278357 -0.014839 -0.545658 0.541157 0.00794371 -0.00344223 -0.0819228 0.0809451 0.00097774 -0.0842222 0.0837217 -0.000253277 0.000753813 -0.227315 0.226974 -0.00138365 0.00172544 -0.402338 0.403202 -0.00154161 0.000677872 -0.59809 0.600404 0.00109517 -0.00340896 -0.798172 0.801744 0.00668119 -0.0102529 -0.998569 1.00274 0.0145956 -0.0187646 -1.21346 1.21793 0.023427 -0.0278962 -1.45794 1.46344 0.0332533 -0.0387545 -1.75353 1.76127 0.045711 -0.0534432 -2.10488 2.11946 0.0644859 -0.0790667 -2.13683 2.16179 0.0983708 -0.123339 -1.97858 1.99803 0.147747 -0.167199 -2.36317 2.33932 0.167727 -0.143869 -2.67678 2.65837 0.13851 -0.120107 -2.44704 2.42707 0.100694 -0.08073 -2.05375 2.03682 0.0644369 -0.0475079 -1.58232 1.56875 0.0328843 -0.0193141 -1.07525 1.0706 0.0110932 -0.0064411 -0.53778 0.5351 0.00388882 -0.00120857 -0.0805499 0.0806864 -0.000136531 -0.0833072 0.082993 -0.000157484 0.000471767 -0.22665 0.22641 -0.000867795 0.00110741 -0.403866 0.404369 -0.0010497 0.000546575 -0.602363 0.604026 0.000618376 -0.00228218 -0.805014 0.807932 0.0048032 -0.00772034 -1.00674 1.01047 0.0114984 -0.0152346 -1.22233 1.22646 0.0194554 -0.0235884 -1.46889 1.47414 0.0287207 -0.0339746 -1.769 1.77645 0.0404655 -0.047913 -2.13441 2.14818 0.0584901 -0.0722611 -2.18582 2.20807 0.0899438 -0.112195 -2.01983 2.04232 0.134529 -0.157012 -2.31065 2.2778 0.159607 -0.126762 -2.63896 2.62199 0.0907118 -0.0737406 -2.40824 2.39118 0.0551958 -0.0381341 -2.0207 2.00942 0.0261333 -0.0148535 -1.56029 1.55757 0.00831179 -0.00559024 -1.06912 1.06927 0.00524326 -0.00539372 -0.532208 0.528867 0.00428627 -0.000944829 -0.0810641 0.0816933 -0.000629133 -0.0828002 0.0827171 -4.82857e-05 0.000131305 -0.226333 0.22638 -0.000183912 0.000137135 -0.404807 0.405233 8.65724e-05 -0.000512515 -0.605393 0.606548 0.00132367 -0.00247864 -0.81047 0.812663 0.00431608 -0.0065088 -1.01389 1.01683 0.00940652 -0.0123485 -1.23019 1.2335 0.0157397 -0.0190544 -1.479 1.48327 0.0231229 -0.0273957 -1.78337 1.78896 0.0326768 -0.0382663 -2.16004 2.16847 0.0453252 -0.0537514 -2.22577 2.23809 0.0643695 -0.0766966 -2.06021 2.0725 0.0884406 -0.100733 -2.24745 2.22169 0.103668 -0.0779094 -2.60642 2.58935 0.0285698 -0.0115002 -2.37903 2.37358 0.00343559 0.00201494 -2.00359 2.00431 -0.00298475 0.00226688 -1.5583 1.56156 -3.38636e-05 -0.00321926 -1.07112 1.07489 0.00746825 -0.0112397 -0.524083 0.51786 0.00886761 -0.00264458 -0.0822647 0.0825983 -0.00033358 -0.0827429 0.0828375 3.70244e-05 -0.000131624 -0.226611 0.226957 0.000354843 -0.000701379 -0.405693 0.406195 0.00120344 -0.00170455 -0.607474 0.608258 0.00232858 -0.00311291 -0.814531 0.816156 0.0043981 -0.00602315 -1.01939 1.02148 0.00816821 -0.0102583 -1.23634 1.23873 0.0127136 -0.0151035 -1.48684 1.48966 0.0179653 -0.0207861 -1.79334 1.79595 0.0239188 -0.0265295 -2.17441 2.17671 0.0290189 -0.031322 -2.24521 2.24484 0.0328514 -0.0324767 -2.07709 2.07665 0.0314881 -0.0310412 -2.20326 2.19196 0.0307834 -0.01949 -2.57137 2.55648 -0.0144258 0.0293177 -2.37567 2.38189 -0.0267664 0.0205434 -2.00875 2.01725 -0.0137212 0.00522575 -1.56918 1.58045 0.00395159 -0.0152214 -1.0777 1.07795 0.0233255 -0.0235788 -0.509012 0.498595 0.01616 -0.00574289 -0.0824776 0.0818116 0.000666001 -0.0830237 0.0832647 9.42628e-05 -0.000335276 -0.227477 0.228097 0.00081845 -0.00143901 -0.40677 0.407419 0.0022146 -0.00286394 -0.608862 0.609385 0.00344233 -0.00396581 -0.817463 0.81849 0.00474886 -0.00577586 -1.02331 1.02474 0.00721924 -0.00864404 -1.24064 1.24221 0.010254 -0.011816 -1.49176 1.49315 0.0135374 -0.0149265 -1.79742 1.79781 0.0160408 -0.0164342 -2.17633 2.17394 0.0157031 -0.0133158 -2.2399 2.22863 0.0074744 0.00379785 -2.06891 2.0571 -0.0164136 0.0282269 -2.18696 2.19132 -0.0327138 0.0283611 -2.54781 2.54537 -0.0341999 0.0366339 -2.39345 2.40627 -0.0275763 0.0147481 -2.02964 2.04313 -0.00288188 -0.0106112 -1.59252 1.60455 0.0232779 -0.0353048 -1.07495 1.0695 0.0404343 -0.0349826 -0.486332 0.473177 0.0213985 -0.00824431 -0.0806849 0.079022 0.00166291 -0.0835575 0.000114526 -0.000432913 0.0838759 -0.228822 0.00106192 -0.00185575 0.229616 -0.408155 0.00284654 -0.00365585 0.408964 -0.609763 0.0042901 -0.00468334 0.610156 -0.819267 0.00511104 -0.00565148 0.819807 -1.02593 0.00648347 -0.00734823 1.0268 -1.24339 0.00833576 -0.00926529 1.24432 -1.49405 0.0101259 -0.0105409 1.49447 -1.79718 0.0103671 -0.00957129 1.79639 -2.16956 0.00748161 -0.0022922 2.16437 -2.21376 -0.00711335 0.023139 2.19774 -2.03957 -0.0439436 0.0648007 2.01871 -2.20173 -0.070696 0.0537768 2.21865 -2.54708 -0.0391928 0.03202 2.55425 -2.42257 -0.0159288 -0.00470123 2.4432 -2.06153 0.0217102 -0.0361356 2.07596 -1.61619 0.0482902 -0.0576761 1.62558 -1.05887 0.055344 -0.0414756 1.045 -0.459179 0.023984 -0.00960604 0.444801 -0.0771303 0.0748278 0.00230253 -0.00021906 -0.0295377 0.00064819 -0.00137068 -0.167199 0.0022248 -0.00329045 -0.347655 0.00417925 -0.00485401 -0.557117 0.00515553 -0.00531393 -0.7841 0.00557567 -0.00606539 -1.01209 0.00663179 -0.00729364 -1.24205 0.00787053 -0.00855186 -1.49484 0.00912925 -0.00942136 -1.79475 0.00887258 -0.0062259 -2.15586 0.00136246 0.00702274 -2.15766 -0.0203391 0.0345962 -1.8732 -0.0511598 0.0545525 -1.88365 -0.0390316 0.0173062 -2.21114 0.000814951 -0.0187243 -2.34988 0.0394799 -0.0559662 -2.09383 0.0711106 -0.0778549 -1.71414 0.0756106 -0.0650052 -1.22632 0.0441588 -0.0264564 -0.637616 -0.0726522 0.0043245 0.833516 -0.809504 0.0357656 -0.0597768 1.1889 -1.18371 0.074686 -0.0798718 1.23239 -1.24059 0.079097 -0.0709004 1.24242 -1.2485 0.0723965 -0.0663235 1.25322 -1.25916 0.0643068 -0.0583656 1.27144 -1.27458 0.055078 -0.0519424 1.29151 -1.2941 0.0500882 -0.0475017 1.30292 -1.30795 0.0458604 -0.040829 1.17405 -1.18451 0.0329155 -0.0224623 0.313063 -0.333106 0.0200427 0.802394 -0.790203 0.0229956 -0.035186 1.18329 -1.18258 0.0392324 -0.0399375 1.24392 -1.24575 0.0383238 -0.0364983 1.25387 -1.25477 0.0360318 -0.0351383 1.26266 -1.26447 0.0333365 -0.0315292 1.27739 -1.27888 0.0313038 -0.0298179 1.29631 -1.29717 0.0288574 -0.0279939 1.31384 -1.3149 0.0271077 -0.0260474 1.19312 -1.19738 0.0243258 -0.0200616 0.33911 -0.348771 0.0096604 0.778953 -0.774655 0.0125311 -0.0168294 1.1856 -1.18749 0.0163771 -0.0144896 1.24766 -1.24796 0.0132164 -0.012909 1.2567 -1.25627 0.0129816 -0.0134136 1.26597 -1.26552 0.013363 -0.0138086 1.27956 -1.27882 0.013918 -0.0146664 1.29766 -1.29604 0.0154979 -0.0171207 1.31463 -1.31273 0.0196256 -0.0215223 1.20281 -1.20686 0.0233488 -0.0192979 0.354784 -0.362774 0.00799001 0.773331 -0.774947 0.00608495 -0.0044689 1.18925 -1.19178 0.00027915 0.0022484 1.24858 -1.24878 -0.00328748 0.00348792 1.25682 -1.25595 -0.00256209 0.0016965 1.26553 -1.26377 0.000160325 -0.00192207 1.2783 -1.27593 0.00353314 -0.00590937 1.29469 -1.29137 0.00846444 -0.0117897 1.30984 -1.30612 0.0157896 -0.019509 1.21128 -1.21465 0.0215307 -0.0181683 0.369439 -0.377411 0.00797141 0.7796 -0.786662 0.00235038 0.00471223 1.19385 -1.1979 -0.0110545 0.015106 1.24763 -1.24772 -0.0150661 0.0151512 1.25468 -1.2529 -0.0127488 0.0109663 1.26253 -1.25972 -0.00810376 0.00529753 1.2734 -1.27058 -0.00257164 -0.000244884 1.28813 -1.2845 0.0050976 -0.00872486 1.30325 -1.29907 0.0135162 -0.0176957 1.21792 -1.21984 0.0205865 -0.0186659 0.384565 -0.392926 0.00836096 0.795809 -0.807053 -0.000952262 0.0121968 1.19965 -1.2029 -0.0202658 0.0235103 1.24578 -1.24404 -0.0235422 0.0218025 1.25078 -1.24835 -0.0194856 0.0170613 1.25756 -1.25397 -0.0134573 0.00986611 1.26712 -1.26289 -0.00632463 0.00209277 1.28048 -1.27548 0.00223314 -0.00723491 1.29482 -1.29029 0.0128107 -0.0173462 1.22195 -1.22383 0.0220478 -0.0201762 0.401344 -0.411394 0.01005 0.819678 -0.834062 -0.00355231 0.017936 1.20531 -1.20854 -0.0270325 0.0302583 1.24285 -1.24063 -0.0298837 0.0276569 1.24611 -1.24239 -0.0247135 0.0210012 1.25105 -1.24734 -0.0173038 0.0135969 1.25928 -1.25428 -0.00865079 0.00365128 1.27126 -1.26485 0.00145323 -0.00786617 1.2851 -1.27905 0.0136389 -0.0196836 1.22446 -1.22552 0.0247438 -0.0236844 0.422686 -0.435748 0.0130623 0.849637 -0.867799 -0.0073766 0.0255395 1.20974 -1.21215 -0.0349289 0.0373432 1.23884 -1.2358 -0.0360561 0.0330132 1.23938 -1.23494 -0.0293701 0.0249297 1.24298 -1.23782 -0.0210463 0.01588 1.24921 -1.24396 -0.010073 0.00482337 1.25977 -1.2531 0.00177025 -0.00844014 1.27296 -1.26593 0.0157467 -0.0227813 1.22572 -1.2253 0.0289589 -0.0293848 0.450423 -0.46788 0.0174574 0.886948 -0.908105 -0.0140209 0.0351777 1.21312 -1.21428 -0.0442724 0.0454322 1.23176 -1.22879 -0.0422887 0.0393194 1.23099 -1.22557 -0.0340838 0.0286663 1.23254 -1.227 -0.0231696 0.0176334 1.23796 -1.23111 -0.010833 0.00398745 1.24645 -1.23946 0.00355349 -0.0105429 1.25881 -1.25142 0.0188056 -0.0261937 1.22442 -1.22344 0.0340958 -0.0350786 0.487745 -0.510953 0.0232076 0.930381 -0.954383 -0.0236559 0.0476573 1.21376 -1.213 -0.0554203 0.0546634 1.22343 -1.21835 -0.0499398 0.0448616 1.22044 -1.21439 -0.0389578 0.0329117 1.22062 -1.21391 -0.0255789 0.0188679 1.22531 -1.21742 -0.0109613 0.00307789 1.23184 -1.22395 0.00543669 -0.0133201 1.24332 -1.23442 0.0224328 -0.0313276 1.22128 -1.21843 0.0396968 -0.0425416 0.537204 -0.567575 0.0303707 0.978889 -1.00473 -0.0369562 0.0627982 1.20981 -1.20706 -0.0670747 0.0643258 1.21199 -1.20458 -0.0582135 0.0508051 1.20722 -1.1998 -0.0433988 0.0359758 1.2063 -1.19845 -0.0273988 0.0195499 1.20937 -1.20056 -0.0106134 0.00180846 1.21549 -1.20627 0.00691823 -0.0161369 1.22612 -1.21652 0.0259021 -0.0355042 1.21484 -1.2111 0.0448294 -0.0485722 0.600898 -0.637952 0.0370536 1.03 -1.05451 -0.0514957 0.0759978 1.20155 -1.19542 -0.0774617 0.0713347 1.19661 -1.18846 -0.0630827 0.0549245 1.19137 -1.18304 -0.0457415 0.0374147 1.19052 -1.18157 -0.0281829 0.0192344 1.1924 -1.18321 -0.0104954 0.00130958 1.19777 -1.18747 0.00783241 -0.0181307 1.20698 -1.1968 0.0278697 -0.0380483 1.20532 -1.19988 0.0480803 -0.0535263 0.678293 -0.721948 0.0436553 1.07731 -1.09755 -0.0641518 0.0843885 1.18776 -1.17953 -0.0810976 0.0728695 1.17936 -1.17006 -0.0634064 0.0541126 1.17471 -1.16584 -0.0453675 0.0364964 1.17356 -1.16474 -0.0279646 0.0191397 1.17445 -1.16603 -0.010539 0.00212577 1.17872 -1.16924 0.00735906 -0.016839 1.18664 -1.17671 0.027054 -0.0369842 1.19284 -1.18459 0.048539 -0.0567809 0.768503 -0.817645 0.0491424 1.11462 -1.12767 -0.0729905 0.0860409 1.16959 -1.16084 -0.0791031 0.0703495 1.16138 -1.15379 -0.0615094 0.053916 1.15777 -1.14892 -0.0457493 0.0368987 1.15657 -1.14719 -0.0280151 0.018643 1.15723 -1.14788 -0.00949282 0.000139214 1.16054 -1.15208 0.00937426 -0.0178428 1.16731 -1.15866 0.0269581 -0.0356106 1.17509 -1.16698 0.0444875 -0.0525927 0.869034 -0.91954 0.050506 1.13591 -1.14071 -0.0771149 0.0819165 1.15264 -1.14471 -0.0779232 0.0699905 1.14545 -1.13608 -0.0601473 0.0507765 1.1403 -1.13148 -0.041562 0.0327482 1.13873 -1.13107 -0.0249267 0.017272 1.13969 -1.13194 -0.0100876 0.00234306 1.14312 -1.13467 0.0062185 -0.014668 1.15082 -1.14079 0.0246794 -0.0347026 1.16117 -1.15116 0.0440149 -0.0540224 0.970536 -1.02542 0.0548828 1.1412 -0.0617149 0.0457979 1.13135 -0.0347021 0.028633 1.1272 -0.0250032 0.0230908 1.12637 -0.0209594 0.0198723 1.12669 -0.0179324 0.0165291 1.1269 -0.0141297 0.0125153 1.12841 -0.00968152 0.00655233 1.13037 -0.00293064 -0.00215476 1.13628 0.00957674 -0.0205734 1.08742 0.0378667 -0.19901 0.0708809 -0.365167 -0.102653 0.103232 -0.431799 -0.0923782 0.0777018 -0.507488 -0.0644074 0.05071 -0.603058 -0.0400602 0.0303352 -0.721059 -0.0234874 0.0176559 -0.864068 -0.0136493 0.0102448 -1.03638 -0.00784541 0.00575352 -1.24321 -0.0042185 0.00282831 -1.4916 -0.00175886 0.000729555 -1.49157 0.000222272 -0.00115413 -1.2429 0.00221165 -0.00329533 -1.03598 0.00468742 -0.00621645 -0.863728 0.00829438 -0.0106709 -0.720428 0.0140398 -0.0180077 -0.601889 0.0237965 -0.0306094 -0.504277 0.0403012 -0.0509239 -0.426588 0.0645947 -0.0778654 -0.364472 0.0925168 -0.10335 -0.289147 0.10273 -0.0709162 0.019705 0.335994 -0.0482739 0.0656783 0.457629 -0.068388 0.0650741 0.53496 -0.0594623 0.0543955 0.626948 -0.049578 0.0441881 0.740092 -0.0388369 0.0328973 0.877959 -0.0275979 0.022217 1.04611 -0.0178417 0.013645 1.25022 -0.0103238 0.00712485 1.49728 -0.00450292 0.00182194 1.49665 0.000616122 -0.00304752 1.24845 0.00570324 -0.00828645 1.04332 0.011439 -0.0147143 0.874156 0.018855 -0.02317 0.735166 0.028474 -0.0336961 0.621395 0.0395493 -0.0448264 0.527802 0.0501416 -0.0548966 0.453473 0.059902 -0.0654608 0.373962 0.0687056 -0.0659218 0.193821 0.0484161 -0.0197515 0.00575502 -0.315947 0.296788 -0.0219855 0.0411443 -0.458536 0.456957 -0.050591 0.0521705 -0.540045 0.54446 -0.0502406 0.0458252 -0.630785 0.634693 -0.0419296 0.0380211 -0.744187 0.74759 -0.034703 0.0313002 -0.882518 0.886141 -0.028084 0.0244607 -1.05045 1.05435 -0.0209525 0.0170441 -1.25395 1.25779 -0.0134681 0.00963391 -1.5006 1.50432 -0.00621093 0.00248955 -1.4997 1.50318 0.00101516 -0.00450102 -1.25152 1.25488 0.00817336 -0.0115329 -1.04689 1.05038 0.0152847 -0.0187766 -0.878194 0.881602 0.0225857 -0.0259932 -0.739146 0.742243 0.0294939 -0.0325907 -0.624955 0.628161 0.035862 -0.0390677 -0.531684 0.535488 0.0428646 -0.0466689 -0.457152 0.458985 0.0509897 -0.052823 -0.367267 0.357668 0.0511191 -0.0415198 -0.171731 0.15537 0.0221745 -0.00581319 0.00308308 -0.279581 0.264644 -0.0123145 0.0272511 -0.453244 0.448197 -0.0379582 0.0430051 -0.547506 0.549479 -0.0433304 0.0413578 -0.638455 0.64169 -0.0386466 0.0354113 -0.751017 0.754415 -0.0323725 0.0289744 -0.889388 0.892623 -0.0259427 0.0227081 -1.05787 1.06112 -0.0197707 0.0165193 -1.26157 1.26514 -0.0134044 0.00983248 -1.50828 1.51225 -0.006388 0.00241502 -1.50694 1.51079 0.00145754 -0.00530444 -1.25829 1.26164 0.00920362 -0.0125532 -1.05359 1.05658 0.0160019 -0.0189924 -0.884536 0.887332 0.0220991 -0.0248945 -0.745134 0.748004 0.0279619 -0.0308316 -0.631347 0.63423 0.0340501 -0.0369326 -0.538735 0.541325 0.0400119 -0.0426017 -0.459488 0.459013 0.0444209 -0.0439459 -0.346915 0.33597 0.0386871 -0.027742 -0.143236 0.133841 0.0125495 -0.00315502 0.00208132 -0.251743 0.240572 -0.00828017 0.0194511 -0.442354 0.43604 -0.0293279 0.035642 -0.550654 0.551398 -0.0372574 0.0365133 -0.644344 0.646717 -0.0345477 0.0321749 -0.757462 0.760159 -0.0298859 0.027188 -0.895869 0.898922 -0.0245631 0.0215103 -1.06441 1.06764 -0.0186375 0.0154068 -1.26865 1.27208 -0.0123826 0.00895327 -1.5162 1.52005 -0.00565181 0.00180805 -1.51462 1.51837 0.00197075 -0.005714 -1.26488 1.26805 0.00945637 -0.012627 -1.05945 1.0623 0.0158863 -0.0187383 -0.890093 0.892776 0.0217711 -0.0244542 -0.750707 0.753123 0.0272888 -0.0297048 -0.636665 0.638752 0.032171 -0.034258 -0.543471 0.545263 0.0364277 -0.0382198 -0.457804 0.455957 0.0387564 -0.0369095 -0.325288 0.315081 0.0302754 -0.020068 -0.126211 0.11981 0.00857051 -0.00216907 0.00152946 -0.230827 0.22229 -0.00608175 0.0146189 -0.429404 0.422642 -0.0232416 0.030003 -0.551798 0.551905 -0.0325848 0.0324784 -0.64888 0.650972 -0.0310636 0.0289718 -0.762571 0.764868 -0.026955 0.0246581 -0.901758 0.904352 -0.0224427 0.0198492 -1.07086 1.07385 -0.0173047 0.0143072 -1.27555 1.27891 -0.0114006 0.008035 -1.52386 1.5276 -0.00480211 0.00106251 -1.52204 1.52564 0.0025787 -0.00617426 -1.27116 1.27422 0.00978107 -0.0128412 -1.06508 1.06776 0.0159821 -0.0186616 -0.895265 0.897562 0.0213989 -0.0236963 -0.755265 0.757216 0.0260096 -0.0279612 -0.640642 0.642405 0.0299684 -0.0317315 -0.546731 0.547902 0.0335689 -0.0347402 -0.453525 0.450609 0.0345586 -0.0316423 -0.305425 0.296371 0.0244333 -0.0153798 -0.114306 0.109505 0.00643695 -0.00163608 0.00116932 -0.214754 0.208085 -0.00465144 0.0113207 -0.415854 0.409177 -0.0186594 0.0253363 -0.551675 0.551178 -0.0285322 0.0290288 -0.652946 0.654868 -0.0281471 0.0262254 -0.767045 0.769179 -0.0243544 0.02222 -0.906839 0.9092 -0.0201783 0.0178182 -1.07677 1.07948 -0.0155144 0.0127973 -1.28225 1.28541 -0.0101162 0.00694888 -1.53133 1.53495 -0.00385256 0.000228862 -1.52919 1.53267 0.0033055 -0.00678192 -1.27719 1.28006 0.0102361 -0.0131115 -1.07028 1.07267 0.0159893 -0.0183782 -0.899669 0.901662 0.0207625 -0.0227549 -0.759029 0.760744 0.0247663 -0.0264816 -0.644065 0.645618 0.0282577 -0.0298114 -0.548729 0.549281 0.031408 -0.03196 -0.447272 0.443614 0.0310629 -0.0274048 -0.28791 0.280028 0.0201335 -0.0122515 -0.105258 0.101473 0.0050838 -0.0012986 0.000908373 -0.202141 0.19684 -0.003629 0.0089299 -0.40265 0.396362 -0.0151171 0.0214043 -0.550363 0.549324 -0.0249206 0.0259589 -0.6566 0.658243 -0.0253729 0.0237305 -0.77122 0.773239 -0.0219776 0.0199589 -0.91154 0.913776 -0.0180264 0.01579 -1.08219 1.08474 -0.0136133 0.0110578 -1.28854 1.29151 -0.00854358 0.00557252 -1.53854 1.54199 -0.00264646 -0.000805956 -1.53609 1.5394 0.00418807 -0.0074962 -1.28281 1.28546 0.0107329 -0.0133795 -1.07491 1.07705 0.0159862 -0.0181335 -0.903526 0.905313 0.0202707 -0.0220578 -0.762356 0.763888 0.023862 -0.0253936 -0.647081 0.64844 0.026975 -0.0283341 -0.549614 0.549787 0.0295419 -0.0297157 -0.439673 0.435534 0.028128 -0.0239885 -0.272672 0.265808 0.0169325 -0.0100684 -0.0980604 0.0949699 0.00415619 -0.00106567 0.0007106 -0.192081 0.187821 -0.00286126 0.00712213 -0.390313 0.384571 -0.0123206 0.0180636 -0.548025 0.546586 -0.0216759 0.0231157 -0.659704 0.661115 -0.022768 0.0213579 -0.775182 0.777126 -0.0196942 0.01775 -0.916015 0.918156 -0.0158947 0.0137539 -1.08733 1.08978 -0.0116694 0.00921773 -1.29448 1.29732 -0.00680648 0.0039654 -1.54539 1.54865 -0.00118073 -0.00208198 -1.54262 1.5457 0.00525729 -0.00834143 -1.28798 1.29042 0.0113375 -0.0137742 -1.07908 1.08103 0.0161606 -0.0181146 -0.906981 0.908582 0.0200465 -0.021648 -0.765321 0.766685 0.0232554 -0.0246197 -0.649717 0.650915 0.0260318 -0.027229 -0.54976 0.549554 0.0280596 -0.0278541 -0.431217 0.426791 0.0256828 -0.0212568 -0.259376 0.253343 0.0145425 -0.00850931 -0.0921387 0.0895381 0.00350185 -0.000901233 0.000553965 -0.183981 0.180542 -0.00225832 0.00569709 -0.379105 0.373976 -0.0100488 0.0151781 -0.544953 0.543255 -0.0187169 0.0204151 -0.662332 0.663517 -0.0202802 0.0190952 -0.779002 0.780901 -0.0174674 0.0155676 -0.920328 0.92241 -0.0137577 0.0116762 -1.0923 1.09467 -0.00965289 0.00727775 -1.30018 1.30292 -0.00494639 0.00220814 -1.55189 1.55499 0.000462217 -0.00356862 -1.54871 1.55159 0.0065649 -0.00944828 -1.29275 1.29499 0.0122242 -0.0144633 -1.08287 1.08464 0.0166392 -0.0184065 -0.910067 0.911497 0.0201411 -0.0215711 -0.767951 0.769155 0.0229962 -0.0242011 -0.652046 0.653108 0.0254492 -0.0265107 -0.549168 0.54857 0.026955 -0.0263568 -0.422254 0.417669 0.0236916 -0.0191063 -0.247649 0.242272 0.0127636 -0.00738673 -0.0871188 0.084867 0.0030371 -0.000785287 0.000424296 -0.177443 0.17468 -0.00176412 0.004528 -0.369141 0.36465 -0.00814473 0.0126365 -0.54143 0.539612 -0.0159731 0.0177918 -0.664528 0.665587 -0.017828 0.0167691 -0.782743 0.784635 -0.0151938 0.0133025 -0.92455 0.926602 -0.0115065 0.00945407 -1.09713 1.09945 -0.00746969 0.00515068 -1.30571 1.30836 -0.00288217 0.000227291 -1.55809 1.56107 0.00234916 -0.00532643 -1.55441 1.55711 0.0081686 -0.0108726 -1.29712 1.29917 0.0134422 -0.0154842 -1.08628 1.08785 0.0174424 -0.0190138 -0.912796 0.914054 0.0205443 -0.0218029 -0.770276 0.771336 0.023055 -0.0241148 -0.654051 0.654894 0.0252152 -0.0260579 -0.547807 0.546795 0.026213 -0.0252013 -0.41302 0.408355 0.0221212 -0.0174567 -0.237152 0.232279 0.0114605 -0.00658755 -0.082739 0.0807323 0.00271235 -0.000705698 0.000311924 -0.172201 0.170014 -0.00134033 0.00352697 -0.360455 0.356605 -0.00648933 0.010339 -0.537717 0.535891 -0.0133798 0.0152053 -0.66651 0.667516 -0.015365 0.0143594 -0.786472 0.788367 -0.0128466 0.0109516 -0.928745 0.930804 -0.00914623 0.00708741 -1.10189 1.1042 -0.00510179 0.00279138 -1.31109 1.3137 -0.000545905 -0.00206027 -1.56405 1.56691 0.00456474 -0.0074282 -1.55976 1.56229 0.0101275 -0.0126571 -1.30111 1.30296 0.0150196 -0.0168677 -1.0893 1.09069 0.0186177 -0.0200059 -0.915176 0.916275 0.021348 -0.0224472 -0.772304 0.773213 0.0235331 -0.0244414 -0.655592 0.656165 0.025358 -0.0259307 -0.545642 0.544231 0.025797 -0.0243862 -0.403646 0.39894 0.0209468 -0.0162405 -0.227592 0.223093 0.0105355 -0.00603641 -0.0788049 0.0769644 0.00249472 -0.000654281 0.000208684 -0.168078 0.16641 -0.000956239 0.00262457 -0.35305 0.349847 -0.00498344 0.00818696 -0.534036 0.53232 -0.0108524 0.0125677 -0.668372 0.669354 -0.0127684 0.0117863 -0.790214 0.792131 -0.0102997 0.00838231 -0.932988 0.935076 -0.00654703 0.00445893 -1.10666 1.10899 -0.002452 0.000128179 -1.3164 1.31899 0.00211715 -0.00470311 -1.56981 1.57259 0.00716557 -0.0099487 -1.56478 1.56716 0.0125342 -0.0149111 -1.30471 1.30636 0.0170784 -0.0187325 -1.09194 1.09314 0.0202641 -0.0214559 -0.917218 0.918144 0.0225954 -0.0235215 -0.774035 0.774771 0.0244208 -0.0251574 -0.656598 0.656872 0.0258883 -0.026162 -0.542654 0.540875 0.0256864 -0.0239073 -0.394182 0.38944 0.0201481 -0.0154064 -0.218715 0.214477 0.00991986 -0.00568207 -0.0751665 0.0734301 0.00236142 -0.000625029 0.000108174 -0.164973 0.163796 -0.000587321 0.00176495 -0.346936 0.344388 -0.00354498 0.00609332 -0.530616 0.529115 -0.00831909 0.00981996 -0.670189 0.671197 -0.00997848 0.00897089 -0.794019 0.795996 -0.00746681 0.00549003 -0.937322 0.939469 -0.00359659 0.0014495 -1.11149 1.11386 0.000606959 -0.00297707 -1.3217 1.3243 0.00525408 -0.00785266 -1.57543 1.57814 0.0102962 -0.0130085 -1.5695 1.57171 0.0154721 -0.0176824 -1.30793 1.30938 0.0196428 -0.0210962 -1.09418 1.09517 0.0223995 -0.0233817 -0.918877 0.919621 0.0243009 -0.0250452 -0.775427 0.775989 0.0257565 -0.0263191 -0.657017 0.656971 0.0268406 -0.0267947 -0.538898 0.536734 0.0259456 -0.0237811 -0.384626 0.379828 0.0197087 -0.0149105 -0.210303 0.206229 0.00956213 -0.005488 -0.0717065 0.0700238 0.00229683 -0.000614164 5.61692e-06 -0.162842 0.162154 -0.000214209 0.000902448 -0.342139 0.340266 -0.00210566 0.00397827 -0.527662 0.526477 -0.00570172 0.00688665 -0.672049 0.673127 -0.00692164 0.00584301 -0.79796 0.800017 -0.00428577 0.00222877 -0.941821 0.944069 -0.000248435 -0.00199905 -1.11645 1.11891 0.00414796 -0.0066102 -1.32705 1.32969 0.00895299 -0.0115936 -1.58092 1.58358 0.0140402 -0.0167058 -1.5739 1.57595 0.0190683 -0.0211188 -1.31074 1.31197 0.0228633 -0.0240969 -1.096 1.09676 0.0251526 -0.0259135 -0.920138 0.920688 0.0266048 -0.0271553 -0.776474 0.776812 0.0276514 -0.027989 -0.656837 0.656489 0.0281894 -0.0278416 -0.534337 0.531784 0.02658 -0.0240268 -0.374921 0.370026 0.0196322 -0.014737 -0.202164 0.198162 0.00943913 -0.00543753 -0.0683272 0.0666532 0.00229391 -0.000619943 -0.000103567 -0.161689 0.161521 0.00017363 -6.17473e-06 -0.338711 0.337553 -0.00060111 0.00175946 -0.525377 0.524619 -0.00291208 0.00366993 -0.674043 0.675271 -0.00348056 0.00225321 -0.802076 0.804244 -0.000578586 -0.00158947 -0.946564 0.948942 0.00368623 -0.00606409 -1.12164 1.12422 0.00833133 -0.0109153 -1.33251 1.33523 0.0133544 -0.0160727 -1.58634 1.58899 0.0185526 -0.0211983 -1.57798 1.57988 0.0234715 -0.0253686 -1.31311 1.3141 0.0268904 -0.0278857 -1.09736 1.09786 0.0286638 -0.0291646 -0.920963 0.921278 0.0295786 -0.029893 -0.777098 0.777176 0.0301331 -0.0302107 -0.656089 0.655409 0.0300508 -0.0293707 -0.528933 0.525959 0.0276672 -0.0246934 -0.364976 0.359922 0.0199405 -0.0148863 -0.194118 0.190099 0.00954098 -0.00552184 -0.0649402 0.0632329 0.00234837 -0.000641024 -0.00024259 -0.161592 0.161943 0.000647221 -0.000998234 -0.33674 0.336342 0.00104552 -0.00064843 -0.523985 0.523764 0.00013104 9.01429e-05 -0.676332 0.677797 0.000435024 -0.00189989 -0.806449 0.80879 0.00375271 -0.00609313 -0.951619 0.954172 0.00834744 -0.0108998 -1.1271 1.12985 0.0133263 -0.0160772 -1.33817 1.34101 0.0186529 -0.021488 -1.59175 1.59438 0.0240259 -0.0266613 -1.58175 1.58347 0.0288407 -0.0305613 -1.315 1.31574 0.0318276 -0.0325617 -1.09819 1.09839 0.0330273 -0.0332297 -0.921288 0.921311 0.0333088 -0.0333321 -0.777243 0.777042 0.0332679 -0.0330674 -0.654681 0.653639 0.0324904 -0.0314479 -0.522614 0.519168 0.0292598 -0.0258136 -0.354657 0.349367 0.0206409 -0.015351 -0.185984 0.18186 0.0098571 -0.00573332 -0.0614623 0.0596821 0.00245682 -0.000676576 -0.000377346 -0.162547 0.163533 0.00112807 -0.00211374 -0.336378 0.336812 0.00284114 -0.00327477 -0.523718 0.524198 0.00348969 -0.00396925 -0.679059 0.680838 0.00497181 -0.00675083 -0.811209 0.81378 0.0088396 -0.0114105 -0.957092 0.95989 0.0138773 -0.0166751 -1.13296 1.13595 0.0193303 -0.0223176 -1.3441 1.34709 0.0250796 -0.0280675 -1.59715 1.59978 0.0306863 -0.0333224 -1.58517 1.58668 0.035401 -0.0369194 -1.31637 1.31679 0.037882 -0.0383063 -1.09842 1.09827 0.0384012 -0.0382545 -0.921034 0.920719 0.0379456 -0.0376309 -0.776875 0.776354 0.0372053 -0.036685 -0.652499 0.651035 0.035626 -0.0341616 -0.515261 0.511276 0.0314083 -0.0274233 -0.343799 0.338184 0.0217537 -0.0161386 -0.177587 0.173269 0.0103866 -0.00606867 -0.0578147 0.0559235 0.00261664 -0.000725455 -0.00055742 -0.164831 0.166504 0.00173031 -0.00340347 -0.337741 0.339148 0.00493551 -0.00634242 -0.524868 0.526187 0.00741391 -0.00873321 -0.682385 0.684604 0.0103535 -0.0125723 -0.816485 0.819358 0.0149712 -0.0178441 -0.963129 0.966239 0.0205863 -0.0236964 -1.13934 1.14262 0.0266357 -0.0299124 -1.35037 1.35355 0.0329034 -0.0360836 -1.60257 1.60521 0.0388029 -0.0414434 -1.58817 1.58945 0.0433988 -0.0446748 -1.31709 1.31712 0.0452882 -0.0453246 -1.09795 1.09739 0.0449951 -0.0444372 -0.920119 0.919407 0.0436769 -0.0429655 -0.77586 0.774938 0.0421217 -0.0411993 -0.649365 0.647376 0.0396381 -0.0376488 -0.506725 0.502107 0.0342238 -0.0296061 -0.332209 0.326155 0.0233291 -0.0172753 -0.168743 0.164134 0.0111407 -0.00653255 -0.0539205 0.0518792 0.00282902 -0.00078774 -0.000772794 -0.168586 0.171075 0.00245009 -0.00493898 -0.34113 0.343647 0.00737968 -0.00989659 -0.527703 0.530055 0.0120244 -0.0143761 -0.686604 0.689424 0.0167574 -0.0195766 -0.822453 0.825742 0.0224096 -0.0256985 -0.969864 0.973364 0.0288012 -0.0323009 -1.14635 1.14998 0.0355874 -0.0392178 -1.35708 1.36049 0.0424877 -0.0458983 -1.60802 1.61063 0.0487275 -0.0513423 -1.59067 1.59163 0.0531166 -0.0540778 -1.31701 1.31659 0.054272 -0.0538534 -1.09666 1.09562 0.0530143 -0.0519702 -0.918429 0.917256 0.0506818 -0.0495087 -0.774 0.772567 0.0481716 -0.0467382 -0.645057 0.642441 0.0446414 -0.0420246 -0.496797 0.491422 0.0377941 -0.0324186 -0.319644 0.313021 0.0253954 -0.0187726 -0.159254 0.154254 0.0121195 -0.00712001 -0.0497016 0.0474737 0.00308893 -0.000861068 -0.00105166 -0.174137 0.177614 0.00335989 -0.00683657 -0.346865 0.350687 0.0103491 -0.0141714 -0.53254 0.536197 0.0175416 -0.021198 -0.692012 0.695594 0.0245247 -0.0281072 -0.829346 0.833159 0.0314946 -0.0353082 -0.977478 0.981485 0.0388743 -0.0428814 -1.15415 1.15822 0.0466164 -0.050689 -1.36428 1.36793 0.054286 -0.0579385 -1.61342 1.61596 0.060859 -0.0634 -1.59252 1.59307 0.0649217 -0.065473 -1.31602 1.31508 0.0651171 -0.0641786 -1.09442 1.0928 0.06269 -0.0610727 -0.915838 0.914129 0.0591707 -0.0574621 -0.771104 0.769042 0.0555672 -0.0535055 -0.639353 0.63598 0.0507529 -0.0473802 -0.485203 0.478923 0.0421851 -0.0359047 -0.305821 0.29848 0.0279727 -0.0206309 -0.148912 0.143418 0.0133104 -0.00781587 -0.0450861 0.0426415 0.00338596 -0.000941419 -0.00141953 -0.18194 0.18662 0.00452709 -0.00920708 -0.355385 0.360806 0.0140152 -0.0194371 -0.539807 0.545121 0.024363 -0.0296769 -0.698935 0.703498 0.0341932 -0.0387567 -0.837425 0.841918 0.0428759 -0.0473687 -0.986224 0.990867 0.0515306 -0.0561732 -1.16289 1.16746 0.0604421 -0.0650075 -1.37197 1.37583 0.0689352 -0.0727865 -1.61863 1.62096 0.0757136 -0.0780462 -1.59348 1.59347 0.0791632 -0.0791511 -1.31394 1.31234 0.0781055 -0.0765117 -1.09106 1.08878 0.0742888 -0.0720045 -0.912216 0.909885 0.0693853 -0.0670545 -0.766943 0.764157 0.0645081 -0.0617221 -0.631964 0.627667 0.0581476 -0.0538508 -0.47161 0.464232 0.0474828 -0.040105 -0.290411 0.282177 0.0310584 -0.022824 -0.137504 0.131414 0.0146773 -0.0085874 -0.0400177 0.0373392 0.00369989 -0.00102139 -0.00193071 -0.192642 0.198847 0.00609002 -0.0122952 -0.367286 0.374771 0.0187447 -0.0262299 -0.550056 0.557497 0.0331664 -0.0406069 -0.707828 0.713642 0.04661 -0.0524235 -0.847064 0.852413 0.057512 -0.0628613 -0.996339 1.00171 0.0677473 -0.0731158 -1.17264 1.17766 0.0779427 -0.0829642 -1.38005 1.38396 0.0871393 -0.0910481 -1.62337 1.62527 0.0938151 -0.0957239 -1.59324 1.59247 0.0962204 -0.0954422 -1.31048 1.30808 0.0935179 -0.0911241 -1.0864 1.08335 0.0880452 -0.0849979 -0.907453 0.904406 0.0815713 -0.078524 -0.761388 0.757845 0.0751396 -0.0715973 -0.622534 0.617097 0.0669836 -0.0615469 -0.455587 0.446868 0.0537359 -0.045017 -0.273024 0.263704 0.0346105 -0.0252906 -0.124818 0.118045 0.0161542 -0.00938043 -0.034468 0.0315585 0.00399977 -0.00109025 -0.00269504 -0.207252 0.215527 0.00831404 -0.0165895 -0.383435 0.393758 0.0252927 -0.0356153 -0.564022 0.574215 0.0452875 -0.0554807 -0.719233 0.726589 0.063322 -0.0706784 -0.858687 0.865045 0.0769123 -0.0832712 -1.00797 1.01407 0.0889585 -0.095051 -1.18328 1.18858 0.100354 -0.105658 -1.38815 1.39182 0.109855 -0.113517 -1.62712 1.62823 0.115809 -0.116918 -1.59136 1.5895 0.116449 -0.114595 -1.30535 1.30197 0.111528 -0.108152 -1.08022 1.07633 0.104074 -0.100185 -0.901387 0.897547 0.0958761 -0.0920364 -0.754382 0.749946 0.0877094 -0.0832737 -0.610617 0.603742 0.0773751 -0.0705008 -0.436607 0.426244 0.0608956 -0.0505325 -0.253219 0.242613 0.0384791 -0.0278731 -0.110666 0.103162 0.0176057 -0.0101016 -0.028452 0.0253462 0.00424093 -0.00113517 -0.00391813 -0.227418 0.239013 0.0117462 -0.0233408 -0.405235 0.419866 0.0356176 -0.050249 -0.582724 0.596187 0.0637111 -0.0771737 -0.733721 0.742971 0.0870522 -0.0963025 -0.872492 0.879752 0.103656 -0.110916 -1.02098 1.02747 0.117212 -0.123701 -1.19432 1.19942 0.129094 -0.134198 -1.39558 1.39847 0.137951 -0.140848 -1.62911 1.62895 0.142204 -0.142042 -1.58719 1.58392 0.140203 -0.136927 -1.29817 1.29361 0.132432 -0.127873 -1.07233 1.0675 0.122646 -0.117818 -0.893881 0.88912 0.112543 -0.107782 -0.745661 0.740086 0.102372 -0.0967967 -0.595631 0.586926 0.0893088 -0.080603 -0.414053 0.401638 0.0687217 -0.0563063 -0.230527 0.218455 0.0422635 -0.0301922 -0.0949279 0.0867637 0.018742 -0.0105778 -0.0220484 0.018836 0.0043551 -0.00114272 -0.00684987 -0.256385 0.274986 0.0201783 -0.0387796 -0.435316 0.455975 0.0571262 -0.0777848 -0.606789 0.623179 0.0955559 -0.111946 -0.751637 0.762475 0.123696 -0.134534 -0.888128 0.895194 0.142021 -0.149086 -1.03445 1.04041 0.155084 -0.161049 -1.20464 1.2087 0.165731 -0.1698 -1.40118 1.40257 0.172377 -0.173772 -1.62831 1.62626 0.173554 -0.171499 -1.58001 1.57489 0.167783 -0.162663 -1.28853 1.28255 0.15639 -0.150411 -1.06252 1.05663 0.143842 -0.137949 -0.884776 0.878941 0.131595 -0.12576 -0.734716 0.727605 0.118934 -0.111822 -0.576788 0.565734 0.102182 -0.0911279 -0.387126 0.372274 0.0764948 -0.0616432 -0.204567 0.190896 0.0451475 -0.0314766 -0.0776571 0.0691653 0.018984 -0.0104922 -0.0154083 0.0122754 0.00425542 -0.00112256 -0.00731624 -0.289735 0.306613 0.0195629 -0.0364403 -0.469755 0.487857 0.0529345 -0.0710365 -0.633257 0.648661 0.0869628 -0.102366 -0.772944 0.784613 0.114325 -0.125994 -0.90577 0.915528 0.135071 -0.144829 -1.05018 1.05962 0.153515 -0.162958 -1.21748 1.22558 0.171213 -0.179315 -1.40951 1.41559 0.186369 -0.192447 -1.63011 1.63309 0.197125 -0.200112 -1.574 1.57276 0.200634 -0.199392 -1.27882 1.27475 0.195755 -0.191682 -1.0521 1.04643 0.18616 -0.180487 -0.8744 0.86754 0.173895 -0.167035 -0.720896 0.710093 0.157564 -0.146762 -0.551081 0.534354 0.131696 -0.114969 -0.35274 0.332392 0.0938587 -0.073511 -0.173595 0.156871 0.0521949 -0.0354707 -0.0590498 0.0495808 0.0208637 -0.0113947 -0.00895268 0.00558355 0.00462289 -0.00125375 -0.00332246 -0.313654 0.324797 0.0102288 -0.0213713 -0.498283 0.511374 0.0330142 -0.0461048 -0.656792 0.669277 0.0581043 -0.0705894 -0.794178 0.803631 0.0808374 -0.0902898 -0.924975 0.933709 0.0982511 -0.106985 -1.06857 1.07701 0.11472 -0.123162 -1.23342 1.24056 0.130472 -0.137608 -1.42131 1.42669 0.143286 -0.148663 -1.63532 1.63692 0.15181 -0.153413 -1.57049 1.56783 0.152718 -0.150061 -1.26958 1.26414 0.145174 -0.139732 -1.04044 1.03388 0.132983 -0.126426 -0.861336 0.853499 0.118606 -0.11077 -0.702928 0.692015 0.101169 -0.0902562 -0.523437 0.510072 0.076993 -0.0636281 -0.320536 0.307876 0.0486997 -0.0360389 -0.14877 0.140294 0.0239824 -0.0155064 -0.0458194 0.0417735 0.00882763 -0.00478179 -0.00453521 0.00313587 0.00199381 -0.000594463 -0.00166015 -0.3273 0.335144 0.00547833 -0.0133228 -0.518244 0.528406 0.0218964 -0.0320582 -0.675339 0.685505 0.0411296 -0.0512957 -0.811935 0.819959 0.0594313 -0.0674543 -0.942108 0.949389 0.0744974 -0.0817784 -1.08456 1.09179 0.0886566 -0.0958925 -1.24733 1.25338 0.102131 -0.108176 -1.43123 1.43527 0.113129 -0.11717 -1.6383 1.63893 0.119702 -0.120324 -1.56459 1.56084 0.11891 -0.115163 -1.25819 1.25207 0.109369 -0.103253 -1.02692 1.01964 0.0958644 -0.0885884 -0.846558 0.838658 0.0803055 -0.072405 -0.685033 0.675316 0.0627995 -0.0530824 -0.501994 0.492014 0.0416282 -0.0316486 -0.301956 0.294288 0.0217047 -0.0140371 -0.138147 0.134578 0.00757684 -0.00400764 -0.0414782 0.0406884 0.00199037 -0.00120058 -0.00322877 0.00285861 0.000654698 -0.000284537 -0.00131757 -0.335164 0.340625 0.00362463 -0.00908547 -0.532838 0.540628 0.0157469 -0.0235377 -0.690628 0.698783 0.0311186 -0.0392732 -0.827112 0.833729 0.0461242 -0.0527412 -0.956574 0.963079 0.0586549 -0.06516 -1.09865 1.10484 0.0710987 -0.0772917 -1.2593 1.2646 0.0828398 -0.08814 -1.4391 1.44251 0.0922482 -0.0956623 -1.63951 1.63968 0.097479 -0.0976398 -1.55718 1.55317 0.0956741 -0.0916691 -1.24587 1.23952 0.0855617 -0.0792095 -1.01253 1.00521 0.0716103 -0.0642923 -0.831328 0.823406 0.0559364 -0.0480149 -0.668288 0.659243 0.0385571 -0.0295121 -0.486178 0.47831 0.0197201 -0.0118519 -0.292421 0.287781 0.00470079 -6.15038e-05 -0.135484 0.135018 -0.00288175 0.00334691 -0.0421583 0.0432346 -0.00265214 0.0015759 -0.00370128 0.0042131 -0.000610265 9.84452e-05 -0.00111974 -0.339353 0.343421 0.00294975 -0.00701856 -0.543966 0.550532 0.012435 -0.0190009 -0.702907 0.709831 0.0250247 -0.0319484 -0.839765 0.84558 0.0374465 -0.0432606 -0.96934 0.975332 0.0483193 -0.0543115 -1.11079 1.11641 0.0595687 -0.0651933 -1.26966 1.27443 0.0700426 -0.0748103 -1.44578 1.44875 0.0784763 -0.0814461 -1.63986 1.63976 0.0829368 -0.0828401 -1.54942 1.54548 0.0807848 -0.0768404 -1.23346 1.22729 0.0709082 -0.0647366 -0.998194 0.991013 0.0573321 -0.0501511 -0.81605 0.808234 0.0418913 -0.0340759 -0.652659 0.644547 0.0252698 -0.0171578 -0.474201 0.46758 0.00854699 -0.00192612 -0.287758 0.28462 -0.00346128 0.00659881 -0.137406 0.138261 -0.00776268 0.00690759 -0.0457447 0.0476731 -0.00498473 0.00305627 -0.0055191 0.00651572 -0.00134177 0.000345145 -0.00111371 -0.341785 0.345318 0.00276874 -0.00630164 -0.552555 0.558277 0.0106467 -0.0163691 -0.7139 0.719375 0.0218799 -0.0273549 -0.850804 0.855909 0.0322057 -0.0373106 -0.980944 0.986174 0.0420413 -0.0472717 -1.12192 1.12675 0.0523114 -0.0571342 -1.27905 1.28348 0.0617246 -0.0661543 -1.45166 1.45438 0.0695929 -0.0723165 -1.63978 1.63962 0.073861 -0.0737 -1.54184 1.53805 0.0717291 -0.067942 -1.22145 1.21548 0.0625431 -0.0565765 -0.984398 0.977496 0.0493708 -0.0424682 -0.80113 0.793969 0.0346504 -0.0274891 -0.638516 0.631349 0.0194711 -0.0123039 -0.464256 0.458497 0.00460606 0.00115327 -0.285351 0.282965 -0.00569659 0.00808306 -0.141008 0.142275 -0.00864648 0.00737984 -0.0505154 0.0524974 -0.00521996 0.00323798 -0.00797831 0.00903049 -0.00143677 0.000384589 -0.00116626 -0.343771 0.347075 0.00280567 -0.00610916 -0.559994 0.564866 0.00985762 -0.0147295 -0.723214 0.727951 0.0198878 -0.0246246 -0.860907 0.865651 0.0289684 -0.0337125 -0.991155 0.996132 0.0381276 -0.0431051 -1.13205 1.13674 0.0474641 -0.052156 -1.28766 1.29195 0.056462 -0.0607446 -1.45753 1.46018 0.0641146 -0.066769 -1.63984 1.64014 0.0681667 -0.0684717 -1.53491 1.5313 0.0669949 -0.0633787 -1.21004 1.20449 0.0583555 -0.0528006 -0.971135 0.964627 0.0459572 -0.0394489 -0.787479 0.781068 0.0323852 -0.0259745 -0.626069 0.61953 0.0189382 -0.0123989 -0.455437 0.45002 0.00541185 4.42328e-06 -0.283335 0.281338 -0.00420614 0.00620312 -0.144859 0.145721 -0.00674912 0.00588723 -0.0552138 0.0567931 -0.00430793 0.00272868 -0.0104627 0.0113558 -0.00123592 0.000342733 -0.00135854 -0.345766 0.348825 0.00305379 -0.00611283 -0.566509 0.571102 0.0096289 -0.0142219 -0.731606 0.73575 0.0189493 -0.0230937 -0.869982 0.87438 0.0272857 -0.031684 -1.00078 1.00524 0.035824 -0.040285 -1.14136 1.14616 0.0444393 -0.0492368 -1.29631 1.30019 0.0534543 -0.057337 -1.46295 1.46608 0.0606368 -0.0637711 -1.64065 1.64115 0.0655237 -0.0660276 -1.52837 1.52538 0.0647765 -0.0617897 -1.19945 1.19439 0.0571198 -0.0520607 -0.958957 0.953086 0.0462695 -0.0403992 -0.775319 0.769598 0.0340746 -0.0283536 -0.614192 0.608086 0.0217902 -0.0156844 -0.446975 0.441611 0.00906084 -0.00369713 -0.281248 0.279182 -0.00057559 0.00264095 -0.147645 0.147894 -0.00367352 0.00342482 -0.0589205 0.0598596 -0.00262595 0.00168679 -0.0125249 0.0130948 -0.000795862 0.00022597 -0.0014551 -0.348201 0.35106 0.00335107 -0.00621031 -0.572584 0.577006 0.00958435 -0.0140058 -0.739122 0.743581 0.0179716 -0.02243 -0.878569 0.88266 0.0262396 -0.0303305 -1.01004 1.01451 0.0341676 -0.0386284 -1.15078 1.15517 0.0428085 -0.0471924 -1.30449 1.30861 0.0515377 -0.0556528 -1.46922 1.47241 0.0590245 -0.0622121 -1.6421 1.64289 0.0644856 -0.0652788 -1.52317 1.52078 0.0646261 -0.0622358 -1.19004 1.18571 0.0584119 -0.0540802 -0.948196 0.943238 0.0489049 -0.0439469 -0.76448 0.759182 0.0383705 -0.0330723 -0.602817 0.59677 0.0266273 -0.0205798 -0.438167 0.432933 0.0142899 -0.00905635 -0.278581 0.276021 0.00437973 -0.00181891 -0.148917 0.148325 0.000217442 0.000375149 -0.0611461 0.0612446 -0.000524825 0.000426266 -0.0138564 0.0140153 -0.000229308 7.04062e-05 -0.00155031 -0.350812 0.353873 0.00358259 -0.00664286 -0.578302 0.582598 0.00980262 -0.0140979 -0.74668 0.7507 0.018024 -0.022044 -0.886698 0.89071 0.0254936 -0.0295059 -1.01872 1.02312 0.0333004 -0.0377026 -1.15978 1.16423 0.0418576 -0.0463071 -1.31305 1.31735 0.0505049 -0.0548059 -1.47567 1.47926 0.0584416 -0.0620264 -1.64441 1.64584 0.0643936 -0.0658215 -1.519 1.51749 0.0657742 -0.0642707 -1.18224 1.17864 0.0611904 -0.057588 -0.93888 0.93449 0.0532677 -0.0488774 -0.753916 0.748693 0.0434909 -0.0382685 -0.591437 0.585502 0.031702 -0.0257677 -0.429322 0.424151 0.0193494 -0.0141784 -0.274903 0.271737 0.00948559 -0.00631955 -0.148472 0.147042 0.00393511 -0.00250465 -0.0616415 0.0610192 0.00138783 -0.00076552 -0.0143315 0.0140984 0.000327486 -9.44389e-05 -0.00166327 -0.354054 0.356973 0.00382499 -0.00674331 -0.584462 0.588407 0.0101058 -0.0140512 -0.754009 0.75782 0.0177428 -0.0215536 -0.894608 0.89878 0.0248987 -0.02907 -1.02748 1.03158 0.032786 -0.0368878 -1.16882 1.17326 0.0412252 -0.0456663 -1.32149 1.32614 0.0497375 -0.0543915 -1.48302 1.48675 0.0582818 -0.0620067 -1.64783 1.64998 0.0649269 -0.0670771 -1.5164 1.51562 0.0676851 -0.0669107 -1.17567 1.17278 0.0647602 -0.0618703 -0.930597 0.926392 0.0580278 -0.0538221 -0.743539 0.738298 0.0484996 -0.0432587 -0.58008 0.573909 0.0366938 -0.0305234 -0.420185 0.41491 0.0244057 -0.0191306 -0.269831 0.266342 0.0142471 -0.010758 -0.146255 0.143976 0.00754957 -0.00527142 -0.0606337 0.0592625 0.00328587 -0.00191471 -0.0140944 0.0135034 0.000853609 -0.000262571 -0.00170887 -0.3577 0.36062 0.00390251 -0.00682312 -0.590146 0.594162 0.0101797 -0.0141957 -0.76109 0.764738 0.017659 -0.0213061 -0.902768 0.906553 0.0247833 -0.0285681 -1.0358 1.04027 0.0321777 -0.0366495 -1.17779 1.18243 0.0404769 -0.0451217 -1.33054 1.3356 0.0494034 -0.0544632 -1.49076 1.49493 0.0584644 -0.0626416 -1.65251 1.65527 0.0658207 -0.0685843 -1.51541 1.51555 0.0699656 -0.0701044 -1.1705 1.16799 0.0686635 -0.0661528 -0.92243 0.918369 0.0626404 -0.0585791 -0.733086 0.727456 0.0532607 -0.047631 -0.568589 0.562627 0.0411699 -0.0352083 -0.410805 0.405722 0.0289984 -0.0239148 -0.263814 0.259681 0.0187727 -0.0146395 -0.142183 0.139093 0.010649 -0.00755904 -0.0581892 0.0561678 0.00470663 -0.00268525 -0.0132139 0.0124012 0.0011451 -0.000332439 -0.00168341 -0.361815 0.364749 0.00401561 -0.00695018 -0.596011 0.599831 0.0102987 -0.014119 -0.767888 0.771351 0.0175873 -0.0210495 -0.910367 0.914252 0.024371 -0.0282558 -1.04433 1.04844 0.0319669 -0.0360779 -1.18684 1.19152 0.0402182 -0.0449063 -1.33997 1.34502 0.049051 -0.0541026 -1.49941 1.50414 0.0584805 -0.0632124 -1.65842 1.66199 0.0668904 -0.0704606 -1.51582 1.51668 0.0722885 -0.0731559 -1.16611 1.16405 0.0723401 -0.07028 -0.914529 0.910553 0.0667763 -0.0628008 -0.722282 0.716795 0.0572873 -0.0517996 -0.557261 0.551386 0.0454131 -0.0395388 -0.401226 0.395966 0.0333823 -0.0281223 -0.256383 0.251693 0.0226882 -0.017998 -0.136572 0.132669 0.0133586 -0.00945589 -0.0545085 0.0519583 0.00590651 -0.00335633 -0.0118801 0.0108662 0.00139095 -0.000377033 -0.00160556 -0.365812 0.36905 0.00387696 -0.00711478 -0.601959 0.605797 0.0103938 -0.0142316 -0.774615 0.777901 0.0172304 -0.0205163 -0.917644 0.921578 0.0239218 -0.0278559 -1.05278 1.05696 0.0314716 -0.0356565 -1.19631 1.20087 0.0397465 -0.0443034 -1.34992 1.35503 0.0487752 -0.0538865 -1.50877 1.51367 0.0585329 -0.0634253 -1.66561 1.66965 0.0677282 -0.0717596 -1.51788 1.51916 0.0745868 -0.0758649 -1.16251 1.16071 0.0757498 -0.0739554 -0.906635 0.902563 0.0707569 -0.0666848 -0.711651 0.706109 0.0612991 -0.0557572 -0.546076 0.54029 0.0493189 -0.043533 -0.391227 0.385735 0.0371798 -0.0316881 -0.24767 0.242448 0.0258213 -0.0205999 -0.129448 0.12495 0.015199 -0.0107003 -0.0498187 0.0469275 0.00653065 -0.00363943 -0.0101591 0.00907499 0.00146581 -0.000381735 -0.00157364 -0.370376 0.373584 0.0038351 -0.00704344 -0.608011 0.611567 0.0101378 -0.0136943 -0.781226 0.784563 0.0167357 -0.0200733 -0.925033 0.928832 0.0234501 -0.027249 -1.06081 1.06532 0.0305751 -0.0350879 -1.20549 1.21062 0.0388988 -0.0440284 -1.36017 1.36516 0.0485848 -0.0535747 -1.51855 1.52413 0.0581858 -0.0637688 -1.67405 1.67872 0.0682378 -0.0729064 -1.52117 1.52324 0.0764049 -0.0784741 -1.15938 1.15809 0.0785535 -0.0772567 -0.898881 0.894963 0.0741728 -0.0702549 -0.701004 0.69547 0.0648459 -0.0593118 -0.53488 0.529036 0.0528397 -0.0469953 -0.380638 0.374762 0.0404613 -0.0345857 -0.237822 0.232031 0.028114 -0.0223231 -0.121004 0.116054 0.0162798 -0.0113299 -0.0444426 0.0413768 0.00677262 -0.00370686 -0.00827596 0.00718146 0.00146246 -0.00036796 -0.00150174 -0.374977 0.378089 0.00380997 -0.006921 -0.614022 0.617411 0.0100462 -0.0134345 -0.787744 0.791159 0.0164126 -0.0198274 -0.932354 0.936141 0.022846 -0.0266331 -1.06934 1.07346 0.0300604 -0.0341823 -1.21482 1.2197 0.0382335 -0.0431135 -1.37048 1.37576 0.0476611 -0.0529431 -1.52942 1.53509 0.0577697 -0.0634377 -1.68355 1.68869 0.0685445 -0.0736906 -1.52549 1.52825 0.0777279 -0.080484 -1.15706 1.15613 0.0811638 -0.0802342 -0.891305 0.887246 0.0775234 -0.0734643 -0.690422 0.684813 0.0682841 -0.0626753 -0.5234 0.517165 0.056163 -0.0499281 -0.369077 0.362508 0.0429857 -0.0364169 -0.226693 0.220418 0.0293701 -0.0230955 -0.111613 0.106378 0.0164748 -0.0112398 -0.0387393 0.0356622 0.006572 -0.00349492 -0.00634056 0.00532369 0.00134751 -0.000330644 -0.00154442 -0.379664 0.382595 0.00367826 -0.00660969 -0.619767 0.622955 0.00979083 -0.012979 -0.793896 0.797193 0.0157751 -0.0190729 -0.939454 0.943049 0.0221372 -0.0257325 -1.07745 1.08142 0.0292584 -0.0332281 -1.22447 1.22905 0.0373992 -0.0419777 -1.38093 1.38604 0.0469628 -0.052072 -1.5403 1.5464 0.0571559 -0.0632568 -1.694 1.69962 0.0683931 -0.0740126 -1.5312 1.53442 0.0787514 -0.0819683 -1.15553 1.15497 0.0833695 -0.0828103 -0.88388 0.880411 0.0804285 -0.0769595 -0.679653 0.674111 0.0716949 -0.0661527 -0.511075 0.504357 0.0592263 -0.0525086 -0.356345 0.349025 0.0446527 -0.0373326 -0.214411 0.207519 0.0292938 -0.0224021 -0.101691 0.0963961 0.0154569 -0.0101619 -0.0330895 0.0303291 0.00572265 -0.00296225 -0.00454834 0.00370337 0.00111491 -0.000269941 -0.00139656 -0.384299 0.387361 0.00343055 -0.00649274 -0.625505 0.628515 0.00940053 -0.0124105 -0.800307 0.803557 0.0153005 -0.0185498 -0.946538 0.949939 0.0215212 -0.0249222 -1.08566 1.08953 0.0284011 -0.0322706 -1.23378 1.23869 0.0361147 -0.0410277 -1.39166 1.3969 0.0457961 -0.0510311 -1.55194 1.55803 0.0562387 -0.0623307 -1.70541 1.71164 0.0678757 -0.0741134 -1.53814 1.54187 0.0791406 -0.0828748 -1.15472 1.15482 0.0851268 -0.0852267 -0.877408 0.874243 0.0833402 -0.080176 -0.668928 0.663243 0.0753196 -0.0696349 -0.497669 0.49007 0.0623957 -0.0547966 -0.341714 0.33302 0.0457079 -0.0370137 -0.200718 0.192741 0.0276064 -0.0196286 -0.0917339 0.0865846 0.0121423 -0.00699298 -0.0282098 0.0262992 0.00319835 -0.00128777 -0.00316549 0.00289241 0.000341832 -6.87519e-05 -0.00144947 -0.388761 0.391546 0.00351641 -0.00630099 -0.631021 0.634051 0.00882671 -0.0118566 -0.806129 0.809276 0.0143861 -0.0175333 -0.953165 0.95648 0.0206178 -0.0239327 -1.09312 1.09719 0.0271779 -0.0312489 -1.24312 1.24789 0.0350883 -0.0398639 -1.40216 1.40774 0.0443732 -0.0499486 -1.56378 1.57007 0.0550441 -0.0613405 -1.71778 1.72407 0.0671514 -0.0734402 -1.54614 1.5506 0.0790656 -0.0835316 -1.15545 1.15612 0.086491 -0.0871689 -0.871314 0.868743 0.0858462 -0.0832748 -0.658284 0.652514 0.0789084 -0.0731379 -0.482566 0.474234 0.065537 -0.0572049 -0.324055 0.313473 0.0468033 -0.0362219 -0.184491 0.174324 0.0244557 -0.0142888 -0.0816513 0.0752315 0.00479184 0.00162802 -0.0251209 0.0238331 -0.00595087 0.0072387 -0.00372048 0.00692327 -0.0058025 0.00259972 -0.00124338 -0.393306 0.396168 0.00318139 -0.00604291 -0.636469 0.639113 0.00856728 -0.0112107 -0.811926 0.81494 0.0139754 -0.0169899 -0.960022 0.96305 0.0199337 -0.0229623 -1.10113 1.10495 0.0260941 -0.0299077 -1.25213 1.25672 0.0340938 -0.0386808 -1.41294 1.41826 0.0431904 -0.0485121 -1.57627 1.58215 0.0539177 -0.0598007 -1.73074 1.73739 0.0659753 -0.072626 -1.55519 1.56028 0.0785798 -0.0836655 -1.1572 1.15862 0.0873156 -0.0887376 -0.86662 0.864486 0.0882751 -0.0861409 -0.647566 0.642325 0.0821096 -0.0768687 -0.46609 0.457222 0.0689286 -0.0600601 -0.302716 0.290317 0.0484803 -0.036082 -0.163251 0.149515 0.0212694 -0.00753364 -0.0670591 0.054704 -0.00677879 0.0191339 -0.0208936 0.0168359 -0.0297038 0.0337615 -0.0136581 0.022894 -0.0313918 0.0221559 -0.00118979 -0.397862 0.400342 0.00306805 -0.00554863 -0.64173 0.644377 0.00820939 -0.0108564 -0.817615 0.82066 0.0134235 -0.0164681 -0.966229 0.969352 0.0195131 -0.022636 -1.10885 1.11284 0.0259274 -0.0299145 -1.2614 1.2663 0.0341402 -0.0390389 -1.42373 1.42973 0.0435615 -0.0495656 -1.58909 1.59575 0.05558 -0.0622399 -1.74472 1.75275 0.069037 -0.0770618 -1.56608 1.57265 0.0842633 -0.0908308 -1.16109 1.16375 0.0961752 -0.0988335 -0.863015 0.861714 0.0996349 -0.0983331 -0.637351 0.631848 0.0950893 -0.0895862 -0.448072 0.438342 0.0812362 -0.0715058 -0.27653 0.261599 0.0580544 -0.0431238 -0.133354 0.114428 0.0240183 -0.00509269 -0.0436656 0.0537097 -0.00614507 -0.00389901 -0.0360283 0.140834 0.0568022 -0.161607 -0.11689 0.345705 0.369322 -0.598137 -0.00111048 -0.402127 0.404619 0.0029163 -0.00540907 -0.646608 0.649526 0.0078328 -0.0107508 -0.823415 0.826078 0.0131447 -0.015807 -0.972821 0.976087 0.0187797 -0.022045 -1.1167 1.12067 0.0253203 -0.0292939 -1.27102 1.27581 0.0335528 -0.0383419 -1.43565 1.44156 0.0434631 -0.0493731 -1.60302 1.61043 0.0557561 -0.0631654 -1.76098 1.76973 0.0705938 -0.0793368 -1.57984 1.58752 0.0876433 -0.0953218 -1.16767 1.17194 0.10213 -0.106396 -0.861217 0.861077 0.108987 -0.108847 -0.627297 0.622443 0.10626 -0.101405 -0.429092 0.419005 0.0926841 -0.082597 -0.246186 0.231487 0.0698375 -0.0551385 -0.10624 0.137469 0.0489658 -0.0801951 -0.128903 0.364126 0.195979 -0.431202 -0.400492 0.628735 0.746256 -0.974499 -0.534586 0.630313 1.12879 -1.22451 -0.000851506 -0.406376 0.408228 0.00313761 -0.00498893 -0.651602 0.654356 0.00744888 -0.0102036 -0.828716 0.831646 0.0122524 -0.0151816 -0.979303 0.982714 0.018238 -0.0216492 -1.12443 1.12893 0.0246373 -0.029132 -1.28062 1.28585 0.0327446 -0.0379744 -1.44779 1.45441 0.0429243 -0.049543 -1.61801 1.62596 0.0558613 -0.0638088 -1.77914 1.78903 0.0716255 -0.0815153 -1.59595 1.60545 0.0906301 -0.100126 -1.17735 1.18392 0.107996 -0.11457 -0.86205 0.864086 0.118833 -0.120869 -0.618389 0.614365 0.118993 -0.114968 -0.410389 0.398993 0.105644 -0.0942475 -0.225954 0.263333 0.0898177 -0.127197 -0.257129 0.518602 0.264646 -0.526119 -0.662683 0.858787 0.858425 -1.05453 -0.74886 0.81192 1.17185 -1.23491 -0.671631 0.692541 1.27343 -1.29434 -0.00090918 -0.408881 0.408616 0.00418361 -0.0039183 -0.656084 0.658651 0.00722053 -0.00978756 -0.834814 0.837769 0.0118298 -0.0147846 -0.986804 0.991806 0.0168164 -0.0218181 -1.13426 1.13972 0.0234311 -0.0288875 -1.29156 1.29848 0.0311263 -0.0380449 -1.46105 1.46857 0.0420617 -0.0495825 -1.63474 1.6443 0.0553322 -0.0648925 -1.79987 1.8117 0.0721099 -0.0839395 -1.61594 1.62814 0.0931882 -0.105389 -1.19175 1.2012 0.113729 -0.123179 -0.868612 0.874495 0.128419 -0.134302 -0.610475 0.602406 0.135562 -0.127493 -0.395166 0.426281 0.125081 -0.156195 -0.379737 0.560214 0.281049 -0.461526 -0.826258 1.06011 0.784108 -1.01796 -0.96272 1.0162 1.13854 -1.19203 -0.84399 0.860951 1.22943 -1.24639 -0.70588 0.717598 1.26321 -1.27493 0.163414 -0.23888 0.124632 -0.00171661 -0.121135 0.3585 0.26814 -0.00612478 -0.157875 0.516214 0.341961 -0.011597 -0.171822 0.653171 0.372864 -0.0175305 -0.176158 0.781395 0.388806 -0.0241882 -0.177193 0.916371 -0.0323859 0.403023 1.06108 0.420196 -0.0423185 1.21483 0.439779 -0.0561475 1.36954 0.461758 -0.0742767 1.50856 0.48453 -0.0977183 1.32964 0.501888 -0.122002 0.938865 0.506408 -0.141843 0.628812 0.490336 -0.148644 -0.143813 0.434509 0.454034 -0.212592 -0.176049 0.622425 0.791637 -0.633912 -0.385052 0.825466 1.8852 -1.06265 -0.587348 0.637664 2.35786 -1.16372 -0.629491 0.416042 2.47951 -1.20936 -0.643119 0.226684 -1.23951 2.53672 -1.26537 -0.730841 2.72395 -0.00266525 -0.00286148 0.228951 -0.06001 -0.00204634 0.424567 -0.425186 0.00500287 -0.00642415 0.668733 -0.667312 0.00874153 -0.0111416 0.843115 -0.840715 0.0134231 -0.0170114 0.995093 -0.991505 0.0197233 -0.0240263 1.14467 -1.14037 0.0280326 -0.0330603 -1.30287 1.3079 0.03881 -0.0452617 -1.47609 1.48254 0.0525271 -0.0607142 -1.6548 1.66299 0.070539 -0.0816762 -1.82545 1.83658 0.0943921 -0.106363 -1.64179 1.65376 0.119899 -0.130022 -1.21022 1.22034 0.140179 -0.147797 -0.878143 0.885761 0.151136 -0.175637 0.621996 -0.597495 0.265114 -0.441933 0.801735 -0.624916 0.761285 -0.932173 1.37709 -1.2062 1.06747 -1.11156 1.30835 -1.26426 1.14634 -1.16845 1.09971 -1.07759 1.1883 -1.20702 0.913833 -0.895108 0.892161 -0.665094 -0.742094 1.41954 -0.000472698 -0.00252692 -0.233408 0.236407 -0.00194658 -0.425396 0.42687 0.00466021 -0.00653028 -0.670903 0.672773 0.00859146 -0.0120685 -0.846658 0.850135 0.0138358 -0.0179376 -1.0002 1.0043 0.0202316 -0.0259553 -1.15071 1.15643 0.0289762 -0.0354697 -1.31513 1.32162 0.0400086 -0.0484815 -1.49145 1.49992 0.0541219 -0.0651911 -1.67453 1.6856 0.0732349 -0.0880311 -1.85159 1.86638 0.098709 -0.115204 -1.67073 1.68723 0.127265 -0.142661 -1.2365 1.25189 0.153044 -0.164193 -0.898318 0.909467 0.188146 -0.258605 -0.673627 0.744087 0.452521 -0.714483 -1.02925 1.29122 0.934295 -1.01944 -1.49964 1.58478 1.07398 -1.10417 -1.33966 1.36985 1.1319 -1.15229 -1.11895 1.13933 1.17529 -1.19596 -0.928113 0.948781 0.898715 -0.635524 -0.770814 1.41671 -0.000323014 -0.00177846 -0.239616 0.241718 -0.00169666 -0.42833 0.429703 0.00442803 -0.00649096 -0.675162 0.677224 0.00943964 -0.0122559 -0.852841 0.855658 0.0147966 -0.0185377 -1.00773 1.01147 0.0220812 -0.0263946 -1.16072 1.16504 0.0309858 -0.0367209 -1.32736 1.3331 0.042742 -0.0500328 -1.50779 1.51508 0.0576812 -0.0678065 -1.69583 1.70595 0.078095 -0.0918047 -1.88033 1.89404 0.105783 -0.121325 -1.70319 1.71874 0.137757 -0.152191 -1.26702 1.28145 0.166735 -0.187932 -0.923879 0.945076 0.249545 -0.39596 -0.858206 1.00462 0.6686 -0.880739 -1.54167 1.75381 0.979259 -1.02743 -1.65013 1.6983 1.05982 -1.08539 -1.39658 1.42215 1.11274 -1.1347 -1.16172 1.18368 1.15938 -1.18431 -0.961348 0.986271 0.905286 -0.606993 -0.802692 1.41897 -0.00049869 -0.00124069 -0.24433 0.246069 -0.00190828 -0.431742 0.433151 0.00451141 -0.00661995 -0.679877 0.681985 0.00952902 -0.0127696 -0.858602 0.861843 0.0158079 -0.0195714 -1.0149 1.01867 0.0234059 -0.028037 -1.16962 1.17426 0.032598 -0.0386673 -1.33868 1.34475 0.0448893 -0.052702 -1.52246 1.53027 0.0607516 -0.071108 -1.71606 1.72642 0.0822506 -0.096442 -1.90767 1.92187 0.111936 -0.128575 -1.73481 1.75145 0.146817 -0.162859 -1.29745 1.31349 0.182221 -0.222219 -0.975484 1.01548 0.349659 -0.56625 -1.19339 1.40998 0.814805 -0.921605 -1.90535 2.01215 0.979145 -1.01202 -1.73712 1.76999 1.03998 -1.06393 -1.44873 1.47267 1.09102 -1.119 -1.20728 1.23526 1.14812 -1.16571 -1.0073 1.02489 0.893303 -0.556979 -0.828897 1.38605 -0.000747222 -0.000718231 -0.248361 0.249827 -0.00228644 -0.43521 0.436749 0.00470323 -0.00728955 -0.684759 0.687345 0.0101888 -0.0132643 -0.864938 0.868014 0.0163908 -0.0206071 -1.02205 1.02627 0.0245572 -0.0294006 -1.17895 1.18379 0.0341798 -0.0403904 -1.35074 1.35695 0.0472323 -0.0551902 -1.5382 1.54616 0.0635914 -0.0748195 -1.73689 1.74812 0.0866133 -0.101527 -1.93655 1.95147 0.118042 -0.135778 -1.76883 1.78656 0.155357 -0.173478 -1.33112 1.34924 0.204089 -0.278476 -1.07133 1.14571 0.468419 -0.7119 -1.6506 1.89408 0.86332 -0.921486 -2.0886 2.14677 0.959845 -0.986916 -1.79833 1.82541 1.01565 -1.04337 -1.50183 1.52955 1.06764 -1.08183 -1.25896 1.27316 1.08756 -1.07814 -1.03404 1.02462 0.809519 -0.419492 -0.822955 1.20967 -0.00101354 -0.000275961 -0.251873 0.253163 -0.00229382 -0.439024 0.440305 0.00485648 -0.00758792 -0.69 0.692731 0.0103886 -0.0136407 -0.871467 0.87472 0.0169755 -0.021363 -1.03021 1.0346 0.0255716 -0.0306066 -1.18874 1.19378 0.0353865 -0.0418437 -1.36324 1.3697 0.0485103 -0.0569564 -1.55466 1.56311 0.0655758 -0.0770752 -1.7591 1.7706 0.088765 -0.104183 -1.96723 1.98265 0.120857 -0.139034 -1.80547 1.82364 0.159238 -0.181072 -1.3705 1.39234 0.228609 -0.345798 -1.24551 1.3627 0.574696 -0.755685 -2.11741 2.2984 0.834347 -0.871955 -2.19597 2.23358 0.899472 -0.921826 -1.84911 1.87146 0.949932 -0.968249 -1.55519 1.5735 0.980782 -0.976389 -1.2845 1.28011 0.943491 -0.868683 -0.996899 0.922091 0.694501 -0.370253 0.319967 -0.644216 -0.000890517 -0.00023347 -0.255346 0.25647 -0.00247247 -0.442619 0.444201 0.0051575 -0.00772134 -0.695829 0.698393 0.0109931 -0.0144361 -0.878341 0.881784 0.0179346 -0.0224325 -1.03827 1.04277 0.0269181 -0.0322067 -1.1987 1.20398 0.0378825 -0.0447736 -1.37637 1.38326 0.0520191 -0.0609975 -1.57157 1.58055 0.0707818 -0.0829267 -1.78171 1.79385 0.0959647 -0.113247 -1.99814 2.01542 0.131856 -0.152313 -1.8426 1.86305 0.175461 -0.205762 -1.41896 1.44926 0.286292 -0.45126 -1.49847 1.66344 0.699422 -0.815493 -2.44331 2.55938 0.870298 -0.900723 -2.26557 2.296 0.925511 -0.949993 -1.8954 1.91988 0.967572 -0.970156 -1.58569 1.58827 0.944557 -0.873584 -1.25091 1.17994 0.697178 -0.393758 -0.753259 0.449839 0.0975856 -0.00250351 -0.0605278 -0.0345543 -0.00108481 -7.77689e-05 -0.25831 0.259472 -0.00255137 -0.447088 0.448555 0.00490006 -0.00772588 -0.70172 0.704546 0.0108109 -0.0144747 -0.885834 0.889498 0.0184124 -0.023196 -1.04718 1.05196 0.0278588 -0.0338985 -1.20977 1.21581 0.0400881 -0.047393 -1.39036 1.39767 0.0551027 -0.0651774 -1.58979 1.59986 0.0757604 -0.0890832 -1.8065 1.81982 0.103519 -0.122247 -2.03294 2.05167 0.143088 -0.166267 -1.88428 1.90746 0.194191 -0.238863 -1.48773 1.5324 0.364877 -0.57468 -1.84592 2.05572 0.781038 -0.852298 -2.64711 2.71837 0.893809 -0.920868 -2.32402 2.35108 0.944549 -0.959311 -1.93921 1.95397 0.957097 -0.917457 -1.57419 1.53455 0.790483 -0.53862 -1.0371 0.785236 0.19325 -0.0389323 -0.164985 0.0106671 -0.00720866 0.00725194 0.0562033 -0.0562466 -0.000717493 -0.000252674 -0.26133 0.262301 -0.00243979 -0.451214 0.452936 0.00458003 -0.00742451 -0.708091 0.710935 0.010793 -0.0146958 -0.893282 0.897185 0.0188287 -0.0238066 -1.05652 1.0615 0.0288018 -0.0352769 -1.22129 1.22777 0.0415932 -0.0498722 -1.4051 1.41338 0.0579474 -0.0690631 -1.60948 1.62059 0.0804826 -0.0947907 -1.83375 1.84806 0.110842 -0.131457 -2.07101 2.09163 0.15415 -0.180404 -1.9314 1.95765 0.216554 -0.284615 -1.58914 1.65721 0.454702 -0.687985 -2.27666 2.50994 0.824859 -0.876042 -2.77669 2.82787 0.909177 -0.929796 -2.37374 2.39436 0.945413 -0.940232 -1.96088 1.9557 0.880762 -0.727942 -1.44891 1.29609 0.39644 -0.107329 -0.456274 0.167162 0.0052034 0.0130209 0.0470303 -0.0652546 -0.0108282 0.00462121 0.051134 -0.044927 -0.000227294 -0.000346682 -0.264256 0.26483 -0.00172193 -0.45575 0.457244 0.00400061 -0.00684061 -0.714929 0.717769 0.0101346 -0.014154 -0.901743 0.905763 0.0186658 -0.0237973 -1.06662 1.07175 0.0293275 -0.0360266 -1.23401 1.24071 0.0429355 -0.0514908 -1.42135 1.42991 0.0606356 -0.0722603 -1.63145 1.64307 0.084764 -0.100498 -1.86334 1.87908 0.117498 -0.139964 -2.11289 2.13536 0.165114 -0.194538 -1.98513 2.01455 0.242632 -0.344601 -1.74175 1.84372 0.556853 -0.761547 -2.72753 2.93223 0.848267 -0.885593 -2.87083 2.90815 0.910999 -0.924385 -2.41227 2.42565 0.915934 -0.857164 -1.92733 1.86856 0.680925 -0.351596 -1.06762 0.738294 0.0644283 -0.00142161 -0.0175834 -0.0454234 -0.0124114 0.0121959 0.0709695 -0.0707541 -0.00737334 0.00255592 0.0396748 -0.0348574 0.000378497 -0.000657651 -0.266645 0.266924 -0.000787 -0.460211 0.461377 0.00309383 -0.00591097 -0.721757 0.724575 0.00922412 -0.013529 -0.91015 0.914455 0.0178693 -0.0233294 -1.07698 1.08244 0.0293359 -0.0360059 -1.24741 1.25408 0.0436413 -0.0524137 -1.43905 1.44782 0.0621086 -0.0746781 -1.65451 1.66708 0.0881851 -0.104872 -1.89514 1.91182 0.123447 -0.147685 -2.15847 2.18271 0.175112 -0.20934 -2.04637 2.0806 0.273406 -0.407318 -1.96114 2.09505 0.652358 -0.796161 -3.10405 3.24786 0.855111 -0.880483 -2.93836 2.96374 0.898598 -0.893622 -2.42987 2.4249 0.832079 -0.670897 -1.76203 1.60085 0.322966 -0.0679337 -0.392543 0.137511 0.00186255 0.0103232 0.0743433 -0.0865291 -0.011094 0.00820032 0.0679016 -0.0650079 -0.00414072 0.00129649 0.0303222 -0.027478 0.00122793 -0.000963594 -0.268688 0.268424 0.000631428 -0.46423 0.464827 0.00128702 -0.00389537 -0.728786 0.731395 0.00730577 -0.0117951 -0.918963 0.923452 0.0163082 -0.0218849 -1.08809 1.09367 0.0278498 -0.0352819 -1.26132 1.26875 0.0429595 -0.0528148 -1.45698 1.46683 0.063057 -0.0760109 -1.67942 1.69237 0.0900166 -0.108167 -1.92917 1.94732 0.12766 -0.15351 -2.20719 2.23304 0.183139 -0.22411 -2.11819 2.15916 0.3107 -0.47541 -2.24276 2.40747 0.711636 -0.803221 -3.36184 3.45342 0.841337 -0.860504 -2.98687 3.00603 0.862909 -0.820637 -2.40039 2.35812 0.673187 -0.379701 -1.39026 1.09677 0.055687 -0.00356129 -0.00557266 -0.046553 -0.00699756 0.00811191 0.0921878 -0.0933022 -0.00654216 0.00426004 0.0625152 -0.0602331 -0.00203361 0.000603455 0.0253157 -0.0238856 0.00253539 -0.00148787 -0.269868 0.26882 0.00237168 -0.467714 0.467877 -0.000969693 -0.00165584 -0.735444 0.73807 0.00450803 -0.00879982 -0.928278 0.93257 0.013522 -0.0193614 -1.09964 1.10548 0.0254392 -0.0332241 -1.2757 1.28348 0.0410818 -0.0511262 -1.47616 1.4862 0.0620572 -0.0754958 -1.70548 1.71892 0.0902314 -0.109041 -1.96571 1.98452 0.129837 -0.156767 -2.25924 2.28617 0.188942 -0.237219 -2.20527 2.25355 0.349642 -0.537687 -2.58103 2.76908 0.731371 -0.787922 -3.52765 3.5842 0.813742 -0.822352 -3.02002 3.02863 0.792475 -0.692647 -2.28639 2.18656 0.442067 -0.0963851 -0.748614 0.402932 0.0118927 0.00651361 0.0808738 -0.0992801 -0.0114126 0.0124214 0.0940109 -0.0950196 -0.010551 0.00733118 0.0577204 -0.0545006 -0.00365146 0.00117456 0.0221079 -0.019631 0.00385504 -0.00211571 -0.269832 0.268093 0.00489536 -0.470033 0.468993 -0.00426624 0.0020987 -0.742032 0.7442 0.00070952 -0.00468024 -0.937676 0.941647 0.00921021 -0.0152608 -1.11109 1.11714 0.0215845 -0.0290612 -1.29097 1.29845 0.0374692 -0.0477026 -1.49625 1.50648 0.0586057 -0.072177 -1.733 1.74657 0.0875519 -0.107298 -2.00347 2.02321 0.128892 -0.157481 -2.31356 2.34215 0.191801 -0.247662 -2.30831 2.36417 0.378166 -0.585047 -2.96766 3.17454 0.715387 -0.751812 -3.63086 3.66728 0.770077 -0.761887 -3.02684 3.01865 0.690387 -0.519985 -2.04453 1.87412 0.177646 -0.0492959 -0.163735 0.0353851 0.00945807 0.00845668 0.114852 -0.132767 -0.0192501 0.0237894 0.0984368 -0.102976 -0.022357 0.0167301 0.0498218 -0.044195 -0.00873053 0.00281022 0.0152233 -0.00930301 0.00562263 -0.00279996 -0.268233 0.26541 0.00835666 -0.470924 0.46819 -0.0089331 0.00723513 -0.747679 0.749377 -0.00484433 0.00129939 -0.946584 0.950129 0.00326102 -0.00875444 -1.12256 1.12806 0.0149306 -0.0228762 -1.30579 1.31373 0.0305946 -0.041035 -1.51648 1.52692 0.0521534 -0.0661019 -1.76068 1.77463 0.081444 -0.101573 -2.04282 2.06295 0.123249 -0.15253 -2.37062 2.3999 0.189574 -0.254973 -2.42788 2.49328 0.400415 -0.59 -3.37433 3.56391 0.673242 -0.697868 -3.69884 3.72346 0.706859 -0.674305 -2.99513 2.96257 0.556004 -0.316083 -1.66984 1.42992 0.0324255 -0.0024903 0.0259318 -0.055867 -0.00960389 0.0170961 0.145051 -0.152543 -0.0236317 0.0259636 0.105263 -0.107595 -0.022993 0.0166619 0.0375262 -0.0311952 -0.00838178 0.00251499 0.00296467 0.00290211 0.00813219 -0.00386808 -0.264285 0.260021 0.0130412 -0.469533 0.464624 -0.0149598 0.0146662 -0.751837 0.752131 -0.0128668 0.00992368 -0.954729 0.957672 -0.00581042 0.000372983 -1.13349 1.13893 0.00553224 -0.0128772 -1.32079 1.32813 0.0206131 -0.0307615 -1.53669 1.54684 0.0413322 -0.055285 -1.78887 1.80282 0.0704123 -0.0899018 -2.08249 2.10198 0.111501 -0.140955 -2.42866 2.45812 0.179972 -0.253306 -2.56732 2.64065 0.402497 -0.554686 -3.73546 3.88765 0.60822 -0.627389 -3.74695 3.76612 0.623454 -0.569237 -2.9121 2.85788 0.409642 -0.137929 -1.15698 0.885266 0.0461865 -0.00782468 0.0924071 -0.130769 -0.0180586 0.0324361 0.163442 -0.17782 -0.0420226 0.0441003 0.109945 -0.112022 -0.0388066 0.0288502 0.0236618 -0.0137054 -0.0155908 0.00539157 -0.0097834 0.0199826 0.0114975 -0.00513123 -0.257522 0.251155 0.018779 -0.46446 0.457178 -0.0231541 0.024501 -0.754166 0.752819 -0.023284 0.021366 -0.961938 0.963856 -0.0182169 0.0133195 -1.14389 1.14879 -0.00787317 0.00103462 -1.33505 1.34189 0.00623897 -0.015858 -1.55619 1.56581 0.0255826 -0.0389339 -1.81602 1.82937 0.0534016 -0.0721408 -2.12133 2.14007 0.0924885 -0.121079 -2.48639 2.51499 0.159588 -0.232402 -2.72048 2.7933 0.376167 -0.48171 -4.01864 4.12418 0.518167 -0.533279 -3.78584 3.80095 0.520931 -0.456179 -2.78635 2.72159 0.27879 -0.0618995 -0.617451 0.40056 0.0108916 0.0332288 0.172066 -0.216186 -0.065088 0.0841622 0.192879 -0.211953 -0.0915482 0.0844163 0.109851 -0.102719 -0.0684475 0.0489082 -0.000397625 0.0199369 -0.0260172 0.00900543 -0.0335002 0.0505119 0.0159306 -0.00675104 -0.247022 0.237842 0.0270367 -0.454765 0.443658 -0.0342071 0.037799 -0.753039 0.749447 -0.0385643 0.0368802 -0.966701 0.968385 -0.0349048 0.0310452 -1.15305 1.1569 -0.0266027 0.0204617 -1.34748 1.35362 -0.0138712 0.00571867 -1.57451 1.58266 0.00319252 -0.0155481 -1.84175 1.8541 0.0285931 -0.0453529 -2.15816 2.17492 0.064361 -0.0905942 -2.54211 2.56834 0.125565 -0.19045 -2.8693 2.93418 0.310894 -0.374205 -4.21241 4.27572 0.393719 -0.402936 -3.81606 3.82528 0.390358 -0.336039 -2.64568 2.59136 0.202781 -0.100051 -0.240842 0.138112 0.00277722 0.0621585 0.271753 -0.336689 -0.112605 0.136933 0.235624 -0.259952 -0.129591 0.108767 0.0843021 -0.0634787 -0.0792296 0.0521595 -0.0454996 0.0725697 -0.0254188 0.00728124 -0.0689514 0.087089 0.0215324 -0.00875575 -0.231556 0.21878 0.0378737 -0.438778 0.422436 -0.0486546 0.0552808 -0.747041 0.740415 -0.0582286 0.0580981 -0.969284 0.969414 -0.0570983 0.0545625 -1.16024 1.16277 -0.0513216 0.0468208 -1.35863 1.36313 -0.0414884 0.0344336 -1.5904 1.59746 -0.026921 0.0169408 -1.86497 1.87495 -0.00613167 -0.00838088 -2.19127 2.20578 0.0247185 -0.0470681 -2.59301 2.61536 0.0754325 -0.122161 -2.99953 3.04626 0.199675 -0.22996 -4.32977 4.36006 0.235264 -0.224848 -3.82939 3.81898 0.198147 -0.163041 -2.53399 2.49889 0.121419 -0.102668 -0.069936 0.0511842 0.0209231 0.0332295 0.400586 -0.454739 -0.0693517 0.0742217 0.275615 -0.280485 -0.0571616 0.0307581 0.0404571 -0.0140536 -0.000515036 -0.0172268 -0.0977611 0.115503 0.0207233 -0.0116498 -0.0952735 0.0862 0.0290921 -0.01106 -0.209849 0.191817 0.0505927 -0.413425 0.391924 -0.0664587 0.0781979 -0.734699 0.722959 -0.0842398 0.0865604 -0.967843 0.965522 -0.0870114 0.0861025 -1.16414 1.16505 -0.0841564 0.0811907 -1.36672 1.36969 -0.0780207 0.0726474 -1.60303 1.6084 -0.0671678 0.0595237 -1.8843 1.89195 -0.0511373 0.0403074 -2.21821 2.22904 -0.0290514 0.0132816 -2.63578 2.65155 0.00573102 -0.0291547 -3.09146 3.11488 0.051484 -0.0538348 -4.38551 4.38786 0.0366187 0.000814852 -3.79781 3.76038 -0.0628098 0.111472 -2.44339 2.39473 -0.100981 0.104987 -0.0217086 0.0177029 -0.111255 0.103032 0.481244 -0.47302 -0.0832015 0.0526236 0.263412 -0.232834 -0.00987621 -0.0202896 -0.0146765 0.0448424 0.0334095 -0.0314151 -0.117333 0.115339 0.0187757 -0.00589238 -0.0686831 0.0557998 0.0339526 -0.0111733 -0.180553 0.157774 0.0622327 -0.376364 0.348084 -0.0858286 0.105218 -0.713231 0.693841 -0.116372 0.123533 -0.961119 0.953957 -0.126113 0.127684 -1.16456 1.16298 -0.127004 0.126413 -1.37136 1.37195 -0.124959 0.12247 -1.61217 1.61466 -0.119185 0.11444 -1.89861 1.90336 -0.108828 0.101136 -2.23858 2.24627 -0.0937167 0.0844421 -2.66462 2.67389 -0.0781007 0.0830678 -3.13678 3.13181 -0.100446 0.130245 -4.38325 4.35345 -0.162364 0.190649 -3.70724 3.67896 -0.238604 0.298107 -2.3151 2.2556 -0.375533 0.396647 0.0280277 -0.0491416 -0.321832 0.24859 0.429787 -0.356546 -0.185469 0.141237 0.180189 -0.135958 -0.0987558 0.0696424 -0.0839742 0.113088 -0.0487766 0.0358472 -0.119911 0.13284 -0.0229334 0.0102636 -0.0545718 0.0672416 0.0358772 -0.0106017 -0.141616 0.11634 0.075096 -0.325208 0.285989 -0.108252 0.13765 -0.676893 0.647495 -0.156914 0.170061 -0.946564 0.933417 -0.177048 0.181226 -1.15961 1.15543 -0.183365 0.184533 -1.37171 1.37054 -0.185388 0.185473 -1.61622 1.61613 -0.185255 0.1838 -1.90724 1.9087 -0.181328 0.177534 -2.25262 2.25641 -0.172949 0.168318 -2.68069 2.68532 -0.172479 0.197812 -3.12814 3.10281 -0.249475 0.281524 -4.33712 4.30507 -0.279632 0.236791 -3.67074 3.71359 -0.160024 0.0998059 -2.22351 2.28373 -0.112103 -0.162704 -0.0553907 0.330197 0.458814 -0.56762 0.286726 -0.17792 0.567049 -0.467658 0.174783 -0.274174 0.27192 -0.102419 -0.10042 -0.0690809 -0.0128784 0.0482378 -0.139539 0.104179 -0.0440806 0.0210836 -0.08476 0.107757 0.0346257 -0.00886771 -0.0968913 0.0711333 0.0824069 -0.252476 0.204695 -0.131044 0.175311 -0.620376 0.57611 -0.205336 0.228089 -0.920285 0.897531 -0.241107 0.249582 -1.14903 1.14055 -0.255339 0.258673 -1.36853 1.36519 -0.261932 0.265174 -1.61492 1.61168 -0.267866 0.269948 -1.90884 1.90676 -0.271622 0.272475 -2.25877 2.25792 -0.27334 0.270642 -2.69068 2.69338 -0.273184 0.323766 -3.07927 3.02868 -0.425822 0.466728 -4.29739 4.25648 -0.432527 0.353435 -3.7853 3.86439 -0.203911 0.0338623 -2.38996 2.56001 0.225338 -0.529277 -0.590752 0.89469 0.803257 -1.01671 0.0431328 0.170315 1.17332 -1.20578 0.298839 -0.266379 1.14614 -0.996264 0.281985 -0.431863 0.742055 -0.463737 0.0881903 -0.366509 0.182637 -0.0281851 -0.0854365 -0.0690154 0.027758 -0.00606075 -0.0520514 0.0303542 0.0776598 -0.163361 0.113459 -0.141018 0.210065 -0.532212 0.463165 -0.259243 0.296211 -0.874991 0.838023 -0.318951 0.334407 -1.13085 1.11539 -0.343654 0.352211 -1.36027 1.35171 -0.357111 0.363558 -1.60837 1.60193 -0.36932 0.375619 -1.90306 1.89676 -0.381965 0.38981 -2.25565 2.24781 -0.397063 0.408575 -2.69216 2.68064 -0.428457 0.486785 -2.99048 2.93216 -0.70048 0.832447 -4.20381 4.07184 -0.91334 0.914161 -3.905 3.90418 -0.842612 0.589755 -2.73983 2.99269 -0.135797 -0.0701882 -1.04721 1.2532 0.221281 -0.324402 -0.321725 0.424846 0.388202 -0.450188 0.194587 -0.132601 0.484592 -0.490246 0.439275 -0.43362 0.485585 -0.434126 0.518339 -0.569798 0.320765 -0.15426 0.277279 -0.443784 0.0171146 -0.00322326 -0.0161502 0.00225886 0.0548039 -0.0751571 0.0374678 -0.120401 0.216899 -0.392518 0.296019 -0.29939 0.367449 -0.798095 0.730036 -0.407977 0.435872 -1.09914 1.07125 -0.451667 0.464361 -1.34312 1.33042 -0.473979 0.482336 -1.59569 1.58733 -0.491881 0.502821 -1.88906 1.87812 -0.514807 0.530488 -2.23767 2.22199 -0.548393 0.573743 -2.66633 2.64098 -0.619113 0.730092 -2.86444 2.75346 -1.03717 1.43853 -3.84908 3.44772 -1.70976 1.92118 -3.8268 3.61537 -2.08159 2.17945 -3.0842 2.98634 -2.06432 1.75406 -1.59611 1.90637 -1.41572 1.12944 -0.547759 0.834036 -0.836646 0.60715 0.068746 0.16075 -0.403542 0.25926 0.412414 -0.268133 -0.142545 0.0386275 0.572011 -0.468093 0.031844 -0.047066 0.525205 -0.509982 0.000871068 -0.00787224 -0.00713608 0.0261148 -0.0140335 -0.00494514 -0.0662735 0.154377 -0.208319 0.120216 -0.263496 0.372398 -0.652633 0.543732 -0.442698 0.487085 -1.03874 0.994351 -0.506645 0.514715 -1.31725 1.30918 -0.517431 0.518016 -1.57822 1.57764 -0.515819 0.516304 -1.86513 1.86465 -0.518711 0.523193 -2.20286 2.19838 -0.534286 0.554943 -2.60504 2.58438 -0.582387 0.638228 -2.6521 2.59626 -0.774045 1.11477 -2.92617 2.58544 -1.50423 1.66537 -3.33256 3.17142 -1.77711 1.76345 -2.84714 2.8608 -1.76696 1.71045 -2.07149 2.128 -1.49986 1.31881 -1.10161 1.28265 -1.12424 0.936877 -0.421261 0.608628 -0.739061 0.573816 0.0461534 0.119091 -0.413888 0.285687 0.291582 -0.16338 -0.157669 0.0625596 0.390701 -0.295591 -0.000103668 0.00791323 -0.00780957 -0.0016188 0.00857174 0.0159469 -0.0228999 -0.0242222 0.0619875 -0.060864 0.0230987 -0.132447 0.244104 -0.428553 0.316896 -0.33787 0.409187 -0.935907 0.86459 -0.446668 0.465609 -1.29589 1.27695 -0.471986 0.475415 -1.57545 1.57203 -0.476454 0.476454 -1.86425 1.86425 -0.479462 0.484803 -2.19433 2.18899 -0.491312 0.508909 -2.56468 2.54708 -0.539846 0.585387 -2.54625 2.50071 -0.654418 0.78666 -2.37245 2.24021 -1.08364 1.28995 -3.01874 2.81243 -1.43809 1.49929 -2.77949 2.71829 -1.52642 1.50733 -2.15005 2.16914 -1.42973 1.31555 -1.43607 1.55026 -1.14807 0.978493 -0.797486 0.967066 -0.788049 0.617931 -0.292499 0.462617 -0.444567 0.307903 0.0139162 0.122748 -0.177328 0.0743699 0.193094 -0.0901367 -3.37741e-05 0.00781832 -0.00778455 -0.000721708 0.00395376 0.0278434 -0.0310755 -0.0112877 0.0280691 0.00123284 -0.0180142 -0.0600326 0.135936 -0.219576 0.143673 -0.229631 0.318925 -0.782425 0.693131 -0.373971 0.406435 -1.2512 1.21873 -0.419233 0.42423 -1.56785 1.56285 -0.426655 0.426995 -1.86422 1.86388 -0.428707 0.434054 -2.18314 2.17779 -0.440975 0.45246 -2.53309 2.52161 -0.473035 0.508091 -2.46025 2.4252 -0.554401 0.617754 -2.15428 2.09092 -0.762199 0.966429 -2.5897 2.38547 -1.09348 1.13418 -2.67634 2.63564 -1.14429 1.12886 -2.18262 2.19805 -1.07186 0.988234 -1.64598 1.72961 -0.875302 0.754734 -1.11276 1.23333 -0.612749 0.483718 -0.613724 0.742755 -0.352428 0.245053 -0.245468 0.352843 -0.139108 0.055157 -0.00552919 0.0894803 -0.00137283 0.00733535 -0.00596251 0.00326482 -0.00357342 0.0325021 -0.0321935 1.66033e-05 0.0104587 0.0307842 -0.0412595 -0.0300393 0.0702737 -0.088742 0.0485076 -0.14043 0.230071 -0.601578 0.511936 -0.294936 0.338012 -1.1797 1.13663 -0.35693 0.363993 -1.55713 1.55007 -0.366185 0.366302 -1.86382 1.86371 -0.366405 0.370602 -2.17312 2.16892 -0.376661 0.387333 -2.51083 2.50016 -0.401767 0.424723 -2.39456 2.37161 -0.454685 0.492945 -2.04191 2.00365 -0.554535 0.66825 -2.22561 2.1119 -0.770017 0.813589 -2.59574 2.55217 -0.802851 0.777215 -2.21602 2.24166 -0.742491 0.695692 -1.79558 1.84238 -0.622544 0.543872 -1.33048 1.40915 -0.449829 0.363106 -0.849988 0.936711 -0.271985 0.193113 -0.444856 0.523728 -0.109776 0.0415644 -0.164962 0.233174 -0.00306531 0.00349976 -0.000434451 0.00586948 -0.0046706 0.0310428 -0.0322417 -0.0018744 0.0133646 0.0506628 -0.062153 -0.0290035 0.0527379 -0.0170733 -0.00666112 -0.0934741 0.166149 -0.428651 0.355976 -0.226818 0.269928 -1.09151 1.0484 -0.28919 0.295526 -1.54312 1.53678 -0.296366 0.296226 -1.86371 1.86385 -0.294619 0.297579 -2.16494 2.16198 -0.304431 0.312595 -2.4909 2.48274 -0.323547 0.334855 -2.3556 2.34429 -0.351055 0.37192 -1.97515 1.95428 -0.405157 0.454383 -2.03575 1.98653 -0.51367 0.539644 -2.52166 2.49568 -0.539624 0.524196 -2.26208 2.27751 -0.497273 0.465893 -1.87922 1.9106 -0.423727 0.375126 -1.47302 1.52162 -0.316055 0.260712 -1.00575 1.0611 -0.199359 0.14222 -0.591049 0.648188 -0.0784408 0.0270884 -0.293375 0.344727 0.000773868 -0.00175517 0.000981303 -0.00983999 0.0326623 0.0414724 -0.0642948 -0.0596787 0.0893991 0.0812102 -0.110931 -0.112952 0.123045 0.0235674 -0.0336599 -0.124547 0.147576 -0.301149 0.27812 -0.18172 0.207631 -1.01309 0.987183 -0.217112 0.218002 -1.53244 1.53155 -0.216638 0.216429 -1.86411 1.86432 -0.216646 0.218252 -2.1602 2.15859 -0.224129 0.231985 -2.47486 2.46701 -0.23843 0.245349 -2.33597 2.32906 -0.251488 0.260548 -1.94015 1.93109 -0.282404 0.313492 -1.94968 1.9186 -0.344402 0.353561 -2.47765 2.46849 -0.347929 0.33529 -2.29062 2.30326 -0.317106 0.297572 -1.936 1.95553 -0.27278 0.245276 -1.55786 1.58536 -0.208889 0.173173 -1.10568 1.1414 -0.131137 0.0895292 -0.69723 0.738838 -0.0429617 0.0106673 -0.386509 0.418804 0.0126832 0.00474245 -0.0174256 -0.0455129 0.0928791 0.10209 -0.149456 -0.130788 0.162011 0.147488 -0.178711 -0.168647 0.159811 0.0330594 -0.0242227 -0.14188 0.121526 -0.282826 0.30318 -0.115458 0.116596 -0.972874 0.971736 -0.117521 0.118669 -1.53217 1.53102 -0.120377 0.123995 -1.86365 1.86003 -0.129113 0.134682 -2.1558 2.15023 -0.140233 0.148044 -2.45927 2.45145 -0.153613 0.156752 -2.32345 2.32031 -0.157824 0.157145 -1.92739 1.92807 -0.16422 0.185579 -1.8929 1.87154 -0.214279 0.22518 -2.46107 2.45017 -0.222997 0.214402 -2.31515 2.32375 -0.201627 0.187325 -1.97188 1.98618 -0.170065 0.152042 -1.60715 1.62517 -0.128954 0.105664 -1.16987 1.19316 -0.0769155 0.0477333 -0.77351 0.802693 -0.0169342 0.000442337 -0.44281 0.459302 0.0227188 0.0369133 -0.0596321 -0.0578883 0.0883466 0.194341 -0.224799 -0.1053 0.104563 0.195169 -0.194431 -0.093067 0.0738443 0.0102755 0.00894726 -0.0478224 0.0106215 -0.334209 0.37141 0.0160777 -0.0275514 -0.980547 0.99202 0.0255793 -0.0129464 -1.52601 1.51337 -0.00130638 0.0162517 -1.85166 1.83671 -0.0309263 0.0470218 -2.14011 2.12402 -0.0591485 0.069587 -2.44299 2.43256 -0.0759064 0.0762631 -2.31942 2.31907 -0.0734028 0.070008 -1.93045 1.93385 -0.0694128 0.0805519 -1.85622 1.84508 -0.120581 0.137758 -2.43523 2.41805 -0.139858 0.136626 -2.32848 2.33171 -0.130287 0.12282 -1.99704 2.00451 -0.113525 0.103274 -1.63952 1.64977 -0.0888637 0.0722478 -1.21282 1.22944 -0.0501431 0.0272674 -0.82847 0.851346 -0.00483502 -0.00394916 -0.470504 0.479289 0.0138685 0.0804942 -0.0943627 -0.0230415 0.0199725 0.239243 -0.236174 -0.0037001 -0.0219626 0.179801 -0.154139 0.0496478 -0.0842191 -0.0347695 0.0693408 0.120045 -0.161972 -0.411639 0.453566 0.191877 -0.202939 -1.00571 1.01677 0.186754 -0.154739 -1.49085 1.45884 0.124579 -0.0919433 -1.81315 1.78052 0.0634358 -0.0350714 -2.10137 2.073 0.013924 0.00303376 -2.41906 2.4021 -0.0124694 0.0149408 -2.31832 2.31585 -0.0120577 0.00318179 -1.94069 1.94956 0.00714882 0.000713742 -1.83713 1.82927 -0.0595938 0.090211 -2.39583 2.36521 -0.101315 0.099922 -2.33454 2.33593 -0.0940427 0.087484 -2.01072 2.01727 -0.0799037 0.0717953 -1.65779 1.66589 -0.0591759 0.044596 -1.24443 1.25901 -0.0256255 0.00762445 -0.871352 0.889353 0.00613774 -0.00634248 -0.484239 0.484444 -0.00426356 0.0994084 -0.0951449 0.0240903 -0.0578533 0.215783 -0.18202 0.0951558 -0.140004 0.11859 -0.073741 0.182982 -0.231468 -0.111416 0.159902 0.274809 -0.314999 -0.495962 0.536152 0.336257 -0.324712 -1.01864 1.00709 0.294273 -0.253112 -1.42074 1.37958 0.212736 -0.16953 -1.74093 1.69772 0.132608 -0.0973508 -2.04034 2.00508 0.0701241 -0.0464272 -2.38165 2.35795 0.0307721 -0.0224578 -2.31102 2.30271 0.0218175 -0.0264593 -1.95673 1.96137 0.0357744 -0.0326093 -1.82139 1.81822 -0.0138886 0.0553324 -2.32797 2.28653 -0.0761629 0.0808039 -2.33353 2.32889 -0.0784746 0.0730925 -2.02416 2.02954 -0.0656538 0.0576101 -1.67435 1.6824 -0.0457286 0.0317243 -1.27343 1.28743 -0.0142819 -0.00113812 -0.906412 0.921832 0.0107739 -0.00690598 -0.482108 0.47824 -0.0183148 0.0820243 -0.0637095 0.0520532 -0.0992498 0.138957 -0.0917605 0.146183 -0.19941 0.0224622 0.0307643 0.247449 -0.296496 -0.210919 0.259967 0.333572 -0.359839 -0.570245 0.596511 0.362243 -0.346409 -0.991307 0.975474 0.318155 -0.280042 -1.33821 1.3001 0.242054 -0.200846 -1.65411 1.61291 0.164062 -0.128082 -1.96855 1.93257 0.0991975 -0.0724716 -2.33212 2.3054 0.053136 -0.03802 -2.29109 2.27597 0.0323488 -0.0318946 -1.96267 1.96221 0.0371119 -0.038212 -1.81766 1.81876 0.0116898 0.0322721 -2.24236 2.1984 -0.054287 0.0594446 -2.32363 2.31847 -0.0561742 0.049807 -2.03452 2.04089 -0.041482 0.0332703 -1.69024 1.69846 -0.0218576 0.00873862 -1.30117 1.31429 0.00702233 -0.0181501 -0.934905 0.946033 0.0177331 -0.00715954 -0.471877 0.461303 -0.0187371 0.0438167 -0.0250795 0.0511659 -0.0949755 0.0447374 -0.000927832 0.137445 -0.184321 -0.082034 0.128911 0.2254 -0.265529 -0.305361 0.34549 0.294018 -0.312025 -0.618315 0.636321 0.314262 -0.300392 -0.9584 0.94453 0.280015 -0.252227 -1.26676 1.23898 0.224092 -0.191963 -1.57602 1.54389 0.162063 -0.131395 -1.89864 1.86798 0.104825 -0.0781028 -2.27854 2.25182 0.0563941 -0.0389791 -2.25915 2.24173 0.0265687 -0.0242716 -1.96122 1.95893 0.0242492 -0.0251767 -1.82 1.82093 0.0134708 0.0136803 -2.16062 2.13347 -0.0347582 0.0397834 -2.31287 2.30784 -0.0353736 0.0271902 -2.04877 2.05695 -0.0162071 0.00589143 -1.70786 1.71818 0.00564288 -0.0171946 -1.3266 1.33816 0.028744 -0.0321555 -0.954067 0.957479 0.0236523 -0.00791703 -0.447341 0.431606 -0.0126872 0.00910755 0.00357967 0.0361473 -0.0686967 -0.0376195 0.0701689 0.100695 -0.135887 -0.170121 0.205312 0.166477 -0.196051 -0.380256 0.409831 0.216965 -0.230638 -0.651685 0.665358 0.233587 -0.228101 -0.935236 0.92975 0.218401 -0.202717 -1.2175 1.20181 0.185265 -0.16316 -1.51667 1.49457 0.14138 -0.117444 -1.8406 1.81666 0.0951675 -0.0711859 -2.22611 2.20213 0.0492731 -0.0318186 -2.22451 2.20706 0.0157319 -0.00687864 -1.95365 1.9448 0.00113069 -0.000826795 -1.8217 1.8214 0.00304603 0.00520527 -2.11658 2.10832 -0.0127004 0.0128592 -2.30461 2.30446 -0.00692591 -0.00148896 -2.06479 2.0732 0.0123014 -0.021881 -1.7282 1.73778 0.0313889 -0.0397045 -1.34839 1.35671 0.0455846 -0.0417422 -0.956853 0.953011 0.0237987 -0.00692133 -0.415144 0.398267 -0.00678757 -0.0130983 0.0198859 0.0206351 -0.0413925 -0.0965662 0.117324 0.0628316 -0.0869367 -0.23468 0.258785 0.108094 -0.128867 -0.434734 0.455507 0.144127 -0.155475 -0.677813 0.689161 0.160596 -0.161403 -0.927783 0.92859 0.158687 -0.151514 -1.19079 1.18362 0.14207 -0.128476 -1.47695 1.46336 0.114237 -0.0969309 -1.79615 1.77884 0.0796866 -0.0593406 -2.17988 2.15954 0.0382298 -0.0191153 -2.18876 2.16965 -0.00156902 0.0203067 -1.93134 1.9126 -0.0372115 0.041278 -1.81913 1.81507 -0.0222611 0.011771 -2.10885 2.11934 -0.00502008 -0.0052578 -2.3092 2.31948 0.0182741 -0.030759 -2.08384 2.09633 0.0430982 -0.0525246 -1.74736 1.75679 0.0598276 -0.0638012 -1.363 1.36698 0.0615456 -0.0478504 -0.944513 0.930818 0.0236289 -0.00666502 -0.381178 0.364214 -0.00303781 -0.0245225 0.0275604 0.0101064 -0.021918 -0.133183 0.144994 0.0351691 -0.0508706 -0.278327 0.294028 0.065053 -0.0794341 -0.472814 0.487195 0.0906097 -0.100013 -0.699534 0.708937 0.105887 -0.109662 -0.931235 0.93501 0.110684 -0.108747 -1.17944 1.1775 0.104584 -0.0971424 -1.453 1.44555 0.0888088 -0.0772617 -1.76463 1.75309 0.0644254 -0.0478746 -2.14091 2.12436 0.0299138 -0.00970998 -2.14972 2.12952 -0.015523 0.0412586 -1.88935 1.86361 -0.0634222 0.0658707 -1.811 1.80855 -0.0352473 0.00134964 -2.1421 2.17599 0.0233852 -0.0381865 -2.33375 2.34855 0.0518092 -0.0629583 -2.10853 2.11968 0.0722304 -0.0779269 -1.76468 1.77037 0.0799523 -0.0777652 -1.36788 1.3657 0.0667694 -0.0464786 -0.913321 0.89303 0.0212867 -0.00613599 -0.347998 0.332847 -0.00108343 -0.0294508 0.0305342 0.00414361 -0.0100916 -0.153525 0.159473 0.0176443 -0.0274264 -0.306495 0.316277 0.0367417 -0.0466357 -0.499143 0.509037 0.0548254 -0.0624637 -0.717428 0.725066 0.0681253 -0.072912 -0.939456 0.944243 0.0757639 -0.0768967 -1.17731 1.17844 0.0761469 -0.0730745 -1.44039 1.43732 0.0690219 -0.0623914 -1.74431 1.73768 0.0543154 -0.0418343 -2.10943 2.09695 0.027918 -0.00951433 -2.10914 2.09074 -0.0140058 0.037228 -1.83815 1.81493 -0.0568966 0.0526194 -1.809 1.81328 -0.0116176 -0.0290319 -2.21513 2.25578 0.0577159 -0.0736829 -2.36465 2.38061 0.0866717 -0.0936905 -2.12909 2.13611 0.0976388 -0.0974093 -1.77314 1.77292 0.0924866 -0.0825872 -1.35986 1.34996 0.063579 -0.0406464 -0.870931 0.847999 0.0182893 -0.00558257 -0.31891 0.306203 -0.000167989 -0.0310727 0.0312407 0.00108539 -0.00351153 -0.163416 0.165843 0.00733556 -0.0130881 -0.323856 0.329608 0.0190963 -0.0259339 -0.517277 0.524114 0.0320311 -0.0382776 -0.731949 0.738195 0.0434412 -0.0483969 -0.949159 0.954115 0.0520976 -0.0549767 -1.18055 1.18343 0.0563855 -0.0564606 -1.43584 1.43592 0.0557303 -0.053149 -1.73327 1.73069 0.0495531 -0.0433499 -2.08734 2.08114 0.0352782 -0.0244372 -2.07518 2.06434 0.0102937 0.00173573 -1.7968 1.78477 -0.007915 -0.00477715 -1.82246 1.83516 0.0433988 -0.0807532 -2.29531 2.33266 0.105301 -0.114966 -2.39489 2.40456 0.119343 -0.117651 -2.1389 2.13721 0.113319 -0.105528 -1.76908 1.76129 0.0921335 -0.0751927 -1.33625 1.31931 0.0520832 -0.0312202 -0.825586 0.804723 0.0141545 -0.00458817 -0.295038 0.285472 0.000195987 -0.0311799 0.0309839 -0.000296263 -0.00016119 -0.167153 0.167611 0.00168465 -0.00475794 -0.333883 0.336956 0.0085232 -0.0132766 -0.529816 0.534569 0.0178978 -0.0231011 -0.743873 0.749076 0.0278119 -0.0327444 -0.959076 0.964009 0.036887 -0.0408474 -1.1869 1.19086 0.0438721 -0.0464445 -1.43723 1.4398 0.0485877 -0.050342 -1.73031 1.73206 0.0510294 -0.0510142 -2.07797 2.07796 0.0510935 -0.0508528 -2.05819 2.05794 0.0510257 -0.053283 -1.77989 1.78214 0.060556 -0.0757641 -1.85051 1.86572 0.104962 -0.133098 -2.36649 2.39463 0.141537 -0.140686 -2.40845 2.40759 0.134201 -0.124272 -2.13093 2.121 0.111981 -0.0971438 -1.74964 1.7348 0.0776458 -0.0577375 -1.30033 1.28042 0.036058 -0.0204628 -0.786345 0.77075 0.00929136 -0.003098 -0.277691 0.271498 0.000315794 -0.0306939 0.0303781 -0.000829868 0.00118183 -0.167545 0.167193 -0.000947782 -0.000407794 -0.339055 0.340411 0.00263222 -0.00591839 -0.538504 0.54179 0.00944909 -0.0137946 -0.753824 0.75817 0.0180681 -0.0228889 -0.968931 0.973752 0.0272454 -0.0318149 -1.1952 1.19977 0.0358215 -0.0399978 -1.44323 1.44741 0.0440088 -0.048661 -1.73542 1.74008 0.0534887 -0.0600373 -2.08133 2.08788 0.0681709 -0.0782954 -2.06311 2.07324 0.0923585 -0.106557 -1.79061 1.80481 0.121486 -0.130945 -1.87917 1.88863 0.137825 -0.149425 -2.41445 2.42605 0.147558 -0.140981 -2.4033 2.39672 0.127234 -0.112011 -2.10808 2.09285 0.0945897 -0.0765947 -1.71806 1.70007 0.0561544 -0.0378674 -1.261 1.24271 0.0212946 -0.011578 -0.758171 0.748454 0.00518235 -0.00165368 -0.266848 0.263319 0.000291726 -0.0300665 0.0297747 -0.000850848 0.00152444 -0.166607 0.165933 -0.00176802 0.00132752 -0.341206 0.341646 -9.91674e-05 -0.00211988 -0.544471 0.54669 0.00480489 -0.00842056 -0.762149 0.765764 0.0122402 -0.0167779 -0.978451 0.982989 0.0210731 -0.0258286 -1.20448 1.20924 0.0303042 -0.0354384 -1.45212 1.45726 0.0406053 -0.0470656 -1.74574 1.7522 0.0544176 -0.0646538 -2.09654 2.10678 0.0782453 -0.0962161 -2.08831 2.10628 0.118367 -0.139569 -1.82294 1.84414 0.158841 -0.161422 -1.89381 1.89639 0.145369 -0.145812 -2.43073 2.43117 0.134411 -0.119634 -2.38554 2.37077 0.100842 -0.0837493 -2.07662 2.05953 0.0654715 -0.0488476 -1.68278 1.66616 0.0315896 -0.0188116 -1.22669 1.21391 0.01003 -0.00558913 -0.741559 0.737118 0.00221256 -0.000395184 -0.260854 0.259037 0.000205884 -0.0295215 0.0293156 -0.000620318 0.00114933 -0.165304 0.164775 -0.00147299 0.00137646 -0.34183 0.341927 -0.000712179 -0.000728976 -0.548463 0.549905 0.0026879 -0.0055603 -0.769037 0.771909 0.00883117 -0.0129476 -0.987332 0.991448 0.0169472 -0.0214741 -1.2139 1.21843 0.0258707 -0.0311986 -1.46261 1.46794 0.0366479 -0.043536 -1.75915 1.76604 0.05127 -0.0623238 -2.11782 2.12887 0.0772752 -0.0967218 -2.12558 2.14503 0.120748 -0.144676 -1.86855 1.89248 0.166479 -0.168294 -1.89692 1.89874 0.139626 -0.120976 -2.42581 2.40716 0.101564 -0.0815139 -2.35135 2.3313 0.0626783 -0.047186 -2.04323 2.02774 0.0310681 -0.0189227 -1.65153 1.63939 0.01046 -0.00688073 -1.20569 1.20211 0.00540153 -0.00391918 -0.734566 0.733083 0.00102755 0.00037769 -0.257692 0.256287 9.82471e-05 -0.0291581 0.0290598 -0.00029105 0.000497612 -0.164379 0.164172 -0.000574761 0.00043461 -0.341985 0.342125 3.36878e-06 -0.000937553 -0.55107 0.552004 0.00230443 -0.00444982 -0.77443 0.776576 0.00698856 -0.010341 -0.995226 0.998579 0.0137594 -0.0176749 -1.22265 1.22656 0.0214041 -0.025939 -1.47307 1.47761 0.0307937 -0.0368455 -1.77253 1.77859 0.0437654 -0.053187 -2.13945 2.14887 0.0650525 -0.0797919 -2.16271 2.17745 0.0974855 -0.115971 -1.91482 1.9333 0.133868 -0.137253 -1.90133 1.90472 0.1069 -0.0592033 -2.37111 2.32342 0.0436313 -0.0307445 -2.31276 2.29987 0.018598 -0.011039 -2.01574 2.00818 0.00520716 -0.00365475 -1.63284 1.63129 0.00438958 -0.00601467 -1.20177 1.20339 0.00786603 -0.00646226 -0.731976 0.730572 0.00167851 0.000571426 -0.254713 0.252463 -9.0661e-06 -0.0290116 0.0290206 3.48665e-05 -0.000143101 -0.164119 0.164228 0.000373819 -0.000760183 -0.342348 0.342735 0.00122081 -0.00190636 -0.552815 0.5535 0.00283209 -0.00434744 -0.778413 0.779928 0.00621507 -0.00869948 -1.00148 1.00396 0.0112542 -0.0142221 -1.22995 1.23292 0.017062 -0.0204955 -1.48168 1.48511 0.0240662 -0.0283311 -1.78387 1.78813 0.0327132 -0.0380876 -2.15593 2.16131 0.0440222 -0.0508871 -2.18807 2.19493 0.0580062 -0.0641048 -1.94504 1.95114 0.0686946 -0.0676713 -1.90765 1.90663 0.0492383 -0.00413471 -2.27408 2.22897 -0.0138389 0.0146997 -2.29181 2.29095 -0.0126136 0.00895251 -2.00721 2.01087 -0.0045088 -0.000954333 -1.63353 1.63899 0.00857874 -0.015536 -1.20764 1.2146 0.0183411 -0.0131334 -0.7282 0.722992 0.00428518 -0.000120673 -0.249485 0.24532 -6.72922e-05 -0.0290577 0.0291249 0.000253429 -0.00064695 -0.164451 0.164844 0.00116629 -0.00182204 -0.343237 0.343893 0.00239704 -0.00297125 -0.554125 0.554699 0.00357462 -0.0045433 -0.781213 0.782182 0.00585044 -0.00770971 -1.00611 1.00797 0.00954512 -0.0115589 -1.23538 1.23739 0.0134713 -0.0156813 -1.48797 1.49018 0.0177769 -0.0199018 -1.79126 1.79339 0.0213688 -0.0223578 -2.16379 2.16478 0.0219753 -0.0196847 -2.19646 2.19417 0.0147469 -0.00782621 -1.95015 1.94323 8.85607e-05 0.00417431 -1.90637 1.90211 -0.00917544 0.028948 -2.19506 2.17529 -0.0376214 0.0321708 -2.2935 2.29895 -0.0206155 0.00941835 -2.0177 2.02889 0.00297497 -0.0146723 -1.64817 1.65986 0.0267466 -0.0340019 -1.2227 1.22996 0.0310078 -0.0193042 -0.715573 0.70387 0.00704081 -0.0011267 -0.240243 0.234329 -0.000108068 -0.0292192 0.0293273 0.000400857 -0.000971652 -0.165328 0.165898 0.00169666 -0.00259901 -0.344668 0.34557 0.00333515 -0.00390812 -0.555277 0.55585 0.00428563 -0.00479514 -0.782965 0.783475 0.00557206 -0.00676929 -1.00941 1.01061 0.00796399 -0.00928495 -1.239 1.24032 0.0104669 -0.0117494 -1.49191 1.49319 0.0126522 -0.0130487 -1.7945 1.7949 0.0124229 -0.0104318 -2.16405 2.16206 0.00604942 0.00256774 -2.18833 2.17971 -0.0174317 0.0349814 -1.93062 1.91307 -0.0525067 0.0567119 -1.89762 1.89342 -0.046297 0.0403191 -2.16945 2.17542 -0.0386143 0.0289513 -2.30801 2.31767 -0.0126518 -0.00531607 -2.04076 2.05873 0.0237125 -0.037239 -1.67253 1.68606 0.0488782 -0.0498447 -1.23509 1.23605 0.0392078 -0.0228915 -0.690286 0.673969 0.00889322 -0.00189166 -0.227748 0.220746 -0.0842077 -0.230486 -0.409864 -0.610417 -0.820182 -1.02748 -1.24503 -1.49495 -1.795 -2.15664 -2.1799 -2.00131 -2.23249 -2.56731 -2.4645 -2.09585 -1.63112 -1.02436 -0.430668 -0.0125134 -0.00217562 -0.213443 0.00933909 0.206279 0.437668 -0.103641 -0.49072 0.842387 0.133666 -0.152413 -1.08769 0.928837 0.137943 -0.127734 -1.23985 0.931868 0.119964 -0.11044 -1.25946 0.921256 0.106054 -0.096507 -1.26395 0.0925215 -0.0832138 -1.27468 0.0754132 -0.0684673 1.28561 -1.29256 0.0650143 -0.063102 1.309 -1.31091 0.0610166 -0.0562792 1.28554 -1.29028 0.0469329 -0.0105502 0.855779 -0.892161 -0.0528056 0.454955 -0.402149 0.0599163 -0.0633512 1.07279 -1.06935 0.0637742 -0.0648192 1.24063 -1.23958 0.0614868 -0.0593358 1.25797 -1.26012 0.0539601 -0.0520013 1.26597 -1.26793 0.0484964 -0.0458988 1.27797 -1.28057 0.0430827 -0.0415893 1.29441 -1.2959 0.0393839 -0.0358634 1.31255 -1.31607 0.0299748 -0.0240222 1.29819 -1.30415 0.0154093 -0.00600406 0.894581 -0.903986 -0.0243822 0.379154 -0.354771 0.0356322 -0.0368325 1.0653 -1.0641 0.0338126 -0.0326347 1.2412 -1.24237 0.0307278 -0.0289665 1.26058 -1.26235 0.027029 -0.026487 1.26973 -1.27027 0.0249902 -0.0247965 1.28079 -1.28098 0.0241112 -0.0238335 1.29686 -1.29714 0.0233455 -0.0230411 1.31696 -1.31726 0.0233124 -0.0221715 1.30587 -1.30701 0.0167431 -0.00601367 0.914387 -0.925117 -0.01256 0.34224 -0.32968 0.0138841 -0.0120536 1.06456 -1.06639 0.0102917 -0.00975462 1.24365 -1.24418 0.00913481 -0.00934074 1.26227 -1.26207 0.00879436 -0.00966076 1.27032 -1.26946 0.00965075 -0.0109939 1.28088 -1.27953 0.0115059 -0.0139804 1.29631 -1.29384 0.0153254 -0.0175268 1.31475 -1.31255 0.0204177 -0.0206555 1.30518 -1.30495 0.0162365 -0.00666496 0.936425 -0.945996 -0.00591135 0.323595 -0.317684 0.00125834 0.00391505 1.07058 -1.07575 -0.00598668 0.00565776 1.24522 -1.24489 -0.00450607 0.0037019 1.26114 -1.26034 -0.00242931 0.001076 1.2676 -1.26625 0.000165839 -0.00279895 1.27792 -1.27529 0.00532493 -0.00788121 1.29128 -1.28872 0.0111169 -0.0150479 1.30855 -1.30462 0.0179147 -0.0200906 1.30292 -1.30075 0.0168179 -0.00715408 0.956193 -0.965857 5.9014e-05 0.315334 -0.315393 -0.00920518 0.0152391 1.08209 -1.08813 -0.0169874 0.0158194 1.24485 -1.24369 -0.0138784 0.0121911 1.25793 -1.25625 -0.0100724 0.00787407 1.26339 -1.26119 -0.00571311 0.0021802 1.27256 -1.26903 0.00128326 -0.00472305 1.28387 -1.28043 0.00874726 -0.0133896 1.29983 -1.29519 0.0176418 -0.0200945 1.29786 -1.2954 0.0179783 -0.00841836 0.976162 -0.985722 0.000987261 0.316345 -0.317332 -0.0136121 0.0221123 1.09619 -1.1047 -0.0245248 0.022603 1.24372 -1.2418 -0.0214213 0.0183392 1.25393 -1.25085 -0.0160901 0.0125186 1.25758 -1.25401 -0.00959885 0.00531836 1.26549 -1.26121 -0.00170711 -0.00377304 1.27611 -1.27063 0.00798771 -0.013489 1.28961 -1.28411 0.0186783 -0.0221337 1.2907 -1.28725 0.0214953 -0.0112916 0.995848 -1.00605 0.00548381 0.320884 -0.326368 -0.0210587 0.0296133 1.11379 -1.12235 -0.0308173 0.0290398 1.24142 -1.23964 -0.0272569 0.0234505 1.24791 -1.2441 -0.0204355 0.0160988 1.25031 -1.24598 -0.0117418 0.00728423 1.25626 -1.2518 -0.00221956 -0.00348563 1.26552 -1.25982 0.00856865 -0.0143261 1.27834 -1.27258 0.0204176 -0.0255116 1.28219 -1.27709 0.0253147 -0.0146748 1.01667 -1.02731 0.0103095 0.333745 -0.344054 -0.0294582 0.0382157 1.13174 -1.14049 -0.0391813 0.0364647 1.23836 -1.23564 -0.0324207 0.0283391 1.24046 -1.23637 -0.0243923 0.0191391 1.24209 -1.23684 -0.0138591 0.00848189 1.246 -1.24062 -0.00247803 -0.00356046 1.25322 -1.24718 0.0102088 -0.0175622 1.26528 -1.25792 0.024682 -0.0303381 1.27092 -1.26526 0.0312118 -0.0198649 1.03924 -1.05059 0.0182736 0.358075 -0.376349 -0.0405499 0.0485545 1.14959 -1.15759 -0.048035 0.0440087 1.2325 -1.22847 -0.038648 0.03337 1.23114 -1.22586 -0.0282347 0.0218502 1.23134 -1.22496 -0.0154706 0.00841338 1.23382 -1.22676 -0.00260688 -0.00503126 1.23964 -1.23201 0.0126533 -0.0209021 1.24966 -1.24141 0.0290043 -0.0358835 1.25736 -1.25048 0.0380426 -0.0262513 1.06246 -1.07425 0.0296228 0.400005 -0.429628 -0.0541296 0.060338 1.16536 -1.17156 -0.0571444 0.0521042 1.22375 -1.21871 -0.0457419 0.038382 1.21996 -1.2126 -0.0312143 0.0241165 1.21763 -1.21053 -0.0165029 0.00893893 1.21886 -1.21129 -0.000883983 -0.00706894 1.22349 -1.21554 0.01553 -0.0245606 1.2323 -1.22327 0.0328577 -0.0413802 1.24211 -1.23359 0.0449743 -0.0333236 1.08642 -1.09807 0.0441592 0.466584 -0.510743 -0.0694324 0.0723549 1.17584 -1.17876 -0.0668452 0.0583428 1.21259 -1.20409 -0.0503774 0.0421585 1.20519 -1.19697 -0.0337279 0.0255546 1.20195 -1.19378 -0.0176252 0.00867351 1.20235 -1.1934 -0.00050527 -0.00932036 1.20681 -1.19699 0.0178235 -0.0268489 1.2135 -1.20448 0.0363947 -0.0457678 1.22426 -1.21489 0.0515424 -0.0403408 1.10959 -1.12079 0.0574452 0.562239 -0.619684 -0.0802522 0.0789315 1.18023 -1.17891 -0.0712678 0.0612377 1.19584 -1.18581 -0.052138 0.0431388 1.18779 -1.17879 -0.0348029 0.0258015 1.18455 -1.17555 -0.0177928 0.0088535 1.18466 -1.17572 -8.76179e-05 -0.00922729 1.18784 -1.17853 0.0179754 -0.028049 1.19474 -1.18466 0.0382101 -0.0479152 1.20486 -1.19515 0.0549573 -0.0465552 1.13066 -1.13907 0.0687019 0.683836 -0.752538 -0.0857687 0.0797756 1.17561 -1.16962 -0.0698366 0.0605488 1.17635 -1.16706 -0.0518668 0.0427636 1.17004 -1.16094 -0.0347001 0.0257391 1.16701 -1.15805 -0.0175669 0.00846254 1.16712 -1.15802 0.00033662 -0.00880658 1.16904 -1.16057 0.0175059 -0.0266794 1.17445 -1.16528 0.0360757 -0.0459179 1.1836 -1.17375 0.0554249 -0.0513884 1.1467 -1.15074 0.0752843 0.825528 -0.900813 -0.0835274 0.0772197 1.16268 -1.15638 -0.0690225 0.0610694 1.15822 -1.15027 -0.0527297 0.0431912 1.15277 -1.14324 -0.0345643 0.0252274 1.14917 -1.13983 -0.0167618 0.00752759 1.14887 -1.13964 0.000665473 -0.00979826 1.15106 -1.14193 0.0187544 -0.0279245 1.15616 -1.14699 0.0357649 -0.0449021 1.16488 -1.15574 0.0507124 -0.0509956 1.15283 -1.15254 0.0856433 0.977927 -1.06357 -0.0861336 0.0701319 1.15238 -1.13638 -0.0567777 0.0452702 1.14042 -1.12892 -0.0363921 0.0297878 1.13402 -1.12742 -0.024678 0.0198925 1.13201 -1.12723 -0.0155081 0.0107422 1.13245 -1.12769 -0.00570074 0.000454388 1.13337 -1.12812 0.00580066 -0.0138718 1.13698 -1.12891 0.0242951 -0.0380149 1.14643 -1.13271 0.0528961 -0.0620006 1.15168 -1.14258 -0.257384 0.222612 -0.375334 0.376825 -0.439888 0.447976 -0.514933 0.523119 -0.608742 0.616198 -0.72444 0.730032 -0.866145 0.869946 -1.03754 1.04015 -1.24398 1.24593 -1.49253 1.49421 -1.49265 1.49456 -1.24457 1.24693 -1.03843 1.04179 -0.867426 0.872472 -0.726843 0.734061 -0.612742 0.621474 -0.521152 0.529819 -0.446443 0.454247 -0.364536 0.353289 -0.128081 0.0881103 0.0318002 -0.194043 0.172071 0.015991 -0.15584 0.14385 0.00995034 -0.134619 0.127171 0.00705397 -0.120972 0.115692 0.0053105 -0.11114 0.107167 0.00411117 -0.103685 0.100607 0.00323101 -0.0978861 0.0954628 0.00255508 -0.0933122 0.0913898 0.00201245 -0.0896855 0.0881641 0.0015596 -0.0868242 0.0856368 0.00116085 -0.0846084 0.0837136 0.000787553 -0.0829661 0.0823435 0.00041831 -0.0818643 0.0815086 2.37824e-05 -0.0813 0.0812298 -0.000371865 -0.0812999 0.0815084 -0.000855586 -0.081913 0.0824627 -0.00142968 -0.0832134 0.0841655 -0.00212711 -0.0853384 0.0867724 -0.00303102 -0.0884497 0.0905016 -0.00424884 -0.0928099 0.0956839 -0.00595908 -0.0987914 0.102806 -0.00852431 -0.106966 0.112668 -0.0127007 -0.118287 0.126688 -0.0205731 -0.134516 0.147747 -0.0141325 -0.161075 0.171119 -0.000511885 -0.183366 0.185802 0.00370434 -0.192709 0.191842 0.00486697 -0.19566 0.193521 0.00468461 -0.195828 0.193529 0.00417789 -0.195359 0.193199 0.00335366 -0.194854 0.193051 0.00247951 -0.194691 0.193405 0.00186789 -0.1951 0.194226 0.00110339 -0.196122 0.195708 0.000575085 -0.19774 0.197692 7.81748e-05 -0.199854 0.200127 -0.000261244 -0.20232 0.202812 -0.000723526 -0.205144 0.205893 -0.000955408 -0.208164 0.209026 -0.00115791 -0.211287 0.212304 -0.00122983 -0.214612 0.215643 -0.00133863 -0.217777 0.218948 -0.00144733 -0.220982 0.222212 -0.00117364 -0.224279 0.225206 -0.00137756 -0.227144 0.228246 -0.00126367 -0.230124 0.2311 -0.00118231 -0.232906 0.233894 -0.00172159 -0.23618 0.238347 -0.000810942 -0.241622 0.291005 0.503249 0.668342 0.817829 0.965883 1.12785 1.30022 1.47948 1.65303 1.46707 1.03575 0.715584 0.449752 0.313069 0.48643 0.608456 0.420124 0.2337 -0.118294 -0.132243 -0.171773 -0.188894 -0.1976 -0.204346 -0.212796 -0.221593 -0.230287 -0.237832 -0.229454 -0.209942 -0.185933 -0.157648 -0.267198 -0.531519 -0.639411 -0.658318 -0.665957 -0.3315 0.906182 -0.314337 0.908005 -0.300864 0.916004 -0.280525 0.872739 -0.229725 0.408104 0.633498 0.00601887 -0.0294418 -9.59367e-05 -0.166527 0.000427811 -0.00109912 -0.346561 0.00196903 -0.00306238 -0.556484 0.00396212 -0.00459518 -0.783902 0.00485642 -0.00505403 -1.01144 0.00542902 -0.00607749 -1.24131 0.00675741 -0.0075015 -1.49405 0.00821463 -0.00900402 -1.79473 0.00949045 -0.00951573 -2.15997 0.00812766 -0.00401715 -2.17031 -0.00371229 0.0163631 -1.89226 -0.0342014 0.0532659 -1.88752 -0.0706705 0.0745388 -2.19001 -0.0606991 0.0395645 -2.33376 -0.0265098 0.0103862 -2.07574 0.0109119 -0.029004 -1.69821 0.0489015 -0.0648261 -1.23372 0.0703741 -0.062971 -0.656478 0.0423335 -0.0234719 -0.00248123 -0.00190522 -0.00196118 -0.00222489 -0.00246796 -0.00298891 -0.00286986 -0.00302325 -0.0030708 -0.00287923 -0.00264475 -0.00207917 -0.0013773 3.33564e-05 0.0017046 0.00372987 0.00595006 0.00874164 0.0117786 0.0158971 0.0221292 0.0254334 0.0238252 0.0171805 0.00981655 ) ; boundaryField { wall-4 { type calculated; value uniform 0; } pressure-outlet-7 { type calculated; value nonuniform List<scalar> 40 ( 0.0846369 0.23134 0.410753 0.610719 0.820444 1.02805 1.24561 1.49553 1.79445 2.15177 2.16658 1.98475 2.24801 2.58543 2.48526 2.111 1.62888 1.00351 0.416725 0.19809 0.0297568 0.167921 0.34872 0.557792 0.784258 1.01258 1.24271 1.49552 1.79504 2.15321 2.14927 1.85894 1.88026 2.23287 2.36779 2.11031 1.72088 1.21571 0.619914 0.0683277 ) ; } velocity-inlet-6 { type calculated; value nonuniform List<scalar> 20 ( -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 -1.12529 ) ; } velocity-inlet-5 { type calculated; value nonuniform List<scalar> 40 ( -0.289011 -0.346776 -0.416168 -0.499439 -0.599215 -0.719057 -0.862907 -1.03564 -1.24269 -1.49119 -1.49119 -1.2425 -1.03545 -0.862907 -0.719057 -0.599402 -0.499252 -0.416168 -0.346776 -0.289011 -0.289011 -0.346776 -0.416168 -0.499252 -0.599402 -0.719057 -0.862907 -1.03545 -1.2425 -1.49119 -1.49119 -1.24269 -1.03564 -0.862907 -0.719057 -0.599215 -0.499439 -0.416168 -0.346776 -0.289011 ) ; } frontAndBackPlanes { type empty; value nonuniform 0(); } } // ************************************************************************* //
[ "jfeatherstone123@gmail.com" ]
jfeatherstone123@gmail.com
8ae4ad27ee7fb1083a3f1797a84f8f9c2f9d9211
3d9e2d58cb310dd5e3b8e1aca5979d66b81c6510
/algorithm/sortiing.cpp
0d8ac44a9f083cd8778836a082aa49091df8392c
[]
no_license
praveen4698/competitiveProgrammingWithCpp
906f1ec5d3689755ff9c2547f987ae96ec8f8387
fbeeb8a9ccc7ea45201889415adfea07ab5dc92c
refs/heads/master
2021-07-08T21:19:20.250388
2020-09-20T08:40:49
2020-09-20T08:40:49
193,205,068
0
0
null
null
null
null
UTF-8
C++
false
false
601
cpp
#include<bits/stdc++.h> using namespace std; #define PI 3.14159265 #define ll long long int #define S(x) scanf("%d",&x) #define S2(x,y) scanf("%d %d",&x,&y) #define S3(x,y,z) scanf("%d %d %d",&x,&y,&z) #define P(x) printf("%d\n",x) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; struct comp { bool operator() (const int& lhs, const int & rhs) const {return lhs>rhs;} }; int main() { int A[50]; for(int i=0;i<5;++i) cin>>A[i]; sort(A,A+5,comp() ); for(int i=0;i<5;++i) cout<<A[i]<<" "; return 0; }
[ "praveen.y469@gmail.com" ]
praveen.y469@gmail.com
6ed2886f04361bdc2c8fd5931336f04e67913d3c
8d835bb91f43e84ab8fcd73858a136ee5dc238a4
/code.ino
93870896a79bbeffa4785880e9416b406119d416
[]
no_license
divayprakash/arduino-parking-sensor
5df66ad03853b336886ac6d9cb71f2f6ba0e9e14
329dee61f77536550ba92f61a1cfbf0d673b5c74
refs/heads/master
2021-01-13T00:15:33.288685
2016-02-28T21:33:07
2016-02-28T21:33:07
52,744,669
0
0
null
2016-02-28T21:33:07
2016-02-28T21:17:42
Arduino
UTF-8
C++
false
false
3,034
ino
#include <TimerOne.h> #define trigPin 4 #define echoPin 2 #define onLED 12 #define echo_int 0 #define TIMER_US 50 #define TICK_COUNTS 4000 volatile long echo_start = 0; volatile long echo_end = 0; volatile long echo_duration = 0; volatile int trigger_time_count = 0; volatile long range_flasher_counter = 0; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(onLED, OUTPUT); Timer1.initialize(TIMER_US); Timer1.attachInterrupt( timerIsr ); attachInterrupt(echo_int, echo_interrupt, CHANGE); Serial.begin (9600); } void loop() { Serial.println(echo_duration / 58); delay(100); } void timerIsr() { trigger_pulse(); distance_flasher(); } void trigger_pulse() { static volatile int state = 0; if (!(--trigger_time_count)) { trigger_time_count = TICK_COUNTS; state = 1; } switch(state) { case 0: break; case 1: digitalWrite(trigPin, HIGH); state = 2; break; case 2: default: digitalWrite(trigPin, LOW); state = 0; break; } } void echo_interrupt() { switch (digitalRead(echoPin)) { case HIGH: echo_end = 0; echo_start = micros(); break; case LOW: echo_end = micros(); echo_duration = echo_end - echo_start; break; } } void distance_flasher() { if (--range_flasher_counter <= 0) { if (echo_duration < 25000) { range_flasher_counter = echo_duration * 2; } else { range_flasher_counter = 25000; } digitalWrite( onLED, digitalRead( onLED ) ^ 1 ); } }
[ "divayprakash3@gmail.com" ]
divayprakash3@gmail.com
52eab007b266efdee14b0ce24c45a338789fcb8f
367fba5df552aef1ee9aa6add6bb512b781bc6d4
/3rdParty/nodejs/8.0.0/source/deps/v8/src/parsing/parser.cc
cc6b6a260b2dfcec45d0cd3019bc8536d6f4e0b9
[ "BSD-3-Clause", "bzip2-1.0.6", "SunPro", "LicenseRef-scancode-free-unknown", "MIT", "ICU", "NTP", "ISC", "LicenseRef-scancode-openssl", "Artistic-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "NAIST-2003", "Zlib", "LicenseRef-scancode-unknown-license-reference", "LicenseRe...
permissive
hamoriakos/ApertusVR
2d3e5736b26404198b222d24388bb3c1c162ee69
14303ab54963e52409ed376cdafae5c43004074b
refs/heads/master
2021-09-16T00:13:48.980732
2017-06-28T18:23:14
2017-06-28T18:23:14
105,749,913
0
1
MIT
2018-06-13T13:54:38
2017-10-04T09:11:13
C++
UTF-8
C++
false
false
200,398
cc
// Copyright 2012 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/parsing/parser.h" #include <memory> #include "src/api.h" #include "src/ast/ast-expression-rewriter.h" #include "src/ast/ast-function-literal-id-reindexer.h" #include "src/ast/ast-traversal-visitor.h" #include "src/ast/ast.h" #include "src/bailout-reason.h" #include "src/base/platform/platform.h" #include "src/char-predicates-inl.h" #include "src/messages.h" #include "src/objects-inl.h" #include "src/parsing/duplicate-finder.h" #include "src/parsing/parameter-initializer-rewriter.h" #include "src/parsing/parse-info.h" #include "src/parsing/rewriter.h" #include "src/parsing/scanner-character-streams.h" #include "src/runtime/runtime.h" #include "src/string-stream.h" #include "src/tracing/trace-event.h" namespace v8 { namespace internal { ScriptData::ScriptData(const byte* data, int length) : owns_data_(false), rejected_(false), data_(data), length_(length) { if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { byte* copy = NewArray<byte>(length); DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); CopyBytes(copy, data, length); data_ = copy; AcquireDataOwnership(); } } FunctionEntry ParseData::GetFunctionEntry(int start) { // The current pre-data entry must be a FunctionEntry with the given // start position. if ((function_index_ + FunctionEntry::kSize <= Length()) && (static_cast<int>(Data()[function_index_]) == start)) { int index = function_index_; function_index_ += FunctionEntry::kSize; Vector<unsigned> subvector(&(Data()[index]), FunctionEntry::kSize); return FunctionEntry(subvector); } return FunctionEntry(); } int ParseData::FunctionCount() { int functions_size = FunctionsSize(); if (functions_size < 0) return 0; if (functions_size % FunctionEntry::kSize != 0) return 0; return functions_size / FunctionEntry::kSize; } bool ParseData::IsSane() { if (!IsAligned(script_data_->length(), sizeof(unsigned))) return false; // Check that the header data is valid and doesn't specify // point to positions outside the store. int data_length = Length(); if (data_length < PreparseDataConstants::kHeaderSize) return false; if (Magic() != PreparseDataConstants::kMagicNumber) return false; if (Version() != PreparseDataConstants::kCurrentVersion) return false; // Check that the space allocated for function entries is sane. int functions_size = FunctionsSize(); if (functions_size < 0) return false; if (functions_size % FunctionEntry::kSize != 0) return false; // Check that the total size has room for header and function entries. int minimum_size = PreparseDataConstants::kHeaderSize + functions_size; if (data_length < minimum_size) return false; return true; } void ParseData::Initialize() { // Prepares state for use. int data_length = Length(); if (data_length >= PreparseDataConstants::kHeaderSize) { function_index_ = PreparseDataConstants::kHeaderSize; } } unsigned ParseData::Magic() { return Data()[PreparseDataConstants::kMagicOffset]; } unsigned ParseData::Version() { return Data()[PreparseDataConstants::kVersionOffset]; } int ParseData::FunctionsSize() { return static_cast<int>(Data()[PreparseDataConstants::kFunctionsSizeOffset]); } // Helper for putting parts of the parse results into a temporary zone when // parsing inner function bodies. class DiscardableZoneScope { public: DiscardableZoneScope(Parser* parser, Zone* temp_zone, bool use_temp_zone) : ast_node_factory_scope_(parser->factory(), temp_zone, use_temp_zone), fni_(parser->ast_value_factory_, temp_zone), parser_(parser), prev_fni_(parser->fni_), prev_zone_(parser->zone_), prev_allow_lazy_(parser->allow_lazy_), prev_temp_zoned_(parser->temp_zoned_) { if (use_temp_zone) { DCHECK(!parser_->temp_zoned_); parser_->allow_lazy_ = false; parser_->temp_zoned_ = true; parser_->fni_ = &fni_; parser_->zone_ = temp_zone; if (parser_->reusable_preparser_ != nullptr) { parser_->reusable_preparser_->zone_ = temp_zone; parser_->reusable_preparser_->factory()->set_zone(temp_zone); } } } void Reset() { parser_->fni_ = prev_fni_; parser_->zone_ = prev_zone_; parser_->allow_lazy_ = prev_allow_lazy_; parser_->temp_zoned_ = prev_temp_zoned_; if (parser_->reusable_preparser_ != nullptr) { parser_->reusable_preparser_->zone_ = prev_zone_; parser_->reusable_preparser_->factory()->set_zone(prev_zone_); } ast_node_factory_scope_.Reset(); } ~DiscardableZoneScope() { Reset(); } private: AstNodeFactory::BodyScope ast_node_factory_scope_; FuncNameInferrer fni_; Parser* parser_; FuncNameInferrer* prev_fni_; Zone* prev_zone_; bool prev_allow_lazy_; bool prev_temp_zoned_; DISALLOW_COPY_AND_ASSIGN(DiscardableZoneScope); }; void Parser::SetCachedData(ParseInfo* info) { DCHECK_NULL(cached_parse_data_); if (consume_cached_parse_data()) { if (allow_lazy_) { cached_parse_data_ = ParseData::FromCachedData(*info->cached_data()); if (cached_parse_data_ != nullptr) return; } compile_options_ = ScriptCompiler::kNoCompileOptions; } } FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name, bool call_super, int pos, int end_pos) { int expected_property_count = -1; const int parameter_count = 0; if (name == nullptr) name = ast_value_factory()->empty_string(); FunctionKind kind = call_super ? FunctionKind::kDefaultDerivedConstructor : FunctionKind::kDefaultBaseConstructor; DeclarationScope* function_scope = NewFunctionScope(kind); SetLanguageMode(function_scope, STRICT); // Set start and end position to the same value function_scope->set_start_position(pos); function_scope->set_end_position(pos); ZoneList<Statement*>* body = NULL; { FunctionState function_state(&function_state_, &scope_, function_scope); body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone()); if (call_super) { // Create a SuperCallReference and handle in BytecodeGenerator. auto constructor_args_name = ast_value_factory()->empty_string(); bool is_duplicate; bool is_rest = true; bool is_optional = false; Variable* constructor_args = function_scope->DeclareParameter( constructor_args_name, TEMPORARY, is_optional, is_rest, &is_duplicate, ast_value_factory()); ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); Spread* spread_args = factory()->NewSpread( factory()->NewVariableProxy(constructor_args), pos, pos); args->Add(spread_args, zone()); Expression* super_call_ref = NewSuperCallReference(pos); Expression* call = factory()->NewCall(super_call_ref, args, pos); body->Add(factory()->NewReturnStatement(call, pos), zone()); } expected_property_count = function_state.expected_property_count(); } FunctionLiteral* function_literal = factory()->NewFunctionLiteral( name, function_scope, body, expected_property_count, parameter_count, parameter_count, FunctionLiteral::kNoDuplicateParameters, FunctionLiteral::kAnonymousExpression, default_eager_compile_hint(), pos, true, GetNextFunctionLiteralId()); return function_literal; } // ---------------------------------------------------------------------------- // The CHECK_OK macro is a convenient macro to enforce error // handling for functions that may fail (by returning !*ok). // // CAUTION: This macro appends extra statements after a call, // thus it must never be used where only a single statement // is correct (e.g. an if statement branch w/o braces)! #define CHECK_OK_VALUE(x) ok); \ if (!*ok) return x; \ ((void)0 #define DUMMY ) // to make indentation work #undef DUMMY #define CHECK_OK CHECK_OK_VALUE(nullptr) #define CHECK_OK_VOID CHECK_OK_VALUE(this->Void()) #define CHECK_FAILED /**/); \ if (failed_) return nullptr; \ ((void)0 #define DUMMY ) // to make indentation work #undef DUMMY // ---------------------------------------------------------------------------- // Implementation of Parser bool Parser::ShortcutNumericLiteralBinaryExpression(Expression** x, Expression* y, Token::Value op, int pos) { if ((*x)->AsLiteral() && (*x)->AsLiteral()->raw_value()->IsNumber() && y->AsLiteral() && y->AsLiteral()->raw_value()->IsNumber()) { double x_val = (*x)->AsLiteral()->raw_value()->AsNumber(); double y_val = y->AsLiteral()->raw_value()->AsNumber(); bool x_has_dot = (*x)->AsLiteral()->raw_value()->ContainsDot(); bool y_has_dot = y->AsLiteral()->raw_value()->ContainsDot(); bool has_dot = x_has_dot || y_has_dot; switch (op) { case Token::ADD: *x = factory()->NewNumberLiteral(x_val + y_val, pos, has_dot); return true; case Token::SUB: *x = factory()->NewNumberLiteral(x_val - y_val, pos, has_dot); return true; case Token::MUL: *x = factory()->NewNumberLiteral(x_val * y_val, pos, has_dot); return true; case Token::DIV: *x = factory()->NewNumberLiteral(x_val / y_val, pos, has_dot); return true; case Token::BIT_OR: { int value = DoubleToInt32(x_val) | DoubleToInt32(y_val); *x = factory()->NewNumberLiteral(value, pos, has_dot); return true; } case Token::BIT_AND: { int value = DoubleToInt32(x_val) & DoubleToInt32(y_val); *x = factory()->NewNumberLiteral(value, pos, has_dot); return true; } case Token::BIT_XOR: { int value = DoubleToInt32(x_val) ^ DoubleToInt32(y_val); *x = factory()->NewNumberLiteral(value, pos, has_dot); return true; } case Token::SHL: { int value = DoubleToInt32(x_val) << (DoubleToInt32(y_val) & 0x1f); *x = factory()->NewNumberLiteral(value, pos, has_dot); return true; } case Token::SHR: { uint32_t shift = DoubleToInt32(y_val) & 0x1f; uint32_t value = DoubleToUint32(x_val) >> shift; *x = factory()->NewNumberLiteral(value, pos, has_dot); return true; } case Token::SAR: { uint32_t shift = DoubleToInt32(y_val) & 0x1f; int value = ArithmeticShiftRight(DoubleToInt32(x_val), shift); *x = factory()->NewNumberLiteral(value, pos, has_dot); return true; } case Token::EXP: { double value = Pow(x_val, y_val); int int_value = static_cast<int>(value); *x = factory()->NewNumberLiteral( int_value == value && value != -0.0 ? int_value : value, pos, has_dot); return true; } default: break; } } return false; } Expression* Parser::BuildUnaryExpression(Expression* expression, Token::Value op, int pos) { DCHECK(expression != NULL); if (expression->IsLiteral()) { const AstValue* literal = expression->AsLiteral()->raw_value(); if (op == Token::NOT) { // Convert the literal to a boolean condition and negate it. bool condition = literal->BooleanValue(); return factory()->NewBooleanLiteral(!condition, pos); } else if (literal->IsNumber()) { // Compute some expressions involving only number literals. double value = literal->AsNumber(); bool has_dot = literal->ContainsDot(); switch (op) { case Token::ADD: return expression; case Token::SUB: return factory()->NewNumberLiteral(-value, pos, has_dot); case Token::BIT_NOT: return factory()->NewNumberLiteral(~DoubleToInt32(value), pos, has_dot); default: break; } } } // Desugar '+foo' => 'foo*1' if (op == Token::ADD) { return factory()->NewBinaryOperation( Token::MUL, expression, factory()->NewNumberLiteral(1, pos, true), pos); } // The same idea for '-foo' => 'foo*(-1)'. if (op == Token::SUB) { return factory()->NewBinaryOperation( Token::MUL, expression, factory()->NewNumberLiteral(-1, pos), pos); } // ...and one more time for '~foo' => 'foo^(~0)'. if (op == Token::BIT_NOT) { return factory()->NewBinaryOperation( Token::BIT_XOR, expression, factory()->NewNumberLiteral(~0, pos), pos); } return factory()->NewUnaryOperation(op, expression, pos); } Expression* Parser::BuildIteratorResult(Expression* value, bool done) { int pos = kNoSourcePosition; if (value == nullptr) value = factory()->NewUndefinedLiteral(pos); auto args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(value, zone()); args->Add(factory()->NewBooleanLiteral(done, pos), zone()); return factory()->NewCallRuntime(Runtime::kInlineCreateIterResultObject, args, pos); } Expression* Parser::NewThrowError(Runtime::FunctionId id, MessageTemplate::Template message, const AstRawString* arg, int pos) { ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(factory()->NewSmiLiteral(message, pos), zone()); args->Add(factory()->NewStringLiteral(arg, pos), zone()); CallRuntime* call_constructor = factory()->NewCallRuntime(id, args, pos); return factory()->NewThrow(call_constructor, pos); } Expression* Parser::NewSuperPropertyReference(int pos) { // this_function[home_object_symbol] VariableProxy* this_function_proxy = NewUnresolved(ast_value_factory()->this_function_string(), pos); Expression* home_object_symbol_literal = factory()->NewSymbolLiteral( AstSymbol::kHomeObjectSymbol, kNoSourcePosition); Expression* home_object = factory()->NewProperty( this_function_proxy, home_object_symbol_literal, pos); return factory()->NewSuperPropertyReference( ThisExpression(pos)->AsVariableProxy(), home_object, pos); } Expression* Parser::NewSuperCallReference(int pos) { VariableProxy* new_target_proxy = NewUnresolved(ast_value_factory()->new_target_string(), pos); VariableProxy* this_function_proxy = NewUnresolved(ast_value_factory()->this_function_string(), pos); return factory()->NewSuperCallReference( ThisExpression(pos)->AsVariableProxy(), new_target_proxy, this_function_proxy, pos); } Expression* Parser::NewTargetExpression(int pos) { auto proxy = NewUnresolved(ast_value_factory()->new_target_string(), pos); proxy->set_is_new_target(); return proxy; } Expression* Parser::FunctionSentExpression(int pos) { // We desugar function.sent into %_GeneratorGetInputOrDebugPos(generator). ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); VariableProxy* generator = factory()->NewVariableProxy(function_state_->generator_object_variable()); args->Add(generator, zone()); return factory()->NewCallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos, args, pos); } Literal* Parser::ExpressionFromLiteral(Token::Value token, int pos) { switch (token) { case Token::NULL_LITERAL: return factory()->NewNullLiteral(pos); case Token::TRUE_LITERAL: return factory()->NewBooleanLiteral(true, pos); case Token::FALSE_LITERAL: return factory()->NewBooleanLiteral(false, pos); case Token::SMI: { uint32_t value = scanner()->smi_value(); return factory()->NewSmiLiteral(value, pos); } case Token::NUMBER: { bool has_dot = scanner()->ContainsDot(); double value = scanner()->DoubleValue(); return factory()->NewNumberLiteral(value, pos, has_dot); } default: DCHECK(false); } return NULL; } void Parser::MarkTailPosition(Expression* expression) { expression->MarkTail(); } Expression* Parser::NewV8Intrinsic(const AstRawString* name, ZoneList<Expression*>* args, int pos, bool* ok) { if (extension_ != nullptr) { // The extension structures are only accessible while parsing the // very first time, not when reparsing because of lazy compilation. GetClosureScope()->ForceEagerCompilation(); } DCHECK(name->is_one_byte()); const Runtime::Function* function = Runtime::FunctionForName(name->raw_data(), name->length()); if (function != nullptr) { // Check for possible name clash. DCHECK_EQ(Context::kNotFound, Context::IntrinsicIndexForName(name->raw_data(), name->length())); // Check for built-in IS_VAR macro. if (function->function_id == Runtime::kIS_VAR) { DCHECK_EQ(Runtime::RUNTIME, function->intrinsic_type); // %IS_VAR(x) evaluates to x if x is a variable, // leads to a parse error otherwise. Could be implemented as an // inline function %_IS_VAR(x) to eliminate this special case. if (args->length() == 1 && args->at(0)->AsVariableProxy() != nullptr) { return args->at(0); } else { ReportMessage(MessageTemplate::kNotIsvar); *ok = false; return nullptr; } } // Check that the expected number of arguments are being passed. if (function->nargs != -1 && function->nargs != args->length()) { ReportMessage(MessageTemplate::kRuntimeWrongNumArgs); *ok = false; return nullptr; } return factory()->NewCallRuntime(function, args, pos); } int context_index = Context::IntrinsicIndexForName(name->raw_data(), name->length()); // Check that the function is defined. if (context_index == Context::kNotFound) { ReportMessage(MessageTemplate::kNotDefined, name); *ok = false; return nullptr; } return factory()->NewCallRuntime(context_index, args, pos); } Parser::Parser(ParseInfo* info) : ParserBase<Parser>(info->zone(), &scanner_, info->stack_limit(), info->extension(), info->ast_value_factory(), info->isolate()->counters()->runtime_call_stats(), true), scanner_(info->unicode_cache()), reusable_preparser_(nullptr), original_scope_(nullptr), mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. target_stack_(nullptr), compile_options_(info->compile_options()), cached_parse_data_(nullptr), total_preparse_skipped_(0), temp_zoned_(false), log_(nullptr), preparsed_scope_data_(info->preparsed_scope_data()), parameters_end_pos_(info->parameters_end_pos()) { // Even though we were passed ParseInfo, we should not store it in // Parser - this makes sure that Isolate is not accidentally accessed via // ParseInfo during background parsing. DCHECK(!info->script().is_null() || info->source_stream() != nullptr || info->character_stream() != nullptr); // Determine if functions can be lazily compiled. This is necessary to // allow some of our builtin JS files to be lazily compiled. These // builtins cannot be handled lazily by the parser, since we have to know // if a function uses the special natives syntax, which is something the // parser records. // If the debugger requests compilation for break points, we cannot be // aggressive about lazy compilation, because it might trigger compilation // of functions without an outer context when setting a breakpoint through // Debug::FindSharedFunctionInfoInScript bool can_compile_lazily = FLAG_lazy && !info->is_debug(); // Consider compiling eagerly when targeting the code cache. can_compile_lazily &= !(FLAG_serialize_eager && info->will_serialize()); set_default_eager_compile_hint(can_compile_lazily ? FunctionLiteral::kShouldLazyCompile : FunctionLiteral::kShouldEagerCompile); allow_lazy_ = FLAG_lazy && info->allow_lazy_parsing() && !info->is_native() && info->extension() == nullptr && can_compile_lazily; set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() && info->isolate()->is_tail_call_elimination_enabled()); set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); set_allow_harmony_function_sent(FLAG_harmony_function_sent); set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas); set_allow_harmony_class_fields(FLAG_harmony_class_fields); set_allow_harmony_object_rest_spread(FLAG_harmony_object_rest_spread); set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import); set_allow_harmony_async_iteration(FLAG_harmony_async_iteration); set_allow_harmony_template_escapes(FLAG_harmony_template_escapes); for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; ++feature) { use_counts_[feature] = 0; } if (info->ast_value_factory() == NULL) { // info takes ownership of AstValueFactory. info->set_ast_value_factory(new AstValueFactory( zone(), info->isolate()->ast_string_constants(), info->hash_seed())); info->set_ast_value_factory_owned(); ast_value_factory_ = info->ast_value_factory(); ast_node_factory_.set_ast_value_factory(ast_value_factory_); } } void Parser::DeserializeScopeChain( ParseInfo* info, MaybeHandle<ScopeInfo> maybe_outer_scope_info) { DCHECK(ThreadId::Current().Equals(info->isolate()->thread_id())); // TODO(wingo): Add an outer SCRIPT_SCOPE corresponding to the native // context, which will have the "this" binding for script scopes. DeclarationScope* script_scope = NewScriptScope(); info->set_script_scope(script_scope); Scope* scope = script_scope; Handle<ScopeInfo> outer_scope_info; if (maybe_outer_scope_info.ToHandle(&outer_scope_info)) { scope = Scope::DeserializeScopeChain( info->isolate(), zone(), *outer_scope_info, script_scope, ast_value_factory(), Scope::DeserializationMode::kScopesOnly); DCHECK(!info->is_module() || scope->is_module_scope()); } original_scope_ = scope; } FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, // see comment for HistogramTimerScope class. // It's OK to use the Isolate & counters here, since this function is only // called in the main thread. DCHECK(parsing_on_main_thread_); RuntimeCallTimerScope runtime_timer( runtime_call_stats_, info->is_eval() ? &RuntimeCallStats::ParseEval : &RuntimeCallStats::ParseProgram); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseProgram"); Handle<String> source(String::cast(info->script()->source())); isolate->counters()->total_parse_size()->Increment(source->length()); base::ElapsedTimer timer; if (FLAG_trace_parse) { timer.Start(); } fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); // Initialize parser state. ParserLogger logger; if (produce_cached_parse_data()) { if (allow_lazy_) { log_ = &logger; } else { compile_options_ = ScriptCompiler::kNoCompileOptions; } } else if (consume_cached_parse_data()) { cached_parse_data_->Initialize(); } DeserializeScopeChain(info, info->maybe_outer_scope_info()); source = String::Flatten(source); FunctionLiteral* result; { std::unique_ptr<Utf16CharacterStream> stream(ScannerStream::For(source)); scanner_.Initialize(stream.get()); result = DoParseProgram(info); } if (result != NULL) { DCHECK_EQ(scanner_.peek_location().beg_pos, source->length()); } HandleSourceURLComments(isolate, info->script()); if (FLAG_trace_parse && result != nullptr) { double ms = timer.Elapsed().InMillisecondsF(); if (info->is_eval()) { PrintF("[parsing eval"); } else if (info->script()->name()->IsString()) { String* name = String::cast(info->script()->name()); std::unique_ptr<char[]> name_chars = name->ToCString(); PrintF("[parsing script: %s", name_chars.get()); } else { PrintF("[parsing script"); } PrintF(" - took %0.3f ms]\n", ms); } if (produce_cached_parse_data() && result != nullptr) { *info->cached_data() = logger.GetScriptData(); } log_ = nullptr; return result; } FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) { // Note that this function can be called from the main thread or from a // background thread. We should not access anything Isolate / heap dependent // via ParseInfo, and also not pass it forward. DCHECK_NULL(scope_); DCHECK_NULL(target_stack_); ParsingModeScope mode(this, allow_lazy_ ? PARSE_LAZILY : PARSE_EAGERLY); ResetFunctionLiteralId(); DCHECK(info->function_literal_id() == FunctionLiteral::kIdTypeTopLevel || info->function_literal_id() == FunctionLiteral::kIdTypeInvalid); FunctionLiteral* result = NULL; { Scope* outer = original_scope_; DCHECK_NOT_NULL(outer); parsing_module_ = info->is_module(); if (info->is_eval()) { outer = NewEvalScope(outer); } else if (parsing_module_) { DCHECK_EQ(outer, info->script_scope()); outer = NewModuleScope(info->script_scope()); } DeclarationScope* scope = outer->AsDeclarationScope(); scope->set_start_position(0); FunctionState function_state(&function_state_, &scope_, scope); ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); bool ok = true; int beg_pos = scanner()->location().beg_pos; if (parsing_module_) { // Declare the special module parameter. auto name = ast_value_factory()->empty_string(); bool is_duplicate; bool is_rest = false; bool is_optional = false; auto var = scope->DeclareParameter(name, VAR, is_optional, is_rest, &is_duplicate, ast_value_factory()); DCHECK(!is_duplicate); var->AllocateTo(VariableLocation::PARAMETER, 0); PrepareGeneratorVariables(); Expression* initial_yield = BuildInitialYield(kNoSourcePosition, kGeneratorFunction); body->Add( factory()->NewExpressionStatement(initial_yield, kNoSourcePosition), zone()); ParseModuleItemList(body, &ok); ok = ok && module()->Validate(this->scope()->AsModuleScope(), &pending_error_handler_, zone()); } else { // Don't count the mode in the use counters--give the program a chance // to enable script-wide strict mode below. this->scope()->SetLanguageMode(info->language_mode()); ParseStatementList(body, Token::EOS, &ok); } // The parser will peek but not consume EOS. Our scope logically goes all // the way to the EOS, though. scope->set_end_position(scanner()->peek_location().beg_pos); if (ok && is_strict(language_mode())) { CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); } if (ok && is_sloppy(language_mode())) { // TODO(littledan): Function bindings on the global object that modify // pre-existing bindings should be made writable, enumerable and // nonconfigurable if possible, whereas this code will leave attributes // unchanged if the property already exists. InsertSloppyBlockFunctionVarBindings(scope); } if (ok) { CheckConflictingVarDeclarations(scope, &ok); } if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { if (body->length() != 1 || !body->at(0)->IsExpressionStatement() || !body->at(0)->AsExpressionStatement()-> expression()->IsFunctionLiteral()) { ReportMessage(MessageTemplate::kSingleFunctionLiteral); ok = false; } } if (ok) { RewriteDestructuringAssignments(); int parameter_count = parsing_module_ ? 1 : 0; result = factory()->NewScriptOrEvalFunctionLiteral( scope, body, function_state.expected_property_count(), parameter_count); } } info->set_max_function_literal_id(GetLastFunctionLiteralId()); // Make sure the target stack is empty. DCHECK(target_stack_ == NULL); return result; } FunctionLiteral* Parser::ParseFunction(Isolate* isolate, ParseInfo* info) { // It's OK to use the Isolate & counters here, since this function is only // called in the main thread. DCHECK(parsing_on_main_thread_); RuntimeCallTimerScope runtime_timer(runtime_call_stats_, &RuntimeCallStats::ParseFunction); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseFunction"); Handle<String> source(String::cast(info->script()->source())); isolate->counters()->total_parse_size()->Increment(source->length()); base::ElapsedTimer timer; if (FLAG_trace_parse) { timer.Start(); } Handle<SharedFunctionInfo> shared_info = info->shared_info(); DeserializeScopeChain(info, info->maybe_outer_scope_info()); if (info->asm_function_scope()) { original_scope_ = info->asm_function_scope(); factory()->set_zone(info->zone()); } else { DCHECK_EQ(factory()->zone(), info->zone()); } // Initialize parser state. source = String::Flatten(source); FunctionLiteral* result; { std::unique_ptr<Utf16CharacterStream> stream(ScannerStream::For( source, shared_info->start_position(), shared_info->end_position())); Handle<String> name(String::cast(shared_info->name())); result = DoParseFunction(info, ast_value_factory()->GetString(name), stream.get()); if (result != nullptr) { Handle<String> inferred_name(shared_info->inferred_name()); result->set_inferred_name(inferred_name); } } if (FLAG_trace_parse && result != NULL) { double ms = timer.Elapsed().InMillisecondsF(); // We need to make sure that the debug-name is available. ast_value_factory()->Internalize(isolate); std::unique_ptr<char[]> name_chars = result->debug_name()->ToCString(); PrintF("[parsing function: %s - took %0.3f ms]\n", name_chars.get(), ms); } return result; } static FunctionLiteral::FunctionType ComputeFunctionType(ParseInfo* info) { if (info->is_declaration()) { return FunctionLiteral::kDeclaration; } else if (info->is_named_expression()) { return FunctionLiteral::kNamedExpression; } else if (IsConciseMethod(info->function_kind()) || IsAccessorFunction(info->function_kind())) { return FunctionLiteral::kAccessorOrMethod; } return FunctionLiteral::kAnonymousExpression; } FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, const AstRawString* raw_name, Utf16CharacterStream* source) { scanner_.Initialize(source); DCHECK_NULL(scope_); DCHECK_NULL(target_stack_); DCHECK(ast_value_factory()); fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); fni_->PushEnclosingName(raw_name); ResetFunctionLiteralId(); DCHECK_LT(0, info->function_literal_id()); SkipFunctionLiterals(info->function_literal_id() - 1); ParsingModeScope parsing_mode(this, PARSE_EAGERLY); // Place holder for the result. FunctionLiteral* result = nullptr; { // Parse the function literal. Scope* outer = original_scope_; DeclarationScope* outer_function = outer->GetClosureScope(); DCHECK(outer); FunctionState function_state(&function_state_, &scope_, outer_function); BlockState block_state(&scope_, outer); DCHECK(is_sloppy(outer->language_mode()) || is_strict(info->language_mode())); FunctionLiteral::FunctionType function_type = ComputeFunctionType(info); FunctionKind kind = info->function_kind(); bool ok = true; if (IsArrowFunction(kind)) { if (IsAsyncFunction(kind)) { DCHECK(!scanner()->HasAnyLineTerminatorAfterNext()); if (!Check(Token::ASYNC)) { CHECK(stack_overflow()); return nullptr; } if (!(peek_any_identifier() || peek() == Token::LPAREN)) { CHECK(stack_overflow()); return nullptr; } } // TODO(adamk): We should construct this scope from the ScopeInfo. DeclarationScope* scope = NewFunctionScope(kind); // These two bits only need to be explicitly set because we're // not passing the ScopeInfo to the Scope constructor. // TODO(adamk): Remove these calls once the above NewScope call // passes the ScopeInfo. if (info->calls_eval()) { scope->RecordEvalCall(); } SetLanguageMode(scope, info->language_mode()); scope->set_start_position(info->start_position()); ExpressionClassifier formals_classifier(this); ParserFormalParameters formals(scope); int rewritable_length = function_state.destructuring_assignments_to_rewrite().length(); Checkpoint checkpoint(this); { // Parsing patterns as variable reference expression creates // NewUnresolved references in current scope. Entrer arrow function // scope for formal parameter parsing. BlockState block_state(&scope_, scope); if (Check(Token::LPAREN)) { // '(' StrictFormalParameters ')' ParseFormalParameterList(&formals, &ok); if (ok) ok = Check(Token::RPAREN); } else { // BindingIdentifier ParseFormalParameter(&formals, &ok); if (ok) DeclareFormalParameters(formals.scope, formals.params); } } if (ok) { checkpoint.Restore(&formals.materialized_literals_count); if (GetLastFunctionLiteralId() != info->function_literal_id() - 1) { // If there were FunctionLiterals in the parameters, we need to // renumber them to shift down so the next function literal id for // the arrow function is the one requested. AstFunctionLiteralIdReindexer reindexer( stack_limit_, (info->function_literal_id() - 1) - GetLastFunctionLiteralId()); for (auto p : formals.params) { if (p->pattern != nullptr) reindexer.Reindex(p->pattern); if (p->initializer != nullptr) reindexer.Reindex(p->initializer); } ResetFunctionLiteralId(); SkipFunctionLiterals(info->function_literal_id() - 1); } // Pass `accept_IN=true` to ParseArrowFunctionLiteral --- This should // not be observable, or else the preparser would have failed. Expression* expression = ParseArrowFunctionLiteral(true, formals, rewritable_length, &ok); if (ok) { // Scanning must end at the same position that was recorded // previously. If not, parsing has been interrupted due to a stack // overflow, at which point the partially parsed arrow function // concise body happens to be a valid expression. This is a problem // only for arrow functions with single expression bodies, since there // is no end token such as "}" for normal functions. if (scanner()->location().end_pos == info->end_position()) { // The pre-parser saw an arrow function here, so the full parser // must produce a FunctionLiteral. DCHECK(expression->IsFunctionLiteral()); result = expression->AsFunctionLiteral(); // Rewrite destructuring assignments in the parameters. (The ones // inside the function body are rewritten by // ParseArrowFunctionLiteral.) RewriteDestructuringAssignments(); } else { ok = false; } } } } else if (IsDefaultConstructor(kind)) { DCHECK_EQ(scope(), outer); result = DefaultConstructor(raw_name, IsDerivedConstructor(kind), info->start_position(), info->end_position()); } else { result = ParseFunctionLiteral( raw_name, Scanner::Location::invalid(), kSkipFunctionNameCheck, kind, kNoSourcePosition, function_type, info->language_mode(), &ok); } // Make sure the results agree. DCHECK(ok == (result != nullptr)); } // Make sure the target stack is empty. DCHECK_NULL(target_stack_); DCHECK_IMPLIES(result, info->function_literal_id() == result->function_literal_id()); return result; } Statement* Parser::ParseModuleItem(bool* ok) { // ecma262/#prod-ModuleItem // ModuleItem : // ImportDeclaration // ExportDeclaration // StatementListItem Token::Value next = peek(); if (next == Token::EXPORT) { return ParseExportDeclaration(ok); } // We must be careful not to parse a dynamic import expression as an import // declaration. if (next == Token::IMPORT && (!allow_harmony_dynamic_import() || PeekAhead() != Token::LPAREN)) { ParseImportDeclaration(CHECK_OK); return factory()->NewEmptyStatement(kNoSourcePosition); } return ParseStatementListItem(ok); } void Parser::ParseModuleItemList(ZoneList<Statement*>* body, bool* ok) { // ecma262/#prod-Module // Module : // ModuleBody? // // ecma262/#prod-ModuleItemList // ModuleBody : // ModuleItem* DCHECK(scope()->is_module_scope()); while (peek() != Token::EOS) { Statement* stat = ParseModuleItem(CHECK_OK_VOID); if (stat && !stat->IsEmpty()) { body->Add(stat, zone()); } } } const AstRawString* Parser::ParseModuleSpecifier(bool* ok) { // ModuleSpecifier : // StringLiteral Expect(Token::STRING, CHECK_OK); return GetSymbol(); } void Parser::ParseExportClause(ZoneList<const AstRawString*>* export_names, ZoneList<Scanner::Location>* export_locations, ZoneList<const AstRawString*>* local_names, Scanner::Location* reserved_loc, bool* ok) { // ExportClause : // '{' '}' // '{' ExportsList '}' // '{' ExportsList ',' '}' // // ExportsList : // ExportSpecifier // ExportsList ',' ExportSpecifier // // ExportSpecifier : // IdentifierName // IdentifierName 'as' IdentifierName Expect(Token::LBRACE, CHECK_OK_VOID); Token::Value name_tok; while ((name_tok = peek()) != Token::RBRACE) { // Keep track of the first reserved word encountered in case our // caller needs to report an error. if (!reserved_loc->IsValid() && !Token::IsIdentifier(name_tok, STRICT, false, parsing_module_)) { *reserved_loc = scanner()->location(); } const AstRawString* local_name = ParseIdentifierName(CHECK_OK_VOID); const AstRawString* export_name = NULL; Scanner::Location location = scanner()->location(); if (CheckContextualKeyword(CStrVector("as"))) { export_name = ParseIdentifierName(CHECK_OK_VOID); // Set the location to the whole "a as b" string, so that it makes sense // both for errors due to "a" and for errors due to "b". location.end_pos = scanner()->location().end_pos; } if (export_name == NULL) { export_name = local_name; } export_names->Add(export_name, zone()); local_names->Add(local_name, zone()); export_locations->Add(location, zone()); if (peek() == Token::RBRACE) break; Expect(Token::COMMA, CHECK_OK_VOID); } Expect(Token::RBRACE, CHECK_OK_VOID); } ZoneList<const Parser::NamedImport*>* Parser::ParseNamedImports( int pos, bool* ok) { // NamedImports : // '{' '}' // '{' ImportsList '}' // '{' ImportsList ',' '}' // // ImportsList : // ImportSpecifier // ImportsList ',' ImportSpecifier // // ImportSpecifier : // BindingIdentifier // IdentifierName 'as' BindingIdentifier Expect(Token::LBRACE, CHECK_OK); auto result = new (zone()) ZoneList<const NamedImport*>(1, zone()); while (peek() != Token::RBRACE) { const AstRawString* import_name = ParseIdentifierName(CHECK_OK); const AstRawString* local_name = import_name; Scanner::Location location = scanner()->location(); // In the presence of 'as', the left-side of the 'as' can // be any IdentifierName. But without 'as', it must be a valid // BindingIdentifier. if (CheckContextualKeyword(CStrVector("as"))) { local_name = ParseIdentifierName(CHECK_OK); } if (!Token::IsIdentifier(scanner()->current_token(), STRICT, false, parsing_module_)) { *ok = false; ReportMessage(MessageTemplate::kUnexpectedReserved); return nullptr; } else if (IsEvalOrArguments(local_name)) { *ok = false; ReportMessage(MessageTemplate::kStrictEvalArguments); return nullptr; } DeclareVariable(local_name, CONST, kNeedsInitialization, position(), CHECK_OK); NamedImport* import = new (zone()) NamedImport(import_name, local_name, location); result->Add(import, zone()); if (peek() == Token::RBRACE) break; Expect(Token::COMMA, CHECK_OK); } Expect(Token::RBRACE, CHECK_OK); return result; } void Parser::ParseImportDeclaration(bool* ok) { // ImportDeclaration : // 'import' ImportClause 'from' ModuleSpecifier ';' // 'import' ModuleSpecifier ';' // // ImportClause : // ImportedDefaultBinding // NameSpaceImport // NamedImports // ImportedDefaultBinding ',' NameSpaceImport // ImportedDefaultBinding ',' NamedImports // // NameSpaceImport : // '*' 'as' ImportedBinding int pos = peek_position(); Expect(Token::IMPORT, CHECK_OK_VOID); Token::Value tok = peek(); // 'import' ModuleSpecifier ';' if (tok == Token::STRING) { const AstRawString* module_specifier = ParseModuleSpecifier(CHECK_OK_VOID); ExpectSemicolon(CHECK_OK_VOID); module()->AddEmptyImport(module_specifier); return; } // Parse ImportedDefaultBinding if present. const AstRawString* import_default_binding = nullptr; Scanner::Location import_default_binding_loc; if (tok != Token::MUL && tok != Token::LBRACE) { import_default_binding = ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK_VOID); import_default_binding_loc = scanner()->location(); DeclareVariable(import_default_binding, CONST, kNeedsInitialization, pos, CHECK_OK_VOID); } // Parse NameSpaceImport or NamedImports if present. const AstRawString* module_namespace_binding = nullptr; Scanner::Location module_namespace_binding_loc; const ZoneList<const NamedImport*>* named_imports = nullptr; if (import_default_binding == nullptr || Check(Token::COMMA)) { switch (peek()) { case Token::MUL: { Consume(Token::MUL); ExpectContextualKeyword(CStrVector("as"), CHECK_OK_VOID); module_namespace_binding = ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK_VOID); module_namespace_binding_loc = scanner()->location(); DeclareVariable(module_namespace_binding, CONST, kCreatedInitialized, pos, CHECK_OK_VOID); break; } case Token::LBRACE: named_imports = ParseNamedImports(pos, CHECK_OK_VOID); break; default: *ok = false; ReportUnexpectedToken(scanner()->current_token()); return; } } ExpectContextualKeyword(CStrVector("from"), CHECK_OK_VOID); const AstRawString* module_specifier = ParseModuleSpecifier(CHECK_OK_VOID); ExpectSemicolon(CHECK_OK_VOID); // Now that we have all the information, we can make the appropriate // declarations. // TODO(neis): Would prefer to call DeclareVariable for each case below rather // than above and in ParseNamedImports, but then a possible error message // would point to the wrong location. Maybe have a DeclareAt version of // Declare that takes a location? if (module_namespace_binding != nullptr) { module()->AddStarImport(module_namespace_binding, module_specifier, module_namespace_binding_loc, zone()); } if (import_default_binding != nullptr) { module()->AddImport(ast_value_factory()->default_string(), import_default_binding, module_specifier, import_default_binding_loc, zone()); } if (named_imports != nullptr) { if (named_imports->length() == 0) { module()->AddEmptyImport(module_specifier); } else { for (int i = 0; i < named_imports->length(); ++i) { const NamedImport* import = named_imports->at(i); module()->AddImport(import->import_name, import->local_name, module_specifier, import->location, zone()); } } } } Statement* Parser::ParseExportDefault(bool* ok) { // Supports the following productions, starting after the 'default' token: // 'export' 'default' HoistableDeclaration // 'export' 'default' ClassDeclaration // 'export' 'default' AssignmentExpression[In] ';' Expect(Token::DEFAULT, CHECK_OK); Scanner::Location default_loc = scanner()->location(); ZoneList<const AstRawString*> local_names(1, zone()); Statement* result = nullptr; switch (peek()) { case Token::FUNCTION: result = ParseHoistableDeclaration(&local_names, true, CHECK_OK); break; case Token::CLASS: Consume(Token::CLASS); result = ParseClassDeclaration(&local_names, true, CHECK_OK); break; case Token::ASYNC: if (PeekAhead() == Token::FUNCTION && !scanner()->HasAnyLineTerminatorAfterNext()) { Consume(Token::ASYNC); result = ParseAsyncFunctionDeclaration(&local_names, true, CHECK_OK); break; } /* falls through */ default: { int pos = position(); ExpressionClassifier classifier(this); Expression* value = ParseAssignmentExpression(true, CHECK_OK); RewriteNonPattern(CHECK_OK); SetFunctionName(value, ast_value_factory()->default_string()); const AstRawString* local_name = ast_value_factory()->star_default_star_string(); local_names.Add(local_name, zone()); // It's fine to declare this as CONST because the user has no way of // writing to it. Declaration* decl = DeclareVariable(local_name, CONST, pos, CHECK_OK); decl->proxy()->var()->set_initializer_position(position()); Assignment* assignment = factory()->NewAssignment( Token::INIT, decl->proxy(), value, kNoSourcePosition); result = factory()->NewExpressionStatement(assignment, kNoSourcePosition); ExpectSemicolon(CHECK_OK); break; } } DCHECK_EQ(local_names.length(), 1); module()->AddExport(local_names.first(), ast_value_factory()->default_string(), default_loc, zone()); DCHECK_NOT_NULL(result); return result; } Statement* Parser::ParseExportDeclaration(bool* ok) { // ExportDeclaration: // 'export' '*' 'from' ModuleSpecifier ';' // 'export' ExportClause ('from' ModuleSpecifier)? ';' // 'export' VariableStatement // 'export' Declaration // 'export' 'default' ... (handled in ParseExportDefault) Expect(Token::EXPORT, CHECK_OK); int pos = position(); Statement* result = nullptr; ZoneList<const AstRawString*> names(1, zone()); Scanner::Location loc = scanner()->peek_location(); switch (peek()) { case Token::DEFAULT: return ParseExportDefault(ok); case Token::MUL: { Consume(Token::MUL); loc = scanner()->location(); ExpectContextualKeyword(CStrVector("from"), CHECK_OK); const AstRawString* module_specifier = ParseModuleSpecifier(CHECK_OK); ExpectSemicolon(CHECK_OK); module()->AddStarExport(module_specifier, loc, zone()); return factory()->NewEmptyStatement(pos); } case Token::LBRACE: { // There are two cases here: // // 'export' ExportClause ';' // and // 'export' ExportClause FromClause ';' // // In the first case, the exported identifiers in ExportClause must // not be reserved words, while in the latter they may be. We // pass in a location that gets filled with the first reserved word // encountered, and then throw a SyntaxError if we are in the // non-FromClause case. Scanner::Location reserved_loc = Scanner::Location::invalid(); ZoneList<const AstRawString*> export_names(1, zone()); ZoneList<Scanner::Location> export_locations(1, zone()); ZoneList<const AstRawString*> original_names(1, zone()); ParseExportClause(&export_names, &export_locations, &original_names, &reserved_loc, CHECK_OK); const AstRawString* module_specifier = nullptr; if (CheckContextualKeyword(CStrVector("from"))) { module_specifier = ParseModuleSpecifier(CHECK_OK); } else if (reserved_loc.IsValid()) { // No FromClause, so reserved words are invalid in ExportClause. *ok = false; ReportMessageAt(reserved_loc, MessageTemplate::kUnexpectedReserved); return nullptr; } ExpectSemicolon(CHECK_OK); const int length = export_names.length(); DCHECK_EQ(length, original_names.length()); DCHECK_EQ(length, export_locations.length()); if (module_specifier == nullptr) { for (int i = 0; i < length; ++i) { module()->AddExport(original_names[i], export_names[i], export_locations[i], zone()); } } else if (length == 0) { module()->AddEmptyImport(module_specifier); } else { for (int i = 0; i < length; ++i) { module()->AddExport(original_names[i], export_names[i], module_specifier, export_locations[i], zone()); } } return factory()->NewEmptyStatement(pos); } case Token::FUNCTION: result = ParseHoistableDeclaration(&names, false, CHECK_OK); break; case Token::CLASS: Consume(Token::CLASS); result = ParseClassDeclaration(&names, false, CHECK_OK); break; case Token::VAR: case Token::LET: case Token::CONST: result = ParseVariableStatement(kStatementListItem, &names, CHECK_OK); break; case Token::ASYNC: // TODO(neis): Why don't we have the same check here as in // ParseStatementListItem? Consume(Token::ASYNC); result = ParseAsyncFunctionDeclaration(&names, false, CHECK_OK); break; default: *ok = false; ReportUnexpectedToken(scanner()->current_token()); return nullptr; } loc.end_pos = scanner()->location().end_pos; ModuleDescriptor* descriptor = module(); for (int i = 0; i < names.length(); ++i) { descriptor->AddExport(names[i], names[i], loc, zone()); } DCHECK_NOT_NULL(result); return result; } VariableProxy* Parser::NewUnresolved(const AstRawString* name, int begin_pos, VariableKind kind) { return scope()->NewUnresolved(factory(), name, begin_pos, kind); } VariableProxy* Parser::NewUnresolved(const AstRawString* name) { return scope()->NewUnresolved(factory(), name, scanner()->location().beg_pos); } Declaration* Parser::DeclareVariable(const AstRawString* name, VariableMode mode, int pos, bool* ok) { return DeclareVariable(name, mode, Variable::DefaultInitializationFlag(mode), pos, ok); } Declaration* Parser::DeclareVariable(const AstRawString* name, VariableMode mode, InitializationFlag init, int pos, bool* ok) { DCHECK_NOT_NULL(name); VariableProxy* proxy = factory()->NewVariableProxy( name, NORMAL_VARIABLE, scanner()->location().beg_pos); Declaration* declaration = factory()->NewVariableDeclaration(proxy, this->scope(), pos); Declare(declaration, DeclarationDescriptor::NORMAL, mode, init, ok, nullptr, scanner()->location().end_pos); if (!*ok) return nullptr; return declaration; } Variable* Parser::Declare(Declaration* declaration, DeclarationDescriptor::Kind declaration_kind, VariableMode mode, InitializationFlag init, bool* ok, Scope* scope, int var_end_pos) { if (scope == nullptr) { scope = this->scope(); } bool sloppy_mode_block_scope_function_redefinition = false; Variable* variable = scope->DeclareVariable( declaration, mode, init, allow_harmony_restrictive_generators(), &sloppy_mode_block_scope_function_redefinition, ok); if (!*ok) { // If we only have the start position of a proxy, we can't highlight the // whole variable name. Pretend its length is 1 so that we highlight at // least the first character. Scanner::Location loc(declaration->proxy()->position(), var_end_pos != kNoSourcePosition ? var_end_pos : declaration->proxy()->position() + 1); if (declaration_kind == DeclarationDescriptor::NORMAL) { ReportMessageAt(loc, MessageTemplate::kVarRedeclaration, declaration->proxy()->raw_name()); } else { ReportMessageAt(loc, MessageTemplate::kParamDupe); } return nullptr; } if (sloppy_mode_block_scope_function_redefinition) { ++use_counts_[v8::Isolate::kSloppyModeBlockScopedFunctionRedefinition]; } return variable; } Block* Parser::BuildInitializationBlock( DeclarationParsingResult* parsing_result, ZoneList<const AstRawString*>* names, bool* ok) { Block* result = factory()->NewBlock( NULL, 1, true, parsing_result->descriptor.declaration_pos); for (auto declaration : parsing_result->declarations) { PatternRewriter::DeclareAndInitializeVariables( this, result, &(parsing_result->descriptor), &declaration, names, CHECK_OK); } return result; } void Parser::DeclareAndInitializeVariables( Block* block, const DeclarationDescriptor* declaration_descriptor, const DeclarationParsingResult::Declaration* declaration, ZoneList<const AstRawString*>* names, bool* ok) { DCHECK_NOT_NULL(block); PatternRewriter::DeclareAndInitializeVariables( this, block, declaration_descriptor, declaration, names, ok); } Statement* Parser::DeclareFunction(const AstRawString* variable_name, FunctionLiteral* function, VariableMode mode, int pos, bool is_sloppy_block_function, ZoneList<const AstRawString*>* names, bool* ok) { VariableProxy* proxy = factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); Declaration* declaration = factory()->NewFunctionDeclaration(proxy, function, scope(), pos); Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, CHECK_OK); if (names) names->Add(variable_name, zone()); if (is_sloppy_block_function) { SloppyBlockFunctionStatement* statement = factory()->NewSloppyBlockFunctionStatement(); GetDeclarationScope()->DeclareSloppyBlockFunction(variable_name, scope(), statement); return statement; } return factory()->NewEmptyStatement(kNoSourcePosition); } Statement* Parser::DeclareClass(const AstRawString* variable_name, Expression* value, ZoneList<const AstRawString*>* names, int class_token_pos, int end_pos, bool* ok) { Declaration* decl = DeclareVariable(variable_name, LET, class_token_pos, CHECK_OK); decl->proxy()->var()->set_initializer_position(end_pos); Assignment* assignment = factory()->NewAssignment(Token::INIT, decl->proxy(), value, class_token_pos); Statement* assignment_statement = factory()->NewExpressionStatement(assignment, kNoSourcePosition); if (names) names->Add(variable_name, zone()); return assignment_statement; } Statement* Parser::DeclareNative(const AstRawString* name, int pos, bool* ok) { // Make sure that the function containing the native declaration // isn't lazily compiled. The extension structures are only // accessible while parsing the first time not when reparsing // because of lazy compilation. GetClosureScope()->ForceEagerCompilation(); // TODO(1240846): It's weird that native function declarations are // introduced dynamically when we meet their declarations, whereas // other functions are set up when entering the surrounding scope. Declaration* decl = DeclareVariable(name, VAR, pos, CHECK_OK); NativeFunctionLiteral* lit = factory()->NewNativeFunctionLiteral(name, extension_, kNoSourcePosition); return factory()->NewExpressionStatement( factory()->NewAssignment(Token::INIT, decl->proxy(), lit, kNoSourcePosition), pos); } ZoneList<const AstRawString*>* Parser::DeclareLabel( ZoneList<const AstRawString*>* labels, VariableProxy* var, bool* ok) { DCHECK(IsIdentifier(var)); const AstRawString* label = var->raw_name(); // TODO(1240780): We don't check for redeclaration of labels // during preparsing since keeping track of the set of active // labels requires nontrivial changes to the way scopes are // structured. However, these are probably changes we want to // make later anyway so we should go back and fix this then. if (ContainsLabel(labels, label) || TargetStackContainsLabel(label)) { ReportMessage(MessageTemplate::kLabelRedeclaration, label); *ok = false; return nullptr; } if (labels == nullptr) { labels = new (zone()) ZoneList<const AstRawString*>(1, zone()); } labels->Add(label, zone()); // Remove the "ghost" variable that turned out to be a label // from the top scope. This way, we don't try to resolve it // during the scope processing. scope()->RemoveUnresolved(var); return labels; } bool Parser::ContainsLabel(ZoneList<const AstRawString*>* labels, const AstRawString* label) { DCHECK_NOT_NULL(label); if (labels != nullptr) { for (int i = labels->length(); i-- > 0;) { if (labels->at(i) == label) return true; } } return false; } Expression* Parser::RewriteReturn(Expression* return_value, int pos) { if (IsDerivedConstructor(function_state_->kind())) { // For subclass constructors we need to return this in case of undefined // return a Smi (transformed into an exception in the ConstructStub) // for a non object. // // return expr; // // Is rewritten as: // // return (temp = expr) === undefined ? this : // %_IsJSReceiver(temp) ? temp : 1; // temp = expr Variable* temp = NewTemporary(ast_value_factory()->empty_string()); Assignment* assign = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(temp), return_value, pos); // %_IsJSReceiver(temp) ZoneList<Expression*>* is_spec_object_args = new (zone()) ZoneList<Expression*>(1, zone()); is_spec_object_args->Add(factory()->NewVariableProxy(temp), zone()); Expression* is_spec_object_call = factory()->NewCallRuntime( Runtime::kInlineIsJSReceiver, is_spec_object_args, pos); // %_IsJSReceiver(temp) ? temp : 1; Expression* is_object_conditional = factory()->NewConditional( is_spec_object_call, factory()->NewVariableProxy(temp), factory()->NewSmiLiteral(1, pos), pos); // temp === undefined Expression* is_undefined = factory()->NewCompareOperation( Token::EQ_STRICT, assign, factory()->NewUndefinedLiteral(kNoSourcePosition), pos); // is_undefined ? this : is_object_conditional return_value = factory()->NewConditional(is_undefined, ThisExpression(pos), is_object_conditional, pos); } if (is_generator()) { return_value = BuildIteratorResult(return_value, true); } return return_value; } Expression* Parser::RewriteDoExpression(Block* body, int pos, bool* ok) { Variable* result = NewTemporary(ast_value_factory()->dot_result_string()); DoExpression* expr = factory()->NewDoExpression(body, result, pos); if (!Rewriter::Rewrite(this, GetClosureScope(), expr, ast_value_factory())) { *ok = false; return nullptr; } return expr; } Statement* Parser::RewriteSwitchStatement(Expression* tag, SwitchStatement* switch_statement, ZoneList<CaseClause*>* cases, Scope* scope) { // In order to get the CaseClauses to execute in their own lexical scope, // but without requiring downstream code to have special scope handling // code for switch statements, desugar into blocks as follows: // { // To group the statements--harmless to evaluate Expression in scope // .tag_variable = Expression; // { // To give CaseClauses a scope // switch (.tag_variable) { CaseClause* } // } // } Block* switch_block = factory()->NewBlock(NULL, 2, false, kNoSourcePosition); Variable* tag_variable = NewTemporary(ast_value_factory()->dot_switch_tag_string()); Assignment* tag_assign = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(tag_variable), tag, tag->position()); Statement* tag_statement = factory()->NewExpressionStatement(tag_assign, kNoSourcePosition); switch_block->statements()->Add(tag_statement, zone()); // make statement: undefined; // This is needed so the tag isn't returned as the value, in case the switch // statements don't have a value. switch_block->statements()->Add( factory()->NewExpressionStatement( factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition), zone()); Expression* tag_read = factory()->NewVariableProxy(tag_variable); switch_statement->Initialize(tag_read, cases); Block* cases_block = factory()->NewBlock(NULL, 1, false, kNoSourcePosition); cases_block->statements()->Add(switch_statement, zone()); cases_block->set_scope(scope); DCHECK_IMPLIES(scope != nullptr, switch_statement->position() >= scope->start_position()); DCHECK_IMPLIES(scope != nullptr, switch_statement->position() < scope->end_position()); switch_block->statements()->Add(cases_block, zone()); return switch_block; } void Parser::RewriteCatchPattern(CatchInfo* catch_info, bool* ok) { if (catch_info->name == nullptr) { DCHECK_NOT_NULL(catch_info->pattern); catch_info->name = ast_value_factory()->dot_catch_string(); } catch_info->variable = catch_info->scope->DeclareLocal(catch_info->name, VAR); if (catch_info->pattern != nullptr) { DeclarationDescriptor descriptor; descriptor.declaration_kind = DeclarationDescriptor::NORMAL; descriptor.scope = scope(); descriptor.mode = LET; descriptor.declaration_pos = catch_info->pattern->position(); descriptor.initialization_pos = catch_info->pattern->position(); // Initializer position for variables declared by the pattern. const int initializer_position = position(); DeclarationParsingResult::Declaration decl( catch_info->pattern, initializer_position, factory()->NewVariableProxy(catch_info->variable)); catch_info->init_block = factory()->NewBlock(nullptr, 8, true, kNoSourcePosition); PatternRewriter::DeclareAndInitializeVariables( this, catch_info->init_block, &descriptor, &decl, &catch_info->bound_names, ok); } else { catch_info->bound_names.Add(catch_info->name, zone()); } } void Parser::ValidateCatchBlock(const CatchInfo& catch_info, bool* ok) { // Check for `catch(e) { let e; }` and similar errors. Scope* inner_block_scope = catch_info.inner_block->scope(); if (inner_block_scope != nullptr) { Declaration* decl = inner_block_scope->CheckLexDeclarationsConflictingWith( catch_info.bound_names); if (decl != nullptr) { const AstRawString* name = decl->proxy()->raw_name(); int position = decl->proxy()->position(); Scanner::Location location = position == kNoSourcePosition ? Scanner::Location::invalid() : Scanner::Location(position, position + 1); ReportMessageAt(location, MessageTemplate::kVarRedeclaration, name); *ok = false; } } } Statement* Parser::RewriteTryStatement(Block* try_block, Block* catch_block, Block* finally_block, const CatchInfo& catch_info, int pos) { // Simplify the AST nodes by converting: // 'try B0 catch B1 finally B2' // to: // 'try { try B0 catch B1 } finally B2' if (catch_block != nullptr && finally_block != nullptr) { // If we have both, create an inner try/catch. DCHECK_NOT_NULL(catch_info.scope); DCHECK_NOT_NULL(catch_info.variable); TryCatchStatement* statement; statement = factory()->NewTryCatchStatement(try_block, catch_info.scope, catch_info.variable, catch_block, kNoSourcePosition); try_block = factory()->NewBlock(nullptr, 1, false, kNoSourcePosition); try_block->statements()->Add(statement, zone()); catch_block = nullptr; // Clear to indicate it's been handled. } if (catch_block != nullptr) { // For a try-catch construct append return expressions from the catch block // to the list of return expressions. function_state_->tail_call_expressions().Append( catch_info.tail_call_expressions); DCHECK_NULL(finally_block); DCHECK_NOT_NULL(catch_info.scope); DCHECK_NOT_NULL(catch_info.variable); return factory()->NewTryCatchStatement( try_block, catch_info.scope, catch_info.variable, catch_block, pos); } else { DCHECK_NOT_NULL(finally_block); return factory()->NewTryFinallyStatement(try_block, finally_block, pos); } } void Parser::ParseAndRewriteGeneratorFunctionBody(int pos, FunctionKind kind, ZoneList<Statement*>* body, bool* ok) { // We produce: // // try { InitialYield; ...body...; return {value: undefined, done: true} } // finally { %_GeneratorClose(generator) } // // - InitialYield yields the actual generator object. // - Any return statement inside the body will have its argument wrapped // in a "done" iterator result object. // - If the generator terminates for whatever reason, we must close it. // Hence the finally clause. Block* try_block = factory()->NewBlock(nullptr, 3, false, kNoSourcePosition); Expression* initial_yield = BuildInitialYield(pos, kind); try_block->statements()->Add( factory()->NewExpressionStatement(initial_yield, kNoSourcePosition), zone()); ParseStatementList(try_block->statements(), Token::RBRACE, ok); if (!*ok) return; Statement* final_return = factory()->NewReturnStatement( BuildIteratorResult(nullptr, true), kNoSourcePosition); try_block->statements()->Add(final_return, zone()); Block* finally_block = factory()->NewBlock(nullptr, 1, false, kNoSourcePosition); ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); VariableProxy* call_proxy = factory()->NewVariableProxy(function_state_->generator_object_variable()); args->Add(call_proxy, zone()); Expression* call = factory()->NewCallRuntime(Runtime::kInlineGeneratorClose, args, kNoSourcePosition); finally_block->statements()->Add( factory()->NewExpressionStatement(call, kNoSourcePosition), zone()); body->Add(factory()->NewTryFinallyStatement(try_block, finally_block, kNoSourcePosition), zone()); } void Parser::CreateFunctionNameAssignment( const AstRawString* function_name, int pos, FunctionLiteral::FunctionType function_type, DeclarationScope* function_scope, ZoneList<Statement*>* result, int index) { if (function_type == FunctionLiteral::kNamedExpression) { StatementT statement = factory()->NewEmptyStatement(kNoSourcePosition); if (function_scope->LookupLocal(function_name) == nullptr) { // Now that we know the language mode, we can create the const assignment // in the previously reserved spot. DCHECK_EQ(function_scope, scope()); Variable* fvar = function_scope->DeclareFunctionVar(function_name); VariableProxy* fproxy = factory()->NewVariableProxy(fvar); statement = factory()->NewExpressionStatement( factory()->NewAssignment(Token::INIT, fproxy, factory()->NewThisFunction(pos), kNoSourcePosition), kNoSourcePosition); } result->Set(index, statement); } } // [if (IteratorType == kNormal)] // !%_IsJSReceiver(result = iterator.next()) && // %ThrowIteratorResultNotAnObject(result) // [else if (IteratorType == kAsync)] // !%_IsJSReceiver(result = Await(iterator.next())) && // %ThrowIteratorResultNotAnObject(result) // [endif] Expression* Parser::BuildIteratorNextResult(Expression* iterator, Variable* result, IteratorType type, int pos) { Expression* next_literal = factory()->NewStringLiteral( ast_value_factory()->next_string(), kNoSourcePosition); Expression* next_property = factory()->NewProperty(iterator, next_literal, kNoSourcePosition); ZoneList<Expression*>* next_arguments = new (zone()) ZoneList<Expression*>(0, zone()); Expression* next_call = factory()->NewCall(next_property, next_arguments, pos); if (type == IteratorType::kAsync) { next_call = RewriteAwaitExpression(next_call, pos); } Expression* result_proxy = factory()->NewVariableProxy(result); Expression* left = factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos); // %_IsJSReceiver(...) ZoneList<Expression*>* is_spec_object_args = new (zone()) ZoneList<Expression*>(1, zone()); is_spec_object_args->Add(left, zone()); Expression* is_spec_object_call = factory()->NewCallRuntime( Runtime::kInlineIsJSReceiver, is_spec_object_args, pos); // %ThrowIteratorResultNotAnObject(result) Expression* result_proxy_again = factory()->NewVariableProxy(result); ZoneList<Expression*>* throw_arguments = new (zone()) ZoneList<Expression*>(1, zone()); throw_arguments->Add(result_proxy_again, zone()); Expression* throw_call = factory()->NewCallRuntime( Runtime::kThrowIteratorResultNotAnObject, throw_arguments, pos); return factory()->NewBinaryOperation( Token::AND, factory()->NewUnaryOperation(Token::NOT, is_spec_object_call, pos), throw_call, pos); } Statement* Parser::InitializeForEachStatement(ForEachStatement* stmt, Expression* each, Expression* subject, Statement* body, int each_keyword_pos) { ForOfStatement* for_of = stmt->AsForOfStatement(); if (for_of != NULL) { const bool finalize = true; return InitializeForOfStatement(for_of, each, subject, body, finalize, IteratorType::kNormal, each_keyword_pos); } else { if (each->IsArrayLiteral() || each->IsObjectLiteral()) { Variable* temp = NewTemporary(ast_value_factory()->empty_string()); VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); Expression* assign_each = PatternRewriter::RewriteDestructuringAssignment( this, factory()->NewAssignment(Token::ASSIGN, each, temp_proxy, kNoSourcePosition), scope()); auto block = factory()->NewBlock(nullptr, 2, false, kNoSourcePosition); block->statements()->Add( factory()->NewExpressionStatement(assign_each, kNoSourcePosition), zone()); block->statements()->Add(body, zone()); body = block; each = factory()->NewVariableProxy(temp); } MarkExpressionAsAssigned(each); stmt->AsForInStatement()->Initialize(each, subject, body); } return stmt; } // Special case for legacy for // // for (var x = initializer in enumerable) body // // An initialization block of the form // // { // x = initializer; // } // // is returned in this case. It has reserved space for two statements, // so that (later on during parsing), the equivalent of // // for (x in enumerable) body // // is added as a second statement to it. Block* Parser::RewriteForVarInLegacy(const ForInfo& for_info) { const DeclarationParsingResult::Declaration& decl = for_info.parsing_result.declarations[0]; if (!IsLexicalVariableMode(for_info.parsing_result.descriptor.mode) && decl.pattern->IsVariableProxy() && decl.initializer != nullptr) { ++use_counts_[v8::Isolate::kForInInitializer]; const AstRawString* name = decl.pattern->AsVariableProxy()->raw_name(); VariableProxy* single_var = NewUnresolved(name); Block* init_block = factory()->NewBlock( nullptr, 2, true, for_info.parsing_result.descriptor.declaration_pos); init_block->statements()->Add( factory()->NewExpressionStatement( factory()->NewAssignment(Token::ASSIGN, single_var, decl.initializer, kNoSourcePosition), kNoSourcePosition), zone()); return init_block; } return nullptr; } // Rewrite a for-in/of statement of the form // // for (let/const/var x in/of e) b // // into // // { // <let x' be a temporary variable> // for (x' in/of e) { // let/const/var x; // x = x'; // b; // } // let x; // for TDZ // } void Parser::DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, Expression** each_variable, bool* ok) { DCHECK(for_info->parsing_result.declarations.length() == 1); DeclarationParsingResult::Declaration& decl = for_info->parsing_result.declarations[0]; Variable* temp = NewTemporary(ast_value_factory()->dot_for_string()); auto each_initialization_block = factory()->NewBlock(nullptr, 1, true, kNoSourcePosition); { auto descriptor = for_info->parsing_result.descriptor; descriptor.declaration_pos = kNoSourcePosition; descriptor.initialization_pos = kNoSourcePosition; decl.initializer = factory()->NewVariableProxy(temp); bool is_for_var_of = for_info->mode == ForEachStatement::ITERATE && for_info->parsing_result.descriptor.mode == VariableMode::VAR; bool collect_names = IsLexicalVariableMode(for_info->parsing_result.descriptor.mode) || is_for_var_of; PatternRewriter::DeclareAndInitializeVariables( this, each_initialization_block, &descriptor, &decl, collect_names ? &for_info->bound_names : nullptr, CHECK_OK_VOID); // Annex B.3.5 prohibits the form // `try {} catch(e) { for (var e of {}); }` // So if we are parsing a statement like `for (var ... of ...)` // we need to walk up the scope chain and look for catch scopes // which have a simple binding, then compare their binding against // all of the names declared in the init of the for-of we're // parsing. if (is_for_var_of) { Scope* catch_scope = scope(); while (catch_scope != nullptr && !catch_scope->is_declaration_scope()) { if (catch_scope->is_catch_scope()) { auto name = catch_scope->catch_variable_name(); // If it's a simple binding and the name is declared in the for loop. if (name != ast_value_factory()->dot_catch_string() && for_info->bound_names.Contains(name)) { ReportMessageAt(for_info->parsing_result.bindings_loc, MessageTemplate::kVarRedeclaration, name); *ok = false; return; } } catch_scope = catch_scope->outer_scope(); } } } *body_block = factory()->NewBlock(nullptr, 3, false, kNoSourcePosition); (*body_block)->statements()->Add(each_initialization_block, zone()); *each_variable = factory()->NewVariableProxy(temp, for_info->position); } // Create a TDZ for any lexically-bound names in for in/of statements. Block* Parser::CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, bool* ok) { if (IsLexicalVariableMode(for_info.parsing_result.descriptor.mode)) { DCHECK_NULL(init_block); init_block = factory()->NewBlock(nullptr, 1, false, kNoSourcePosition); for (int i = 0; i < for_info.bound_names.length(); ++i) { // TODO(adamk): This needs to be some sort of special // INTERNAL variable that's invisible to the debugger // but visible to everything else. Declaration* tdz_decl = DeclareVariable(for_info.bound_names[i], LET, kNoSourcePosition, CHECK_OK); tdz_decl->proxy()->var()->set_initializer_position(position()); } } return init_block; } Statement* Parser::InitializeForOfStatement( ForOfStatement* for_of, Expression* each, Expression* iterable, Statement* body, bool finalize, IteratorType type, int next_result_pos) { // Create the auxiliary expressions needed for iterating over the iterable, // and initialize the given ForOfStatement with them. // If finalize is true, also instrument the loop with code that performs the // proper ES6 iterator finalization. In that case, the result is not // immediately a ForOfStatement. const int nopos = kNoSourcePosition; auto avfactory = ast_value_factory(); Variable* iterator = NewTemporary(avfactory->dot_iterator_string()); Variable* result = NewTemporary(avfactory->dot_result_string()); Variable* completion = NewTemporary(avfactory->empty_string()); // iterator = GetIterator(iterable, type) Expression* assign_iterator; { assign_iterator = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(iterator), factory()->NewGetIterator(iterable, type, iterable->position()), iterable->position()); } // [if (IteratorType == kNormal)] // !%_IsJSReceiver(result = iterator.next()) && // %ThrowIteratorResultNotAnObject(result) // [else if (IteratorType == kAsync)] // !%_IsJSReceiver(result = Await(iterator.next())) && // %ThrowIteratorResultNotAnObject(result) // [endif] Expression* next_result; { Expression* iterator_proxy = factory()->NewVariableProxy(iterator); next_result = BuildIteratorNextResult(iterator_proxy, result, type, next_result_pos); } // result.done Expression* result_done; { Expression* done_literal = factory()->NewStringLiteral( ast_value_factory()->done_string(), kNoSourcePosition); Expression* result_proxy = factory()->NewVariableProxy(result); result_done = factory()->NewProperty(result_proxy, done_literal, kNoSourcePosition); } // result.value Expression* result_value; { Expression* value_literal = factory()->NewStringLiteral(avfactory->value_string(), nopos); Expression* result_proxy = factory()->NewVariableProxy(result); result_value = factory()->NewProperty(result_proxy, value_literal, nopos); } // {{completion = kAbruptCompletion;}} Statement* set_completion_abrupt; if (finalize) { Expression* proxy = factory()->NewVariableProxy(completion); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, proxy, factory()->NewSmiLiteral(Parser::kAbruptCompletion, nopos), nopos); Block* block = factory()->NewBlock(nullptr, 1, true, nopos); block->statements()->Add( factory()->NewExpressionStatement(assignment, nopos), zone()); set_completion_abrupt = block; } // do { let tmp = #result_value; #set_completion_abrupt; tmp } // Expression* result_value (gets overwritten) if (finalize) { Variable* var_tmp = NewTemporary(avfactory->empty_string()); Expression* tmp = factory()->NewVariableProxy(var_tmp); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, tmp, result_value, nopos); Block* block = factory()->NewBlock(nullptr, 2, false, nopos); block->statements()->Add( factory()->NewExpressionStatement(assignment, nopos), zone()); block->statements()->Add(set_completion_abrupt, zone()); result_value = factory()->NewDoExpression(block, var_tmp, nopos); } // each = #result_value; Expression* assign_each; { assign_each = factory()->NewAssignment(Token::ASSIGN, each, result_value, nopos); if (each->IsArrayLiteral() || each->IsObjectLiteral()) { assign_each = PatternRewriter::RewriteDestructuringAssignment( this, assign_each->AsAssignment(), scope()); } } // {{completion = kNormalCompletion;}} Statement* set_completion_normal; if (finalize) { Expression* proxy = factory()->NewVariableProxy(completion); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, proxy, factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), nopos); Block* block = factory()->NewBlock(nullptr, 1, true, nopos); block->statements()->Add( factory()->NewExpressionStatement(assignment, nopos), zone()); set_completion_normal = block; } // { #loop-body; #set_completion_normal } // Statement* body (gets overwritten) if (finalize) { Block* block = factory()->NewBlock(nullptr, 2, false, nopos); block->statements()->Add(body, zone()); block->statements()->Add(set_completion_normal, zone()); body = block; } for_of->Initialize(body, iterator, assign_iterator, next_result, result_done, assign_each); return finalize ? FinalizeForOfStatement(for_of, completion, type, nopos) : for_of; } Statement* Parser::DesugarLexicalBindingsInForStatement( ForStatement* loop, Statement* init, Expression* cond, Statement* next, Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok) { // ES6 13.7.4.8 specifies that on each loop iteration the let variables are // copied into a new environment. Moreover, the "next" statement must be // evaluated not in the environment of the just completed iteration but in // that of the upcoming one. We achieve this with the following desugaring. // Extra care is needed to preserve the completion value of the original loop. // // We are given a for statement of the form // // labels: for (let/const x = i; cond; next) body // // and rewrite it as follows. Here we write {{ ... }} for init-blocks, ie., // blocks whose ignore_completion_value_ flag is set. // // { // let/const x = i; // temp_x = x; // first = 1; // undefined; // outer: for (;;) { // let/const x = temp_x; // {{ if (first == 1) { // first = 0; // } else { // next; // } // flag = 1; // if (!cond) break; // }} // labels: for (; flag == 1; flag = 0, temp_x = x) { // body // } // {{ if (flag == 1) // Body used break. // break; // }} // } // } DCHECK(for_info.bound_names.length() > 0); ZoneList<Variable*> temps(for_info.bound_names.length(), zone()); Block* outer_block = factory()->NewBlock( nullptr, for_info.bound_names.length() + 4, false, kNoSourcePosition); // Add statement: let/const x = i. outer_block->statements()->Add(init, zone()); const AstRawString* temp_name = ast_value_factory()->dot_for_string(); // For each lexical variable x: // make statement: temp_x = x. for (int i = 0; i < for_info.bound_names.length(); i++) { VariableProxy* proxy = NewUnresolved(for_info.bound_names[i]); Variable* temp = NewTemporary(temp_name); VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); Assignment* assignment = factory()->NewAssignment(Token::ASSIGN, temp_proxy, proxy, kNoSourcePosition); Statement* assignment_statement = factory()->NewExpressionStatement(assignment, kNoSourcePosition); outer_block->statements()->Add(assignment_statement, zone()); temps.Add(temp, zone()); } Variable* first = NULL; // Make statement: first = 1. if (next) { first = NewTemporary(temp_name); VariableProxy* first_proxy = factory()->NewVariableProxy(first); Expression* const1 = factory()->NewSmiLiteral(1, kNoSourcePosition); Assignment* assignment = factory()->NewAssignment( Token::ASSIGN, first_proxy, const1, kNoSourcePosition); Statement* assignment_statement = factory()->NewExpressionStatement(assignment, kNoSourcePosition); outer_block->statements()->Add(assignment_statement, zone()); } // make statement: undefined; outer_block->statements()->Add( factory()->NewExpressionStatement( factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition), zone()); // Make statement: outer: for (;;) // Note that we don't actually create the label, or set this loop up as an // explicit break target, instead handing it directly to those nodes that // need to know about it. This should be safe because we don't run any code // in this function that looks up break targets. ForStatement* outer_loop = factory()->NewForStatement(NULL, kNoSourcePosition); outer_block->statements()->Add(outer_loop, zone()); outer_block->set_scope(scope()); Block* inner_block = factory()->NewBlock(NULL, 3, false, kNoSourcePosition); { BlockState block_state(&scope_, inner_scope); Block* ignore_completion_block = factory()->NewBlock( nullptr, for_info.bound_names.length() + 3, true, kNoSourcePosition); ZoneList<Variable*> inner_vars(for_info.bound_names.length(), zone()); // For each let variable x: // make statement: let/const x = temp_x. for (int i = 0; i < for_info.bound_names.length(); i++) { Declaration* decl = DeclareVariable( for_info.bound_names[i], for_info.parsing_result.descriptor.mode, kNoSourcePosition, CHECK_OK); inner_vars.Add(decl->proxy()->var(), zone()); VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i)); Assignment* assignment = factory()->NewAssignment( Token::INIT, decl->proxy(), temp_proxy, kNoSourcePosition); Statement* assignment_statement = factory()->NewExpressionStatement(assignment, kNoSourcePosition); DCHECK(init->position() != kNoSourcePosition); decl->proxy()->var()->set_initializer_position(init->position()); ignore_completion_block->statements()->Add(assignment_statement, zone()); } // Make statement: if (first == 1) { first = 0; } else { next; } if (next) { DCHECK(first); Expression* compare = NULL; // Make compare expression: first == 1. { Expression* const1 = factory()->NewSmiLiteral(1, kNoSourcePosition); VariableProxy* first_proxy = factory()->NewVariableProxy(first); compare = factory()->NewCompareOperation(Token::EQ, first_proxy, const1, kNoSourcePosition); } Statement* clear_first = NULL; // Make statement: first = 0. { VariableProxy* first_proxy = factory()->NewVariableProxy(first); Expression* const0 = factory()->NewSmiLiteral(0, kNoSourcePosition); Assignment* assignment = factory()->NewAssignment( Token::ASSIGN, first_proxy, const0, kNoSourcePosition); clear_first = factory()->NewExpressionStatement(assignment, kNoSourcePosition); } Statement* clear_first_or_next = factory()->NewIfStatement( compare, clear_first, next, kNoSourcePosition); ignore_completion_block->statements()->Add(clear_first_or_next, zone()); } Variable* flag = NewTemporary(temp_name); // Make statement: flag = 1. { VariableProxy* flag_proxy = factory()->NewVariableProxy(flag); Expression* const1 = factory()->NewSmiLiteral(1, kNoSourcePosition); Assignment* assignment = factory()->NewAssignment( Token::ASSIGN, flag_proxy, const1, kNoSourcePosition); Statement* assignment_statement = factory()->NewExpressionStatement(assignment, kNoSourcePosition); ignore_completion_block->statements()->Add(assignment_statement, zone()); } // Make statement: if (!cond) break. if (cond) { Statement* stop = factory()->NewBreakStatement(outer_loop, kNoSourcePosition); Statement* noop = factory()->NewEmptyStatement(kNoSourcePosition); ignore_completion_block->statements()->Add( factory()->NewIfStatement(cond, noop, stop, cond->position()), zone()); } inner_block->statements()->Add(ignore_completion_block, zone()); // Make cond expression for main loop: flag == 1. Expression* flag_cond = NULL; { Expression* const1 = factory()->NewSmiLiteral(1, kNoSourcePosition); VariableProxy* flag_proxy = factory()->NewVariableProxy(flag); flag_cond = factory()->NewCompareOperation(Token::EQ, flag_proxy, const1, kNoSourcePosition); } // Create chain of expressions "flag = 0, temp_x = x, ..." Statement* compound_next_statement = NULL; { Expression* compound_next = NULL; // Make expression: flag = 0. { VariableProxy* flag_proxy = factory()->NewVariableProxy(flag); Expression* const0 = factory()->NewSmiLiteral(0, kNoSourcePosition); compound_next = factory()->NewAssignment(Token::ASSIGN, flag_proxy, const0, kNoSourcePosition); } // Make the comma-separated list of temp_x = x assignments. int inner_var_proxy_pos = scanner()->location().beg_pos; for (int i = 0; i < for_info.bound_names.length(); i++) { VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i)); VariableProxy* proxy = factory()->NewVariableProxy(inner_vars.at(i), inner_var_proxy_pos); Assignment* assignment = factory()->NewAssignment( Token::ASSIGN, temp_proxy, proxy, kNoSourcePosition); compound_next = factory()->NewBinaryOperation( Token::COMMA, compound_next, assignment, kNoSourcePosition); } compound_next_statement = factory()->NewExpressionStatement(compound_next, kNoSourcePosition); } // Make statement: labels: for (; flag == 1; flag = 0, temp_x = x) // Note that we re-use the original loop node, which retains its labels // and ensures that any break or continue statements in body point to // the right place. loop->Initialize(NULL, flag_cond, compound_next_statement, body); inner_block->statements()->Add(loop, zone()); // Make statement: {{if (flag == 1) break;}} { Expression* compare = NULL; // Make compare expresion: flag == 1. { Expression* const1 = factory()->NewSmiLiteral(1, kNoSourcePosition); VariableProxy* flag_proxy = factory()->NewVariableProxy(flag); compare = factory()->NewCompareOperation(Token::EQ, flag_proxy, const1, kNoSourcePosition); } Statement* stop = factory()->NewBreakStatement(outer_loop, kNoSourcePosition); Statement* empty = factory()->NewEmptyStatement(kNoSourcePosition); Statement* if_flag_break = factory()->NewIfStatement(compare, stop, empty, kNoSourcePosition); Block* ignore_completion_block = factory()->NewBlock(NULL, 1, true, kNoSourcePosition); ignore_completion_block->statements()->Add(if_flag_break, zone()); inner_block->statements()->Add(ignore_completion_block, zone()); } inner_block->set_scope(inner_scope); } outer_loop->Initialize(NULL, NULL, NULL, inner_block); return outer_block; } void Parser::AddArrowFunctionFormalParameters( ParserFormalParameters* parameters, Expression* expr, int end_pos, bool* ok) { // ArrowFunctionFormals :: // Binary(Token::COMMA, NonTailArrowFunctionFormals, Tail) // Tail // NonTailArrowFunctionFormals :: // Binary(Token::COMMA, NonTailArrowFunctionFormals, VariableProxy) // VariableProxy // Tail :: // VariableProxy // Spread(VariableProxy) // // As we need to visit the parameters in left-to-right order, we recurse on // the left-hand side of comma expressions. // if (expr->IsBinaryOperation()) { BinaryOperation* binop = expr->AsBinaryOperation(); // The classifier has already run, so we know that the expression is a valid // arrow function formals production. DCHECK_EQ(binop->op(), Token::COMMA); Expression* left = binop->left(); Expression* right = binop->right(); int comma_pos = binop->position(); AddArrowFunctionFormalParameters(parameters, left, comma_pos, CHECK_OK_VOID); // LHS of comma expression should be unparenthesized. expr = right; } // Only the right-most expression may be a rest parameter. DCHECK(!parameters->has_rest); bool is_rest = expr->IsSpread(); if (is_rest) { expr = expr->AsSpread()->expression(); parameters->has_rest = true; } if (parameters->is_simple) { parameters->is_simple = !is_rest && expr->IsVariableProxy(); } Expression* initializer = nullptr; if (expr->IsAssignment()) { Assignment* assignment = expr->AsAssignment(); DCHECK(!assignment->is_compound()); initializer = assignment->value(); expr = assignment->target(); } AddFormalParameter(parameters, expr, initializer, end_pos, is_rest); } void Parser::DeclareArrowFunctionFormalParameters( ParserFormalParameters* parameters, Expression* expr, const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, bool* ok) { if (expr->IsEmptyParentheses()) return; AddArrowFunctionFormalParameters(parameters, expr, params_loc.end_pos, CHECK_OK_VOID); if (parameters->arity > Code::kMaxArguments) { ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList); *ok = false; return; } ExpressionClassifier classifier(this); if (!parameters->is_simple) { this->classifier()->RecordNonSimpleParameter(); } DeclareFormalParameters(parameters->scope, parameters->params); if (!this->classifier() ->is_valid_formal_parameter_list_without_duplicates()) { *duplicate_loc = this->classifier()->duplicate_formal_parameter_error().location; } DCHECK_EQ(parameters->is_simple, parameters->scope->has_simple_parameters()); } void Parser::PrepareGeneratorVariables() { // For generators, allocating variables in contexts is currently a win because // it minimizes the work needed to suspend and resume an activation. The // code produced for generators relies on this forced context allocation (it // does not restore the frame's parameters upon resume). function_state_->scope()->ForceContextAllocation(); // Calling a generator returns a generator object. That object is stored // in a temporary variable, a definition that is used by "yield" // expressions. function_state_->scope()->DeclareGeneratorObjectVar( ast_value_factory()->dot_generator_object_string()); } FunctionLiteral* Parser::ParseFunctionLiteral( const AstRawString* function_name, Scanner::Location function_name_location, FunctionNameValidity function_name_validity, FunctionKind kind, int function_token_pos, FunctionLiteral::FunctionType function_type, LanguageMode language_mode, bool* ok) { // Function :: // '(' FormalParameterList? ')' '{' FunctionBody '}' // // Getter :: // '(' ')' '{' FunctionBody '}' // // Setter :: // '(' PropertySetParameterList ')' '{' FunctionBody '}' int pos = function_token_pos == kNoSourcePosition ? peek_position() : function_token_pos; // Anonymous functions were passed either the empty symbol or a null // handle as the function name. Remember if we were passed a non-empty // handle to decide whether to invoke function name inference. bool should_infer_name = function_name == NULL; // We want a non-null handle as the function name. if (should_infer_name) { function_name = ast_value_factory()->empty_string(); } FunctionLiteral::EagerCompileHint eager_compile_hint = function_state_->next_function_is_likely_called() ? FunctionLiteral::kShouldEagerCompile : default_eager_compile_hint(); // Determine if the function can be parsed lazily. Lazy parsing is // different from lazy compilation; we need to parse more eagerly than we // compile. // We can only parse lazily if we also compile lazily. The heuristics for lazy // compilation are: // - It must not have been prohibited by the caller to Parse (some callers // need a full AST). // - The outer scope must allow lazy compilation of inner functions. // - The function mustn't be a function expression with an open parenthesis // before; we consider that a hint that the function will be called // immediately, and it would be a waste of time to make it lazily // compiled. // These are all things we can know at this point, without looking at the // function itself. // We separate between lazy parsing top level functions and lazy parsing inner // functions, because the latter needs to do more work. In particular, we need // to track unresolved variables to distinguish between these cases: // (function foo() { // bar = function() { return 1; } // })(); // and // (function foo() { // var a = 1; // bar = function() { return a; } // })(); // Now foo will be parsed eagerly and compiled eagerly (optimization: assume // parenthesis before the function means that it will be called // immediately). bar can be parsed lazily, but we need to parse it in a mode // that tracks unresolved variables. DCHECK_IMPLIES(parse_lazily(), FLAG_lazy); DCHECK_IMPLIES(parse_lazily(), allow_lazy_); DCHECK_IMPLIES(parse_lazily(), extension_ == nullptr); bool can_preparse = parse_lazily() && eager_compile_hint == FunctionLiteral::kShouldLazyCompile; bool is_lazy_top_level_function = can_preparse && impl()->AllowsLazyParsingWithoutUnresolvedVariables(); RuntimeCallTimerScope runtime_timer( runtime_call_stats_, parsing_on_main_thread_ ? &RuntimeCallStats::ParseFunctionLiteral : &RuntimeCallStats::ParseBackgroundFunctionLiteral); // Determine whether we can still lazy parse the inner function. // The preconditions are: // - Lazy compilation has to be enabled. // - Neither V8 natives nor native function declarations can be allowed, // since parsing one would retroactively force the function to be // eagerly compiled. // - The invoker of this parser can't depend on the AST being eagerly // built (either because the function is about to be compiled, or // because the AST is going to be inspected for some reason). // - Because of the above, we can't be attempting to parse a // FunctionExpression; even without enclosing parentheses it might be // immediately invoked. // - The function literal shouldn't be hinted to eagerly compile. // Inner functions will be parsed using a temporary Zone. After parsing, we // will migrate unresolved variable into a Scope in the main Zone. // TODO(marja): Refactor parsing modes: simplify this. bool use_temp_zone = (FLAG_aggressive_lazy_inner_functions ? can_preparse : (is_lazy_top_level_function || (parse_lazily() && function_type == FunctionLiteral::kDeclaration && eager_compile_hint == FunctionLiteral::kShouldLazyCompile))); DCHECK_IMPLIES( (is_lazy_top_level_function || (parse_lazily() && function_type == FunctionLiteral::kDeclaration && eager_compile_hint == FunctionLiteral::kShouldLazyCompile)), can_preparse); bool is_lazy_inner_function = use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function; ZoneList<Statement*>* body = nullptr; int expected_property_count = -1; bool should_be_used_once_hint = false; int num_parameters = -1; int function_length = -1; bool has_duplicate_parameters = false; int function_literal_id = GetNextFunctionLiteralId(); Zone* outer_zone = zone(); DeclarationScope* scope; { // Temporary zones can nest. When we migrate free variables (see below), we // need to recreate them in the previous Zone. AstNodeFactory previous_zone_ast_node_factory(ast_value_factory()); previous_zone_ast_node_factory.set_zone(zone()); // Open a new zone scope, which sets our AstNodeFactory to allocate in the // new temporary zone if the preconditions are satisfied, and ensures that // the previous zone is always restored after parsing the body. To be able // to do scope analysis correctly after full parsing, we migrate needed // information when the function is parsed. Zone temp_zone(zone()->allocator(), ZONE_NAME); DiscardableZoneScope zone_scope(this, &temp_zone, use_temp_zone); // This Scope lives in the main zone. We'll migrate data into that zone // later. scope = NewFunctionScope(kind, outer_zone); SetLanguageMode(scope, language_mode); #ifdef DEBUG scope->SetScopeName(function_name); if (use_temp_zone) scope->set_needs_migration(); #endif Expect(Token::LPAREN, CHECK_OK); scope->set_start_position(scanner()->location().beg_pos); // Eager or lazy parse? If is_lazy_top_level_function, we'll parse // lazily. We'll call SkipFunction, which may decide to // abort lazy parsing if it suspects that wasn't a good idea. If so (in // which case the parser is expected to have backtracked), or if we didn't // try to lazy parse in the first place, we'll have to parse eagerly. if (is_lazy_top_level_function || is_lazy_inner_function) { Scanner::BookmarkScope bookmark(scanner()); bookmark.Set(); LazyParsingResult result = SkipFunction( kind, scope, &num_parameters, &function_length, &has_duplicate_parameters, &expected_property_count, is_lazy_inner_function, is_lazy_top_level_function, CHECK_OK); if (result == kLazyParsingAborted) { DCHECK(is_lazy_top_level_function); bookmark.Apply(); // Trigger eager (re-)parsing, just below this block. is_lazy_top_level_function = false; // This is probably an initialization function. Inform the compiler it // should also eager-compile this function, and that we expect it to be // used once. eager_compile_hint = FunctionLiteral::kShouldEagerCompile; should_be_used_once_hint = true; scope->ResetAfterPreparsing(ast_value_factory(), true); zone_scope.Reset(); use_temp_zone = false; } } if (!is_lazy_top_level_function && !is_lazy_inner_function) { body = ParseFunction(function_name, pos, kind, function_type, scope, &num_parameters, &function_length, &has_duplicate_parameters, &expected_property_count, CHECK_OK); } DCHECK(use_temp_zone || !is_lazy_top_level_function); if (use_temp_zone) { // If the preconditions are correct the function body should never be // accessed, but do this anyway for better behaviour if they're wrong. body = nullptr; scope->AnalyzePartially(&previous_zone_ast_node_factory, preparsed_scope_data_); } DCHECK_IMPLIES(use_temp_zone, temp_zoned_); if (FLAG_trace_preparse) { PrintF(" [%s]: %i-%i %.*s\n", is_lazy_top_level_function ? "Preparse no-resolution" : (temp_zoned_ ? "Preparse resolution" : "Full parse"), scope->start_position(), scope->end_position(), function_name->byte_length(), function_name->raw_data()); } if (V8_UNLIKELY(FLAG_runtime_stats)) { if (is_lazy_top_level_function) { RuntimeCallStats::CorrectCurrentCounterId( runtime_call_stats_, parsing_on_main_thread_ ? &RuntimeCallStats::PreParseNoVariableResolution : &RuntimeCallStats::PreParseBackgroundNoVariableResolution); } else if (temp_zoned_) { RuntimeCallStats::CorrectCurrentCounterId( runtime_call_stats_, parsing_on_main_thread_ ? &RuntimeCallStats::PreParseWithVariableResolution : &RuntimeCallStats::PreParseBackgroundWithVariableResolution); } } // Validate function name. We can do this only after parsing the function, // since the function can declare itself strict. language_mode = scope->language_mode(); CheckFunctionName(language_mode, function_name, function_name_validity, function_name_location, CHECK_OK); if (is_strict(language_mode)) { CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), CHECK_OK); } CheckConflictingVarDeclarations(scope, CHECK_OK); } // DiscardableZoneScope goes out of scope. FunctionLiteral::ParameterFlag duplicate_parameters = has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters : FunctionLiteral::kNoDuplicateParameters; // Note that the FunctionLiteral needs to be created in the main Zone again. FunctionLiteral* function_literal = factory()->NewFunctionLiteral( function_name, scope, body, expected_property_count, num_parameters, function_length, duplicate_parameters, function_type, eager_compile_hint, pos, true, function_literal_id); function_literal->set_function_token_position(function_token_pos); if (should_be_used_once_hint) function_literal->set_should_be_used_once_hint(); if (should_infer_name) { DCHECK_NOT_NULL(fni_); fni_->AddFunction(function_literal); } return function_literal; } Parser::LazyParsingResult Parser::SkipFunction( FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, int* function_length, bool* has_duplicate_parameters, int* expected_property_count, bool is_inner_function, bool may_abort, bool* ok) { DCHECK_NE(kNoSourcePosition, function_scope->start_position()); DCHECK_EQ(kNoSourcePosition, parameters_end_pos_); if (produce_cached_parse_data()) CHECK(log_); DCHECK_IMPLIES(IsArrowFunction(kind), scanner()->current_token() == Token::ARROW); // Inner functions are not part of the cached data. if (!is_inner_function && consume_cached_parse_data() && !cached_parse_data_->rejected()) { // If we have cached data, we use it to skip parsing the function. The data // contains the information we need to construct the lazy function. FunctionEntry entry = cached_parse_data_->GetFunctionEntry(function_scope->start_position()); // Check that cached data is valid. If not, mark it as invalid (the embedder // handles it). Note that end position greater than end of stream is safe, // and hard to check. if (entry.is_valid() && entry.end_pos() > function_scope->start_position()) { total_preparse_skipped_ += entry.end_pos() - position(); function_scope->set_end_position(entry.end_pos()); scanner()->SeekForward(entry.end_pos() - 1); Expect(Token::RBRACE, CHECK_OK_VALUE(kLazyParsingComplete)); *num_parameters = entry.num_parameters(); *function_length = entry.function_length(); *has_duplicate_parameters = entry.has_duplicate_parameters(); *expected_property_count = entry.property_count(); SetLanguageMode(function_scope, entry.language_mode()); if (entry.uses_super_property()) function_scope->RecordSuperPropertyUsage(); if (entry.calls_eval()) function_scope->RecordEvalCall(); SkipFunctionLiterals(entry.num_inner_functions()); return kLazyParsingComplete; } cached_parse_data_->Reject(); } // With no cached data, we partially parse the function, without building an // AST. This gathers the data needed to build a lazy function. TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); if (reusable_preparser_ == NULL) { reusable_preparser_ = new PreParser( zone(), &scanner_, stack_limit_, ast_value_factory(), &pending_error_handler_, runtime_call_stats_, parsing_on_main_thread_); #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); SET_ALLOW(natives); SET_ALLOW(harmony_do_expressions); SET_ALLOW(harmony_function_sent); SET_ALLOW(harmony_trailing_commas); SET_ALLOW(harmony_class_fields); SET_ALLOW(harmony_object_rest_spread); SET_ALLOW(harmony_dynamic_import); SET_ALLOW(harmony_async_iteration); #undef SET_ALLOW } // Aborting inner function preparsing would leave scopes in an inconsistent // state; we don't parse inner functions in the abortable mode anyway. DCHECK(!is_inner_function || !may_abort); PreParser::PreParseResult result = reusable_preparser_->PreParseFunction( kind, function_scope, parsing_module_, is_inner_function, may_abort, use_counts_); // Return immediately if pre-parser decided to abort parsing. if (result == PreParser::kPreParseAbort) return kLazyParsingAborted; if (result == PreParser::kPreParseStackOverflow) { // Propagate stack overflow. set_stack_overflow(); *ok = false; return kLazyParsingComplete; } if (pending_error_handler_.has_pending_error()) { *ok = false; return kLazyParsingComplete; } PreParserLogger* logger = reusable_preparser_->logger(); function_scope->set_end_position(logger->end()); Expect(Token::RBRACE, CHECK_OK_VALUE(kLazyParsingComplete)); total_preparse_skipped_ += function_scope->end_position() - function_scope->start_position(); *num_parameters = logger->num_parameters(); *function_length = logger->function_length(); *has_duplicate_parameters = logger->has_duplicate_parameters(); *expected_property_count = logger->properties(); SkipFunctionLiterals(logger->num_inner_functions()); if (!is_inner_function && produce_cached_parse_data()) { DCHECK(log_); log_->LogFunction( function_scope->start_position(), function_scope->end_position(), *num_parameters, *function_length, *has_duplicate_parameters, *expected_property_count, language_mode(), function_scope->uses_super_property(), function_scope->calls_eval(), logger->num_inner_functions()); } return kLazyParsingComplete; } Statement* Parser::BuildAssertIsCoercible(Variable* var) { // if (var === null || var === undefined) // throw /* type error kNonCoercible) */; Expression* condition = factory()->NewBinaryOperation( Token::OR, factory()->NewCompareOperation( Token::EQ_STRICT, factory()->NewVariableProxy(var), factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition), factory()->NewCompareOperation( Token::EQ_STRICT, factory()->NewVariableProxy(var), factory()->NewNullLiteral(kNoSourcePosition), kNoSourcePosition), kNoSourcePosition); Expression* throw_type_error = NewThrowTypeError(MessageTemplate::kNonCoercible, ast_value_factory()->empty_string(), kNoSourcePosition); IfStatement* if_statement = factory()->NewIfStatement( condition, factory()->NewExpressionStatement(throw_type_error, kNoSourcePosition), factory()->NewEmptyStatement(kNoSourcePosition), kNoSourcePosition); return if_statement; } class InitializerRewriter final : public AstTraversalVisitor<InitializerRewriter> { public: InitializerRewriter(uintptr_t stack_limit, Expression* root, Parser* parser, Scope* scope) : AstTraversalVisitor(stack_limit, root), parser_(parser), scope_(scope) {} private: // This is required so that the overriden Visit* methods can be // called by the base class (template). friend class AstTraversalVisitor<InitializerRewriter>; // Just rewrite destructuring assignments wrapped in RewritableExpressions. void VisitRewritableExpression(RewritableExpression* to_rewrite) { if (to_rewrite->is_rewritten()) return; Parser::PatternRewriter::RewriteDestructuringAssignment(parser_, to_rewrite, scope_); AstTraversalVisitor::VisitRewritableExpression(to_rewrite); } // Code in function literals does not need to be eagerly rewritten, it will be // rewritten when scheduled. void VisitFunctionLiteral(FunctionLiteral* expr) {} Parser* parser_; Scope* scope_; }; void Parser::RewriteParameterInitializer(Expression* expr, Scope* scope) { InitializerRewriter rewriter(stack_limit_, expr, this, scope); rewriter.Run(); } Block* Parser::BuildParameterInitializationBlock( const ParserFormalParameters& parameters, bool* ok) { DCHECK(!parameters.is_simple); DCHECK(scope()->is_function_scope()); Block* init_block = factory()->NewBlock(NULL, 1, true, kNoSourcePosition); int index = 0; for (auto parameter : parameters.params) { if (parameter->is_nondestructuring_rest()) break; DeclarationDescriptor descriptor; descriptor.declaration_kind = DeclarationDescriptor::PARAMETER; descriptor.scope = scope(); descriptor.mode = LET; descriptor.declaration_pos = parameter->pattern->position(); // The position that will be used by the AssignmentExpression // which copies from the temp parameter to the pattern. // // TODO(adamk): Should this be kNoSourcePosition, since // it's just copying from a temp var to the real param var? descriptor.initialization_pos = parameter->pattern->position(); Expression* initial_value = factory()->NewVariableProxy(parameters.scope->parameter(index)); if (parameter->initializer != nullptr) { // IS_UNDEFINED($param) ? initializer : $param // Ensure initializer is rewritten RewriteParameterInitializer(parameter->initializer, scope()); auto condition = factory()->NewCompareOperation( Token::EQ_STRICT, factory()->NewVariableProxy(parameters.scope->parameter(index)), factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition); initial_value = factory()->NewConditional( condition, parameter->initializer, initial_value, kNoSourcePosition); descriptor.initialization_pos = parameter->initializer->position(); } Scope* param_scope = scope(); Block* param_block = init_block; if (!parameter->is_simple() && scope()->calls_sloppy_eval()) { param_scope = NewVarblockScope(); param_scope->set_start_position(descriptor.initialization_pos); param_scope->set_end_position(parameter->initializer_end_position); param_scope->RecordEvalCall(); param_block = factory()->NewBlock(NULL, 8, true, kNoSourcePosition); param_block->set_scope(param_scope); // Pass the appropriate scope in so that PatternRewriter can appropriately // rewrite inner initializers of the pattern to param_scope descriptor.scope = param_scope; // Rewrite the outer initializer to point to param_scope ReparentParameterExpressionScope(stack_limit(), initial_value, param_scope); } BlockState block_state(&scope_, param_scope); DeclarationParsingResult::Declaration decl( parameter->pattern, parameter->initializer_end_position, initial_value); PatternRewriter::DeclareAndInitializeVariables( this, param_block, &descriptor, &decl, nullptr, CHECK_OK); if (param_block != init_block) { param_scope = param_scope->FinalizeBlockScope(); if (param_scope != nullptr) { CheckConflictingVarDeclarations(param_scope, CHECK_OK); } init_block->statements()->Add(param_block, zone()); } ++index; } return init_block; } Block* Parser::BuildRejectPromiseOnException(Block* inner_block) { // .promise = %AsyncFunctionPromiseCreate(); // try { // <inner_block> // } catch (.catch) { // %RejectPromise(.promise, .catch); // return .promise; // } finally { // %AsyncFunctionPromiseRelease(.promise); // } Block* result = factory()->NewBlock(nullptr, 2, true, kNoSourcePosition); // .promise = %AsyncFunctionPromiseCreate(); Statement* set_promise; { Expression* create_promise = factory()->NewCallRuntime( Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX, new (zone()) ZoneList<Expression*>(0, zone()), kNoSourcePosition); Assignment* assign_promise = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(PromiseVariable()), create_promise, kNoSourcePosition); set_promise = factory()->NewExpressionStatement(assign_promise, kNoSourcePosition); } result->statements()->Add(set_promise, zone()); // catch (.catch) { return %RejectPromise(.promise, .catch), .promise } Scope* catch_scope = NewScope(CATCH_SCOPE); catch_scope->set_is_hidden(); Variable* catch_variable = catch_scope->DeclareLocal(ast_value_factory()->dot_catch_string(), VAR); Block* catch_block = factory()->NewBlock(nullptr, 1, true, kNoSourcePosition); Expression* promise_reject = BuildRejectPromise( factory()->NewVariableProxy(catch_variable), kNoSourcePosition); ReturnStatement* return_promise_reject = factory()->NewReturnStatement(promise_reject, kNoSourcePosition); catch_block->statements()->Add(return_promise_reject, zone()); TryStatement* try_catch_statement = factory()->NewTryCatchStatementForAsyncAwait(inner_block, catch_scope, catch_variable, catch_block, kNoSourcePosition); // There is no TryCatchFinally node, so wrap it in an outer try/finally Block* outer_try_block = factory()->NewBlock(nullptr, 1, true, kNoSourcePosition); outer_try_block->statements()->Add(try_catch_statement, zone()); // finally { %AsyncFunctionPromiseRelease(.promise) } Block* finally_block = factory()->NewBlock(nullptr, 1, true, kNoSourcePosition); { ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); Expression* call_promise_release = factory()->NewCallRuntime( Context::ASYNC_FUNCTION_PROMISE_RELEASE_INDEX, args, kNoSourcePosition); Statement* promise_release = factory()->NewExpressionStatement( call_promise_release, kNoSourcePosition); finally_block->statements()->Add(promise_release, zone()); } Statement* try_finally_statement = factory()->NewTryFinallyStatement( outer_try_block, finally_block, kNoSourcePosition); result->statements()->Add(try_finally_statement, zone()); return result; } Assignment* Parser::BuildCreateJSGeneratorObject(int pos, FunctionKind kind) { // .generator = %CreateJSGeneratorObject(...); DCHECK_NOT_NULL(function_state_->generator_object_variable()); ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(factory()->NewThisFunction(pos), zone()); args->Add(IsArrowFunction(kind) ? GetLiteralUndefined(pos) : ThisExpression(kNoSourcePosition), zone()); Expression* allocation = factory()->NewCallRuntime(Runtime::kCreateJSGeneratorObject, args, pos); VariableProxy* proxy = factory()->NewVariableProxy(function_state_->generator_object_variable()); return factory()->NewAssignment(Token::INIT, proxy, allocation, kNoSourcePosition); } Expression* Parser::BuildResolvePromise(Expression* value, int pos) { // %ResolvePromise(.promise, value), .promise ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); args->Add(value, zone()); Expression* call_runtime = factory()->NewCallRuntime(Context::PROMISE_RESOLVE_INDEX, args, pos); return factory()->NewBinaryOperation( Token::COMMA, call_runtime, factory()->NewVariableProxy(PromiseVariable()), pos); } Expression* Parser::BuildRejectPromise(Expression* value, int pos) { // %promise_internal_reject(.promise, value, false), .promise // Disables the additional debug event for the rejection since a debug event // already happened for the exception that got us here. ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(3, zone()); args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); args->Add(value, zone()); args->Add(factory()->NewBooleanLiteral(false, pos), zone()); Expression* call_runtime = factory()->NewCallRuntime( Context::PROMISE_INTERNAL_REJECT_INDEX, args, pos); return factory()->NewBinaryOperation( Token::COMMA, call_runtime, factory()->NewVariableProxy(PromiseVariable()), pos); } Variable* Parser::PromiseVariable() { // Based on the various compilation paths, there are many different code // paths which may be the first to access the Promise temporary. Whichever // comes first should create it and stash it in the FunctionState. Variable* promise = function_state_->promise_variable(); if (function_state_->promise_variable() == nullptr) { promise = function_state_->scope()->DeclarePromiseVar( ast_value_factory()->empty_string()); } return promise; } Expression* Parser::BuildInitialYield(int pos, FunctionKind kind) { Assignment* assignment = BuildCreateJSGeneratorObject(pos, kind); VariableProxy* generator = factory()->NewVariableProxy(function_state_->generator_object_variable()); // The position of the yield is important for reporting the exception // caused by calling the .throw method on a generator suspended at the // initial yield (i.e. right after generator instantiation). return factory()->NewYield(generator, assignment, scope()->start_position(), Yield::kOnExceptionThrow); } ZoneList<Statement*>* Parser::ParseFunction( const AstRawString* function_name, int pos, FunctionKind kind, FunctionLiteral::FunctionType function_type, DeclarationScope* function_scope, int* num_parameters, int* function_length, bool* has_duplicate_parameters, int* expected_property_count, bool* ok) { ParsingModeScope mode(this, allow_lazy_ ? PARSE_LAZILY : PARSE_EAGERLY); FunctionState function_state(&function_state_, &scope_, function_scope); DuplicateFinder duplicate_finder; ExpressionClassifier formals_classifier(this, &duplicate_finder); if (IsResumableFunction(kind)) PrepareGeneratorVariables(); int expected_parameters_end_pos = parameters_end_pos_; if (expected_parameters_end_pos != kNoSourcePosition) { // This is the first function encountered in a CreateDynamicFunction eval. parameters_end_pos_ = kNoSourcePosition; // The function name should have been ignored, giving us the empty string // here. DCHECK_EQ(function_name, ast_value_factory()->empty_string()); } ParserFormalParameters formals(function_scope); ParseFormalParameterList(&formals, CHECK_OK); if (expected_parameters_end_pos != kNoSourcePosition) { // Check for '(' or ')' shenanigans in the parameter string for dynamic // functions. int position = peek_position(); if (position < expected_parameters_end_pos) { ReportMessageAt(Scanner::Location(position, position + 1), MessageTemplate::kArgStringTerminatesParametersEarly); *ok = false; return nullptr; } else if (position > expected_parameters_end_pos) { ReportMessageAt(Scanner::Location(expected_parameters_end_pos - 2, expected_parameters_end_pos), MessageTemplate::kUnexpectedEndOfArgString); *ok = false; return nullptr; } } Expect(Token::RPAREN, CHECK_OK); int formals_end_position = scanner()->location().end_pos; *num_parameters = formals.num_parameters(); *function_length = formals.function_length; CheckArityRestrictions(formals.arity, kind, formals.has_rest, function_scope->start_position(), formals_end_position, CHECK_OK); Expect(Token::LBRACE, CHECK_OK); ZoneList<Statement*>* body = new (zone()) ZoneList<Statement*>(8, zone()); ParseFunctionBody(body, function_name, pos, formals, kind, function_type, ok); // Validate parameter names. We can do this only after parsing the function, // since the function can declare itself strict. const bool allow_duplicate_parameters = is_sloppy(function_scope->language_mode()) && formals.is_simple && !IsConciseMethod(kind); ValidateFormalParameters(function_scope->language_mode(), allow_duplicate_parameters, CHECK_OK); RewriteDestructuringAssignments(); *has_duplicate_parameters = !classifier()->is_valid_formal_parameter_list_without_duplicates(); *expected_property_count = function_state.expected_property_count(); return body; } void Parser::DeclareClassVariable(const AstRawString* name, ClassInfo* class_info, int class_token_pos, bool* ok) { #ifdef DEBUG scope()->SetScopeName(name); #endif if (name != nullptr) { class_info->proxy = factory()->NewVariableProxy(name, NORMAL_VARIABLE); Declaration* declaration = factory()->NewVariableDeclaration( class_info->proxy, scope(), class_token_pos); Declare(declaration, DeclarationDescriptor::NORMAL, CONST, Variable::DefaultInitializationFlag(CONST), ok); } } // This method declares a property of the given class. It updates the // following fields of class_info, as appropriate: // - constructor // - properties void Parser::DeclareClassProperty(const AstRawString* class_name, ClassLiteralProperty* property, ClassLiteralProperty::Kind kind, bool is_static, bool is_constructor, ClassInfo* class_info, bool* ok) { if (is_constructor) { DCHECK(!class_info->constructor); class_info->constructor = GetPropertyValue(property)->AsFunctionLiteral(); DCHECK_NOT_NULL(class_info->constructor); class_info->constructor->set_raw_name( class_name != nullptr ? class_name : ast_value_factory()->empty_string()); return; } if (property->kind() == ClassLiteralProperty::FIELD) { DCHECK(allow_harmony_class_fields()); // TODO(littledan): Implement class fields } class_info->properties->Add(property, zone()); } // This method rewrites a class literal into a do-expression. // It uses the following fields of class_info: // - constructor (if missing, it updates it with a default constructor) // - proxy // - extends // - properties // - has_name_static_property // - has_static_computed_names Expression* Parser::RewriteClassLiteral(const AstRawString* name, ClassInfo* class_info, int pos, bool* ok) { int end_pos = scanner()->location().end_pos; Block* do_block = factory()->NewBlock(nullptr, 1, false, pos); Variable* result_var = NewTemporary(ast_value_factory()->empty_string()); DoExpression* do_expr = factory()->NewDoExpression(do_block, result_var, pos); bool has_extends = class_info->extends != nullptr; bool has_default_constructor = class_info->constructor == nullptr; if (has_default_constructor) { class_info->constructor = DefaultConstructor(name, has_extends, pos, end_pos); } scope()->set_end_position(end_pos); if (name != nullptr) { DCHECK_NOT_NULL(class_info->proxy); class_info->proxy->var()->set_initializer_position(end_pos); } ClassLiteral* class_literal = factory()->NewClassLiteral( class_info->proxy, class_info->extends, class_info->constructor, class_info->properties, pos, end_pos, class_info->has_name_static_property, class_info->has_static_computed_names); do_block->statements()->Add( factory()->NewExpressionStatement( factory()->NewAssignment(Token::ASSIGN, factory()->NewVariableProxy(result_var), class_literal, kNoSourcePosition), pos), zone()); do_block->set_scope(scope()->FinalizeBlockScope()); do_expr->set_represented_function(class_info->constructor); AddFunctionForNameInference(class_info->constructor); return do_expr; } Literal* Parser::GetLiteralUndefined(int position) { return factory()->NewUndefinedLiteral(position); } void Parser::CheckConflictingVarDeclarations(Scope* scope, bool* ok) { Declaration* decl = scope->CheckConflictingVarDeclarations(); if (decl != NULL) { // In ES6, conflicting variable bindings are early errors. const AstRawString* name = decl->proxy()->raw_name(); int position = decl->proxy()->position(); Scanner::Location location = position == kNoSourcePosition ? Scanner::Location::invalid() : Scanner::Location(position, position + 1); ReportMessageAt(location, MessageTemplate::kVarRedeclaration, name); *ok = false; } } void Parser::InsertShadowingVarBindingInitializers(Block* inner_block) { // For each var-binding that shadows a parameter, insert an assignment // initializing the variable with the parameter. Scope* inner_scope = inner_block->scope(); DCHECK(inner_scope->is_declaration_scope()); Scope* function_scope = inner_scope->outer_scope(); DCHECK(function_scope->is_function_scope()); BlockState block_state(&scope_, inner_scope); for (Declaration* decl : *inner_scope->declarations()) { if (decl->proxy()->var()->mode() != VAR || !decl->IsVariableDeclaration()) { continue; } const AstRawString* name = decl->proxy()->raw_name(); Variable* parameter = function_scope->LookupLocal(name); if (parameter == nullptr) continue; VariableProxy* to = NewUnresolved(name); VariableProxy* from = factory()->NewVariableProxy(parameter); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, to, from, kNoSourcePosition); Statement* statement = factory()->NewExpressionStatement(assignment, kNoSourcePosition); inner_block->statements()->InsertAt(0, statement, zone()); } } void Parser::InsertSloppyBlockFunctionVarBindings(DeclarationScope* scope) { // For the outermost eval scope, we cannot hoist during parsing: let // declarations in the surrounding scope may prevent hoisting, but the // information is unaccessible during parsing. In this case, we hoist later in // DeclarationScope::Analyze. if (scope->is_eval_scope() && scope->outer_scope() == original_scope_) { return; } scope->HoistSloppyBlockFunctions(factory()); } // ---------------------------------------------------------------------------- // Parser support bool Parser::TargetStackContainsLabel(const AstRawString* label) { for (ParserTarget* t = target_stack_; t != NULL; t = t->previous()) { if (ContainsLabel(t->statement()->labels(), label)) return true; } return false; } BreakableStatement* Parser::LookupBreakTarget(const AstRawString* label, bool* ok) { bool anonymous = label == NULL; for (ParserTarget* t = target_stack_; t != NULL; t = t->previous()) { BreakableStatement* stat = t->statement(); if ((anonymous && stat->is_target_for_anonymous()) || (!anonymous && ContainsLabel(stat->labels(), label))) { return stat; } } return NULL; } IterationStatement* Parser::LookupContinueTarget(const AstRawString* label, bool* ok) { bool anonymous = label == NULL; for (ParserTarget* t = target_stack_; t != NULL; t = t->previous()) { IterationStatement* stat = t->statement()->AsIterationStatement(); if (stat == NULL) continue; DCHECK(stat->is_target_for_anonymous()); if (anonymous || ContainsLabel(stat->labels(), label)) { return stat; } } return NULL; } void Parser::HandleSourceURLComments(Isolate* isolate, Handle<Script> script) { Handle<String> source_url = scanner_.SourceUrl(isolate); if (!source_url.is_null()) { script->set_source_url(*source_url); } Handle<String> source_mapping_url = scanner_.SourceMappingUrl(isolate); if (!source_mapping_url.is_null()) { script->set_source_mapping_url(*source_mapping_url); } } void Parser::ReportErrors(Isolate* isolate, Handle<Script> script) { if (stack_overflow()) { isolate->StackOverflow(); } else { DCHECK(pending_error_handler_.has_pending_error()); // Internalize ast values for throwing the pending error. ast_value_factory()->Internalize(isolate); pending_error_handler_.ThrowPendingError(isolate, script); } } void Parser::UpdateStatistics(Isolate* isolate, Handle<Script> script) { // Move statistics to Isolate. for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; ++feature) { if (use_counts_[feature] > 0) { isolate->CountUsage(v8::Isolate::UseCounterFeature(feature)); } } if (scanner_.FoundHtmlComment()) { isolate->CountUsage(v8::Isolate::kHtmlComment); if (script->line_offset() == 0 && script->column_offset() == 0) { isolate->CountUsage(v8::Isolate::kHtmlCommentInExternalScript); } } isolate->counters()->total_preparse_skipped()->Increment( total_preparse_skipped_); if (!parsing_on_main_thread_ && FLAG_runtime_stats == v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE) { // Copy over the counters from the background thread to the main counters on // the isolate. isolate->counters()->runtime_call_stats()->Add(runtime_call_stats_); } } void Parser::ParseOnBackground(ParseInfo* info) { parsing_on_main_thread_ = false; DCHECK(info->literal() == NULL); FunctionLiteral* result = NULL; ParserLogger logger; if (produce_cached_parse_data()) { if (allow_lazy_) { log_ = &logger; } else { compile_options_ = ScriptCompiler::kNoCompileOptions; } } if (FLAG_runtime_stats) { // Create separate runtime stats for background parsing. runtime_call_stats_ = new (zone()) RuntimeCallStats(); } std::unique_ptr<Utf16CharacterStream> stream; Utf16CharacterStream* stream_ptr; if (info->character_stream()) { DCHECK(info->source_stream() == nullptr); stream_ptr = info->character_stream(); } else { DCHECK(info->character_stream() == nullptr); stream.reset(ScannerStream::For(info->source_stream(), info->source_stream_encoding(), runtime_call_stats_)); stream_ptr = stream.get(); } DCHECK(info->maybe_outer_scope_info().is_null()); DCHECK(original_scope_); // When streaming, we don't know the length of the source until we have parsed // it. The raw data can be UTF-8, so we wouldn't know the source length until // we have decoded it anyway even if we knew the raw data length (which we // don't). We work around this by storing all the scopes which need their end // position set at the end of the script (the top scope and possible eval // scopes) and set their end position after we know the script length. if (info->is_toplevel()) { fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); scanner_.Initialize(stream_ptr); result = DoParseProgram(info); } else { result = DoParseFunction(info, info->function_name(), stream_ptr); } info->set_literal(result); // We cannot internalize on a background thread; a foreground task will take // care of calling Parser::Internalize just before compilation. if (produce_cached_parse_data()) { if (result != NULL) *info->cached_data() = logger.GetScriptData(); log_ = NULL; } if (FLAG_runtime_stats & v8::tracing::TracingCategoryObserver::ENABLED_BY_TRACING) { auto value = v8::tracing::TracedValue::Create(); runtime_call_stats_->Dump(value.get()); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), "V8.RuntimeStats", TRACE_EVENT_SCOPE_THREAD, "runtime-call-stats", std::move(value)); } } Parser::TemplateLiteralState Parser::OpenTemplateLiteral(int pos) { return new (zone()) TemplateLiteral(zone(), pos); } void Parser::AddTemplateSpan(TemplateLiteralState* state, bool should_cook, bool tail) { DCHECK(should_cook || allow_harmony_template_escapes()); int pos = scanner()->location().beg_pos; int end = scanner()->location().end_pos - (tail ? 1 : 2); const AstRawString* trv = scanner()->CurrentRawSymbol(ast_value_factory()); Literal* raw = factory()->NewStringLiteral(trv, pos); if (should_cook) { const AstRawString* tv = scanner()->CurrentSymbol(ast_value_factory()); Literal* cooked = factory()->NewStringLiteral(tv, pos); (*state)->AddTemplateSpan(cooked, raw, end, zone()); } else { (*state)->AddTemplateSpan(GetLiteralUndefined(pos), raw, end, zone()); } } void Parser::AddTemplateExpression(TemplateLiteralState* state, Expression* expression) { (*state)->AddExpression(expression, zone()); } Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start, Expression* tag) { TemplateLiteral* lit = *state; int pos = lit->position(); const ZoneList<Expression*>* cooked_strings = lit->cooked(); const ZoneList<Expression*>* raw_strings = lit->raw(); const ZoneList<Expression*>* expressions = lit->expressions(); DCHECK_EQ(cooked_strings->length(), raw_strings->length()); DCHECK_EQ(cooked_strings->length(), expressions->length() + 1); if (!tag) { // Build tree of BinaryOps to simplify code-generation Expression* expr = cooked_strings->at(0); int i = 0; while (i < expressions->length()) { Expression* sub = expressions->at(i++); Expression* cooked_str = cooked_strings->at(i); // Let middle be ToString(sub). ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(sub, zone()); Expression* middle = factory()->NewCallRuntime(Runtime::kInlineToString, args, sub->position()); expr = factory()->NewBinaryOperation( Token::ADD, factory()->NewBinaryOperation( Token::ADD, expr, middle, expr->position()), cooked_str, sub->position()); } return expr; } else { uint32_t hash = ComputeTemplateLiteralHash(lit); // $getTemplateCallSite ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone()); args->Add(factory()->NewArrayLiteral( const_cast<ZoneList<Expression*>*>(cooked_strings), pos), zone()); args->Add(factory()->NewArrayLiteral( const_cast<ZoneList<Expression*>*>(raw_strings), pos), zone()); // Truncate hash to Smi-range. Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); args->Add(factory()->NewNumberLiteral(hash_obj->value(), pos), zone()); Expression* call_site = factory()->NewCallRuntime( Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); // Call TagFn ZoneList<Expression*>* call_args = new (zone()) ZoneList<Expression*>(expressions->length() + 1, zone()); call_args->Add(call_site, zone()); call_args->AddAll(*expressions, zone()); return factory()->NewCall(tag, call_args, pos); } } uint32_t Parser::ComputeTemplateLiteralHash(const TemplateLiteral* lit) { const ZoneList<Expression*>* raw_strings = lit->raw(); int total = raw_strings->length(); DCHECK(total); uint32_t running_hash = 0; for (int index = 0; index < total; ++index) { if (index) { running_hash = StringHasher::ComputeRunningHashOneByte( running_hash, "${}", 3); } const AstRawString* raw_string = raw_strings->at(index)->AsLiteral()->raw_value()->AsString(); if (raw_string->is_one_byte()) { const char* data = reinterpret_cast<const char*>(raw_string->raw_data()); running_hash = StringHasher::ComputeRunningHashOneByte( running_hash, data, raw_string->length()); } else { const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); running_hash = StringHasher::ComputeRunningHash(running_hash, data, raw_string->length()); } } return running_hash; } namespace { bool OnlyLastArgIsSpread(ZoneList<Expression*>* args) { for (int i = 0; i < args->length() - 1; i++) { if (args->at(i)->IsSpread()) { return false; } } return args->at(args->length() - 1)->IsSpread(); } } // namespace ZoneList<Expression*>* Parser::PrepareSpreadArguments( ZoneList<Expression*>* list) { ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); if (list->length() == 1) { // Spread-call with single spread argument produces an InternalArray // containing the values from the array. // // Function is called or constructed with the produced array of arguments // // EG: Apply(Func, Spread(spread0)) ZoneList<Expression*>* spread_list = new (zone()) ZoneList<Expression*>(0, zone()); spread_list->Add(list->at(0)->AsSpread()->expression(), zone()); args->Add(factory()->NewCallRuntime(Runtime::kSpreadIterablePrepare, spread_list, kNoSourcePosition), zone()); return args; } else { // Spread-call with multiple arguments produces array literals for each // sequences of unspread arguments, and converts each spread iterable to // an Internal array. Finally, all of these produced arrays are flattened // into a single InternalArray, containing the arguments for the call. // // EG: Apply(Func, Flatten([unspread0, unspread1], Spread(spread0), // Spread(spread1), [unspread2, unspread3])) int i = 0; int n = list->length(); while (i < n) { if (!list->at(i)->IsSpread()) { ZoneList<Expression*>* unspread = new (zone()) ZoneList<Expression*>(1, zone()); // Push array of unspread parameters while (i < n && !list->at(i)->IsSpread()) { unspread->Add(list->at(i++), zone()); } args->Add(factory()->NewArrayLiteral(unspread, kNoSourcePosition), zone()); if (i == n) break; } // Push eagerly spread argument ZoneList<Expression*>* spread_list = new (zone()) ZoneList<Expression*>(1, zone()); spread_list->Add(list->at(i++)->AsSpread()->expression(), zone()); args->Add(factory()->NewCallRuntime(Context::SPREAD_ITERABLE_INDEX, spread_list, kNoSourcePosition), zone()); } list = new (zone()) ZoneList<Expression*>(1, zone()); list->Add(factory()->NewCallRuntime(Context::SPREAD_ARGUMENTS_INDEX, args, kNoSourcePosition), zone()); return list; } UNREACHABLE(); } Expression* Parser::SpreadCall(Expression* function, ZoneList<Expression*>* args, int pos, Call::PossiblyEval is_possibly_eval) { // Handle these cases in BytecodeGenerator. // [Call,New]WithSpread bytecodes aren't used with tailcalls - see // https://crbug.com/v8/5867 if (!allow_tailcalls() && OnlyLastArgIsSpread(args)) { return factory()->NewCall(function, args, pos); } if (function->IsSuperCallReference()) { // Super calls // $super_constructor = %_GetSuperConstructor(<this-function>) // %reflect_construct($super_constructor, args, new.target) args = PrepareSpreadArguments(args); ZoneList<Expression*>* tmp = new (zone()) ZoneList<Expression*>(1, zone()); tmp->Add(function->AsSuperCallReference()->this_function_var(), zone()); Expression* super_constructor = factory()->NewCallRuntime( Runtime::kInlineGetSuperConstructor, tmp, pos); args->InsertAt(0, super_constructor, zone()); args->Add(function->AsSuperCallReference()->new_target_var(), zone()); return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); } else { args = PrepareSpreadArguments(args); if (function->IsProperty()) { // Method calls if (function->AsProperty()->IsSuperAccess()) { Expression* home = ThisExpression(kNoSourcePosition); args->InsertAt(0, function, zone()); args->InsertAt(1, home, zone()); } else { Variable* temp = NewTemporary(ast_value_factory()->empty_string()); VariableProxy* obj = factory()->NewVariableProxy(temp); Assignment* assign_obj = factory()->NewAssignment( Token::ASSIGN, obj, function->AsProperty()->obj(), kNoSourcePosition); function = factory()->NewProperty( assign_obj, function->AsProperty()->key(), kNoSourcePosition); args->InsertAt(0, function, zone()); obj = factory()->NewVariableProxy(temp); args->InsertAt(1, obj, zone()); } } else { // Non-method calls args->InsertAt(0, function, zone()); args->InsertAt(1, factory()->NewUndefinedLiteral(kNoSourcePosition), zone()); } return factory()->NewCallRuntime(Context::REFLECT_APPLY_INDEX, args, pos); } } Expression* Parser::SpreadCallNew(Expression* function, ZoneList<Expression*>* args, int pos) { if (OnlyLastArgIsSpread(args)) { // Handle in BytecodeGenerator. return factory()->NewCallNew(function, args, pos); } args = PrepareSpreadArguments(args); args->InsertAt(0, function, zone()); return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); } void Parser::SetLanguageMode(Scope* scope, LanguageMode mode) { v8::Isolate::UseCounterFeature feature; if (is_sloppy(mode)) feature = v8::Isolate::kSloppyMode; else if (is_strict(mode)) feature = v8::Isolate::kStrictMode; else UNREACHABLE(); ++use_counts_[feature]; scope->SetLanguageMode(mode); } void Parser::SetAsmModule() { // Store the usage count; The actual use counter on the isolate is // incremented after parsing is done. ++use_counts_[v8::Isolate::kUseAsm]; DCHECK(scope()->is_declaration_scope()); scope()->AsDeclarationScope()->set_asm_module(); } void Parser::MarkCollectedTailCallExpressions() { const ZoneList<Expression*>& tail_call_expressions = function_state_->tail_call_expressions().expressions(); for (int i = 0; i < tail_call_expressions.length(); ++i) { MarkTailPosition(tail_call_expressions[i]); } } Expression* Parser::ExpressionListToExpression(ZoneList<Expression*>* args) { Expression* expr = args->at(0); for (int i = 1; i < args->length(); ++i) { expr = factory()->NewBinaryOperation(Token::COMMA, expr, args->at(i), expr->position()); } return expr; } // This method intoduces the line initializing the generator object // when desugaring the body of async_function. void Parser::PrepareAsyncFunctionBody(ZoneList<Statement*>* body, FunctionKind kind, int pos) { // When parsing an async arrow function, we get here without having called // PrepareGeneratorVariables yet, so do it now. if (function_state_->generator_object_variable() == nullptr) { PrepareGeneratorVariables(); } body->Add(factory()->NewExpressionStatement( BuildCreateJSGeneratorObject(pos, kind), kNoSourcePosition), zone()); } // This method completes the desugaring of the body of async_function. void Parser::RewriteAsyncFunctionBody(ZoneList<Statement*>* body, Block* block, Expression* return_value, bool* ok) { // function async_function() { // .generator_object = %CreateJSGeneratorObject(); // BuildRejectPromiseOnException({ // ... block ... // return %ResolvePromise(.promise, expr), .promise; // }) // } return_value = BuildResolvePromise(return_value, return_value->position()); block->statements()->Add( factory()->NewReturnStatement(return_value, return_value->position()), zone()); block = BuildRejectPromiseOnException(block); body->Add(block, zone()); } Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) { // yield do { // tmp = <operand>; // %AsyncFunctionAwait(.generator_object, tmp, .promise); // .promise // } // The value of the expression is returned to the caller of the async // function for the first yield statement; for this, .promise is the // appropriate return value, being a Promise that will be fulfilled or // rejected with the appropriate value by the desugaring. Subsequent yield // occurrences will return to the AsyncFunctionNext call within the // implemementation of the intermediate throwaway Promise's then handler. // This handler has nothing useful to do with the value, as the Promise is // ignored. If we yielded the value of the throwawayPromise that // AsyncFunctionAwait creates as an intermediate, it would create a memory // leak; we must return .promise instead; // The operand needs to be evaluated on a separate statement in order to get // a break location, and the .promise needs to be read earlier so that it // doesn't insert a false location. // TODO(littledan): investigate why this ordering is needed in more detail. Variable* generator_object_variable = function_state_->generator_object_variable(); DCHECK_NOT_NULL(generator_object_variable); const int nopos = kNoSourcePosition; Block* do_block = factory()->NewBlock(nullptr, 2, false, nopos); Variable* promise = PromiseVariable(); // Wrap value evaluation to provide a break location. Variable* temp_var = NewTemporary(ast_value_factory()->empty_string()); Expression* value_assignment = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(temp_var), value, nopos); do_block->statements()->Add( factory()->NewExpressionStatement(value_assignment, value->position()), zone()); ZoneList<Expression*>* async_function_await_args = new (zone()) ZoneList<Expression*>(3, zone()); Expression* generator_object = factory()->NewVariableProxy(generator_object_variable); async_function_await_args->Add(generator_object, zone()); async_function_await_args->Add(factory()->NewVariableProxy(temp_var), zone()); async_function_await_args->Add(factory()->NewVariableProxy(promise), zone()); // The parser emits calls to AsyncFunctionAwaitCaught, but the // AstNumberingVisitor will rewrite this to AsyncFunctionAwaitUncaught // if there is no local enclosing try/catch block. Expression* async_function_await = factory()->NewCallRuntime(Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX, async_function_await_args, nopos); do_block->statements()->Add( factory()->NewExpressionStatement(async_function_await, await_pos), zone()); // Wrap await to provide a break location between value evaluation and yield. Expression* do_expr = factory()->NewDoExpression(do_block, promise, nopos); generator_object = factory()->NewVariableProxy(generator_object_variable); return factory()->NewYield(generator_object, do_expr, nopos, Yield::kOnExceptionRethrow); } class NonPatternRewriter : public AstExpressionRewriter { public: NonPatternRewriter(uintptr_t stack_limit, Parser* parser) : AstExpressionRewriter(stack_limit), parser_(parser) {} ~NonPatternRewriter() override {} private: bool RewriteExpression(Expression* expr) override { if (expr->IsRewritableExpression()) return true; // Rewrite only what could have been a pattern but is not. if (expr->IsArrayLiteral()) { // Spread rewriting in array literals. ArrayLiteral* lit = expr->AsArrayLiteral(); VisitExpressions(lit->values()); replacement_ = parser_->RewriteSpreads(lit); return false; } if (expr->IsObjectLiteral()) { return true; } if (expr->IsBinaryOperation() && expr->AsBinaryOperation()->op() == Token::COMMA) { return true; } // Everything else does not need rewriting. return false; } void VisitLiteralProperty(LiteralProperty* property) override { if (property == nullptr) return; // Do not rewrite (computed) key expressions AST_REWRITE_PROPERTY(Expression, property, value); } Parser* parser_; }; void Parser::RewriteNonPattern(bool* ok) { ValidateExpression(CHECK_OK_VOID); auto non_patterns_to_rewrite = function_state_->non_patterns_to_rewrite(); int begin = classifier()->GetNonPatternBegin(); int end = non_patterns_to_rewrite->length(); if (begin < end) { NonPatternRewriter rewriter(stack_limit_, this); for (int i = begin; i < end; i++) { DCHECK(non_patterns_to_rewrite->at(i)->IsRewritableExpression()); rewriter.Rewrite(non_patterns_to_rewrite->at(i)); } non_patterns_to_rewrite->Rewind(begin); } } void Parser::RewriteDestructuringAssignments() { const auto& assignments = function_state_->destructuring_assignments_to_rewrite(); for (int i = assignments.length() - 1; i >= 0; --i) { // Rewrite list in reverse, so that nested assignment patterns are rewritten // correctly. const DestructuringAssignment& pair = assignments.at(i); RewritableExpression* to_rewrite = pair.assignment->AsRewritableExpression(); DCHECK_NOT_NULL(to_rewrite); if (!to_rewrite->is_rewritten()) { // Since this function is called at the end of parsing the program, // pair.scope may already have been removed by FinalizeBlockScope in the // meantime. Scope* scope = pair.scope->GetUnremovedScope(); PatternRewriter::RewriteDestructuringAssignment(this, to_rewrite, scope); } } } Expression* Parser::RewriteExponentiation(Expression* left, Expression* right, int pos) { ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(left, zone()); args->Add(right, zone()); return factory()->NewCallRuntime(Context::MATH_POW_INDEX, args, pos); } Expression* Parser::RewriteAssignExponentiation(Expression* left, Expression* right, int pos) { ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); if (left->IsVariableProxy()) { VariableProxy* lhs = left->AsVariableProxy(); Expression* result; DCHECK_NOT_NULL(lhs->raw_name()); result = ExpressionFromIdentifier(lhs->raw_name(), lhs->position()); args->Add(left, zone()); args->Add(right, zone()); Expression* call = factory()->NewCallRuntime(Context::MATH_POW_INDEX, args, pos); return factory()->NewAssignment(Token::ASSIGN, result, call, pos); } else if (left->IsProperty()) { Property* prop = left->AsProperty(); auto temp_obj = NewTemporary(ast_value_factory()->empty_string()); auto temp_key = NewTemporary(ast_value_factory()->empty_string()); Expression* assign_obj = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(temp_obj), prop->obj(), kNoSourcePosition); Expression* assign_key = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(temp_key), prop->key(), kNoSourcePosition); args->Add(factory()->NewProperty(factory()->NewVariableProxy(temp_obj), factory()->NewVariableProxy(temp_key), left->position()), zone()); args->Add(right, zone()); Expression* call = factory()->NewCallRuntime(Context::MATH_POW_INDEX, args, pos); Expression* target = factory()->NewProperty( factory()->NewVariableProxy(temp_obj), factory()->NewVariableProxy(temp_key), kNoSourcePosition); Expression* assign = factory()->NewAssignment(Token::ASSIGN, target, call, pos); return factory()->NewBinaryOperation( Token::COMMA, assign_obj, factory()->NewBinaryOperation(Token::COMMA, assign_key, assign, pos), pos); } UNREACHABLE(); return nullptr; } Expression* Parser::RewriteSpreads(ArrayLiteral* lit) { // Array literals containing spreads are rewritten using do expressions, e.g. // [1, 2, 3, ...x, 4, ...y, 5] // is roughly rewritten as: // do { // $R = [1, 2, 3]; // for ($i of x) %AppendElement($R, $i); // %AppendElement($R, 4); // for ($j of y) %AppendElement($R, $j); // %AppendElement($R, 5); // $R // } // where $R, $i and $j are fresh temporary variables. ZoneList<Expression*>::iterator s = lit->FirstSpread(); if (s == lit->EndValue()) return nullptr; // no spread, no rewriting... Variable* result = NewTemporary(ast_value_factory()->dot_result_string()); // NOTE: The value assigned to R is the whole original array literal, // spreads included. This will be fixed before the rewritten AST is returned. // $R = lit Expression* init_result = factory()->NewAssignment( Token::INIT, factory()->NewVariableProxy(result), lit, kNoSourcePosition); Block* do_block = factory()->NewBlock(nullptr, 16, false, kNoSourcePosition); do_block->statements()->Add( factory()->NewExpressionStatement(init_result, kNoSourcePosition), zone()); // Traverse the array literal starting from the first spread. while (s != lit->EndValue()) { Expression* value = *s++; Spread* spread = value->AsSpread(); if (spread == nullptr) { // If the element is not a spread, we're adding a single: // %AppendElement($R, value) // or, in case of a hole, // ++($R.length) if (!value->IsLiteral() || !value->AsLiteral()->raw_value()->IsTheHole()) { ZoneList<Expression*>* append_element_args = NewExpressionList(2); append_element_args->Add(factory()->NewVariableProxy(result), zone()); append_element_args->Add(value, zone()); do_block->statements()->Add( factory()->NewExpressionStatement( factory()->NewCallRuntime(Runtime::kAppendElement, append_element_args, kNoSourcePosition), kNoSourcePosition), zone()); } else { Property* length_property = factory()->NewProperty( factory()->NewVariableProxy(result), factory()->NewStringLiteral(ast_value_factory()->length_string(), kNoSourcePosition), kNoSourcePosition); CountOperation* count_op = factory()->NewCountOperation( Token::INC, true /* prefix */, length_property, kNoSourcePosition); do_block->statements()->Add( factory()->NewExpressionStatement(count_op, kNoSourcePosition), zone()); } } else { // If it's a spread, we're adding a for/of loop iterating through it. Variable* each = NewTemporary(ast_value_factory()->dot_for_string()); Expression* subject = spread->expression(); // %AppendElement($R, each) Statement* append_body; { ZoneList<Expression*>* append_element_args = NewExpressionList(2); append_element_args->Add(factory()->NewVariableProxy(result), zone()); append_element_args->Add(factory()->NewVariableProxy(each), zone()); append_body = factory()->NewExpressionStatement( factory()->NewCallRuntime(Runtime::kAppendElement, append_element_args, kNoSourcePosition), kNoSourcePosition); } // for (each of spread) %AppendElement($R, each) ForOfStatement* loop = factory()->NewForOfStatement(nullptr, kNoSourcePosition); const bool finalize = false; InitializeForOfStatement(loop, factory()->NewVariableProxy(each), subject, append_body, finalize, IteratorType::kNormal); do_block->statements()->Add(loop, zone()); } } // Now, rewind the original array literal to truncate everything from the // first spread (included) until the end. This fixes $R's initialization. lit->RewindSpreads(); return factory()->NewDoExpression(do_block, result, lit->position()); } void Parser::QueueDestructuringAssignmentForRewriting(Expression* expr) { DCHECK(expr->IsRewritableExpression()); function_state_->AddDestructuringAssignment( DestructuringAssignment(expr, scope())); } void Parser::QueueNonPatternForRewriting(Expression* expr, bool* ok) { DCHECK(expr->IsRewritableExpression()); function_state_->AddNonPatternForRewriting(expr, ok); } void Parser::AddAccessorPrefixToFunctionName(bool is_get, FunctionLiteral* function, const AstRawString* name) { DCHECK_NOT_NULL(name); const AstRawString* prefix = is_get ? ast_value_factory()->get_space_string() : ast_value_factory()->set_space_string(); function->set_raw_name(ast_value_factory()->NewConsString(prefix, name)); } void Parser::SetFunctionNameFromPropertyName(ObjectLiteralProperty* property, const AstRawString* name) { DCHECK(property->kind() != ObjectLiteralProperty::GETTER); DCHECK(property->kind() != ObjectLiteralProperty::SETTER); // Computed name setting must happen at runtime. DCHECK(!property->is_computed_name()); // Ignore "__proto__" as a name when it's being used to set the [[Prototype]] // of an object literal. if (property->kind() == ObjectLiteralProperty::PROTOTYPE) return; Expression* value = property->value(); DCHECK(!value->IsAnonymousFunctionDefinition() || property->kind() == ObjectLiteralProperty::COMPUTED); SetFunctionName(value, name); } void Parser::SetFunctionNameFromIdentifierRef(Expression* value, Expression* identifier) { if (!identifier->IsVariableProxy()) return; SetFunctionName(value, identifier->AsVariableProxy()->raw_name()); } void Parser::SetFunctionName(Expression* value, const AstRawString* name) { DCHECK_NOT_NULL(name); if (!value->IsAnonymousFunctionDefinition()) return; auto function = value->AsFunctionLiteral(); if (function != nullptr) { function->set_raw_name(name); } else { DCHECK(value->IsDoExpression()); value->AsDoExpression()->represented_function()->set_raw_name(name); } } // Desugaring of yield* // ==================== // // With the help of do-expressions and function.sent, we desugar yield* into a // loop containing a "raw" yield (a yield that doesn't wrap an iterator result // object around its argument). Concretely, "yield* iterable" turns into // roughly the following code: // // do { // const kNext = 0; // const kReturn = 1; // const kThrow = 2; // // let input = undefined; // let mode = kNext; // let output = undefined; // // let iterator = GetIterator(iterable); // // while (true) { // // From the generator to the iterator: // // Forward input according to resume mode and obtain output. // switch (mode) { // case kNext: // output = iterator.next(input); // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); // break; // case kReturn: // IteratorClose(iterator, input, output); // See below. // break; // case kThrow: // let iteratorThrow = iterator.throw; // if (IS_NULL_OR_UNDEFINED(iteratorThrow)) { // IteratorClose(iterator); // See below. // throw MakeTypeError(kThrowMethodMissing); // } // output = %_Call(iteratorThrow, iterator, input); // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); // break; // } // if (output.done) break; // // // From the generator to its user: // // Forward output, receive new input, and determine resume mode. // mode = kReturn; // try { // try { // RawYield(output); // See explanation above. // mode = kNext; // } catch (error) { // mode = kThrow; // } // } finally { // input = function.sent; // continue; // } // } // // if (mode === kReturn) { // return {value: output.value, done: true}; // } // output.value // } // // IteratorClose(iterator) expands to the following: // // let iteratorReturn = iterator.return; // if (!IS_NULL_OR_UNDEFINED(iteratorReturn)) { // let output = %_Call(iteratorReturn, iterator); // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); // } // // IteratorClose(iterator, input, output) expands to the following: // // let iteratorReturn = iterator.return; // if (IS_NULL_OR_UNDEFINED(iteratorReturn)) return input; // output = %_Call(iteratorReturn, iterator, input); // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); Expression* Parser::RewriteYieldStar(Expression* generator, Expression* iterable, int pos) { const int nopos = kNoSourcePosition; // Forward definition for break/continue statements. WhileStatement* loop = factory()->NewWhileStatement(nullptr, nopos); // let input = undefined; Variable* var_input = NewTemporary(ast_value_factory()->empty_string()); Statement* initialize_input; { Expression* input_proxy = factory()->NewVariableProxy(var_input); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, input_proxy, factory()->NewUndefinedLiteral(nopos), nopos); initialize_input = factory()->NewExpressionStatement(assignment, nopos); } // let mode = kNext; Variable* var_mode = NewTemporary(ast_value_factory()->empty_string()); Statement* initialize_mode; { Expression* mode_proxy = factory()->NewVariableProxy(var_mode); Expression* knext = factory()->NewSmiLiteral(JSGeneratorObject::kNext, nopos); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos); initialize_mode = factory()->NewExpressionStatement(assignment, nopos); } // let output = undefined; Variable* var_output = NewTemporary(ast_value_factory()->empty_string()); Statement* initialize_output; { Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, output_proxy, factory()->NewUndefinedLiteral(nopos), nopos); initialize_output = factory()->NewExpressionStatement(assignment, nopos); } // let iterator = GetIterator(iterable); Variable* var_iterator = NewTemporary(ast_value_factory()->empty_string()); Statement* get_iterator; { Expression* iterator = factory()->NewGetIterator(iterable, IteratorType::kNormal, nopos); Expression* iterator_proxy = factory()->NewVariableProxy(var_iterator); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, iterator_proxy, iterator, nopos); get_iterator = factory()->NewExpressionStatement(assignment, nopos); } // output = iterator.next(input); Statement* call_next; { Expression* iterator_proxy = factory()->NewVariableProxy(var_iterator); Expression* literal = factory()->NewStringLiteral(ast_value_factory()->next_string(), nopos); Expression* next_property = factory()->NewProperty(iterator_proxy, literal, nopos); Expression* input_proxy = factory()->NewVariableProxy(var_input); auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(input_proxy, zone()); Expression* call = factory()->NewCall(next_property, args, nopos); Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, output_proxy, call, nopos); call_next = factory()->NewExpressionStatement(assignment, nopos); } // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); Statement* validate_next_output; { Expression* is_receiver_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); is_receiver_call = factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos); } Statement* throw_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); Expression* call = factory()->NewCallRuntime( Runtime::kThrowIteratorResultNotAnObject, args, nopos); throw_call = factory()->NewExpressionStatement(call, nopos); } validate_next_output = factory()->NewIfStatement( is_receiver_call, factory()->NewEmptyStatement(nopos), throw_call, nopos); } // let iteratorThrow = iterator.throw; Variable* var_throw = NewTemporary(ast_value_factory()->empty_string()); Statement* get_throw; { Expression* iterator_proxy = factory()->NewVariableProxy(var_iterator); Expression* literal = factory()->NewStringLiteral(ast_value_factory()->throw_string(), nopos); Expression* property = factory()->NewProperty(iterator_proxy, literal, nopos); Expression* throw_proxy = factory()->NewVariableProxy(var_throw); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, throw_proxy, property, nopos); get_throw = factory()->NewExpressionStatement(assignment, nopos); } // if (IS_NULL_OR_UNDEFINED(iteratorThrow) { // IteratorClose(iterator); // throw MakeTypeError(kThrowMethodMissing); // } Statement* check_throw; { Expression* condition = factory()->NewCompareOperation( Token::EQ, factory()->NewVariableProxy(var_throw), factory()->NewNullLiteral(nopos), nopos); Expression* call = NewThrowTypeError(MessageTemplate::kThrowMethodMissing, ast_value_factory()->empty_string(), nopos); Statement* throw_call = factory()->NewExpressionStatement(call, nopos); Block* then = factory()->NewBlock(nullptr, 4 + 1, false, nopos); BuildIteratorCloseForCompletion( scope(), then->statements(), var_iterator, factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), IteratorType::kNormal); then->statements()->Add(throw_call, zone()); check_throw = factory()->NewIfStatement( condition, then, factory()->NewEmptyStatement(nopos), nopos); } // output = %_Call(iteratorThrow, iterator, input); Statement* call_throw; { auto args = new (zone()) ZoneList<Expression*>(3, zone()); args->Add(factory()->NewVariableProxy(var_throw), zone()); args->Add(factory()->NewVariableProxy(var_iterator), zone()); args->Add(factory()->NewVariableProxy(var_input), zone()); Expression* call = factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, factory()->NewVariableProxy(var_output), call, nopos); call_throw = factory()->NewExpressionStatement(assignment, nopos); } // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); Statement* validate_throw_output; { Expression* is_receiver_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); is_receiver_call = factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos); } Statement* throw_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); Expression* call = factory()->NewCallRuntime( Runtime::kThrowIteratorResultNotAnObject, args, nopos); throw_call = factory()->NewExpressionStatement(call, nopos); } validate_throw_output = factory()->NewIfStatement( is_receiver_call, factory()->NewEmptyStatement(nopos), throw_call, nopos); } // if (output.done) break; Statement* if_done; { Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* literal = factory()->NewStringLiteral(ast_value_factory()->done_string(), nopos); Expression* property = factory()->NewProperty(output_proxy, literal, nopos); BreakStatement* break_loop = factory()->NewBreakStatement(loop, nopos); if_done = factory()->NewIfStatement( property, break_loop, factory()->NewEmptyStatement(nopos), nopos); } // mode = kReturn; Statement* set_mode_return; { Expression* mode_proxy = factory()->NewVariableProxy(var_mode); Expression* kreturn = factory()->NewSmiLiteral(JSGeneratorObject::kReturn, nopos); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, mode_proxy, kreturn, nopos); set_mode_return = factory()->NewExpressionStatement(assignment, nopos); } // Yield(output); Statement* yield_output; { Expression* output_proxy = factory()->NewVariableProxy(var_output); Yield* yield = factory()->NewYield(generator, output_proxy, nopos, Yield::kOnExceptionThrow); yield_output = factory()->NewExpressionStatement(yield, nopos); } // mode = kNext; Statement* set_mode_next; { Expression* mode_proxy = factory()->NewVariableProxy(var_mode); Expression* knext = factory()->NewSmiLiteral(JSGeneratorObject::kNext, nopos); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos); set_mode_next = factory()->NewExpressionStatement(assignment, nopos); } // mode = kThrow; Statement* set_mode_throw; { Expression* mode_proxy = factory()->NewVariableProxy(var_mode); Expression* kthrow = factory()->NewSmiLiteral(JSGeneratorObject::kThrow, nopos); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, mode_proxy, kthrow, nopos); set_mode_throw = factory()->NewExpressionStatement(assignment, nopos); } // input = function.sent; Statement* get_input; { Expression* function_sent = FunctionSentExpression(nopos); Expression* input_proxy = factory()->NewVariableProxy(var_input); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, input_proxy, function_sent, nopos); get_input = factory()->NewExpressionStatement(assignment, nopos); } // if (mode === kReturn) { // return {value: output.value, done: true}; // } Statement* maybe_return_value; { Expression* mode_proxy = factory()->NewVariableProxy(var_mode); Expression* kreturn = factory()->NewSmiLiteral(JSGeneratorObject::kReturn, nopos); Expression* condition = factory()->NewCompareOperation( Token::EQ_STRICT, mode_proxy, kreturn, nopos); Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* literal = factory()->NewStringLiteral(ast_value_factory()->value_string(), nopos); Expression* property = factory()->NewProperty(output_proxy, literal, nopos); Statement* return_value = factory()->NewReturnStatement( BuildIteratorResult(property, true), nopos); maybe_return_value = factory()->NewIfStatement( condition, return_value, factory()->NewEmptyStatement(nopos), nopos); } // output.value Statement* get_value; { Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* literal = factory()->NewStringLiteral(ast_value_factory()->value_string(), nopos); Expression* property = factory()->NewProperty(output_proxy, literal, nopos); get_value = factory()->NewExpressionStatement(property, nopos); } // Now put things together. // try { ... } catch(e) { ... } Statement* try_catch; { Block* try_block = factory()->NewBlock(nullptr, 2, false, nopos); try_block->statements()->Add(yield_output, zone()); try_block->statements()->Add(set_mode_next, zone()); Block* catch_block = factory()->NewBlock(nullptr, 1, false, nopos); catch_block->statements()->Add(set_mode_throw, zone()); Scope* catch_scope = NewScope(CATCH_SCOPE); catch_scope->set_is_hidden(); const AstRawString* name = ast_value_factory()->dot_catch_string(); Variable* catch_variable = catch_scope->DeclareLocal(name, VAR); try_catch = factory()->NewTryCatchStatementForDesugaring( try_block, catch_scope, catch_variable, catch_block, nopos); } // try { ... } finally { ... } Statement* try_finally; { Block* try_block = factory()->NewBlock(nullptr, 1, false, nopos); try_block->statements()->Add(try_catch, zone()); Block* finally = factory()->NewBlock(nullptr, 2, false, nopos); finally->statements()->Add(get_input, zone()); finally->statements()->Add(factory()->NewContinueStatement(loop, nopos), zone()); try_finally = factory()->NewTryFinallyStatement(try_block, finally, nopos); } // switch (mode) { ... } SwitchStatement* switch_mode = factory()->NewSwitchStatement(nullptr, nopos); { auto case_next = new (zone()) ZoneList<Statement*>(3, zone()); case_next->Add(call_next, zone()); case_next->Add(validate_next_output, zone()); case_next->Add(factory()->NewBreakStatement(switch_mode, nopos), zone()); auto case_return = new (zone()) ZoneList<Statement*>(5, zone()); BuildIteratorClose(case_return, var_iterator, var_input, var_output); case_return->Add(factory()->NewBreakStatement(switch_mode, nopos), zone()); auto case_throw = new (zone()) ZoneList<Statement*>(5, zone()); case_throw->Add(get_throw, zone()); case_throw->Add(check_throw, zone()); case_throw->Add(call_throw, zone()); case_throw->Add(validate_throw_output, zone()); case_throw->Add(factory()->NewBreakStatement(switch_mode, nopos), zone()); auto cases = new (zone()) ZoneList<CaseClause*>(3, zone()); Expression* knext = factory()->NewSmiLiteral(JSGeneratorObject::kNext, nopos); Expression* kreturn = factory()->NewSmiLiteral(JSGeneratorObject::kReturn, nopos); Expression* kthrow = factory()->NewSmiLiteral(JSGeneratorObject::kThrow, nopos); cases->Add(factory()->NewCaseClause(knext, case_next, nopos), zone()); cases->Add(factory()->NewCaseClause(kreturn, case_return, nopos), zone()); cases->Add(factory()->NewCaseClause(kthrow, case_throw, nopos), zone()); switch_mode->Initialize(factory()->NewVariableProxy(var_mode), cases); } // while (true) { ... } // Already defined earlier: WhileStatement* loop = ... { Block* loop_body = factory()->NewBlock(nullptr, 4, false, nopos); loop_body->statements()->Add(switch_mode, zone()); loop_body->statements()->Add(if_done, zone()); loop_body->statements()->Add(set_mode_return, zone()); loop_body->statements()->Add(try_finally, zone()); loop->Initialize(factory()->NewBooleanLiteral(true, nopos), loop_body); } // do { ... } DoExpression* yield_star; { // The rewriter needs to process the get_value statement only, hence we // put the preceding statements into an init block. Block* do_block_ = factory()->NewBlock(nullptr, 6, true, nopos); do_block_->statements()->Add(initialize_input, zone()); do_block_->statements()->Add(initialize_mode, zone()); do_block_->statements()->Add(initialize_output, zone()); do_block_->statements()->Add(get_iterator, zone()); do_block_->statements()->Add(loop, zone()); do_block_->statements()->Add(maybe_return_value, zone()); Block* do_block = factory()->NewBlock(nullptr, 2, false, nopos); do_block->statements()->Add(do_block_, zone()); do_block->statements()->Add(get_value, zone()); Variable* dot_result = NewTemporary(ast_value_factory()->dot_result_string()); yield_star = factory()->NewDoExpression(do_block, dot_result, nopos); Rewriter::Rewrite(this, GetClosureScope(), yield_star, ast_value_factory()); } return yield_star; } Statement* Parser::CheckCallable(Variable* var, Expression* error, int pos) { const int nopos = kNoSourcePosition; Statement* validate_var; { Expression* type_of = factory()->NewUnaryOperation( Token::TYPEOF, factory()->NewVariableProxy(var), nopos); Expression* function_literal = factory()->NewStringLiteral( ast_value_factory()->function_string(), nopos); Expression* condition = factory()->NewCompareOperation( Token::EQ_STRICT, type_of, function_literal, nopos); Statement* throw_call = factory()->NewExpressionStatement(error, pos); validate_var = factory()->NewIfStatement( condition, factory()->NewEmptyStatement(nopos), throw_call, nopos); } return validate_var; } void Parser::BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, Variable* input, Variable* var_output) { // // This function adds four statements to [statements], corresponding to the // following code: // // let iteratorReturn = iterator.return; // if (IS_NULL_OR_UNDEFINED(iteratorReturn) { // return {value: input, done: true}; // } // output = %_Call(iteratorReturn, iterator, input); // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); // const int nopos = kNoSourcePosition; // let iteratorReturn = iterator.return; Variable* var_return = var_output; // Reusing the output variable. Statement* get_return; { Expression* iterator_proxy = factory()->NewVariableProxy(iterator); Expression* literal = factory()->NewStringLiteral( ast_value_factory()->return_string(), nopos); Expression* property = factory()->NewProperty(iterator_proxy, literal, nopos); Expression* return_proxy = factory()->NewVariableProxy(var_return); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, return_proxy, property, nopos); get_return = factory()->NewExpressionStatement(assignment, nopos); } // if (IS_NULL_OR_UNDEFINED(iteratorReturn) { // return {value: input, done: true}; // } Statement* check_return; { Expression* condition = factory()->NewCompareOperation( Token::EQ, factory()->NewVariableProxy(var_return), factory()->NewNullLiteral(nopos), nopos); Expression* value = factory()->NewVariableProxy(input); Statement* return_input = factory()->NewReturnStatement(BuildIteratorResult(value, true), nopos); check_return = factory()->NewIfStatement( condition, return_input, factory()->NewEmptyStatement(nopos), nopos); } // output = %_Call(iteratorReturn, iterator, input); Statement* call_return; { auto args = new (zone()) ZoneList<Expression*>(3, zone()); args->Add(factory()->NewVariableProxy(var_return), zone()); args->Add(factory()->NewVariableProxy(iterator), zone()); args->Add(factory()->NewVariableProxy(input), zone()); Expression* call = factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, output_proxy, call, nopos); call_return = factory()->NewExpressionStatement(assignment, nopos); } // if (!IS_RECEIVER(output)) %ThrowIteratorResultNotAnObject(output); Statement* validate_output; { Expression* is_receiver_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); is_receiver_call = factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos); } Statement* throw_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); Expression* call = factory()->NewCallRuntime( Runtime::kThrowIteratorResultNotAnObject, args, nopos); throw_call = factory()->NewExpressionStatement(call, nopos); } validate_output = factory()->NewIfStatement( is_receiver_call, factory()->NewEmptyStatement(nopos), throw_call, nopos); } statements->Add(get_return, zone()); statements->Add(check_return, zone()); statements->Add(call_return, zone()); statements->Add(validate_output, zone()); } void Parser::FinalizeIteratorUse(Scope* use_scope, Variable* completion, Expression* condition, Variable* iter, Block* iterator_use, Block* target, IteratorType type) { // // This function adds two statements to [target], corresponding to the // following code: // // completion = kNormalCompletion; // try { // try { // iterator_use // } catch(e) { // if (completion === kAbruptCompletion) completion = kThrowCompletion; // %ReThrow(e); // } // } finally { // if (condition) { // #BuildIteratorCloseForCompletion(iter, completion) // } // } // const int nopos = kNoSourcePosition; // completion = kNormalCompletion; Statement* initialize_completion; { Expression* proxy = factory()->NewVariableProxy(completion); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, proxy, factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), nopos); initialize_completion = factory()->NewExpressionStatement(assignment, nopos); } // if (completion === kAbruptCompletion) completion = kThrowCompletion; Statement* set_completion_throw; { Expression* condition = factory()->NewCompareOperation( Token::EQ_STRICT, factory()->NewVariableProxy(completion), factory()->NewSmiLiteral(Parser::kAbruptCompletion, nopos), nopos); Expression* proxy = factory()->NewVariableProxy(completion); Expression* assignment = factory()->NewAssignment( Token::ASSIGN, proxy, factory()->NewSmiLiteral(Parser::kThrowCompletion, nopos), nopos); Statement* statement = factory()->NewExpressionStatement(assignment, nopos); set_completion_throw = factory()->NewIfStatement( condition, statement, factory()->NewEmptyStatement(nopos), nopos); } // if (condition) { // #BuildIteratorCloseForCompletion(iter, completion) // } Block* maybe_close; { Block* block = factory()->NewBlock(nullptr, 2, true, nopos); Expression* proxy = factory()->NewVariableProxy(completion); BuildIteratorCloseForCompletion(use_scope, block->statements(), iter, proxy, type); DCHECK(block->statements()->length() == 2); maybe_close = factory()->NewBlock(nullptr, 1, true, nopos); maybe_close->statements()->Add( factory()->NewIfStatement(condition, block, factory()->NewEmptyStatement(nopos), nopos), zone()); } // try { #try_block } // catch(e) { // #set_completion_throw; // %ReThrow(e); // } Statement* try_catch; { Scope* catch_scope = NewScopeWithParent(use_scope, CATCH_SCOPE); Variable* catch_variable = catch_scope->DeclareLocal(ast_value_factory()->dot_catch_string(), VAR); catch_scope->set_is_hidden(); Statement* rethrow; // We use %ReThrow rather than the ordinary throw because we want to // preserve the original exception message. This is also why we create a // TryCatchStatementForReThrow below (which does not clear the pending // message), rather than a TryCatchStatement. { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(catch_variable), zone()); rethrow = factory()->NewExpressionStatement( factory()->NewCallRuntime(Runtime::kReThrow, args, nopos), nopos); } Block* catch_block = factory()->NewBlock(nullptr, 2, false, nopos); catch_block->statements()->Add(set_completion_throw, zone()); catch_block->statements()->Add(rethrow, zone()); try_catch = factory()->NewTryCatchStatementForReThrow( iterator_use, catch_scope, catch_variable, catch_block, nopos); } // try { #try_catch } finally { #maybe_close } Statement* try_finally; { Block* try_block = factory()->NewBlock(nullptr, 1, false, nopos); try_block->statements()->Add(try_catch, zone()); try_finally = factory()->NewTryFinallyStatement(try_block, maybe_close, nopos); } target->statements()->Add(initialize_completion, zone()); target->statements()->Add(try_finally, zone()); } void Parser::BuildIteratorCloseForCompletion(Scope* scope, ZoneList<Statement*>* statements, Variable* iterator, Expression* completion, IteratorType type) { // // This function adds two statements to [statements], corresponding to the // following code: // // let iteratorReturn = iterator.return; // if (!IS_NULL_OR_UNDEFINED(iteratorReturn)) { // if (completion === kThrowCompletion) { // if (!IS_CALLABLE(iteratorReturn)) { // throw MakeTypeError(kReturnMethodNotCallable); // } // [if (IteratorType == kAsync)] // try { Await(%_Call(iteratorReturn, iterator) } catch (_) { } // [else] // try { %_Call(iteratorReturn, iterator) } catch (_) { } // [endif] // } else { // [if (IteratorType == kAsync)] // let output = Await(%_Call(iteratorReturn, iterator)); // [else] // let output = %_Call(iteratorReturn, iterator); // [endif] // if (!IS_RECEIVER(output)) { // %ThrowIterResultNotAnObject(output); // } // } // } // const int nopos = kNoSourcePosition; // let iteratorReturn = iterator.return; Variable* var_return = NewTemporary(ast_value_factory()->empty_string()); Statement* get_return; { Expression* iterator_proxy = factory()->NewVariableProxy(iterator); Expression* literal = factory()->NewStringLiteral( ast_value_factory()->return_string(), nopos); Expression* property = factory()->NewProperty(iterator_proxy, literal, nopos); Expression* return_proxy = factory()->NewVariableProxy(var_return); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, return_proxy, property, nopos); get_return = factory()->NewExpressionStatement(assignment, nopos); } // if (!IS_CALLABLE(iteratorReturn)) { // throw MakeTypeError(kReturnMethodNotCallable); // } Statement* check_return_callable; { Expression* throw_expr = NewThrowTypeError(MessageTemplate::kReturnMethodNotCallable, ast_value_factory()->empty_string(), nopos); check_return_callable = CheckCallable(var_return, throw_expr, nopos); } // try { %_Call(iteratorReturn, iterator) } catch (_) { } Statement* try_call_return; { auto args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(factory()->NewVariableProxy(var_return), zone()); args->Add(factory()->NewVariableProxy(iterator), zone()); Expression* call = factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); if (type == IteratorType::kAsync) { call = RewriteAwaitExpression(call, nopos); } Block* try_block = factory()->NewBlock(nullptr, 1, false, nopos); try_block->statements()->Add(factory()->NewExpressionStatement(call, nopos), zone()); Block* catch_block = factory()->NewBlock(nullptr, 0, false, nopos); Scope* catch_scope = NewScopeWithParent(scope, CATCH_SCOPE); Variable* catch_variable = catch_scope->DeclareLocal(ast_value_factory()->dot_catch_string(), VAR); catch_scope->set_is_hidden(); try_call_return = factory()->NewTryCatchStatement( try_block, catch_scope, catch_variable, catch_block, nopos); } // let output = %_Call(iteratorReturn, iterator); // if (!IS_RECEIVER(output)) { // %ThrowIteratorResultNotAnObject(output); // } Block* validate_return; { Variable* var_output = NewTemporary(ast_value_factory()->empty_string()); Statement* call_return; { auto args = new (zone()) ZoneList<Expression*>(2, zone()); args->Add(factory()->NewVariableProxy(var_return), zone()); args->Add(factory()->NewVariableProxy(iterator), zone()); Expression* call = factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); if (type == IteratorType::kAsync) { call = RewriteAwaitExpression(call, nopos); } Expression* output_proxy = factory()->NewVariableProxy(var_output); Expression* assignment = factory()->NewAssignment(Token::ASSIGN, output_proxy, call, nopos); call_return = factory()->NewExpressionStatement(assignment, nopos); } Expression* is_receiver_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); is_receiver_call = factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos); } Statement* throw_call; { auto args = new (zone()) ZoneList<Expression*>(1, zone()); args->Add(factory()->NewVariableProxy(var_output), zone()); Expression* call = factory()->NewCallRuntime( Runtime::kThrowIteratorResultNotAnObject, args, nopos); throw_call = factory()->NewExpressionStatement(call, nopos); } Statement* check_return = factory()->NewIfStatement( is_receiver_call, factory()->NewEmptyStatement(nopos), throw_call, nopos); validate_return = factory()->NewBlock(nullptr, 2, false, nopos); validate_return->statements()->Add(call_return, zone()); validate_return->statements()->Add(check_return, zone()); } // if (completion === kThrowCompletion) { // #check_return_callable; // #try_call_return; // } else { // #validate_return; // } Statement* call_return_carefully; { Expression* condition = factory()->NewCompareOperation( Token::EQ_STRICT, completion, factory()->NewSmiLiteral(Parser::kThrowCompletion, nopos), nopos); Block* then_block = factory()->NewBlock(nullptr, 2, false, nopos); then_block->statements()->Add(check_return_callable, zone()); then_block->statements()->Add(try_call_return, zone()); call_return_carefully = factory()->NewIfStatement(condition, then_block, validate_return, nopos); } // if (!IS_NULL_OR_UNDEFINED(iteratorReturn)) { ... } Statement* maybe_call_return; { Expression* condition = factory()->NewCompareOperation( Token::EQ, factory()->NewVariableProxy(var_return), factory()->NewNullLiteral(nopos), nopos); maybe_call_return = factory()->NewIfStatement( condition, factory()->NewEmptyStatement(nopos), call_return_carefully, nopos); } statements->Add(get_return, zone()); statements->Add(maybe_call_return, zone()); } Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop, Variable* var_completion, IteratorType type, int pos) { // // This function replaces the loop with the following wrapping: // // completion = kNormalCompletion; // try { // try { // #loop; // } catch(e) { // if (completion === kAbruptCompletion) completion = kThrowCompletion; // %ReThrow(e); // } // } finally { // if (!(completion === kNormalCompletion)) { // #BuildIteratorCloseForCompletion(#iterator, completion) // } // } // // Note that the loop's body and its assign_each already contain appropriate // assignments to completion (see InitializeForOfStatement). // const int nopos = kNoSourcePosition; // !(completion === kNormalCompletion) Expression* closing_condition; { Expression* cmp = factory()->NewCompareOperation( Token::EQ_STRICT, factory()->NewVariableProxy(var_completion), factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), nopos); closing_condition = factory()->NewUnaryOperation(Token::NOT, cmp, nopos); } Block* final_loop = factory()->NewBlock(nullptr, 2, false, nopos); { Block* try_block = factory()->NewBlock(nullptr, 1, false, nopos); try_block->statements()->Add(loop, zone()); // The scope in which the parser creates this loop. Scope* loop_scope = scope()->outer_scope(); DCHECK_EQ(loop_scope->scope_type(), BLOCK_SCOPE); DCHECK_EQ(scope()->scope_type(), BLOCK_SCOPE); FinalizeIteratorUse(loop_scope, var_completion, closing_condition, loop->iterator(), try_block, final_loop, type); } return final_loop; } #undef CHECK_OK #undef CHECK_OK_VOID #undef CHECK_FAILED } // namespace internal } // namespace v8
[ "akos.hamori@sztaki.mta.hu" ]
akos.hamori@sztaki.mta.hu
ff070d82f650cb0d427432015655f50eeca9c9d2
bc2b4fa90552c0c0fc36095d2196c9abcd67d86e
/DebugMessage.h
1b2b556fbcdd7887005c3e2eac4af8c4b9ef8b95
[]
no_license
pfx8/d3d9tutorial
35f85c85166d1e37a081a3dd08faef473c30f1e7
8b7d57f17b7fbc80c431968d63000acaa97ba433
refs/heads/master
2021-09-07T08:19:42.172397
2018-02-20T03:56:05
2018-02-20T03:56:05
105,626,767
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,018
h
//***************************************************************************** // // デバックメッセージ処理 [DebugMessage.h] // // Author : LIAO HANCHEN // //***************************************************************************** #ifndef _DEBUG_MESSAGE_H_ #define _DEBUG_MESSAGE_H_ #include "Engine.h" #include <iostream> //***************************************************************************** // // クラス宣言 // //***************************************************************************** class DebugMessage { private: LPD3DXFONT font; // フォントのポインタ RECT rectCoor; // デバッグメッセージの位置 public: DebugMessage(); ~DebugMessage(); void DrawPosMessage(const char name[], D3DXVECTOR3 OutputPos, D3DXVECTOR2 MessagePos); // 座標を描画する void DrawMatrixMessage(D3DXMATRIX* matrix, D3DXVECTOR2 MessagePos); // 行列を描画 void DrawMessage(const char message[]); // デバッグメッセージ }; #endif // !Debug_MESSAGE_H_
[ "dashar825@gmail.com" ]
dashar825@gmail.com
a83886a0bf5707c5a3efcb4a6bf2c894be7779da
e440f64a8de17147f11873a999aa8e7d9acc4a0d
/Source/TheLast/Public/Common/TL_Command.h
dc48da9c9993f08fbbdd8d0ec1fae492b5735c59
[]
no_license
NiJiang66/TheLast
18b2ca6809c5a8911856b6f7cc8850364febd1d9
437359c130040dc242c9beb3056d044eb064156a
refs/heads/master
2020-08-20T10:34:33.542378
2019-10-21T16:12:50
2019-10-21T16:12:50
216,012,474
0
0
null
2019-10-21T16:20:13
2019-10-18T11:50:18
C#
UTF-8
C++
false
false
294
h
#pragma once #include "CoreMinimal.h" #include "GameFramework/CheatManager.h" #include "TL_Command.generated.h" /** * 主要用于测试的GM命令 */ UCLASS() class THELAST_API UTL_Command : public UCheatManager { GENERATED_BODY() public: UFUNCTION(exec) void TestPrintCommand(); };
[ "a807675238@163.com" ]
a807675238@163.com
193017a6dd578fbdf619a2bf0a6d56ca0c247caf
6ab9a3229719f457e4883f8b9c5f1d4c7b349362
/brspoj/obi/ENERGIA.cpp
88cedaa83e88e74a7598096a70af596cd48f7bcd
[]
no_license
ajmarin/coding
77c91ee760b3af34db7c45c64f90b23f6f5def16
8af901372ade9d3d913f69b1532df36fc9461603
refs/heads/master
2022-01-26T09:54:38.068385
2022-01-09T11:26:30
2022-01-09T11:26:30
2,166,262
33
15
null
null
null
null
UTF-8
C++
false
false
554
cpp
#include <cstdio> int adj[100][100], deg[100], vis; bool v[100]; void dfs(int k){ v[k] = 1; vis++; for(int j = 0; j < deg[k]; j++) if(!v[adj[k][j]]) v[adj[k][j]] = 1, dfs(adj[k][j]); } int main(void){ int a, b, i, E, L; for(int t = 1; scanf("%d%d",&E,&L) && E; t++){ for(i = 0; i < E; i++) deg[i] = v[i] = 0; for(i = 0; i < L; i++) scanf("%d%d",&a,&b), adj[--a][deg[a]++] = --b, adj[b][deg[b]++] = a; vis = 0; dfs(0); printf("Teste %d\n",t); if(vis == E) printf("normal\n\n"); else printf("falha\n\n"); } return 0; }
[ "mistermarin@gmail.com" ]
mistermarin@gmail.com
312cd39bcc78a9bc7f0310757645fcaf4c627b8c
1880ae99db197e976c87ba26eb23a20248e8ee51
/cls/include/tencentcloud/cls/v20201016/model/DescribeConfigMachineGroupsResponse.h
8d483d1c10d3da7a2b78db0de9a8753dd537c70d
[ "Apache-2.0" ]
permissive
caogenwang/tencentcloud-sdk-cpp
84869793b5eb9811bb1eb46ed03d4dfa7ce6d94d
6e18ee6622697a1c60a20a509415b0ddb8bdeb75
refs/heads/master
2023-08-23T12:37:30.305972
2021-11-08T01:18:30
2021-11-08T01:18:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,707
h
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TENCENTCLOUD_CLS_V20201016_MODEL_DESCRIBECONFIGMACHINEGROUPSRESPONSE_H_ #define TENCENTCLOUD_CLS_V20201016_MODEL_DESCRIBECONFIGMACHINEGROUPSRESPONSE_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/cls/v20201016/model/MachineGroupInfo.h> namespace TencentCloud { namespace Cls { namespace V20201016 { namespace Model { /** * DescribeConfigMachineGroups返回参数结构体 */ class DescribeConfigMachineGroupsResponse : public AbstractModel { public: DescribeConfigMachineGroupsResponse(); ~DescribeConfigMachineGroupsResponse() = default; CoreInternalOutcome Deserialize(const std::string &payload); std::string ToJsonString() const; /** * 获取采集规则配置绑定的机器组列表 注意:此字段可能返回 null,表示取不到有效值。 * @return MachineGroups 采集规则配置绑定的机器组列表 注意:此字段可能返回 null,表示取不到有效值。 */ std::vector<MachineGroupInfo> GetMachineGroups() const; /** * 判断参数 MachineGroups 是否已赋值 * @return MachineGroups 是否已赋值 */ bool MachineGroupsHasBeenSet() const; private: /** * 采集规则配置绑定的机器组列表 注意:此字段可能返回 null,表示取不到有效值。 */ std::vector<MachineGroupInfo> m_machineGroups; bool m_machineGroupsHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_CLS_V20201016_MODEL_DESCRIBECONFIGMACHINEGROUPSRESPONSE_H_
[ "tencentcloudapi@tenent.com" ]
tencentcloudapi@tenent.com
ba0f9d79fea423acb03994027a76c13008107c17
5e4970bbd63e7c3d443d5edf0a211aa9579752c6
/SDK/Mordhau_BP_FistsWeapon_classes.hpp
f12501cf96f3fedb8a02e178667a072d9b1d493e
[]
no_license
SchwarzKruppzo/Mordhau_SDK
d4a1bccc659c94848eba4ab52fce299a96c94e5e
cdcb034218983d401c6ceb6c674251113cc11586
refs/heads/master
2020-05-25T05:22:52.440527
2019-05-08T16:22:19
2019-05-08T16:22:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
659
hpp
#pragma once // Mordhau (Dumped by Hinnie) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass BP_FistsWeapon.BP_FistsWeapon_C // 0x0000 (0x1A20 - 0x1A20) class ABP_FistsWeapon_C : public AFistsWeapon { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_FistsWeapon.BP_FistsWeapon_C"); return ptr; } }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "hsibma02@gmail.com" ]
hsibma02@gmail.com
c9991845018f0fb8a487139ae6553f817147973c
5b2860726a5e75fcb51c8a4c48c2adcb3432ab98
/Algorhythms/Dynamics.cpp
375c2080c022a3e2da30c3d9c7ae1716f2d60f3a
[]
no_license
voidmirror/Algorhythms
635b55e086bf7e153184d3a4afd3c06612c45f56
a693bc79f70e41f64d63cf3accc0522899656358
refs/heads/master
2020-08-04T09:24:27.294600
2019-10-22T21:05:39
2019-10-22T21:05:39
212,088,831
0
0
null
null
null
null
UTF-8
C++
false
false
2,516
cpp
#include <iostream> #include "Dynamics.h" using namespace std; void add2List(List** head, char addval) { List **pp = head; List *newelem; while (*pp) { if (addval < (*head)->value) break; else pp = &((*pp)->point); } newelem = (List*)malloc(sizeof(List)); newelem->value = addval; newelem->point = *pp; *pp = newelem; } void printList(List* head) { List* p = head; while (p) { cout << p->value << " "; p = p->point; } cout << endl; } void add2DoubleList(doubleList** head, doubleList** tail, int addval) { doubleList **pp = tail; doubleList *newelem; newelem = (doubleList*)malloc(sizeof(doubleList)); newelem->value = addval; newelem->pointNext = NULL; if (!(*head)) { newelem->pointPrev = NULL; *head = newelem; *tail = newelem; } else { newelem->pointPrev = *pp; (*pp)->pointNext = newelem; *pp = newelem; } } Skip** createSkipListArr(int lvls, Skip *head, int* checkArrLengthP) { // lvls - number of levels Skip **lvlarr = (Skip**)malloc(lvls * sizeof(Skip*)); for (int i = 0; i < lvls; i++) { lvlarr[i] = NULL; //*(lvlarr + i) = NULL; } lvlarr[0] = head; int randomize; Skip *elem = head, *listelem = NULL; for (int i = 1; i < lvls; i++) { while (elem) { randomize = rand() % 2; if (randomize) { Skip *newelem; newelem = (Skip*)malloc(sizeof(Skip)); newelem->point = NULL; newelem->value = elem->value; newelem->lowlvl = elem; if (listelem) { listelem->point = newelem; listelem = listelem->point; } else { lvlarr[i] = newelem; //*(lvlarr + i) = newelem; listelem = newelem; (*checkArrLengthP)++; } } elem = elem->point; } elem = lvlarr[i]; listelem = NULL; } return lvlarr; } void fillSkipList(Skip** head, int addval) { Skip **pp = head; Skip *newelem; while (*pp) { if (addval < (*head)->value) break; else pp = &((*pp)->point); } newelem = (Skip*)malloc(sizeof(Skip)); newelem->value = addval; newelem->point = *pp; *pp = newelem; } void printSkipList(Skip* head) { Skip* p = head; while (p) { cout << p->value << " "; p = p->point; } cout << endl; } Skip* findInSkip(int val, int lvls, Skip **lvlarr) { Skip *elem, *prev = NULL; int l = lvls; elem = lvlarr[l - 1]; while ((elem) && (elem->value != val)) { if (elem->value > val || !(elem->point)) { prev = prev->lowlvl; elem = prev->point; } else { prev = elem; elem = elem->point; } } cout << "found: " << elem->value << endl; return elem; }
[ "voidmirror@users.noreply.github.com" ]
voidmirror@users.noreply.github.com
eac511419c33f22b00589d18e95e348ade5d3680
61d8c44ba288f8ee5d42985073aaf97240ceef05
/builder_pattern.cpp
65de839207a9d48ffb999d532db00e47c1ac9e50
[]
no_license
yunzhongke/design-cpp_test
d81d78ea422f58b318bad29c6912e9b596f4b519
70e135f22ddcfd8da0df7772432fadeb2dc34665
refs/heads/master
2021-09-04T20:26:04.840546
2018-01-22T06:04:54
2018-01-22T06:04:54
118,413,669
0
0
null
null
null
null
UTF-8
C++
false
false
1,711
cpp
/*================================================================ * Copyright (C) 2018 Vertiv Tech Co Ltd. All rights reserved. * * 文件名称:builder_pattern.cpp * 创 建 者:yunzhongke * 创建日期:2018年01月20日09时 * 描 述:建造者模式实现 * ================================================================*/ #include <iostream> #include "builder_pattern.h" boss::boss() { std::cout << "我是这里的大老板!\n"; } /* * @brief 老板指定某个员工 * * @param builder* */ void boss::set_builder(builder*& b) { this->w = b; } /* * @brief 指派某员工任务 */ void boss::assignment() { this->w->build_cardoor(); this->w->build_carwheel(); this->w->build_carengine(); this->w->build_carsteerwheel(); } boss::~boss() { if (w){ delete w; w = NULL; } } worker::worker():c(new car()) { std::cout << "我是张大炮组装员\n"; } void worker::build_cardoor() { c->Add("组装车门"); } void worker::build_carwheel() { c->Add("组装车轮"); } void worker::build_carengine() { c->Add("组装发动机"); } void worker::build_carsteerwheel() { c->Add("组装方向盘"); } car* worker::getCar() { return c; } worker::~worker(){ if (c){ delete c; c = NULL; } } car::car():parts(new std::vector<std::string>()) { std::cout << "即将为您组装汽车\n"; } void car::Add(std::string part) { parts->emplace_back(part); } void car::Show() { for(auto &part : *parts){ std::cout << part << "\n"; } std::cout << "汽车组装完成!\n"; } car::~car() { if (parts){ delete parts; parts = NULL; } }
[ "18689568563@163.com" ]
18689568563@163.com
e050da221ed916af85d4f6a96122ef690f1b9475
1b35ebe43428579639a54145567162d8a6e8fd03
/Game.cpp
ccb83e3e347a5f98eb2011d73e914a8d165e796e
[]
no_license
MattDienhart/starship-bloopers
586db89119868b99d5c18eddc02bba26453695f8
2f76d439991e245162867fb24c0ed672ae6b474e
refs/heads/master
2020-03-28T18:13:08.297026
2018-09-15T02:42:21
2018-09-15T02:42:21
148,861,787
0
0
null
null
null
null
UTF-8
C++
false
false
11,547
cpp
/************************************************************************************************ * Author: Matt Dienhart * Date: 3/16/2018 * Description: (Final Project) This is the class implementation file for Game. * **********************************************************************************************/ #include "Game.hpp" //Game::playGame() //This member function creates a game of fantasy combat and runs it until one player is the winner. void Game::playGame() { //control variables int menuSelect = 0; std::string userString; //display intro dialogue std::cout << "Please enter your character's name: " << std::endl; std::getline(std::cin, userString); playerPtr->setName(userString); std::cout << "Please enter your character's date of birth (format: DDMMYYY)" << std::endl; std::getline(std::cin, userString); playerPtr->setDOB(userString); std::cout << "You are a Lieutenant in the Galactic Navy serving on the starship Daedalus." << std::endl; std::cout << "Your commanding officer, Commander Fitzpatrick, together with most of the Daedalus' crew, left the ship last night to attend a fancy banquet on a nearby station." << std::endl; std::cout << "The Commander left you and a few of your peers behind to watch over the Daedalus." << std::endl; std::cout << "Resentful at having been made to stay behind and emboldened at having the whole ship to yourselves, you decided to throw your own 'banquet' consisting mostly of alcohol." << std::endl; std::cout << "You awaken at 1400 with only a hazy memory of last night's events aboard the ship, and a pounding headache." << std::endl; std::cout << "You realize that the Commander is scheduled to return at 1600, which gives you only 2 hours (120 minutes) to clean up the mess you've made!" << std::endl; std::cout << std::endl; //start the game loop; loop until player runs out of time while (playerPtr->getTimer() < 120 && playerPtr->getPoints() < 6) { //display information about the current room on the ship std::cout << "Your current location is: " << currentLoc->getName() << "." << std::endl; std::cout << currentLoc->getInspectionReminder() << std::endl; //display options for user to choose from if (currentLoc->getInspected() == true && currentLoc->getActionsRemaining() > 0) { //room has been inspected and there are actions left to do, so interact() is available std::cout << " 1. Move" << std::endl; std::cout << " 2. Look Around" << std::endl; std::cout << " 3. Check Inventory" << std::endl; std::cout << " 4. Check Directory" << std::endl; std::cout << " 5. Check Time" << std::endl; std::cout << " 6. " << currentLoc->getActionLabel() << std::endl; //get input from user menuSelect = validInput(1,6); //process input if (menuSelect == 1) { this->movePlayer(); } else if (menuSelect == 2) { currentLoc->inspect(playerPtr); } else if (menuSelect == 3) { playerPtr->checkInventory(); } else if (menuSelect == 4) { playerPtr->checkDirectory(); } else if (menuSelect == 5) { playerPtr->checkTime(); } else if (menuSelect == 6) { currentLoc->interact(playerPtr); } } else { //room has not yet been inspected or there is no action available, so interact() is not available std::cout << " 1. Move" << std::endl; std::cout << " 2. Look Around" << std::endl; std::cout << " 3. Check Inventory" << std::endl; std::cout << " 4. Check Directory" << std::endl; std::cout << " 5. Check Time" << std::endl; //get input from user menuSelect = validInput(1,5); //process input if (menuSelect == 1) { this->movePlayer(); } else if (menuSelect == 2) { currentLoc->inspect(playerPtr); } else if (menuSelect == 3) { playerPtr->checkInventory(); } else if (menuSelect == 4) { playerPtr->checkDirectory(); } else if (menuSelect == 5) { playerPtr->checkTime(); } } std::cout << std::endl; } //determine if player won or not if (playerPtr->getPoints() >=6) { std::cout << "You have completely cleaned the ship! All evidence of your debauchery has been disposed of." << std::endl; std::cout << "You win!" << std::endl; } else { std::cout << "You ran out of time! The ship is not completely clean, and Commander Fitzpatrick is on her way back!" << std::endl; std::cout << "Better luck next time!" << std::endl; std::cout << "You cleaned up " << playerPtr->getPoints() << " out of 6 messes." << std::endl; } return; } //Game::movePlayer() //This method asks the user to enter a direction to move the player, then moves the player to the //adjacent space in that direction void Game::movePlayer() { std::vector<std::string> options; int moveSelect = 0; //check each direction in the current space to see which ones it is possible to move in if (currentLoc->getForward() != NULL) { options.push_back("Forward"); } if (currentLoc->getAft() != NULL) { options.push_back("Aft"); } if (currentLoc->getPort() != NULL) { options.push_back("Port"); } if (currentLoc->getStarboard() != NULL) { options.push_back("Starboard"); } //Display menu to user asking which direction to move in; menu only shows possible moves if (options.empty()) { std::cout << "ERROR: There are no possible moves." << std::endl; } else { std::cout << "Please select a direction to move." << std::endl; for (int i=0; i<options.size(); i++) { std::cout << (i+1) << ". " << options[i] << std::endl; } //read input from user moveSelect = validInput(1, options.size()); //process move in selected direction if (options[moveSelect-1] == "Forward") { currentLoc = currentLoc->getForward(); } else if (options[moveSelect-1] == "Aft") { currentLoc = currentLoc->getAft(); } else if (options[moveSelect-1] == "Port") { currentLoc = currentLoc->getPort(); } else if (options[moveSelect-1] == "Starboard") { currentLoc = currentLoc->getStarboard(); } //Moving takes 1 minute playerPtr->addToTimer(1); } return; } //Game::validInput() //This member function is similar to validInput(int, int), but it has no boundaries int Game::validInput() { int checkValue = 0; //get input from user std::cin >> checkValue; //loop to ensure checkValue is valid while (std::cin.fail()) { std::cout << "Invalid entry, please try again." << std::endl; std::cin.clear(); std::cin.ignore(999, '\n'); std::cin >> checkValue; } //clear the input buffer std::cin.ignore(999, '\n'); return checkValue; } //Game::validInput(int, int) //This member function prompts the user to enter a number, and then checks that that number is an integer //within the specified bounds. If the number is not an integer, or cannot be converted to one, or it //is not within the specified bounds, the user will be prompted again until a valid input is given. int Game::validInput(int lowerBound, int upperBound) { int checkValue = 0; //get input from user std::cin >> checkValue; //loop to ensure checkValue is valid while (std::cin.fail() || checkValue < lowerBound || checkValue > upperBound) { std::cout << "Invalid entry, please try again." << std::endl; std::cin.clear(); std::cin.ignore(999, '\n'); std::cin >> checkValue; } //clear the input buffer std::cin.ignore(999, '\n'); //return validated input return checkValue; } //default constructor Game::Game() { //build the ship spaces, as shown in the directory currentLoc = new CrewQuarters(NULL, NULL, NULL, NULL, "Crew Quarters"); nextLoc = new Agriculture(currentLoc, NULL, NULL, NULL, "Agriculture"); currentLoc->setAft(nextLoc); currentLoc = nextLoc; //moved to Agriculture nextLoc = new MedBay(currentLoc, NULL, NULL, NULL, "Med Bay"); currentLoc->setAft(nextLoc); currentLoc = nextLoc; //moved to Med Bay nextLoc = new Propulsion(NULL, NULL, currentLoc, NULL, "Propulsion"); currentLoc->setStarboard(nextLoc); currentLoc = nextLoc; //moved to Propulsion nextLoc = new Kitchen(NULL, currentLoc, NULL, NULL, "Kitchen"); currentLoc->setForward(nextLoc); currentLoc = currentLoc->getPort()->getForward(); //moved to Agriculture nextLoc->setPort(currentLoc); currentLoc->setStarboard(nextLoc); currentLoc = nextLoc; //moved to Kitchen nextLoc = new MainDeck(NULL, currentLoc, NULL, NULL, "Main Deck"); currentLoc->setForward(nextLoc); currentLoc = currentLoc->getPort()->getForward(); //moved to crew quarters nextLoc->setPort(currentLoc); currentLoc->setStarboard(nextLoc); currentLoc = nextLoc; //moved to Main Deck nextLoc = new FlightDeck(NULL, currentLoc, NULL, NULL, "Flight Deck"); currentLoc->setForward(nextLoc); nextLoc = new LifeSupport(NULL, NULL, currentLoc, NULL, "Life Support"); currentLoc->setStarboard(nextLoc); currentLoc = nextLoc; //moved to Life Support nextLoc = new EVAChamber(currentLoc, NULL, NULL, NULL, "EVA Chamber"); currentLoc->setAft(nextLoc); currentLoc = currentLoc->getPort()->getAft(); //moved to Kitchen nextLoc->setPort(currentLoc); currentLoc->setStarboard(nextLoc); currentLoc = nextLoc; //moved to EVA Chamber nextLoc = new DockingBay(currentLoc, NULL, NULL, NULL, "Docking Bay"); currentLoc->setAft(nextLoc); currentLoc = currentLoc->getPort()->getAft(); //moved to Propulsion nextLoc->setPort(currentLoc); currentLoc->setStarboard(nextLoc); //return currentLoc to crew quarters currentLoc = currentLoc->getPort()->getForward()->getForward(); crewQuartersPtr = currentLoc; nextLoc = NULL; //create the player character playerPtr = new Player("Mike", "00112222"); } //destructor Game::~Game() { //move through the ship as shown in the directory, and deallocate memory currentLoc = crewQuartersPtr; nextLoc = currentLoc->getAft(); delete currentLoc; //delete crew quarters currentLoc = nextLoc; nextLoc = currentLoc->getAft(); delete currentLoc; //delete agriculture currentLoc = nextLoc; nextLoc = currentLoc->getStarboard(); delete currentLoc; //delete Med Bay currentLoc = nextLoc; nextLoc = currentLoc->getForward(); delete currentLoc; //delete Propulsion currentLoc = nextLoc; nextLoc = currentLoc->getForward(); delete currentLoc; //delete Kitchen currentLoc = nextLoc; nextLoc = currentLoc->getForward(); delete nextLoc; //delete flight deck nextLoc = currentLoc->getStarboard(); delete currentLoc; //delete main deck currentLoc = nextLoc; nextLoc = currentLoc->getAft(); delete currentLoc; //delete life support currentLoc = nextLoc; nextLoc = currentLoc->getAft(); delete currentLoc; //delete EVA Chamber delete nextLoc; //delete Docking Bay //delete player character delete playerPtr; //set pointers to NULL currentLoc = NULL; nextLoc = NULL; crewQuartersPtr = NULL; playerPtr = NULL; }
[ "noreply@github.com" ]
noreply@github.com
ecac4dc44db63308cac1f2b8a51ff7b4bab58763
b5f6d2410a794a9acba9a0f010f941a1d35e46ce
/vgui2/controls/Menu.cpp
19008e24440adab9b3ada9e3dca4cbfc9c8ebcb3
[]
no_license
chrizonix/RCBot2
0a58591101e4537b166a672821ea28bc3aa486c6
ef0572f45c9542268923d500e64bb4cd037077eb
refs/heads/master
2021-01-19T12:55:49.003814
2018-08-27T08:48:55
2018-08-27T08:48:55
44,916,746
4
0
null
null
null
null
WINDOWS-1252
C++
false
false
74,273
cpp
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #include "vgui_controls/pch_vgui_controls.h" // memdbgon must be the last include file in a .cpp file #include "tier0/memdbgon.h" #define MENU_SEPARATOR_HEIGHT 3 using namespace vgui; //----------------------------------------------------------------------------- // Purpose: divider line in a menu //----------------------------------------------------------------------------- class vgui::MenuSeparator : public Panel { public: DECLARE_CLASS_SIMPLE( MenuSeparator, Panel ); MenuSeparator( Panel *parent, char const *panelName ) : BaseClass( parent, panelName ) { SetPaintEnabled( true ); SetPaintBackgroundEnabled( true ); SetPaintBorderEnabled( false ); } virtual void Paint() { int w, h; GetSize( w, h ); surface()->DrawSetColor( GetFgColor() ); surface()->DrawFilledRect( 4, 1, w-1, 2 ); } virtual void ApplySchemeSettings( IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); SetFgColor( pScheme->GetColor( "Menu.SeparatorColor", Color( 142, 142, 142, 255 ) ) ); SetBgColor( pScheme->GetColor( "Menu.BgColor", Color( 0, 0, 0, 255 ) ) ); } }; DECLARE_BUILD_FACTORY( Menu ); //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- Menu::Menu(Panel *parent, const char *panelName) : Panel(parent, panelName) { m_Alignment = Label::a_west; m_iFixedWidth = 0; m_iMinimumWidth = 0; m_iNumVisibleLines = -1; // No limit m_iCurrentlySelectedItemID = m_MenuItems.InvalidIndex(); m_pScroller = new ScrollBar(this, "MenuScrollBar", true); m_pScroller->SetVisible(false); m_pScroller->AddActionSignalTarget(this); _sizedForScrollBar = false; SetZPos(1); SetVisible(false); MakePopup(false); SetParent(parent); _recalculateWidth = true; m_iInputMode = MOUSE; m_iCheckImageWidth = 0; m_iActivatedItem = 0; if (IsProportional()) { m_iMenuItemHeight = scheme()->GetProportionalScaledValueEx( GetScheme(), DEFAULT_MENU_ITEM_HEIGHT ); } else { m_iMenuItemHeight = DEFAULT_MENU_ITEM_HEIGHT; } m_hItemFont = 0; } //----------------------------------------------------------------------------- // Purpose: Destructor //----------------------------------------------------------------------------- Menu::~Menu() { delete m_pScroller; } //----------------------------------------------------------------------------- // Purpose: Remove all menu items from the menu. //----------------------------------------------------------------------------- void Menu::DeleteAllItems() { FOR_EACH_LL( m_MenuItems, i ) { m_MenuItems[i]->MarkForDeletion(); } m_MenuItems.RemoveAll(); m_SortedItems.RemoveAll(); m_VisibleSortedItems.RemoveAll(); m_Separators.RemoveAll(); int c = m_SeparatorPanels.Count(); for ( int i = 0 ; i < c; ++i ) { m_SeparatorPanels[ i ]->MarkForDeletion(); } m_SeparatorPanels.RemoveAll(); InvalidateLayout(); } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. //----------------------------------------------------------------------------- int Menu::AddMenuItem( MenuItem *panel ) { panel->SetParent( this ); MEM_ALLOC_CREDIT(); int itemID = m_MenuItems.AddToTail( panel ); m_SortedItems.AddToTail(itemID); InvalidateLayout(false); _recalculateWidth = true; panel->SetContentAlignment( m_Alignment ); return itemID; } //----------------------------------------------------------------------------- // Remove a single item //----------------------------------------------------------------------------- void Menu::DeleteItem( int itemID ) { // FIXME: This doesn't work with separator panels yet Assert( m_SeparatorPanels.Count() == 0 ); m_MenuItems[itemID]->MarkForDeletion(); m_MenuItems.Remove( itemID ); m_SortedItems.FindAndRemove( itemID ); m_VisibleSortedItems.FindAndRemove( itemID ); InvalidateLayout(false); _recalculateWidth = true; } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *item - MenuItem // *command - Command text to be sent when menu item is selected // *target - Target panel of the command // *userData - any user data associated with this menu item // Output: itemID - ID of this item //----------------------------------------------------------------------------- int Menu::AddMenuItemCharCommand(MenuItem *item, const char *command, Panel *target, const KeyValues *userData) { item->SetCommand(command); item->AddActionSignalTarget( target ); item->SetUserData(userData); return AddMenuItem( item ); } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item // Output: itemID - ID of this item //----------------------------------------------------------------------------- int Menu::AddMenuItemKeyValuesCommand( MenuItem *item, KeyValues *message, Panel *target, const KeyValues *userData ) { item->SetCommand(message); item->AddActionSignalTarget(target); item->SetUserData(userData); return AddMenuItem(item); } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *command - Command text to be sent when menu item is selected // *target - Target panel of the command // Output: itemID - ID of this item //----------------------------------------------------------------------------- int Menu::AddMenuItem( const char *itemName, const char *itemText, const char *command, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, itemText ); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemCharCommand(item, command, target, userData); } int Menu::AddMenuItem( const char *itemName, const wchar_t *wszItemText, const char *command, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, wszItemText ); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemCharCommand(item, command, target, userData); } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be used as the name of the menu item panel. // *command - Command text to be sent when menu item is selected // *target - Target panel of the command // Output: itemID - ID of this item //----------------------------------------------------------------------------- int Menu::AddMenuItem( const char *itemText, const char *command, Panel *target, const KeyValues *userData ) { return AddMenuItem(itemText, itemText, command, target, userData ) ; } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddMenuItem( const char *itemName, const char *itemText, KeyValues *message, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, itemText ); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemKeyValuesCommand(item, message, target, userData); } int Menu::AddMenuItem( const char *itemName, const wchar_t *wszItemText, KeyValues *message, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, wszItemText ); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemKeyValuesCommand(item, message, target, userData); } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be used as the name of the menu item panel. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddMenuItem( const char *itemText, KeyValues *message, Panel *target, const KeyValues *userData ) { return AddMenuItem(itemText, itemText, message, target, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be the text of the command sent when the // item is selected. // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddMenuItem( const char *itemText, Panel *target , const KeyValues *userData ) { return AddMenuItem(itemText, itemText, target, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a checkable menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *command - Command text to be sent when menu item is selected // *target - Target panel of the command //----------------------------------------------------------------------------- int Menu::AddCheckableMenuItem( const char *itemName, const char *itemText, const char *command, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, itemText, NULL, true); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemCharCommand(item, command, target, userData); } int Menu::AddCheckableMenuItem( const char *itemName, const wchar_t *wszItemText, const char *command, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, wszItemText, NULL, true); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemCharCommand(item, command, target, userData); } //----------------------------------------------------------------------------- // Purpose: Add a checkable menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be used as the name of the menu item panel. // *command - Command text to be sent when menu item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCheckableMenuItem( const char *itemText, const char *command, Panel *target, const KeyValues *userData ) { return AddCheckableMenuItem(itemText, itemText, command, target, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a checkable menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCheckableMenuItem( const char *itemName, const char *itemText, KeyValues *message, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, itemText, NULL, true); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemKeyValuesCommand(item, message, target, userData); } int Menu::AddCheckableMenuItem( const char *itemName, const wchar_t *wszItemText, KeyValues *message, Panel *target, const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, wszItemText, NULL, true); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemKeyValuesCommand(item, message, target, userData); } //----------------------------------------------------------------------------- // Purpose: Add a checkable menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be used as the name of the menu item panel. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCheckableMenuItem( const char *itemText, KeyValues *message, Panel *target, const KeyValues *userData ) { return AddCheckableMenuItem(itemText, itemText, message, target, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a checkable menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be the text of the command sent when the // item is selected. // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCheckableMenuItem( const char *itemText, Panel *target, const KeyValues *userData ) { return AddCheckableMenuItem(itemText, itemText, target, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a Cascading menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *command - Command text to be sent when menu item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCascadingMenuItem( const char *itemName, const char *itemText, const char *command, Panel *target, Menu *cascadeMenu , const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, itemText, cascadeMenu ); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemCharCommand(item, command, target, userData); } int Menu::AddCascadingMenuItem( const char *itemName, const wchar_t *wszItemText, const char *command, Panel *target, Menu *cascadeMenu , const KeyValues *userData ) { MenuItem *item = new MenuItem(this, itemName, wszItemText, cascadeMenu ); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemCharCommand(item, command, target, userData); } //----------------------------------------------------------------------------- // Purpose: Add a Cascading menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be used as the name of the menu item panel. // *command - Command text to be sent when menu item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCascadingMenuItem( const char *itemText, const char *command, Panel *target, Menu *cascadeMenu , const KeyValues *userData ) { return AddCascadingMenuItem( itemText, itemText, command, target, cascadeMenu, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a Cascading menu item to the menu. // Input : *itemName - Name of item // *itemText - Name of item text that will appear in the manu. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCascadingMenuItem( const char *itemName, const char *itemText, KeyValues *message, Panel *target, Menu *cascadeMenu, const KeyValues *userData ) { MenuItem *item = new MenuItem( this, itemName, itemText, cascadeMenu); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemKeyValuesCommand(item, message, target, userData); } int Menu::AddCascadingMenuItem( const char *itemName, const wchar_t *wszItemText, KeyValues *message, Panel *target, Menu *cascadeMenu, const KeyValues *userData ) { MenuItem *item = new MenuItem( this, itemName, wszItemText, cascadeMenu); if ( m_hItemFont != 0 ) { item->SetFont( m_hItemFont ); } return AddMenuItemKeyValuesCommand(item, message, target, userData); } //----------------------------------------------------------------------------- // Purpose: Add a Cascading menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be used as the name of the menu item panel. // *message - pointer to the message to send when the item is selected // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCascadingMenuItem( const char *itemText, KeyValues *message, Panel *target, Menu *cascadeMenu, const KeyValues *userData ) { return AddCascadingMenuItem(itemText, itemText, message, target, cascadeMenu, userData ); } //----------------------------------------------------------------------------- // Purpose: Add a Cascading menu item to the menu. // Input : *itemText - Name of item text that will appear in the manu. // This will also be the text of the command sent when the // item is selected. // *target - Target panel of the command // *cascadeMenu - if the menu item opens a cascading menu, this is a // ptr to the menu that opens on selecting the item //----------------------------------------------------------------------------- int Menu::AddCascadingMenuItem( const char *itemText, Panel *target, Menu *cascadeMenu, const KeyValues *userData ) { return AddCascadingMenuItem(itemText, itemText, target, cascadeMenu, userData); } //----------------------------------------------------------------------------- // Purpose: Sets the values of a menu item at the specified index // Input : index - the index of this item entry // *message - pointer to the message to send when the item is selected //----------------------------------------------------------------------------- void Menu::UpdateMenuItem(int itemID, const char *itemText, KeyValues *message, const KeyValues *userData) { Assert( m_MenuItems.IsValidIndex(itemID) ); if ( m_MenuItems.IsValidIndex(itemID) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); // make sure its enabled since disabled items get highlighted. if (menuItem) { menuItem->SetText(itemText); menuItem->SetCommand(message); if(userData) { menuItem->SetUserData(userData); } } } _recalculateWidth = true; } //----------------------------------------------------------------------------- // Purpose: Sets the values of a menu item at the specified index //----------------------------------------------------------------------------- void Menu::UpdateMenuItem(int itemID, const wchar_t *wszItemText, KeyValues *message, const KeyValues *userData) { Assert( m_MenuItems.IsValidIndex(itemID) ); if ( m_MenuItems.IsValidIndex(itemID) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); // make sure its enabled since disabled items get highlighted. if (menuItem) { menuItem->SetText(wszItemText); menuItem->SetCommand(message); if(userData) { menuItem->SetUserData(userData); } } } _recalculateWidth = true; } //----------------------------------------------------------------------------- // Sets the content alignment of all items in the menu //----------------------------------------------------------------------------- void Menu::SetContentAlignment( Label::Alignment alignment ) { if ( m_Alignment != alignment ) { m_Alignment = alignment; // Change the alignment of existing menu items int nCount = m_MenuItems.Count(); for ( int i = 0; i < nCount; ++i ) { m_MenuItems[i]->SetContentAlignment( alignment ); } } } //----------------------------------------------------------------------------- // Purpose: Locks down a specific width //----------------------------------------------------------------------------- void Menu::SetFixedWidth(int width) { // the padding makes it so the menu has the label padding on each side of the menu. // makes the menu items look centered. m_iFixedWidth = width; InvalidateLayout(false); } //----------------------------------------------------------------------------- // Purpose: sets the height of each menu item //----------------------------------------------------------------------------- void Menu::SetMenuItemHeight(int itemHeight) { m_iMenuItemHeight = itemHeight; } int Menu::GetMenuItemHeight() const { return m_iMenuItemHeight; } int Menu::CountVisibleItems() { int count = 0; int c = m_SortedItems.Count(); for ( int i = 0 ; i < c; ++i ) { if ( m_MenuItems[ m_SortedItems[ i ] ]->IsVisible() ) ++count; } return count; } void Menu::ComputeWorkspaceSize( int& workWide, int& workTall ) { // make sure we factor in insets int ileft, iright, itop, ibottom; GetInset(ileft, iright, itop, ibottom); int workX, workY; surface()->GetWorkspaceBounds(workX, workY, workWide, workTall); workTall -= 20; workTall -= itop; workTall -= ibottom; } // Assumes relative coords in screenspace void Menu::PositionRelativeToPanel( Panel *relative, MenuDirection_e direction, int nAdditionalYOffset /*=0*/, bool showMenu /*=false*/ ) { Assert( relative ); int rx, ry, rw, rh; relative->GetBounds( rx, ry, rw, rh ); relative->LocalToScreen( rx, ry ); if ( direction == CURSOR ) { // force the menu to appear where the mouse button was pressed input()->GetCursorPos(rx, ry); rw = rh = 0; } else if ( direction == ALIGN_WITH_PARENT && relative->GetVParent() ) { rx = 0, ry = 0; relative->ParentLocalToScreen(rx, ry); rx -= 1; // take border into account ry += rh + nAdditionalYOffset; rw = rh = 0; } else { rx = 0, ry = 0; relative->LocalToScreen(rx, ry); } int workWide, workTall; ComputeWorkspaceSize( workWide, workTall ); // Final pos int x = 0, y = 0; int mWide, mTall; GetSize( mWide, mTall ); switch( direction ) { case Menu::UP: // Menu prefers to open upward { x = rx; int topOfReference = ry; y = topOfReference - mTall; if ( y < 0 ) { int bottomOfReference = ry + rh + 1; int remainingPixels = workTall - bottomOfReference; // Can't fit on bottom, either, move to side if ( mTall >= remainingPixels ) { y = workTall - mTall; x = rx + rw; // Try and place it to the left of the button if ( x + mWide > workWide ) { x = rx - mWide; } } else { // Room at bottom y = bottomOfReference; } } } break; // Everyone else aligns downward... default: case Menu::LEFT: case Menu::RIGHT: case Menu::DOWN: { x = rx; int bottomOfReference = ry + rh + 1; y = bottomOfReference; if ( bottomOfReference + mTall >= workTall ) { // See if there's run straight above if ( mTall >= ry ) // No room, try and push menu to right or left { y = workTall - mTall; x = rx + rw; // Try and place it to the left of the button if ( x + mWide > workWide ) { x = rx - mWide; } } else { // Room at top y = ry - mTall; } } } break; } // Check left rightness if ( x + mWide > workWide ) { x = workWide - mWide; Assert( x >= 0 ); // yikes!!! } else if ( x < 0 ) { x = 0; } SetPos( x, y ); if ( showMenu ) { SetVisible( true ); } } int Menu::ComputeFullMenuHeightWithInsets() { // make sure we factor in insets int ileft, iright, itop, ibottom; GetInset(ileft, iright, itop, ibottom); int separatorHeight = 3; // add up the size of all the child panels // move the child panels to the correct place in the menu int totalTall = itop + ibottom; int i; for ( i = 0 ; i < m_SortedItems.Count() ; i++ ) // use sortedItems instead of MenuItems due to SetPos() { int itemId = m_SortedItems[i]; MenuItem *child = m_MenuItems[ itemId ]; Assert( child ); if ( !child ) continue; // These should all be visible at this point if ( !child->IsVisible() ) continue; totalTall += m_iMenuItemHeight; // Add a separator if needed... int sepIndex = m_Separators.Find( itemId ); if ( sepIndex != m_Separators.InvalidIndex() ) { totalTall += separatorHeight; } } return totalTall; } //----------------------------------------------------------------------------- // Purpose: Reformat according to the new layout //----------------------------------------------------------------------------- void Menu::PerformLayout() { MenuItem *parent = GetParentMenuItem(); bool cascading = parent != NULL ? true : false; // make sure we factor in insets int ileft, iright, itop, ibottom; GetInset(ileft, iright, itop, ibottom); int workWide, workTall; ComputeWorkspaceSize( workWide, workTall ); int fullHeightWouldRequire = ComputeFullMenuHeightWithInsets(); bool bNeedScrollbar = fullHeightWouldRequire >= workTall; int maxVisibleItems = CountVisibleItems(); if ( m_iNumVisibleLines > 0 && maxVisibleItems > m_iNumVisibleLines ) { bNeedScrollbar = true; maxVisibleItems = m_iNumVisibleLines; } // if we have a scroll bar if ( bNeedScrollbar ) { // add it to the display AddScrollBar(); // This fills in m_VisibleSortedItems as needed MakeItemsVisibleInScrollRange( m_iNumVisibleLines, MIN( fullHeightWouldRequire, workTall ) ); } else { RemoveScrollBar(); // Make everything visible m_VisibleSortedItems.RemoveAll(); int i; int c = m_SortedItems.Count(); for ( i = 0; i < c; ++i ) { int itemID = m_SortedItems[ i ]; MenuItem *child = m_MenuItems[ itemID ]; if ( !child || !child->IsVisible() ) continue; m_VisibleSortedItems.AddToTail( itemID ); } // Hide the separators, the needed ones will be readded below c = m_SeparatorPanels.Count(); for ( i = 0; i < c; ++i ) { if ( m_SeparatorPanels[ i ] ) { m_SeparatorPanels[ i ]->SetVisible( false ); } } } // get the appropriate menu border LayoutMenuBorder(); int trueW = GetWide(); if ( bNeedScrollbar ) { trueW -= m_pScroller->GetWide(); } int separatorHeight = MENU_SEPARATOR_HEIGHT; // add up the size of all the child panels // move the child panels to the correct place in the menu int menuTall = 0; int totalTall = itop + ibottom; int i; for ( i = 0 ; i < m_VisibleSortedItems.Count() ; i++ ) // use sortedItems instead of MenuItems due to SetPos() { int itemId = m_VisibleSortedItems[i]; MenuItem *child = m_MenuItems[ itemId ]; Assert( child ); if ( !child ) continue; // These should all be visible at this point if ( !child->IsVisible() ) continue; if ( totalTall >= workTall ) break; if ( m_hItemFont ) { child->SetFont( m_hItemFont ); } // take into account inset child->SetPos (0, menuTall); child->SetTall( m_iMenuItemHeight ); // Width is set in a second pass menuTall += m_iMenuItemHeight; totalTall += m_iMenuItemHeight; // this will make all the menuitems line up in a column with space for the checks to the left. if ( ( !child->IsCheckable() ) && ( m_iCheckImageWidth > 0 ) ) { // Non checkable items have to move over child->SetTextInset( m_iCheckImageWidth, 0 ); } else if ( child->IsCheckable() ) { child->SetTextInset(0, 0); //TODO: for some reason I can't comment this out. } // Add a separator if needed... int sepIndex = m_Separators.Find( itemId ); if ( sepIndex != m_Separators.InvalidIndex() ) { MenuSeparator *sep = m_SeparatorPanels[ sepIndex ]; Assert( sep ); sep->SetVisible( true ); sep->SetBounds( 0, menuTall, trueW, separatorHeight ); menuTall += separatorHeight; totalTall += separatorHeight; } } if (!m_iFixedWidth) { _recalculateWidth = true; CalculateWidth(); } else if (m_iFixedWidth) { _menuWide = m_iFixedWidth; // fixed width menus include the scroll bar in their width. if (_sizedForScrollBar) { _menuWide -= m_pScroller->GetWide(); } } SizeMenuItems(); int extraWidth = 0; if (_sizedForScrollBar) { extraWidth = m_pScroller->GetWide(); } int mwide = _menuWide + extraWidth; if ( mwide > workWide ) { mwide = workWide; } int mtall = menuTall + itop + ibottom; if ( mtall > workTall ) { // Shouldn't happen mtall = workTall; } // set the new size of the menu SetSize( mwide, mtall ); // move the menu to the correct position if it is a cascading menu. if ( cascading ) { // move the menu to the correct position if it is a cascading menu. PositionCascadingMenu(); } // set up scroll bar as appropriate if ( m_pScroller->IsVisible() ) { LayoutScrollBar(); } FOR_EACH_LL( m_MenuItems, j ) { m_MenuItems[j]->InvalidateLayout(); // cause each menu item to redo its apply settings now we have sized ourselves } Repaint(); } //----------------------------------------------------------------------------- // Purpose: Force the menu to work out how wide it should be //----------------------------------------------------------------------------- void Menu::ForceCalculateWidth() { _recalculateWidth = true; CalculateWidth(); PerformLayout(); } //----------------------------------------------------------------------------- // Purpose: Figure out how wide the menu should be if the menu is not fixed width //----------------------------------------------------------------------------- void Menu::CalculateWidth() { if (!_recalculateWidth) return; _menuWide = 0; if (!m_iFixedWidth) { // find the biggest menu item FOR_EACH_LL( m_MenuItems, i ) { int wide, tall; m_MenuItems[i]->GetContentSize(wide, tall); if (wide > _menuWide - Label::Content) { _menuWide = wide + Label::Content; } } } // enfoce a minimumWidth if (_menuWide < m_iMinimumWidth) { _menuWide = m_iMinimumWidth; } _recalculateWidth = false; } //----------------------------------------------------------------------------- // Purpose: Set up the scroll bar attributes,size and location. //----------------------------------------------------------------------------- void Menu::LayoutScrollBar() { //!! need to make it recalculate scroll positions m_pScroller->SetEnabled(false); m_pScroller->SetRangeWindow( m_VisibleSortedItems.Count() ); m_pScroller->SetRange( 0, CountVisibleItems() ); m_pScroller->SetButtonPressedScrollValue( 1 ); int wide, tall; GetSize (wide, tall); // make sure we factor in insets int ileft, iright, itop, ibottom; GetInset(ileft, iright, itop, ibottom); // with a scroll bar we take off the inset wide -= iright; m_pScroller->SetPos(wide - m_pScroller->GetWide(), 1); // scrollbar is inside the menu's borders. m_pScroller->SetSize(m_pScroller->GetWide(), tall - ibottom - itop); } //----------------------------------------------------------------------------- // Purpose: Figure out where to open menu if it is a cascading menu //----------------------------------------------------------------------------- void Menu::PositionCascadingMenu() { Assert(GetVParent()); int parentX, parentY, parentWide, parentTall; // move the menu to the correct place below the menuItem ipanel()->GetSize(GetVParent(), parentWide, parentTall); ipanel()->GetPos(GetVParent(), parentX, parentY); parentX += parentWide, parentY = 0; ParentLocalToScreen(parentX, parentY); SetPos(parentX, parentY); // for cascading menus, // make sure we're on the screen int workX, workY, workWide, workTall, x, y, wide, tall; GetBounds(x, y, wide, tall); surface()->GetWorkspaceBounds(workX, workY, workWide, workTall); if (x + wide > workX + workWide) { // we're off the right, move the menu to the left side // orignalX - width of the parentmenuitem - width of this menu. // add 2 pixels to offset one pixel onto the parent menu. x -= (parentWide + wide); x -= 2; } else { // alignment move it in the amount of the insets. x += 1; } if ( y + tall > workY + workTall ) { int lastWorkY = workY + workTall; int pixelsOffBottom = ( y + tall ) - lastWorkY; y -= pixelsOffBottom; y -= 2; } else { y -= 1; } SetPos(x, y); MoveToFront(); } //----------------------------------------------------------------------------- // Purpose: Size the menu items so they are the width of the menu. // Also size the menu items with cascading menus so the arrow fits in there. //----------------------------------------------------------------------------- void Menu::SizeMenuItems() { int ileft, iright, itop, ibottom; GetInset(ileft, iright, itop, ibottom); // assign the sizes of all the menu item panels FOR_EACH_LL( m_MenuItems, i ) { MenuItem *child = m_MenuItems[i]; if (child ) { // labels do thier own sizing. this will size the label to the width of the menu, // this will put the cascading menu arrow on the right side automatically. child->SetWide(_menuWide - ileft - iright); } } } //----------------------------------------------------------------------------- // Purpose: Makes menu items visible in relation to where the scroll bar is //----------------------------------------------------------------------------- void Menu::MakeItemsVisibleInScrollRange( int maxVisibleItems, int nNumPixelsAvailable ) { // Detach all items from tree int i; FOR_EACH_LL( m_MenuItems, item ) { m_MenuItems[ item ]->SetBounds( 0, 0, 0, 0 ); } for ( i = 0; i < m_SeparatorPanels.Count(); ++i ) { m_SeparatorPanels[ i ]->SetVisible( false ); } m_VisibleSortedItems.RemoveAll(); int tall = 0; int startItem = m_pScroller->GetValue(); Assert( startItem >= 0 ); do { if ( startItem >= m_SortedItems.Count() ) break; int itemId = m_SortedItems[ startItem ]; if ( !m_MenuItems[ itemId ]->IsVisible() ) { ++startItem; continue; } int itemHeight = m_iMenuItemHeight; int sepIndex = m_Separators.Find( itemId ); if ( sepIndex != m_Separators.InvalidIndex() ) { itemHeight += MENU_SEPARATOR_HEIGHT; } if ( tall + itemHeight > nNumPixelsAvailable ) break; // Too many items if ( maxVisibleItems > 0 ) { if ( m_VisibleSortedItems.Count() >= maxVisibleItems ) break; } tall += itemHeight; // Re-attach this one m_VisibleSortedItems.AddToTail( itemId ); ++startItem; } while ( true ); } //----------------------------------------------------------------------------- // Purpose: Get the approproate menu border //----------------------------------------------------------------------------- void Menu::LayoutMenuBorder() { IBorder *menuBorder; IScheme *pScheme = scheme()->GetIScheme( GetScheme() ); menuBorder = pScheme->GetBorder("MenuBorder"); if ( menuBorder ) { SetBorder(menuBorder); } } //----------------------------------------------------------------------------- // Purpose: Draw a black border on the right side of the menu items //----------------------------------------------------------------------------- void Menu::Paint() { if ( m_pScroller->IsVisible() ) { // draw black bar int wide, tall; GetSize (wide, tall); surface()->DrawSetColor(_borderDark); if( IsProportional() ) { surface()->DrawFilledRect(wide - m_pScroller->GetWide(), -1, wide - m_pScroller->GetWide() + 1, tall); } else { surface()->DrawFilledRect(wide - m_pScroller->GetWide(), -1, wide - m_pScroller->GetWide() + 1, tall); } } } //----------------------------------------------------------------------------- // Purpose: sets the max number of items visible (scrollbar appears with more) // Input : numItems - //----------------------------------------------------------------------------- void Menu::SetNumberOfVisibleItems( int numItems ) { m_iNumVisibleLines = numItems; InvalidateLayout(false); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- MenuItem *Menu::GetMenuItem(int itemID) { if ( !m_MenuItems.IsValidIndex(itemID) ) return NULL; return m_MenuItems[itemID]; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool Menu::IsValidMenuID(int itemID) { return m_MenuItems.IsValidIndex(itemID); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int Menu::GetInvalidMenuID() { return m_MenuItems.InvalidIndex(); } //----------------------------------------------------------------------------- // Purpose: When a menuItem is selected, close cascading menus // if the menuItem selected has a cascading menu attached, we // want to keep that one open so skip it. // Passing NULL will close all cascading menus. //----------------------------------------------------------------------------- void Menu::CloseOtherMenus(MenuItem *item) { FOR_EACH_LL( m_MenuItems, i ) { if (m_MenuItems[i] == item) continue; m_MenuItems[i]->CloseCascadeMenu(); } } //----------------------------------------------------------------------------- // Purpose: Respond to string commands. //----------------------------------------------------------------------------- void Menu::OnCommand( const char *command ) { // forward on the message PostActionSignal(new KeyValues("Command", "command", command)); Panel::OnCommand(command); } //----------------------------------------------------------------------------- // Purpose: Handle key presses, Activate shortcuts //----------------------------------------------------------------------------- void Menu::OnKeyCodeTyped(KeyCode code) { bool alt = (input()->IsKeyDown(KEY_LALT) || input()->IsKeyDown(KEY_RALT)); if (alt) { BaseClass::OnKeyCodeTyped( code ); PostActionSignal(new KeyValues("MenuClose")); } switch (code) { case KEY_ESCAPE: { // hide the menu on ESC SetVisible(false); break; } // arrow keys scroll through items on the list. // they should also scroll the scroll bar if needed case KEY_UP: { MoveAlongMenuItemList(MENU_UP, 0); m_MenuItems[m_iCurrentlySelectedItemID]->ArmItem(); break; } case KEY_DOWN: { MoveAlongMenuItemList(MENU_DOWN, 0); m_MenuItems[m_iCurrentlySelectedItemID]->ArmItem(); break; } // for now left and right arrows just open or close submenus if they are there. case KEY_RIGHT: { // make sure a menuItem is currently selected if ( m_MenuItems.IsValidIndex(m_iCurrentlySelectedItemID) ) { if (m_MenuItems[m_iCurrentlySelectedItemID]->HasMenu()) { ActivateItem(m_iCurrentlySelectedItemID); } else { BaseClass::OnKeyCodeTyped( code ); } } else { BaseClass::OnKeyCodeTyped( code ); } break; } case KEY_LEFT: { // if our parent is a menu item then we are a submenu so close us. if (GetParentMenuItem()) { SetVisible(false); } else { BaseClass::OnKeyCodeTyped( code ); } break; } case KEY_ENTER: { // make sure a menuItem is currently selected if ( m_MenuItems.IsValidIndex(m_iCurrentlySelectedItemID) ) { ActivateItem(m_iCurrentlySelectedItemID); } else { BaseClass::OnKeyCodeTyped( code ); // chain up } break; } } // don't chain back } //----------------------------------------------------------------------------- // Purpose: Handle key presses, Activate shortcuts // Input : code - //----------------------------------------------------------------------------- void Menu::OnKeyTyped(wchar_t unichar) { // // NOTE - if hotkeys are ever enabled you need to work out a way to differentiate between // combo box menus (which can't have hot keys) and system style menus (which do have hot keys). // // /* if (unichar) { // iterate the menu items looking for one with the matching hotkey FOR_EACH_LL( m_MenuItems, i ) { MenuItem *panel = m_MenuItems[i]; if (panel->IsVisible()) { Panel *hot = panel->HasHotkey(unichar); if (hot) { // post a message to the menuitem telling it it's hotkey was pressed PostMessage(hot, new KeyValues("Hotkey")); return; } // if the menuitem is a cascading menuitem and it is open, check its hotkeys too Menu *cascadingMenu = panel->GetMenu(); if (cascadingMenu && cascadingMenu->IsVisible()) { cascadingMenu->OnKeyTyped(unichar); } } } } */ int itemToSelect = m_iCurrentlySelectedItemID; if ( itemToSelect < 0 ) { itemToSelect = 0; } int i; wchar_t menuItemName[255]; i = itemToSelect + 1; if ( i >= m_MenuItems.Count() ) { i = 0; } while ( i != itemToSelect ) { m_MenuItems[i]->GetText(menuItemName, 254); if ( towlower(menuItemName[0]) == towlower(unichar) ) { itemToSelect = i; break; } i++; if ( i >= m_MenuItems.Count() ) { i = 0; } } if ( itemToSelect >= 0 ) { SetCurrentlyHighlightedItem( itemToSelect ); InvalidateLayout(); } // don't chain back } //----------------------------------------------------------------------------- // Purpose: Handle the mouse wheel event, scroll the selection //----------------------------------------------------------------------------- void Menu::OnMouseWheeled(int delta) { if (!m_pScroller->IsVisible()) return; int val = m_pScroller->GetValue(); val -= delta; m_pScroller->SetValue(val); // moving the slider redraws the scrollbar, // and so we should redraw the menu since the // menu draws the black border to the right of the scrollbar. InvalidateLayout(); // don't chain back } //----------------------------------------------------------------------------- // Purpose: Lose focus, hide menu //----------------------------------------------------------------------------- void Menu::OnKillFocus() { // check to see if it's a child taking it if (!input()->GetFocus() || !ipanel()->HasParent(input()->GetFocus(), GetVPanel())) { // if we don't accept keyboard input, then we have to ignore the killfocus if it's not actually being stolen if (!IsKeyBoardInputEnabled() && !input()->GetFocus()) return; // get the parent of this menu. MenuItem *item = GetParentMenuItem(); // if the parent is a menu item, this menu is a cascading menu // if the panel that is getting focus is the parent menu, don't close this menu. if ( (item) && (input()->GetFocus() == item->GetVParent()) ) { // if we are in mouse mode and we clicked on the menuitem that // triggers the cascading menu, leave it open. if (m_iInputMode == MOUSE) { // return the focus to the cascading menu. MoveToFront(); return; } } // forward the message to the parent. PostActionSignal(new KeyValues("MenuClose")); // hide this menu SetVisible(false); } } class CMenuManager { public: void AddMenu( Menu *m ) { if ( !m ) return; int c = m_Menus.Count(); for ( int i = 0 ; i < c; ++i ) { if ( m_Menus[ i ].Get() == m ) return; } DHANDLE< Menu > h; h = m; m_Menus.AddToTail( h ); } void RemoveMenu( Menu *m ) { if ( !m ) return; int c = m_Menus.Count(); for ( int i = c - 1 ; i >= 0; --i ) { if ( m_Menus[ i ].Get() == m ) { m_Menus.Remove( i ); return; } } } void OnInternalMousePressed( Panel *other, MouseCode code ) { int c = m_Menus.Count(); if ( !c ) return; int x, y; input()->GetCursorPos( x, y ); bool mouseInsideMenuRelatedPanel = false; for ( int i = c - 1; i >= 0 ; --i ) { Menu *m = m_Menus[ i ].Get(); if ( !m ) { m_Menus.Remove( i ); continue; } // See if the mouse is within a menu if ( IsWithinMenuOrRelative( m, x, y ) ) { mouseInsideMenuRelatedPanel = true; } } if ( mouseInsideMenuRelatedPanel ) { return; } AbortMenus(); } void AbortMenus() { // Close all of the menus int c = m_Menus.Count(); for ( int i = c - 1; i >= 0 ; --i ) { Menu *m = m_Menus[ i ].Get(); if ( !m ) { continue; } m_Menus.Remove( i ); // Force it to close m->SetVisible( false ); } m_Menus.RemoveAll(); } bool IsWithinMenuOrRelative( Panel *panel, int x, int y ) { VPANEL topMost = panel->IsWithinTraverse( x, y, true ); if ( topMost ) { // It's over the menu if ( topMost == panel->GetVPanel() ) { return true; } // It's over something which is parented to the menu (i.e., a menu item) if ( ipanel()->HasParent( topMost, panel->GetVPanel() ) ) { return true; } } if ( panel->GetParent() ) { Panel *parent = panel->GetParent(); topMost = parent->IsWithinTraverse( x, y, true ); if ( topMost ) { if ( topMost == parent->GetVPanel() ) { return true; } if ( ipanel()->HasParent( topMost, parent->GetVPanel() ) ) { return true; } } } return false; } #ifdef DBGFLAG_VALIDATE void Validate( CValidator &validator, char *pchName ) { validator.Push( "CMenuManager", this, pchName ); m_Menus.Validate( validator, "m_Menus" ); validator.Pop(); } #endif private: // List of visible menus CUtlVector< DHANDLE< Menu > > m_Menus; }; // Singleton helper class static CMenuManager g_MenuMgr; namespace vgui { void ValidateMenuGlobals( CValidator &validator ) { #ifdef DBGFLAG_VALIDATE g_MenuMgr.Validate( validator, "g_MenuMgr" ); #endif } } //----------------------------------------------------------------------------- // Purpose: Static method called on mouse released to see if Menu objects should be aborted // Input : *other - // code - //----------------------------------------------------------------------------- void Menu::OnInternalMousePressed( Panel *other, MouseCode code ) { g_MenuMgr.OnInternalMousePressed( other, code ); } //----------------------------------------------------------------------------- // Purpose: Set visibility of menu and its children as appropriate. //----------------------------------------------------------------------------- void Menu::SetVisible(bool state) { if (state == IsVisible()) return; if ( state == false ) { PostActionSignal(new KeyValues("MenuClose")); CloseOtherMenus(NULL); SetCurrentlySelectedItem(-1); g_MenuMgr.RemoveMenu( this ); } else if ( state == true ) { MoveToFront(); RequestFocus(); g_MenuMgr.AddMenu( this ); } // must be after movetofront() BaseClass::SetVisible(state); _sizedForScrollBar = false; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Menu::ApplySchemeSettings(IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); SetFgColor(GetSchemeColor("Menu.TextColor", pScheme)); SetBgColor(GetSchemeColor("Menu.BgColor", pScheme)); _borderDark = pScheme->GetColor("BorderDark", Color(255, 255, 255, 0)); FOR_EACH_LL( m_MenuItems, i ) { if( m_MenuItems[i]->IsCheckable() ) { int wide, tall; m_MenuItems[i]->GetCheckImageSize( wide, tall ); m_iCheckImageWidth = MAX ( m_iCheckImageWidth, wide ); } } _recalculateWidth = true; CalculateWidth(); InvalidateLayout(); } void Menu::SetBgColor( Color newColor ) { BaseClass::SetBgColor( newColor ); FOR_EACH_LL( m_MenuItems, i ) { if( m_MenuItems[i]->HasMenu() ) { m_MenuItems[i]->GetMenu()->SetBgColor( newColor ); } } } void Menu::SetFgColor( Color newColor ) { BaseClass::SetFgColor( newColor ); FOR_EACH_LL( m_MenuItems, i ) { if( m_MenuItems[i]->HasMenu() ) { m_MenuItems[i]->GetMenu()->SetFgColor( newColor ); } } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Menu::SetBorder(class IBorder *border) { Panel::SetBorder(border); } //----------------------------------------------------------------------------- // Purpose: returns a pointer to a MenuItem that is this menus parent, if it has one //----------------------------------------------------------------------------- MenuItem *Menu::GetParentMenuItem() { return dynamic_cast<MenuItem *>(GetParent()); } //----------------------------------------------------------------------------- // Purpose: Hide the menu when an item has been selected //----------------------------------------------------------------------------- void Menu::OnMenuItemSelected(Panel *panel) { SetVisible(false); m_pScroller->SetVisible(false); // chain this message up through the hierarchy so // all the parent menus will close // get the parent of this menu. MenuItem *item = GetParentMenuItem(); // if the parent is a menu item, this menu is a cascading menu if (item) { // get the parent of the menuitem. it should be a menu. Menu *parentMenu = item->GetParentMenu(); if (parentMenu) { // send the message to this parent menu KeyValues *kv = new KeyValues("MenuItemSelected"); kv->SetPtr("panel", panel); ivgui()->PostMessage(parentMenu->GetVPanel(), kv, GetVPanel()); } } bool activeItemSet = false; FOR_EACH_LL( m_MenuItems, i ) { if( m_MenuItems[i] == panel ) { activeItemSet = true; m_iActivatedItem = i; break; } } if( !activeItemSet ) { FOR_EACH_LL( m_MenuItems, i ) { if(m_MenuItems[i]->HasMenu() ) { /* // GetActiveItem needs to return -1 or similar if it hasn't been set... if( m_MenuItems[i]->GetActiveItem() ) { m_iActivatedItem = m_MenuItems[i]->GetActiveItem(); }*/ } } } // also pass it to the parent so they can respond if they like if (GetVParent()) { KeyValues *kv = new KeyValues("MenuItemSelected"); kv->SetPtr("panel", panel); ivgui()->PostMessage(GetVParent(), kv, GetVPanel()); } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int Menu::GetActiveItem() { return m_iActivatedItem; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- KeyValues *Menu::GetItemUserData(int itemID) { if ( m_MenuItems.IsValidIndex( itemID ) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); // make sure its enabled since disabled items get highlighted. if (menuItem && menuItem->IsEnabled()) { return menuItem->GetUserData(); } } return NULL; } //----------------------------------------------------------------------------- // Purpose: data accessor //----------------------------------------------------------------------------- void Menu::GetItemText(int itemID, wchar_t *text, int bufLenInBytes) { if ( m_MenuItems.IsValidIndex( itemID ) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); if (menuItem) { menuItem->GetText(text, bufLenInBytes); return; } } text[0] = 0; } void Menu::GetItemText(int itemID, char *text, int bufLenInBytes) { if ( m_MenuItems.IsValidIndex( itemID ) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); if (menuItem) { menuItem->GetText( text, bufLenInBytes ); return; } } text[0] = 0; } //----------------------------------------------------------------------------- // Purpose: Activate the n'th item in the menu list, as if that menu item had been selected by the user //----------------------------------------------------------------------------- void Menu::ActivateItem(int itemID) { if ( m_MenuItems.IsValidIndex( itemID ) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); // make sure its enabled since disabled items get highlighted. if (menuItem && menuItem->IsEnabled()) { menuItem->FireActionSignal(); m_iActivatedItem = itemID; } } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Menu::ActivateItemByRow(int row) { if (m_SortedItems.IsValidIndex(row)) { ActivateItem(m_SortedItems[row]); } } //----------------------------------------------------------------------------- // Purpose: Return the number of items currently in the menu list //----------------------------------------------------------------------------- int Menu::GetItemCount() { return m_MenuItems.Count(); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int Menu::GetMenuID(int index) { if ( !m_SortedItems.IsValidIndex(index) ) return m_MenuItems.InvalidIndex(); return m_SortedItems[index]; } //----------------------------------------------------------------------------- // Purpose: Return the number of items currently visible in the menu list //----------------------------------------------------------------------------- int Menu::GetCurrentlyVisibleItemsCount() { if (m_MenuItems.Count() < m_iNumVisibleLines) { int cMenuItems = 0; FOR_EACH_LL(m_MenuItems, i) { if (m_MenuItems[i]->IsVisible()) { ++cMenuItems; } } return cMenuItems; } return m_iNumVisibleLines; } //----------------------------------------------------------------------------- // Purpose: Enables/disables choices in the list // itemText - string name of item in the list // state - true enables, false disables //----------------------------------------------------------------------------- void Menu::SetItemEnabled(const char *itemName, bool state) { FOR_EACH_LL( m_MenuItems, i ) { if ((Q_stricmp(itemName, m_MenuItems[i]->GetName())) == 0) { m_MenuItems[i]->SetEnabled(state); } } } //----------------------------------------------------------------------------- // Purpose: Enables/disables choices in the list //----------------------------------------------------------------------------- void Menu::SetItemEnabled(int itemID, bool state) { if ( !m_MenuItems.IsValidIndex(itemID) ) return; m_MenuItems[itemID]->SetEnabled(state); } //----------------------------------------------------------------------------- // Purpose: shows/hides choices in the list //----------------------------------------------------------------------------- void Menu::SetItemVisible(const char *itemName, bool state) { FOR_EACH_LL( m_MenuItems, i ) { if ((Q_stricmp(itemName, m_MenuItems[i]->GetName())) == 0) { m_MenuItems[i]->SetVisible(state); InvalidateLayout(); } } } //----------------------------------------------------------------------------- // Purpose: shows/hides choices in the list //----------------------------------------------------------------------------- void Menu::SetItemVisible(int itemID, bool state) { if ( !m_MenuItems.IsValidIndex(itemID) ) return; m_MenuItems[itemID]->SetVisible(state); } //----------------------------------------------------------------------------- // Purpose: Make the scroll bar visible and narrow the menu // also make items visible or invisible in the list as appropriate //----------------------------------------------------------------------------- void Menu::AddScrollBar() { m_pScroller->SetVisible(true); _sizedForScrollBar = true; } //----------------------------------------------------------------------------- // Purpose: Make the scroll bar invisible and widen the menu //----------------------------------------------------------------------------- void Menu::RemoveScrollBar() { m_pScroller->SetVisible(false); _sizedForScrollBar = false; } //----------------------------------------------------------------------------- // Purpose: Invalidate layout if the slider is moved so items scroll //----------------------------------------------------------------------------- void Menu::OnSliderMoved() { CloseOtherMenus(NULL); // close any cascading menus // Invalidate so we redraw the menu! InvalidateLayout(); Repaint(); } //----------------------------------------------------------------------------- // Purpose: Toggle into mouse mode. //----------------------------------------------------------------------------- void Menu::OnCursorMoved(int x, int y) { m_iInputMode = MOUSE; // chain up CallParentFunction(new KeyValues("OnCursorMoved", "x", x, "y", y)); RequestFocus(); InvalidateLayout(); } //----------------------------------------------------------------------------- // Purpose: Toggle into keyboard mode. //----------------------------------------------------------------------------- void Menu::OnKeyCodePressed(KeyCode code) { m_iInputMode = KEYBOARD; // send the message to this parent in case this is a cascading menu if (GetVParent()) { ivgui()->PostMessage(GetVParent(), new KeyValues("KeyModeSet"), GetVPanel()); } } //----------------------------------------------------------------------------- // Purpose: Sets the item currently highlighted in the menu by ptr //----------------------------------------------------------------------------- void Menu::SetCurrentlySelectedItem(MenuItem *item) { int itemNum = -1; // find it in our list of menuitems FOR_EACH_LL( m_MenuItems, i ) { MenuItem *child = m_MenuItems[i]; if (child == item) { itemNum = i; break; } } Assert( itemNum >= 0 ); SetCurrentlySelectedItem(itemNum); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Menu::ClearCurrentlyHighlightedItem() { if ( m_MenuItems.IsValidIndex(m_iCurrentlySelectedItemID) ) { m_MenuItems[m_iCurrentlySelectedItemID]->DisarmItem(); } m_iCurrentlySelectedItemID = m_MenuItems.InvalidIndex(); } //----------------------------------------------------------------------------- // Purpose: Sets the item currently highlighted in the menu by index //----------------------------------------------------------------------------- void Menu::SetCurrentlySelectedItem(int itemID) { // dont deselect if its the same item if (itemID == m_iCurrentlySelectedItemID) return; if ( m_MenuItems.IsValidIndex(m_iCurrentlySelectedItemID) ) { m_MenuItems[m_iCurrentlySelectedItemID]->DisarmItem(); } PostActionSignal(new KeyValues("MenuItemHighlight", "itemID", itemID)); m_iCurrentlySelectedItemID = itemID; } //----------------------------------------------------------------------------- // This will set the item to be currenly selected and highlight it // will not open cascading menu. This was added for comboboxes // to have the combobox item highlighted in the menu when they open the // dropdown. //----------------------------------------------------------------------------- void Menu::SetCurrentlyHighlightedItem(int itemID) { SetCurrentlySelectedItem(itemID); int row = m_SortedItems.Find(itemID); Assert(row != -1); // if there is a scroll bar, and we scroll off lets move it. if ( m_pScroller->IsVisible() ) { // now if we are off the scroll bar, it means we moved the scroll bar // by hand or set the item off the list // so just snap the scroll bar straight to the item. if ( ( row > m_pScroller->GetValue() + m_iNumVisibleLines - 1 ) || ( row < m_pScroller->GetValue() ) ) { if ( !m_pScroller->IsVisible() ) return; m_pScroller->SetValue(row); } } if ( m_MenuItems.IsValidIndex(m_iCurrentlySelectedItemID) ) { if ( !m_MenuItems[m_iCurrentlySelectedItemID]->IsArmed() ) { m_MenuItems[m_iCurrentlySelectedItemID]->ArmItem(); } } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int Menu::GetCurrentlyHighlightedItem() { return m_iCurrentlySelectedItemID; } //----------------------------------------------------------------------------- // Purpose: Respond to cursor entering a menuItem. //----------------------------------------------------------------------------- void Menu::OnCursorEnteredMenuItem(int VPanel) { VPANEL menuItem = (VPANEL)VPanel; // if we are in mouse mode if (m_iInputMode == MOUSE) { MenuItem *item = static_cast<MenuItem *>(ipanel()->GetPanel(menuItem, GetModuleName())); // arm the menu item->ArmItem(); // open the cascading menu if there is one. item->OpenCascadeMenu(); SetCurrentlySelectedItem(item); } } //----------------------------------------------------------------------------- // Purpose: Respond to cursor exiting a menuItem //----------------------------------------------------------------------------- void Menu::OnCursorExitedMenuItem(int VPanel) { VPANEL menuItem = (VPANEL)VPanel; // only care if we are in mouse mode if (m_iInputMode == MOUSE) { MenuItem *item = static_cast<MenuItem *>(ipanel()->GetPanel(menuItem, GetModuleName())); // unhighlight the item. // note menuItems with cascading menus will stay lit. item->DisarmItem(); } } //----------------------------------------------------------------------------- // Purpose: Move up or down one in the list of items in the menu // Direction is MENU_UP or MENU_DOWN //----------------------------------------------------------------------------- void Menu::MoveAlongMenuItemList(int direction, int loopCount) { int itemID = m_iCurrentlySelectedItemID; int row = m_SortedItems.Find(itemID); row += direction; if ( row > m_SortedItems.Count() - 1 ) { if ( m_pScroller->IsVisible() ) { // stop at bottom of scrolled list row = m_SortedItems.Count() - 1; } else { // if no scroll bar we circle around row = 0; } } else if (row < 0) { if ( m_pScroller->IsVisible() ) { // stop at top of scrolled list row = m_pScroller->GetValue(); } else { // if no scroll bar circle around row = m_SortedItems.Count()-1; } } // if there is a scroll bar, and we scroll off lets move it. if ( m_pScroller->IsVisible() ) { if ( row > m_pScroller->GetValue() + m_iNumVisibleLines - 1) { int val = m_pScroller->GetValue(); val -= -direction; m_pScroller->SetValue(val); // moving the slider redraws the scrollbar, // and so we should redraw the menu since the // menu draws the black border to the right of the scrollbar. InvalidateLayout(); } else if ( row < m_pScroller->GetValue() ) { int val = m_pScroller->GetValue(); val -= -direction; m_pScroller->SetValue(val); // moving the slider redraws the scrollbar, // and so we should redraw the menu since the // menu draws the black border to the right of the scrollbar. InvalidateLayout(); } // now if we are still off the scroll bar, it means we moved the scroll bar // by hand and created a situation in which we moved an item down, but the // scroll bar is already too far down and should scroll up or vice versa // so just snap the scroll bar straight to the item. if ( ( row > m_pScroller->GetValue() + m_iNumVisibleLines - 1) || ( row < m_pScroller->GetValue() ) ) { m_pScroller->SetValue(row); } } // switch it back to an itemID from row SetCurrentlySelectedItem( m_SortedItems[row] ); // don't allow us to loop around more than once if (loopCount < m_MenuItems.Count()) { // see if the text is empty, if so skip wchar_t text[256]; m_MenuItems[m_iCurrentlySelectedItemID]->GetText(text, 255); if (text[0] == 0 || !m_MenuItems[m_iCurrentlySelectedItemID]->IsVisible()) { // menu item is empty, keep moving along MoveAlongMenuItemList(direction, loopCount + 1); } } } //----------------------------------------------------------------------------- // Purpose: Return which type of events the menu is currently interested in // MenuItems need to know because behaviour is different depending on mode. //----------------------------------------------------------------------------- int Menu::GetMenuMode() { return m_iInputMode; } //----------------------------------------------------------------------------- // Purpose: Set the menu to key mode if a child menu goes into keymode // This mode change has to be chained up through the menu heirarchy // so cascading menus will work when you do a bunch of stuff in keymode // in high level menus and then switch to keymode in lower level menus. //----------------------------------------------------------------------------- void Menu::OnKeyModeSet() { m_iInputMode = KEYBOARD; } //----------------------------------------------------------------------------- // Purpose: Set the checked state of a menuItem //----------------------------------------------------------------------------- void Menu::SetMenuItemChecked(int itemID, bool state) { m_MenuItems[itemID]->SetChecked(state); } //----------------------------------------------------------------------------- // Purpose: Check if item is checked. //----------------------------------------------------------------------------- bool Menu::IsChecked(int itemID) { return m_MenuItems[itemID]->IsChecked(); } //----------------------------------------------------------------------------- // Purpose: Set the minmum width the menu has to be. This // is useful if you have a menu that is sized to the largest item in it // but you don't want the menu to be thinner than the menu button //----------------------------------------------------------------------------- void Menu::SetMinimumWidth(int width) { m_iMinimumWidth = width; } //----------------------------------------------------------------------------- // Purpose: Get the minmum width the menu //----------------------------------------------------------------------------- int Menu::GetMinimumWidth() { return m_iMinimumWidth; } //----------------------------------------------------------------------------- // Purpose: // Input : - //----------------------------------------------------------------------------- void Menu::AddSeparator() { int lastID = m_MenuItems.Count() - 1; m_Separators.AddToTail( lastID ); m_SeparatorPanels.AddToTail( new MenuSeparator( this, "MenuSeparator" ) ); } void Menu::AddSeparatorAfterItem( int itemID ) { Assert( m_MenuItems.IsValidIndex( itemID ) ); m_Separators.AddToTail( itemID ); m_SeparatorPanels.AddToTail( new MenuSeparator( this, "MenuSeparator" ) ); } void Menu::MoveMenuItem( int itemID, int moveBeforeThisItemID ) { int c = m_SortedItems.Count(); for ( int i = 0; i < c; ++i ) { if ( m_SortedItems[i] == itemID ) { m_SortedItems.Remove( i ); break; } } // Didn't find it if ( i >= c ) { return; } // Now find insert pos c = m_SortedItems.Count(); for ( int i = 0; i < c; ++i ) { if ( m_SortedItems[i] == moveBeforeThisItemID ) { m_SortedItems.InsertBefore( i, itemID ); break; } } } void Menu::SetFont( HFont font ) { m_hItemFont = font; if ( font ) { m_iMenuItemHeight = surface()->GetFontTall( font ) + 2; } InvalidateLayout(); } void Menu::SetCurrentKeyBinding( int itemID, char const *hotkey ) { if ( m_MenuItems.IsValidIndex( itemID ) ) { MenuItem *menuItem = dynamic_cast<MenuItem *>(m_MenuItems[itemID]); menuItem->SetCurrentKeyBinding( hotkey ); } } //----------------------------------------------------------------------------- // Purpose: Static method to display a context menu // Input : *parent - // *menu - //----------------------------------------------------------------------------- void Menu::PlaceContextMenu( Panel *parent, Menu *menu ) { Assert( parent ); Assert( menu ); if ( !menu || !parent ) return; menu->SetVisible(false); menu->SetParent( parent ); menu->AddActionSignalTarget( parent ); // get cursor position, this is local to this text edit window int cursorX, cursorY; input()->GetCursorPos(cursorX, cursorY); menu->SetVisible(true); // relayout the menu immediately so that we know it's size menu->InvalidateLayout(true); int menuWide, menuTall; menu->GetSize(menuWide, menuTall); // work out where the cursor is and therefore the best place to put the menu int wide, tall; surface()->GetScreenSize(wide, tall); if (wide - menuWide > cursorX) { // menu hanging right if (tall - menuTall > cursorY) { // menu hanging down menu->SetPos(cursorX, cursorY); } else { // menu hanging up menu->SetPos(cursorX, cursorY - menuTall); } } else { // menu hanging left if (tall - menuTall > cursorY) { // menu hanging down menu->SetPos(cursorX - menuWide, cursorY); } else { // menu hanging up menu->SetPos(cursorX - menuWide, cursorY - menuTall); } } menu->RequestFocus(); } #ifdef DBGFLAG_VALIDATE //----------------------------------------------------------------------------- // Purpose: Run a global validation pass on all of our data structures and memory // allocations. // Input: validator - Our global validator object // pchName - Our name (typically a member var in our container) //----------------------------------------------------------------------------- void Menu::Validate( CValidator &validator, char *pchName ) { validator.Push( "vgui::Menu", this, pchName ); m_MenuItems.Validate( validator, "m_MenuItems" ); m_SortedItems.Validate( validator, "m_SortedItems" ); BaseClass::Validate( validator, "vgui::Menu" ); validator.Pop(); } #endif // DBGFLAG_VALIDATE
[ "christian.pichler.msc@gmail.com" ]
christian.pichler.msc@gmail.com
d6789d98ca58353101069af659d14927be638aea
bf09b499edc5bf2e47a43c7c2dd4cd4bcc53255b
/App/ogl2d/VFT.cpp
77e4878d1865bc1f807641c931502231284f41ab
[]
no_license
15831944/SmartISO
95ab3319f1005daf9aa3fc1e38a3f010118a8d20
5040e76891190b2146f171e03445343dc005d3be
refs/heads/main
2023-04-12T19:06:21.472281
2021-05-03T04:12:59
2021-05-03T04:12:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,893
cpp
#include "StdAfx.h" #include <assert.h> #include "VFT.h" char CVFT::m_szHead[4]; // parameter : // description : // remarks : // returns : CVFT::CVFT(){ strcpy(CVFT::m_szHead,"DVFT"); m_nHeight = 0.; memset(m_ptrData,NULL,256*sizeof(VCHAR*)); memset(m_ptrChar,NULL,256*sizeof(VCHAR_T*)); } // parameter : // description : // remarks : // returns : CVFT::~CVFT(){ int i = 0; for(i = 0;i < 256;i++){ if(m_ptrData[i]){ free((void*)m_ptrData[i]->ptrLines->ptrPoints); free((void*)m_ptrData[i]->ptrLines); free((void*)m_ptrData[i]); } } for(i = 0;i < 256;i++){ if(m_ptrChar[i]){ VDATA_T* ptrNext=NULL; for(VDATA_T* ptr=m_ptrChar[i]->ptrData;ptr;ptr = ptrNext){ free((void*)ptr->ptrFloat); ptrNext = ptr->next; free((void*)ptr); } } } } /** \brief The CVFT::Read function \param pFilePath a parameter of type const char* \return bool */ bool CVFT::Read(const char* pFilePath){ assert(pFilePath && "pFilePath is NULL"); bool bRet=false; if(pFilePath){ FILE* fp=NULL; if(fp = fopen(pFilePath,"rb")){ char szHead[13]={0,},szDesc[256]={0,}; fread(szHead,sizeof(char),12,fp); char len=0; fread(&len,sizeof(char),1,fp); fread(szDesc,sizeof(char),len,fp); ////////////////////////////////////////////////////////////////////////// /// get font name strcpy(m_szFontName,pFilePath); ////////////////////////////////////////////////////////////////////////// m_nHeight = ReadFloat(fp); for(int i = 0;i < 256;i++) m_nAdvances[i] = ReadFloat(fp); while(!feof(fp)){ ReadChar(fp); } fclose(fp); bRet = true; } } return bRet; } // parameter : // description : // remarks : // returns : bool CVFT::Load(const char* pFilePath){ assert(pFilePath && "pFilePath is NULL"); bool bRet=false; if(pFilePath){ FILE* fp=NULL; if(fp = fopen(pFilePath,"rb")){ char szHead[5]={0,}; fread(szHead,sizeof(char),4,fp); if(0 == strcmp(szHead,CVFT::m_szHead)){ m_nHeight = ReadFloat(fp); for(int i = 0;i < 256;i++) m_nAdvances[i] = ReadFloat(fp); while(!feof(fp)){ LoadChar(fp); } } fclose(fp); bRet = true; } } return bRet; } // parameter : // description : // remarks : // returns : bool CVFT::Write(const char* pFilePath){ assert(pFilePath && "pFilePath is NULL"); bool bRet=false; if(pFilePath){ FILE* fp=NULL; if(fp = fopen(pFilePath,"wb")){ char *szDesc="gothice"; fwrite("VFT Ver 1.0 ",sizeof(char),12,fp); char len=strlen(szDesc); fwrite(&len,sizeof(char),1,fp); fwrite(szDesc,sizeof(char),len,fp); WriteFloat(fp,m_nHeight); int i = 0; for(i = 0;i < 256;i++) WriteFloat(fp,m_nAdvances[i]); for(i = 0;i < 256;i++) { if(m_ptrData[i]) { WriteShort(fp,m_ptrData[i]->nCharNum); for(int j = 0;j < m_ptrData[i]->nLines;j++){ fprintf(fp,"%c",MOVETO); WriteFloat(fp,m_ptrData[i]->ptrLines[j].ptrPoints[0].x); WriteFloat(fp,m_ptrData[i]->ptrLines[j].ptrPoints[0].y); for(int k = 1;k < m_ptrData[i]->ptrLines[j].nPoints;k++){ fprintf(fp,"%c",LINETO); WriteFloat(fp,m_ptrData[i]->ptrLines[j].ptrPoints[k].x); WriteFloat(fp,m_ptrData[i]->ptrLines[j].ptrPoints[k].y); } } fprintf(fp,"%c",fp); } } fclose(fp); bRet = true; } } return bRet; } // parameter : // description : // remarks : // returns : void CVFT::Dump(const char* pFilePath){ assert(pFilePath && "pFilePath is NULL"); if(pFilePath){ FILE* fp=fopen(pFilePath,"wb"); if(fp){ for(int i = 0;i < 256;i++){ if(m_ptrChar[i]) WriteChar(fp,m_ptrData[i]); } fclose(fp); } } } // parameter : // description : // remarks : // returns : VCHAR_T* CVFT::GetChar(const char ch){ return m_ptrChar[ch]; } // parameter : // description : // remarks : // returns : void CVFT::LoadChar(FILE* fp){ assert(fp && "fp is NULL"); if(fp){ short nCharNum=ReadShort(fp); if((nCharNum > 0) && (nCharNum < 256)){ if(NULL == m_ptrData[nCharNum]) m_ptrData[nCharNum] = (VCHAR*)calloc(1,sizeof(VCHAR)); if(m_ptrData[nCharNum]){ m_ptrData[nCharNum]->nCharNum = nCharNum; m_ptrData[nCharNum]->nLines = ReadShort(fp); m_ptrData[nCharNum]->ptrLines = (VLINE*)calloc(m_ptrData[nCharNum]->nLines,sizeof(VLINE)); if(m_ptrData[nCharNum]->ptrLines){ for(int i = 0;i < m_ptrData[nCharNum]->nLines;i++){ ReadLine(&(m_ptrData[nCharNum]->ptrLines[i]),fp); } } } } } } // parameter : // description : // remarks : // returns : void CVFT::ReadChar(FILE* fp){ assert(fp && "fp is NULL"); if(fp){ short nCharNum=ReadShort(fp); if((nCharNum >= 0) && (nCharNum < 256)){ if(NULL == m_ptrChar[nCharNum]) m_ptrChar[nCharNum] = (VCHAR_T*)calloc(1,sizeof(VCHAR_T)); if(m_ptrChar[nCharNum]){ VDATA_T *pData=NULL,*pLast=NULL; while(pData = ReadData(fp)){ if(NULL == pLast) m_ptrChar[nCharNum]->ptrData = pLast = pData; else{ pLast->next = pData; pLast = pLast->next; } } } } } } // parameter : // description : // remarks : // returns : void CVFT::WriteChar(FILE* fp,VCHAR* ptrChar){ assert(fp && "fp is NULL"); assert(ptrChar && "ptrChar is NULL"); if(fp && ptrChar){ fprintf(fp,"%c\r\n",ptrChar->nCharNum); for(int i = 0;i < ptrChar->nLines;i++){ WriteLine(fp,&(ptrChar->ptrLines[i])); } } } // parameter : // description : // remarks : // returns : void CVFT::ReadLine(VLINE* ptrLine,FILE* fp){ assert(ptrLine && "ptrLine is NULL"); assert(fp && "fp is NULL"); if(ptrLine && fp){ ptrLine->nPoints = ReadShort(fp); ptrLine->ptrPoints = (POINT_T*)calloc(ptrLine->nPoints,sizeof(POINT_T)); if(ptrLine->ptrPoints){ for(int i = 0;i < ptrLine->nPoints;i++){ ptrLine->ptrPoints[i].x = ReadFloat(fp); ptrLine->ptrPoints[i].y = ReadFloat(fp); } } } } // parameter : // description : // remarks : // returns : VDATA_T* CVFT::ReadData(FILE* fp){ assert(fp && "fp is NULL"); VDATA_T* pRet=NULL; if(fp){ char code=0; fread(&code,sizeof(char),1,fp); if(code && (pRet = (VDATA_T*)calloc(1,sizeof(VDATA_T)))){ pRet->chCode = code; if((MOVETO == code) || (LINETO == code)){ pRet->ptrFloat = (float*)calloc(2,sizeof(float)); if(pRet->ptrFloat){ for(int i = 0;i < 2;i++) pRet->ptrFloat[i] = ReadFloat(fp); } } } } return pRet; } // parameter : // description : // remarks : // returns : void CVFT::WriteLine(FILE* fp,VLINE* ptrLine){ assert(ptrLine && "ptrLine is NULL"); assert(fp && "fp is NULL"); if(ptrLine && fp){ for(int i = 0;i < ptrLine->nPoints;i++){ fprintf(fp,"%lf,%lf\r\n",ptrLine->ptrPoints[i].x,ptrLine->ptrPoints[i].y); } } } // parameter : // description : // remarks : // returns : short CVFT::ReadShort(FILE* fp){ assert(fp && "fp is NULL"); short nRet=0.; if(fp){ char ch[2]={0,}; fread(ch,sizeof(char),2,fp); char* ptr=(char*)&nRet; ptr[0] = ch[1]; ptr[1] = ch[0]; } return nRet; } // parameter : // description : // remarks : // returns : void CVFT::WriteShort(FILE* fp,short sh){ assert(fp && "fp is NULL"); if(fp){ char* ptr=(char*)&sh; fwrite(ptr + 1,sizeof(char),1,fp); fwrite(ptr,sizeof(char),1,fp); } } // parameter : // description : // remarks : // returns : float CVFT::ReadFloat(FILE* fp){ assert(fp && "fp is NULL"); float nRet=0.; if(fp){ char ch[4]={0,}; fread(ch,sizeof(char),4,fp); char* ptr=(char*)&nRet; ptr[0] = ch[3]; ptr[1] = ch[2]; ptr[2] = ch[1]; ptr[3] = ch[0]; } return nRet; } // parameter : // description : // remarks : // returns : void CVFT::WriteFloat(FILE* fp,float fl) { assert(fp && "fp is NULL"); float nRet=0.; if(fp){ char* ptr=(char*)&fl; fwrite(ptr + 3,sizeof(char),1,fp); fwrite(ptr + 2,sizeof(char),1,fp); fwrite(ptr + 1,sizeof(char),1,fp); fwrite(ptr,sizeof(char),1,fp); } }
[ "humkyung@atools.co.kr" ]
humkyung@atools.co.kr
02c8a7c7641e9dfadad4a27bbf214451ba7281ac
19ccfd6806c5054679dab3f275822302206b222f
/src/game/client/in_trackir.cpp
5b8a294bab27d48efb961c8bd8abec93945789c9
[ "Apache-2.0" ]
permissive
BenLubar/SwarmDirector2
425441d5ac3fd120c998379ddc96072b2c375109
78685d03eaa0d35e87c638ffa78f46f3aa8379a6
refs/heads/master
2021-01-17T22:14:37.146323
2015-07-09T19:18:03
2015-07-09T19:18:03
20,357,966
4
1
Apache-2.0
2018-08-30T13:37:22
2014-05-31T15:00:51
C++
WINDOWS-1252
C++
false
false
6,325
cpp
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: TrackIR handling function // // $Workfile: $ // $Date: $ // $NoKeywords: $ //=============================================================================// #if !defined( _X360 ) #include <windows.h> #endif #include "string_t.h" // These two have to be included very early #include <predictableid.h> #include <predictable_entity.h> #include "cdll_util.h" #include <util_shared.h> #include "vphysics_interface.h" #include <icvar.h> #include <baseentity_shared.h> #include "basehandle.h" #include "ehandle.h" #include "utlvector.h" #include "cdll_client_int.h" #include "kbutton.h" #include "usercmd.h" #include "iclientvehicle.h" #include "input.h" #include "iviewrender.h" #include "convar.h" #include "hud.h" #include "vgui/isurface.h" #include "vgui_controls/controls.h" #include "vgui/cursor.h" #include "tier0/icommandline.h" #include "inputsystem/iinputsystem.h" #include "inputsystem/ButtonCode.h" #include "math.h" #include "tier1/convar_serverbounded.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" #if !defined( _X360 ) #include "npsclient.h" #define TIR_MAX_VALUE 16383 QAngle g_angleCenter; ConVar tir_maxyaw( "tir_maxyaw", "90", FCVAR_CHEAT, "TrackIR Max Yaw", true, 0.0, true, 180.0); ConVar tir_maxpitch( "tir_maxpitch", "15", FCVAR_CHEAT, "TrackIR Max Pitch", true, 0.0, true, 180.0); ConVar tir_maxroll( "tir_maxroll", "90", FCVAR_CHEAT, "TrackIR Max Roll", true, 0.0, true, 180.0); ConVar tir_maxx( "tir_maxx", "4", FCVAR_CHEAT, "TrackIR Max X", true, 0.0, true, 50.0); ConVar tir_maxy( "tir_maxy", "6", FCVAR_CHEAT, "TrackIR Max Y", true, 0.0, true, 50.0); ConVar tir_maxz( "tir_maxz", "1", FCVAR_CHEAT, "TrackIR Max Z", true, 0.0, true, 50.0); ConVar tir_start( "tir_start", "0", 0, "TrackIR Start", true, 0.0, true, 1.0); ConVar tir_stop( "tir_stop", "0", 0, "TrackIR Stop", true, 0.0, true, 1.0); LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWnd, message, wParam, lParam); } HWND CreateHiddenWindow() { HWND hWnd; HINSTANCE hInstance = GetModuleHandle(NULL); WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = 0; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = NULL; wcex.hCursor = NULL; wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = NULL; wcex.lpszClassName = TEXT("HL2-TrackIR"); wcex.hIconSm = NULL; RegisterClassEx(&wcex); hWnd = CreateWindow(TEXT("HL2-TrackIR"), NULL, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (hWnd) { ShowWindow(hWnd, SW_HIDE); UpdateWindow(hWnd); } return hWnd; } #endif //----------------------------------------------------------------------------- // Purpose: Init_TrackIR //----------------------------------------------------------------------------- void CInput::Init_TrackIR( void ) { #if !defined( _X360 ) if ( !IsHeadTrackingEnabled() ) return; ZeroMemory(&g_angleCenter, sizeof(g_angleCenter)); HWND hWnd = CreateHiddenWindow(); NPRESULT result = NPS_Init(hWnd); // Mark the TrackIR as available and advanced initialization not completed // this is needed as correctly set cvars are not available this early during initialization // FIXME: Is this still the case? Msg( "TrackIR initialized [%d]\n", result ); m_fTrackIRAvailable = true; #endif } //----------------------------------------------------------------------------- // Purpose: Init_TrackIR //----------------------------------------------------------------------------- void CInput::Shutdown_TrackIR( void ) { #if !defined( _X360 ) if ( !IsHeadTrackingEnabled() ) return; NPS_Shutdown(); Msg( "TrackIR shut down\n" ); #endif } //----------------------------------------------------------------------------- // Purpose: Apply TrackIR to CUserCmd creation // Input : frametime - // *cmd - //----------------------------------------------------------------------------- void CInput::TrackIRMove( float frametime, CUserCmd *cmd ) { #if !defined( _X360 ) if ( !IsHeadTrackingEnabled() ) return; // complete initialization if first time in ( needed as cvars are not available at initialization time ) // verify TrackIR is available and that the user wants to use it if (!m_fTrackIRAvailable ) { return; } if (tir_start.GetFloat() == 1.0) { Init_TrackIR(); tir_start.SetValue(0); } if (tir_stop.GetFloat() == 1.0) { Shutdown_TrackIR(); tir_stop.SetValue(0); } // grab the data from the TrackIR TRACKIRDATA tid; NPRESULT result; // Go get the latest data result = NPS_GetData(&tid); if( NP_OK == result ) { QAngle viewangles; QAngle engineview; // get the current player C_BasePlayer * pPlayer = C_BasePlayer::GetLocalPlayer(); // calculate the amount of rotation from TrackIR viewangles[YAW] = g_angleCenter[YAW] + (tid.fNPYaw / (float) TIR_MAX_VALUE) * tir_maxyaw.GetFloat(); viewangles[PITCH] = g_angleCenter[PITCH] + (tid.fNPPitch / (float) TIR_MAX_VALUE) * tir_maxpitch.GetFloat(); viewangles[ROLL] = g_angleCenter[ROLL] + (tid.fNPRoll / (float) TIR_MAX_VALUE) * tir_maxroll.GetFloat() * -1.0; // get the direction the player is facing QAngle eyeAngle; eyeAngle = pPlayer->EyeAngles(); // add in the head rotation eyeAngle += viewangles; // get the rotation matrix for the head matrix3x4_t mat; AngleMatrix( pPlayer->EyeAngles(), mat ); // create a normalized vector based on the TIR input Vector tirForward, tirEye; tirForward.x = (tid.fNPZ / (float) TIR_MAX_VALUE) * -1; tirForward.y = (tid.fNPX / (float) TIR_MAX_VALUE); tirForward.z = (tid.fNPY / (float) TIR_MAX_VALUE); // now rotate the vector based on the eye angle VectorRotate(tirForward, mat, tirEye); // scale the translation vector tirEye.x *= tir_maxz.GetFloat(); tirEye.y *= tir_maxx.GetFloat(); tirEye.z *= tir_maxy.GetFloat(); // save the values for later pPlayer->SetEyeOffset(tirEye); pPlayer->SetEyeAngleOffset(viewangles); cmd->headangles = viewangles; cmd->headoffset = tirEye; } #endif }
[ "ben.lubar@gmail.com" ]
ben.lubar@gmail.com
c914e35eeee3eece7bd6f06c94d22002904607cf
1a8db3a0d145f9805ec169e57f9de326ba9d7f57
/cs475-tutorials-master/Tutorial_06/gl_framework.cpp
b8870d4cb7c510b0cdffe2d691b068f23dd1cd0b
[]
no_license
LostSam423/Soviet-Republic
4fe0ae4f3507d13856c1672ac517e96f9a6f3e2b
52da03dbe4b5e6b07505bcdab51f53c0ba53756b
refs/heads/master
2022-07-28T03:15:23.568876
2020-05-17T10:58:53
2020-05-17T10:58:53
249,247,696
1
2
null
null
null
null
UTF-8
C++
false
false
1,775
cpp
#include "gl_framework.hpp" extern GLfloat xrot,yrot,zrot,c_xrot,c_yrot,c_zrot; extern bool enable_perspective; namespace csX75 { //! Initialize GL State void initGL(void) { //Set framebuffer clear color glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //Set depth buffer furthest depth glClearDepth(1.0); //Set depth test to less-than glDepthFunc(GL_LESS); //Enable depth testing glEnable(GL_DEPTH_TEST); } //!GLFW Error Callback void error_callback(int error, const char* description) { std::cerr<<description<<std::endl; } //!GLFW framebuffer resize callback void framebuffer_size_callback(GLFWwindow* window, int width, int height) { //!Resize the viewport to fit the window size - draw to entire window glViewport(0, 0, width, height); } //!GLFW keyboard callback void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { //!Close the window if the ESC key was pressed if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GL_TRUE); else if (key == GLFW_KEY_LEFT ) yrot -= 1.0; else if (key == GLFW_KEY_RIGHT ) yrot += 1.0; else if (key == GLFW_KEY_UP ) xrot -= 1.0; else if (key == GLFW_KEY_DOWN ) xrot += 1.0; else if (key == GLFW_KEY_PAGE_UP ) zrot -= 1.0; else if (key == GLFW_KEY_PAGE_DOWN) zrot += 1.0; else if (key == GLFW_KEY_A ) c_yrot -= 1.0; else if (key == GLFW_KEY_D ) c_yrot += 1.0; else if (key == GLFW_KEY_W ) c_xrot -= 1.0; else if (key == GLFW_KEY_S ) c_xrot += 1.0; else if (key == GLFW_KEY_Q ) c_zrot -= 1.0; else if (key == GLFW_KEY_E ) c_zrot += 1.0; } };
[ "beherasambit423@gmail.com" ]
beherasambit423@gmail.com
405b7be3664020ee950cb0bbcc56249aa0a05a0c
e37d6479533fa5fbb6a8646fee5a2faa22d4fdb2
/src/saiga/util/threadName.h
c2d9cf06d7ed0ea829a78e713e8ced391b011d20
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ElectricRobot/saiga
4996b6327f4472eb3feff3000b19c6882125da68
4987074847aabd025278168ea72ca8a991811c42
refs/heads/master
2020-04-11T03:41:01.515890
2018-12-12T09:25:16
2018-12-12T09:25:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
585
h
/** * Copyright (c) 2017 Darius Rückert * Licensed under the MIT License. * See LICENSE file for more information. */ #pragma once #include "saiga/config.h" #include <thread> namespace Saiga { /** * Sets a thread name for debugging purposes. * * Basically copy+paste from here: https://stackoverflow.com/questions/10121560/stdthread-naming-your-thread * Slight modifications on the interface. */ SAIGA_GLOBAL extern void setThreadName(const std::string& name); SAIGA_GLOBAL extern void setThreadName(std::thread& thread, const std::string& name); } // namespace Saiga
[ "darius.rueckert@fau.de" ]
darius.rueckert@fau.de