blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
67e199f18f53cb3df960fbe04c1d5e42ea7dce84
8fca09e098da3cdefae5341f182e3bbfc5a755fb
/PromptYN.cpp
547faef352c1cc5c770d5a25942b4b741774ead9
[]
no_license
TheDitis/HangMan
ff056bdfac7beabbc56b67ef8c89b42940bde3c7
e562ae6921174242c3eaa6e747868e89c8850105
refs/heads/master
2022-11-23T08:15:44.583243
2020-07-26T03:53:32
2020-07-26T03:53:32
282,569,896
0
0
null
null
null
null
UTF-8
C++
false
false
2,282
cpp
/* Author: Ryan McKay * Date: 07/24/2020 * File Name: myfuncts.cpp * Class: CSC160-470 * Summary: definition of PromptYN function and its helper functions */ #include <string> #include <cctype> #include <algorithm> #include "PromptYN.h" std::string lowercase(string str) // helper function for converting inputs to lowercase { for (char & i : str) // looping through the characters in a string { i = std::tolower(i); // we can modify the original through i since we defined it as a reference } return str; // output the lowercase string } bool isIn(std::string item, std::string arr[], int arrayLength) { item = lowercase(item); // convert input to lowercase for comparison for (int i = 0; i < arrayLength; ++i) // for each item in the array { if (item == arr[i]) // if the all-lowercase version of the typed reply matches the current list item: { return true; // return true indicating a match! } } return false; // in the case that no matches were made (return never called) return false } int PromptYN(std::string reply) { const int N_PLAY_REPLIES = 5; const int N_STOP_REPLIES = 7; std::string playReplies [N_PLAY_REPLIES] = {"yes", "yea", "sure", "ok", "y"}; // array of lowercase versions of proper play responses std::string stopReplies [N_STOP_REPLIES] = {"no", "nah", "quit", "stop", "terminate", "n", "q"}; // array of lowercase versions of proper stop responses char play = isIn(reply, playReplies, N_PLAY_REPLIES) ? 'y' : 'e'; // if reply belongs to playReplies, set play to y (for yes), else to e (for error) play = isIn(reply, stopReplies, N_STOP_REPLIES) ? 'n' : play; // if reply belongs to stopReplies, reassign play to n, otherwise maintain previous assignment // std::cout << "myfuncts out: " << reply << " " << play << std::endl; // for debugging purposes, output info to console if (play == 'y') // if user entered something that is in playReplies: { return PLAY; // return variable for continuation } else if (play == 'n') { return STOP; // return variable for ending the game } else { return ERROR; // return variable for indicating an bad input or error } }
[ "ryanscottmckay@gmail.com" ]
ryanscottmckay@gmail.com
3fd6faf125709fc3a944f1e04d6cda20c3e714cf
ead5c32ff8cf5ce04c35603cc7698904e1536be4
/revfe/pluginclass.h
46e7a5a22575bae1d28be0b9a521e73dc095e743
[]
no_license
malcom2073/revfe
7bda0386f4fb0d24b24414c724ddfcf7f768fd8e
775a9a3efb11aa8f59210b3b440542acd61e8f58
refs/heads/master
2021-01-23T15:52:59.247127
2012-03-24T13:12:31
2012-03-24T13:12:31
33,929,251
0
0
null
null
null
null
UTF-8
C++
false
false
3,187
h
/*************************************************************************** * Copyright (C) 2009 by Michael Carpenter (malcom2073) * * mcarpenter@interforcesystems.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef PLUGINCLASS_H #define PLUGINCLASS_H #include <QObject> #include <QString> #include "pluginthreadclass.h" #include "baseinterface.h" #include "ipcmessage.h" #include <QPluginLoader> class PluginClass : public QObject { Q_OBJECT public: PluginClass(); PluginClass(QObject *p,QString n,QString f); PluginClass(QString f); void startThreaded(); void startUnThreaded(); void passPluginMessage(QString,IPCMessage); void passPluginMessageBlocking(QString,IPCMessage); void passPluginMessage(QString,IPCMessage,bool); QString getName() { return pluginName; } QString getFileName() { return pluginFileName; } bool IsThreaded() { return isThreaded; } void reload(); void setName(QString name) { pluginName = name; } bool IsInitStarted() { return isInitStarted; } bool IsInitCompleted() { return isInitCompleted; } bool IsRegistered() { return registered; } void unloadPlugin(); bool isLoaded() { return isPluginLoaded; } private: bool isPluginLoaded; bool registered; bool isThreaded; bool isInitStarted; bool isInitCompleted; PluginThreadClass *threadedPluginObject; BaseInterface *pluginObject; QString pluginName; QString pluginFileName; QPluginLoader loader; signals: void passPluginMessageSignal(QString,IPCMessage); void passCoreModel(QString,QObject*); void passCoreGUIItem(QObject *item); void passPluginMessageSignalBlocking(QString,IPCMessage); void passCoreMessageBlocking(QString,IPCMessage); void passCoreMessage(QString,IPCMessage); void pluginLoadFail(QString pluginFileName); private slots: //void passPluginMessage(QString,IPCMessage,bool); //void passCoreMessage(QString,IPCMessage); }; #endif //PLUGINCLASS_H
[ "malcom2073@gmail.com" ]
malcom2073@gmail.com
243bde9389dc92eb6fef84f5da9e76c3dd6a4492
6f88d12f7f707b2f3d1701f8532b8be0d9b3deab
/code/29.最小的K个数.cpp
84d5920364cf852cd0846fac86f277632582e6cc
[]
no_license
codewithzichao/CodingInterviewCode
3785d94907e97895cbd73f4e54f3a40f660b40bd
5687b01210eb3b48dea6e5fedc23c7f5cef95c3f
refs/heads/master
2021-01-01T02:47:32.498394
2020-02-08T15:07:34
2020-02-08T15:07:34
239,148,266
1
0
null
null
null
null
UTF-8
C++
false
false
1,892
cpp
/* 题目描述 输入n个整数,找出其中最小的K个数。例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,。 */ #include<stdio.h> #include<string.h> #include<string> #include<algorithm> #include<vector> #include<set> using namespace std; class Solution{ public: /* 方法一:排序。这是最直观的思路。时间复杂度为:O(nlogn).不推荐,能这样做的话,还做个锤子的算法题! */ vector<int> GetLeastNumbers_Solution(vector<int> input, int k) { if(input.size()==0 || k==0 || k>input.size()){ vector<int> ans; return ans; } vector<int> ans; sort(input.begin(),input.end()); for(int i=0;i<k;i++){ ans.push_back(input[i]); } return ans; } /* 方法二:使用set或者multiset。在这道题里,需要使用multiset,因为有可能会有重复元素。 时间复杂度:O(nlogk). */ vector<int> GetLeastNumbers_Solution2(vector<int> input, int k) { if(input.size()==0 || k<=0 || k>input.size()){ vector<int> ans; return ans; } multiset<int,greater<int> > s;//greater表示s中的元素是从大到小排序的,因为红黑树具有自动排序功能。 for(int i=0;i<input.size();i++){ if(s.size()<k){//首先插入k个元素 s.insert(input[i]); } else{ multiset<int,greater<int> >::iterator it=s.begin();//接下来,如果元素小于集合中最大的元素,那么删除最大的元素,插入该元素 if(*it>input[i]){ s.erase(it); s.insert(input[i]); } } } vector<int> ans(s.begin(),s.end()); return ans; } }; int main(){ int n,k; scanf("%d%d ",&n,&k); vector<int> input; for(int i=0;i<n;i++){ int x; scanf("%d",&x); input.push_back(x); } Solution so1; vector<int> ans=so1.GetLeastNumbers_Solution2(input,k); for(int i=0;i<ans.size();i++){ printf("%d ",ans[i]); } printf("\n"); return 0; }
[ "lzctosdream@163.com" ]
lzctosdream@163.com
fddbd37cf8b4fb5b658a62ff7e6c2357fc36a4b7
7cc719c0f2a0df610a7d59ca33b3fb7d29711a75
/Game Engine/Villain.cpp
053ff9b732d0374ddea4348bc4b4ba2f600d72c8
[]
no_license
Math273ProjectSp15/Game-Engine-World-Class
b232caff480ce5ece698f562eafb11b4b2ec91ac
11f75c0436b3706f111a511d8d5833da45194895
refs/heads/master
2021-01-10T16:16:58.070247
2015-06-03T16:05:54
2015-06-03T16:05:54
35,961,549
0
0
null
null
null
null
UTF-8
C++
false
false
1,184
cpp
#include "Villain.h" bool Villain::initialize(Game *gamePtr, TextureManager *textureM) { deadImage_.initialize(gamePtr->getGraphics(), villainNS::WIDTH, villainNS::HEIGHT, villainNS::TEXTURE_COLS, textureM); deadImage_.setFrames(villainNS::START_FRAME, villainNS::END_FRAME); deadImage_.setCurrentFrame(villainNS::START_FRAME); deadImage_.setFrameDelay(villainNS::ANIMATION_DELAY); deadImage_.setLoop(false); onGround_ = false; dead_ = false; return true; } void Villain::update(float frameTime, int marioX, int marioY) { if (dead_) deadImage_.update(frameTime); else { if (!isOnGround()) { velocity.y += frameTime * 3 * GRAVITY; } else { velocity.y = 0; } spriteData.y += velocity.y * frameTime; if (marioX < spriteData.x) { flipHorizontal(false); velocity.x = -abs(villainNS::SPEED); } else { flipHorizontal(true); velocity.x = abs(villainNS::SPEED); } spriteData.x += velocity.x * frameTime; Entity::update(frameTime); } } void Villain::draw() { if (dead_) { deadImage_.draw(spriteData); } else { Image::draw(); } } bool Villain::animationComplete() { return deadImage_.getAnimationComplete(); }
[ "avilajorge314@gmail.com" ]
avilajorge314@gmail.com
80b56cb65d72393c55aa8e0d971775be6b14f456
d4a2c50a90792600c4d864fffe9c1a9d1ebd6acc
/mma_g/MMA_G/DataFile.h
836a94b6db508ae6f4968432390fe87cdbb40226
[]
no_license
iwasen/MyProg
3080316c3444e98d013587e92c066e278e796041
a0755a21d77647261df271ce301404a4e0294a7b
refs/heads/master
2022-12-30T00:28:07.539183
2020-10-25T06:36:27
2020-10-25T06:36:27
307,039,466
0
4
null
null
null
null
SHIFT_JIS
C++
false
false
2,630
h
#pragma once //***************************************************************************************************** // 1. ファイル名 // DataFile.h //---------------------------------------------------------------------------------------------------- // 2. 機能 // データファイルクラスの定義 //---------------------------------------------------------------------------------------------------- // 3. 備考 //---------------------------------------------------------------------------------------------------- // 4. 履歴 // 2007.08.09 S.Aizawa 新規作成 //***************************************************************************************************** #include "ProgressBar.h" #include "datadatetime.h" // 情報ファイルのヘッダ部 struct INFO_FILE_HEADER { INT32 nSeqNo; INT32 nDataSize; INT32 nDataSizeHour; char sFiller[4]; }; class CStringArrayEx : public CStringArray { public: int operator=(CStringArrayEx&) { return 0; } }; class CDataFile { public: CDataFile(); ~CDataFile(); BOOL ReadInfoFile(LPCTSTR pFilePath); BOOL ReadDataFile(int nBeginTime, int nEndTime, BOOL bReadAccelData, BOOL bReadTempData, BOOL bProgressBar); BOOL ReadWriteDataFile(LPCSTR fname, int nBeginTime, int nEndTime, BOOL bReadTempData); public: CString m_sDatPath; double *m_pTempDACM; double *m_pTempX; double *m_pTempY; double *m_pTempZ; double *m_pDataX; double *m_pDataY; double *m_pDataZ; int m_nDataSize; double m_fSampleRate; int m_nStartYear; int m_nStartMonth; int m_nStartDay; int m_nStartMiliSecond; double m_fStartSecond; double m_fTotalSecond; CStringArrayEx m_aDataFileName; int m_nDownRate; CString m_WriteFilePath; int m_nBeginTime; int m_nSensorId; int m_nGain; int m_nCutoff; int m_nSensorIdx; CString m_SensorPos; CString m_IssConfig; CDataDateTime m_dStarttime; CDataDateTime m_dInStarttime; CDataDateTime m_dInEndtime; double m_fAllocFactor; int m_nTotalDataSize; BOOL m_bTempOnly; int m_nDataType; protected: BOOL GetTotalTime(); static BOOL ReadBinaryFileThread(LPVOID pParam, CProgressBar *pProgressBar); static BOOL WriteBinaryFileThread(LPVOID pParam, CProgressBar *pProgressBar); BOOL ReadBinaryFileThread2(CProgressBar *pProgressBar); BOOL WriteBinaryFileThread2(CProgressBar *pProgressBar); void AllocBuf(); double *ReallocBuf(const double *pOldBuf, int nOldSize, int nNewSize); void FreeBuf(); protected: int m_nDataOffset; BOOL m_bReadAccelData; BOOL m_bReadTempData; int m_nAllocSize; int m_nReadSize; };
[ "git@iwasen.jp" ]
git@iwasen.jp
4dc49570deb91785254250e19734bd9ec2522e3c
43eec1fb7119427d9eec22f489980e6cd3020fae
/browser/Browser.h
8f4afb678c5cddf3e873c0e960f85746f830d29e
[]
no_license
aformusatii/MediaHub
1455ad16869755bf96c61deebb21558c5696d72c
6b1004f9d815081f497a1c1ae303147698053daf
refs/heads/master
2016-09-06T15:23:33.309617
2014-12-21T19:38:10
2014-12-21T19:38:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,644
h
#include <gtk/gtk.h> struct MouseCoordinates { int x; int y; bool jump; }; // Browser class class Browser { private: Browser(){ mouseContinuousMove = false; preventDefaultEvents = FALSE; afterInit=NULL; closeWindow=NULL; mouseMove=NULL; mouseButtonPress=NULL; mouseButtonRelease=NULL; keyPress=NULL;keyRelease=NULL; receivedUIEvent=NULL; }; // Private so that it can not be called Browser(Browser const&){ preventDefaultEvents = FALSE; mouseContinuousMove = false; afterInit=NULL; closeWindow=NULL; mouseMove=NULL; mouseButtonPress=NULL; mouseButtonRelease=NULL; keyPress=NULL; keyRelease=NULL; receivedUIEvent=NULL; }; // copy constructor is private bool mouseContinuousMove; gboolean preventDefaultEvents; static Browser* browserInstance; public: static Browser* getInstance(); int initBrowser(int argc, char** argv); void setMouseContinuousMove(bool); bool isMouseContinuousMove(); void setPreventDefaultEvents(bool); gboolean isPreventDefaultEvents(); /* External Event Handlers */ void (*afterInit)(MouseCoordinates); void (*closeWindow)(void); void (*mouseMove)(MouseCoordinates); void (*mouseButtonPress)(int); void (*mouseButtonRelease)(int); void (*keyPress)(int); void (*keyRelease)(int); void (*receivedUIEvent)(char *); };
[ "aformusatii@gmail.com" ]
aformusatii@gmail.com
c0eea5e39c7d169c6b55933711886322061e1e03
f896696c96d4c15b3f8bb037efa6fa92dc41f1ca
/GOMC/serial/PDBSetup.h
d29b60a273092abd3ef4cf815292f78b1321ca2a
[]
no_license
zzzhe1990/Projects
a626de9c2fe3f0c6bf01bec0c244ced54268abaf
cef8c9292e061329057516f40c6b443dd11a8501
refs/heads/master
2021-01-18T15:07:24.970189
2015-10-19T00:53:20
2015-10-19T00:53:20
44,499,832
0
0
null
null
null
null
UTF-8
C++
false
false
3,461
h
#ifndef PDB_SETUP_H #define PDB_SETUP_H #include <vector> #include <map> //for function lookup table. #include "InputAbstracts.h" //For FWReadableBase #include "../lib/BasicTypes.h" //For uint #include "EnsemblePreprocessor.h" //For BOX_TOTAL, etc. #include "PDBConst.h" //For fields positions, etc. #include "XYZArray.h" //For box dimensions. namespace config_setup { class RestartSettings; } class FWReadableBase; namespace pdb_setup { struct Remarks : FWReadableBase { bool restart, reached; ulong restartStep; void SetRestart(config_setup::RestartSettings const& r); void Read(FixedWidthReader & pdb); private: void HandleRemark(const uint num, std::string const& varName, const ulong step); void CheckStep(std::string const& varName, const ulong readStep); void CheckGOMC(std::string const& varName); }; struct Cryst1 : FWReadableBase { //box dimensions uint currBox; bool hasVolume; XYZArray axis; Cryst1(void) : currBox(0), hasVolume(false), axis(BOX_TOTAL) {} void SetBox(const uint b) { currBox = b; } void Read(FixedWidthReader & pdb) { XYZ temp; using namespace pdb_entry::cryst1::field; hasVolume = true; pdb.Get(temp.x, x::POS) .Get(temp.y, y::POS) .Get(temp.z, z::POS); axis.Set(currBox, temp); } }; struct Atoms : FWReadableBase { //member data std::vector<char> chainLetter; //chain ids of each molecule std::vector<double> x, y, z; //coordinates of each particle std::vector<uint> box; std::vector<std::string> atomAliases, resNamesFull, resNames, resKindNames; std::vector<uint> startIdxRes, resKinds; bool restart, firstResInFile; //CurrRes is used to store res vals, currBox is used to //determine box either via the file (new) or the occupancy //(restart), count allows overwriting of coordinates during //second box read (restart only) uint currBox, count, currRes; //Set the current residue to something other than 1 Atoms(void) : restart(false), currBox(0), count(0), currRes(10) {} void SetRestart(config_setup::RestartSettings const& r); void SetBox(const uint b) { currBox = b; firstResInFile = true; //restart count if new system, second box. count = ((b == 1 && restart) ? 0 : count); } void Assign(std::string const& atomName, std::string const& resName, const uint resNum, const char l_chain, const double l_x, const double l_y, const double l_z, const double l_occ); void Read(FixedWidthReader & file); }; } struct PDBSetup { pdb_setup::Atoms atoms; pdb_setup::Cryst1 cryst; pdb_setup::Remarks remarks; PDBSetup(void) : dataKinds(SetReadFunctions()) {} void Init(config_setup::RestartSettings const& restart, std::string const*const name); private: //Map variable names to functions std::map<std::string, FWReadableBase *> SetReadFunctions(void) { std::map<std::string, FWReadableBase *> funct; funct[pdb_entry::label::REMARK] = &remarks; funct[pdb_entry::label::CRYST1] = &cryst; funct[pdb_entry::label::ATOM] = &atoms; return funct; } const std::map<std::string, FWReadableBase *> dataKinds; static const std::string pdbAlias[]; }; #endif /*PDB_SETUP_H*/
[ "zzzhe1990@gmail.com" ]
zzzhe1990@gmail.com
323c0ed8eee04b6a6dc6fb2354ff86601eced323
e7d7377b40fc431ef2cf8dfa259a611f6acc2c67
/SampleDump/Cpp/SDK/BP_ToolboxWidget_classes.h
fd88983d5dca086a43d0e345948577661af6cbe9
[]
no_license
liner0211/uSDK_Generator
ac90211e005c5f744e4f718cd5c8118aab3f8a18
9ef122944349d2bad7c0abe5b183534f5b189bd7
refs/heads/main
2023-09-02T16:37:22.932365
2021-10-31T17:38:03
2021-10-31T17:38:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
738
h
#pragma once // Name: Mordhau, Version: Patch23 /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // WidgetBlueprintGeneratedClass BP_ToolboxWidget.BP_ToolboxWidget_C // 0x0000 (FullSize[0x0230] - InheritedSize[0x0230]) class UBP_ToolboxWidget_C : public UUserWidget { public: static UClass* StaticClass() { static UClass* ptr = UObject::FindClass("WidgetBlueprintGeneratedClass BP_ToolboxWidget.BP_ToolboxWidget_C"); return ptr; } }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "talon_hq@outlook.com" ]
talon_hq@outlook.com
e873ccedabef276600456c1f545ea7ec4833c6f0
0ecfb1ec3509631c5813e30fd21c8ecf0c91732c
/debug/src/xpview/OS2/xpview.cpp
3ad4f6ba0e4b3f21c38d4492270325535f3cde24
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
zanud/xds-2.60
2c2c32c6d564c8f1d3ca71eb3229e7886f67355d
b4a32b9c9c91fe513fa5ff78ec87bb44102a3b72
refs/heads/master
2023-08-29T00:35:07.014940
2021-10-14T11:39:07
2021-10-14T11:39:07
416,922,119
0
1
Apache-2.0
2023-08-15T22:12:29
2021-10-13T23:02:38
Modula-2
IBM866
C++
false
false
35,493
cpp
#include <stdio.h> #include <string.h> #include <stdlib.h> #define INCL_DOS #define INCL_WIN #define INCL_WINSTDFONT #define INCL_GPI #include <os2.h> #include "xpview.h" #include "headwin.h" #include "profile.h" #define VPCLIENTCLASS "VPClWinClass" #define MM_SUBCLASS WM_USER+2000 #define MM_PROFILE WM_USER+2001 #define MM_APPLYWIDTHS WM_USER+2002 #define GCAUTO 1 #define HEAPLIMIT 4000000 #define GCTHRESHOLD 2000000 extern "C" void Profile_BEGIN(void); // // Globals: // HAB hAB; VIEWPORT VPortComponents (VP_COMPONENTS); VIEWPORT VPortModPub (VP_MODULES); VIEWPORT VPortProcs (VP_PROCEDURES); VIEWPORT VPortLines (VP_LINES); LISTLINE llBottom; HISTORY History; HSWITCH hSwitch; PVIEWPORT apVPorts[4] = {&VPortComponents, &VPortModPub, &VPortProcs, &VPortLines}; int nComponents = 0; BOOL fClearDBI = FALSE; MRESULT EXPENTRY wpVPFrame (HWND hWnd, ULONG ulMsg, MPARAM m1, MPARAM m2); MRESULT EXPENTRY wpVPClient (HWND hWnd, ULONG ulMsg, MPARAM m1, MPARAM m2); PSZ GetSourceLine(PSZ szFile, ULONG ulLine) { ULONG IOErMsg(APIRET err, HWND hWnd, char *szCapt, char *szErr, char *szFile, ULONG MBF); static char szFileInBuf[CCHMAXPATH] = ""; static ULONG ulLineNow = 0; static PSZ pszLineNow; static PSZ pszBuf = 0; static PSZ pszBufTop; static char szError[CCHMAXPATH+100] = ""; static char szRetLine[4000] = ""; if (sf_stricmp(szFile,szFileInBuf)) { free(pszBuf); //--- Установка заголовка окна тут, вообще говоря, примочка... { char sz[CCHMAXPATH+50]; sprintf(sz,"Source: %s",szFile); VPortLines.SetCaption(sz); } pszBuf = 0; HFILE hf; ULONG ulAction, fsize, ul; APIRET rc = DosOpen((PSZ)szFile,&hf,&ulAction,0,FILE_NORMAL,FILE_OPEN, OPEN_FLAGS_NO_CACHE |OPEN_FLAGS_SEQUENTIAL| // Fastest mode? OPEN_ACCESS_READONLY|OPEN_SHARE_DENYNONE, (PEAOP2)0); if (rc) { PSZ pszEr = (PSZ)IOErMsg(rc, 0, "", "Can't open file", szFile, MB_OK); strcpy(szError,pszEr ? pszEr : "Can't open file"); } else { DosSetFilePtr(hf,0L,FILE_END,&fsize); if (fsize>4*1024*1024) sprintf(szError,"File %s is too large (more than 4Mb)!",szFile); else { DosSetFilePtr(hf,0L,FILE_BEGIN,&ul); pszBuf = (PSZ)malloc(fsize+1); if (!pszBuf) sprintf(szError,"Can't allocate memory (file %s)",szFile); else { DosRead(hf,pszBuf,fsize,&ul); DosClose(hf); pszBuf[ul] = '\0'; pszBufTop = pszBuf+ul; ulLineNow = 0; pszLineNow = pszBuf; for (int i=0; i<ul; i++) if (pszBuf[i]==0x0d) pszBuf[i]=' '; } } DosClose(hf); } strcpy(szFileInBuf,szFile); } //--- файл в malloc()ed pszBuf..pszBufTop or pszBuf==0 if (!pszBuf) return szError; if (ulLineNow > ulLine) { ulLineNow = 0; pszLineNow = pszBuf; } while(ulLineNow < ulLine && pszLineNow < pszBufTop) { PSZ szLF = (PSZ)memchr(pszLineNow,0x0a,pszBufTop-pszLineNow); if (!szLF) break; pszLineNow = szLF+1; ulLineNow ++; } if (ulLine!=ulLineNow) sprintf(szRetLine,"Line %u : out of range (file %s)",ulLine,szFile); else { PSZ szLF = (PSZ)memchr(pszLineNow,0x0a,pszBufTop-pszLineNow); if (!szLF) szLF = pszBufTop; int len = min(szLF-pszLineNow, sizeof(szRetLine)-1); strncpy(szRetLine,pszLineNow,len); szRetLine[len] = 0; } return szRetLine; } /*-------------------------------------------------------------------------------------------*/ /*------------------------+-/ \-+------- 1.***** ---------------*/ /*-------------------------< LISTLINE class realisation >-------- 2. ** *** ---------------*/ /*------------------------+-\ /-+--------3.*** ** ---------------*/ /*-------------------------------------------------------------------------------------------*/ LISTLINE::LISTLINE() { memset(this,0,sizeof(*this)); lineKind = BOTTOM; nGlobRelTime = -1; nModRelTime = -1; nSnapshots = -1; } LISTLINE::~LISTLINE() { free(pszText); pszText = 0; } PSZ LISTLINE::QueryText() { PSZ psz = 0; if (!pszText) { switch (lineKind) { case COMPONENT: psz = ComponentName(nOrder); break; case PUBLIC: psz = PublicName(pParentLine->nOrder,nOrder); break; case MODULE: psz = ModuleName(pParentLine->nOrder,nOrder); break; case PROCEDURE: psz = ProcName(pParentLine->pParentLine->nOrder,pParentLine->nOrder,nOrder); break; case LINE: { int nModule = pParentLine->pParentLine->nOrder; int nCom = pParentLine->pParentLine->pParentLine->nOrder; PSZ szFile = SourceName(nCom,nModule); psz = GetSourceLine(szFile,nOrder); break; } } if (!psz) psz = "<Wrong line: internal error>"; pszText = sf_mallocstr(psz); } return pszText ? pszText : "<Error: can not allocate memory>"; } int LISTLINE::GlobRelTime() { if (nGlobRelTime < 0) { PLISTLINE pllBottom = 0; switch (lineKind) { case COMPONENT: pllBottom = pParentLine; break; case PUBLIC: pllBottom = pParentLine->pParentLine; break; case MODULE: pllBottom = pParentLine->pParentLine; break; case PROCEDURE: pllBottom = pParentLine->pParentLine->pParentLine; break; case LINE: pllBottom = pParentLine->pParentLine->pParentLine->pParentLine; break; } int q = pllBottom->q_snapshots(); nGlobRelTime = q ? HIPERCENT*q_snapshots()/q : 0; nGlobRelTime = min(nGlobRelTime,HIPERCENT); nGlobRelTime = max(nGlobRelTime,0); } return nGlobRelTime; } int LISTLINE::ModRelTime() { if (nModRelTime < 0) { int q = pParentLine->q_snapshots(); nModRelTime = (lineKind == BOTTOM) ? HIPERCENT : (q ? HIPERCENT*q_snapshots()/q : 0); nModRelTime = min(nModRelTime,HIPERCENT); nModRelTime = max(nModRelTime,0); } return nModRelTime; } int LISTLINE::q_snapshots() { if (nSnapshots<0) { switch (lineKind) { case BOTTOM: nSnapshots = GetSnapshots(); break; case COMPONENT: nSnapshots = ComponentSnapshots(nOrder); break; case PUBLIC: nSnapshots = PublicSnapshots(pParentLine->nOrder,nOrder); break; case MODULE: nSnapshots = ModuleSnapshots(pParentLine->nOrder,nOrder); break; case PROCEDURE: nSnapshots = ProcSnapshots(pParentLine->pParentLine->nOrder,pParentLine->nOrder,nOrder); break; case LINE: nSnapshots = LineSnapshots(pParentLine->pParentLine->pParentLine->nOrder, pParentLine->pParentLine->nOrder,nOrder); break; } if (nSnapshots<0) nSnapshots = 0; } return nSnapshots; } void LISTLINE::ClickLine() { LONG i=0,iHi; PLISTLINE pll; PVIEWPORT pVP; LINE_KIND lkNew; PSZ pszCapt; switch (lineKind) { case BOTTOM: pVP = &VPortComponents; iHi = nComponents; lkNew = COMPONENT; pszCapt = 0; break; case COMPONENT: pVP = &VPortModPub; if ((iHi = N_Parts(nOrder))>0) lkNew = MODULE, pszCapt = "Modules"; else lkNew = PUBLIC, pszCapt = "Publics"; iHi = abs(iHi); break; case MODULE: pVP = &VPortProcs; iHi = N_Proc(pParentLine->nOrder, nOrder); lkNew = PROCEDURE; pszCapt = "Procedures"; break; case PROCEDURE: pVP = &VPortLines; ProcBounds(pParentLine->pParentLine->nOrder, pParentLine->nOrder, nOrder, &i, &iHi); iHi++; lkNew = LINE; pszCapt = 0; // Set in GetSourceLine break; default: return; } pVP->StartUpdate(); for (i; i<iHi; i++) { pll = new LISTLINE; pll->lineKind = lkNew; pll->nOrder = i; pll->pParentLine = this; pVP->AddLine(pll); } pVP->EndUpdate(pszCapt); } /*-------------------------------------------------------------------------------------------*/ /*------------------------+-/ \-+------ !%%%%%%%%%! ---------*/ /*-------------------------< VIEWPORT class realisation >------- ! !%%%%! ---------*/ /*------------------------+-\ /-+------ !_________! ! ---------*/ /*-------------------------------------------------------------------------------------------*/ VIEWPORT::VIEWPORT(VIEWPORT_KIND vpKind) { memset(this,0,sizeof(*this)); this->vpKind = vpKind; } VIEWPORT::~VIEWPORT() { clear_list(); memset(this,0,sizeof(*this)); } void VIEWPORT::Init(int nPrfItem) { // // Создает окна, для VP_COMPONENTS - показывает и регистрирует в тасклисте // QWL_USER у окон - указатель на VIEWPORT // if (hFrame) return; static BOOL f1st = TRUE; if (f1st) { InitHeadwin(hAB); WinRegisterClass(hAB,VPCLIENTCLASS,(PFNWP)wpVPClient, CS_SIZEREDRAW | CS_CLIPCHILDREN,4); f1st = FALSE; } ULONG fcdata = FCF_NOBYTEALIGN | FCF_TITLEBAR | FCF_SYSMENU | FCF_MINBUTTON | FCF_MAXBUTTON | FCF_SIZEBORDER | FCF_ICON | FCF_MENU | FCF_ACCELTABLE; hFrame = WinCreateStdWindow(HWND_DESKTOP, 0, &fcdata, VPCLIENTCLASS, "Components", WS_VISIBLE, (HMODULE)NULL, RES_MAIN, &hClient); hList = WinCreateWindow(hClient, WC_LISTBOX, "", WS_VISIBLE | LS_NOADJUSTPOS | LS_HORZSCROLL | LS_OWNERDRAW, -100, 0, 1, 1, hFrame, HWND_TOP, 1234, 0, NULL); hHead = WinCreateWindow(hClient, WC_HEADWIN, "", WS_VISIBLE, -100, 0, 1, 1, hFrame, HWND_TOP, 0, 0, NULL); if (!hList) exit(5); this->nPrfItem = nPrfItem; wpVPFrame(hFrame, MM_SUBCLASS, MPARAM(ULONG(WinSubclassWindow(hFrame, (PFNWP)wpVPFrame))),0); WinSetWindowULong(hFrame, QWL_USER,ULONG(this)); WinSetWindowULong(hClient, QWL_USER,ULONG(this)); WinSetWindowULong(hList, QWL_USER,ULONG(this)); { ULONG rgb = 0x00ffffff; char szF[] = "8.Helv"; WinSetPresParam(hList, PP_BACKGROUNDCOLOR, sizeof(rgb), &rgb); WinSetPresParam(hList, PP_FONTNAMESIZE, strlen(szF)+1, szF); } lNumFract = 4; lTimeFract = 8; lTime1Fract = 10; lNameFract = 28; dyHead = (int)WinSendMsg(hHead,HM_QUERYOPTHEIGHT,0,0); HBTNCREATESTRUCT hbs; memset(&hbs,0,sizeof(hbs)); hbs.lWidth = 5; hbs.pszText = "#"; hbs.usCmd = HCMD_NUM; WinSendMsg(hHead,HM_ADDBUTTON,MPARAM(&hbs),0); hbs.pszText = "Time"; hbs.usCmd = HCMD_TIME; WinSendMsg(hHead,HM_ADDBUTTON,MPARAM(&hbs),0); hbs.pszText = "Time"; hbs.usCmd = HCMD_TIME1; WinSendMsg(hHead,HM_ADDBUTTON,MPARAM(&hbs),0); hbs.pszText = "Item name"; hbs.usCmd = HCMD_NAME; WinSendMsg(hHead,HM_ADDBUTTON,MPARAM(&hbs),0); if (vpKind==VP_COMPONENTS) { SWCNTRL SwData; SwData.hwnd = hFrame; SwData.hwndIcon = 0; SwData.hprog = 0; SwData.idProcess = 0; SwData.idSession = 0; SwData.uchVisibility = SWL_VISIBLE; SwData.fbJump = SWL_JUMPABLE; SwData.szSwtitle[0] = '\0'; hSwitch = WinAddSwitchEntry(&SwData); } WinSendMsg(hFrame,MM_PROFILE,MPARAM(TRUE),MPARAM(nPrfItem)); if (!nPrfItem) { WinShowWindow(hFrame,TRUE); WinSetFocus(HWND_DESKTOP,hList); } else WinShowWindow(hFrame,FALSE); } void VIEWPORT::Kill() { if (hFrame) { char sz[100]; WinShowWindow(hFrame,FALSE); sprintf(sz,PRFKEYNAME "Frame%u",nPrfItem); WinStoreWindowPos(PRFAPPNAME, sz, hFrame); clear_list(); WinDestroyWindow(hFrame); memset(this,0,sizeof(*this)); } } void VIEWPORT::StartUpdate() { clear_list(); lock_update(TRUE); } void VIEWPORT::AddLine(PLISTLINE pLL) { int nIt = (int)WinSendMsg(hList, LM_INSERTITEM, MPARAM(LIT_END), MPARAM("???")); WinSendMsg(hList, LM_SETITEMHANDLE, MPARAM(nIt), MPARAM(pLL)); } void VIEWPORT::EndUpdate(PSZ pszCapt) { WinSendMsg(hList, LM_SELECTITEM, MPARAM(0), MPARAM(TRUE)); BOOL fCont = !!WinSendMsg(hList,LM_QUERYITEMCOUNT,0,0); // BOOL fHidden = !(WS_VISIBLE & (int)WinQueryWindowULong(hFrame,QWL_STYLE)); // BOOL fHidNew = fCont || vpKind==VP_COMPONENTS; if (pszCapt) WinSetWindowText(hFrame,pszCapt); if (!fCont) switch (vpKind) { case VP_COMPONENTS: WinShowWindow(VPortModPub.hFrame,FALSE); case VP_MODULES: WinShowWindow(VPortProcs.hFrame,FALSE); case VP_PROCEDURES: WinShowWindow(VPortLines.hFrame,FALSE); } MM_ApplyWidths(hFrame,0,0); Sort(sortMode); WinShowWindow(hFrame, fCont || vpKind==VP_COMPONENTS); WinSetWindowPos(hFrame,HWND_TOP,0,0,0,0,SWP_ZORDER); lock_update(FALSE); } SORT_MODE sm; int _Optlink compare (const void *arg1, const void *arg2) { int i=0; switch(sm) { case SORT_TIME: i = (*(PPLISTLINE)arg2)->nSnapshots - (*(PPLISTLINE)arg1)->nSnapshots; break; case SORT_TEXT: i = sf_stricmp((*(PPLISTLINE)arg1)->pszText ? (*(PPLISTLINE)arg1)->pszText : "", (*(PPLISTLINE)arg2)->pszText ? (*(PPLISTLINE)arg2)->pszText : ""); break; } return i ? i : ((*(PPLISTLINE)arg1)->nOrder - (*(PPLISTLINE)arg2)->nOrder); } void VIEWPORT::Sort(SORT_MODE sMode) { int nTotal = (int)WinSendMsg(hList,LM_QUERYITEMCOUNT,0,0); int i = (int)WinSendMsg(hList,LM_QUERYSELECTION,MPARAM(LIT_FIRST),0); PLISTLINE pllSel = (i==LIT_NONE) ? 0 : (PLISTLINE)WinSendMsg(hList,LM_QUERYITEMHANDLE,MPARAM(i),0); PLISTLINE *apll = (PLISTLINE*)malloc(nTotal*sizeof(PLISTLINE)); if (!nTotal || !apll) return; for (i=0; i<nTotal; i++) if (!(apll[i] = (PLISTLINE)WinSendMsg(hList,LM_QUERYITEMHANDLE,MPARAM(i),0))) { free(apll); return; } sortMode = sm = sMode; qsort(apll,nTotal,sizeof(PLISTLINE),compare); lock_update(TRUE); // re-fill listbox WinSendMsg(hList,LM_DELETEALL,0,0); int nSel = LIT_NONE; for (i=0;i<nTotal;i++) { int nIt = (int)WinSendMsg(hList, LM_INSERTITEM, MPARAM(LIT_END), MPARAM("???")); WinSendMsg(hList, LM_SETITEMHANDLE, MPARAM(nIt), MPARAM(apll[i])); if (apll[i]==pllSel) nSel = i; } free(apll); fLockLMSel++; if (nSel!=LIT_NONE) WinSendMsg(hList,LM_SELECTITEM,MPARAM(nSel),MPARAM(TRUE)); fLockLMSel--; lock_update(FALSE); } void VIEWPORT::SetCaption (PSZ psz) { WinSetWindowText(hFrame,psz); } void VIEWPORT::clear_list() { if (hList) { lock_update(TRUE); int nIt = (int)WinSendMsg(hList,LM_QUERYITEMCOUNT,0,0); while (--nIt >= 0) { PLISTLINE pLL = (PLISTLINE)WinSendMsg(hList,LM_QUERYITEMHANDLE,MPARAM(nIt),0); delete pLL; } WinSendMsg(hList,LM_DELETEALL,0,0); lock_update(FALSE); } } void VIEWPORT::lock_update(BOOL fLock) { if (fLock) nUpdateLocked++; else nUpdateLocked--; if (!nUpdateLocked) WinInvalidateRect(hList,0,0); } MRESULT VIEWPORT::WM_DrawItem (HWND hWnd, MPARAM m1, MPARAM m2) { POWNERITEM pow = POWNERITEM(m2); PLISTLINE pLL = PLISTLINE(pow->hItem); PVIEWPORT pVP = (PVIEWPORT)WinQueryWindowULong(hWnd,QWL_USER); if (nUpdateLocked || !pLL || !pVP) return MRESULT(TRUE); RECTL rc = pow->rclItem; RECTL rcDraw = rc; LONG clrFore = CLR_BLACK; LONG clrBack = CLR_WHITE; if (pow->fsState){ clrFore = CLR_WHITE; clrBack = CLR_DARKGRAY; } WinFillRect(pow->hps,&rc,clrBack); rc.yTop--; GpiSetColor (pow->hps,clrFore); GpiSetBackColor(pow->hps,clrBack); int nAbs = pLL->GlobRelTime(); // of HIPERCENT% int nRel = pLL->ModRelTime(); // of HIPERCENT% // Номер (xNumFract): { rcDraw.xLeft = rc.xLeft + 2; rcDraw.xRight = rc.xLeft + pVP->xNumFract; char sz[10]=""; sprintf(sz,"%u.",pLL->QueryOrder()+1); // От '1' WinDrawText(pow->hps,-1,sz,&rcDraw,0,0, DT_LEFT | DT_VCENTER | DT_TEXTATTRS); } // Текст процентов (xTimeFract): { rcDraw.xLeft = rc.xLeft + pVP->xNumFract; rcDraw.xRight = rcDraw.xLeft + pVP->xTimeFract; char sz[30]=""; if (nAbs<100) sprintf(sz,"%3.1f(",float(nAbs)/10.0); else sprintf(sz,"%2u(", nAbs/10); if (nRel<100) sprintf(sz+strlen(sz),"%3.1f)%%",float(nRel)/10.0); else sprintf(sz+strlen(sz),"%2u)%%", nRel/10); WinDrawText(pow->hps,-1,sz,&rcDraw,0,0, DT_LEFT | DT_VCENTER | DT_TEXTATTRS); } // Поставим градусник (xTime1Fract): { LONG dh = (rc.yTop-rc.yBottom)/5 + 1; rcDraw.yBottom = rc.yBottom + dh; rcDraw.yTop = rc.yTop-dh; rcDraw.xLeft = rc.xLeft + pVP->xNumFract + pVP->xTimeFract; rcDraw.xRight = rcDraw.xLeft + 1 + pVP->xTime1Fract*nAbs/1100; WinFillRect(pow->hps,&rcDraw,CLR_RED); rcDraw.xLeft = rcDraw.xRight; rcDraw.xRight = rcDraw.xLeft + pVP->xTime1Fract*(nRel-nAbs)/1100; WinFillRect(pow->hps,&rcDraw,CLR_BLUE); rcDraw = rc; } // Текст (xNameFract): { rcDraw.xLeft = rc.xLeft + pVP->xNumFract + pVP->xTimeFract + pVP->xTime1Fract; rcDraw.xRight = rc.xRight; // rcDraw.xLeft + pVP->xNameFract; WinDrawText(pow->hps,-1,pLL->QueryText(),&rcDraw,0,0, DT_LEFT | DT_VCENTER | DT_TEXTATTRS); } pow->fsState = pow->fsStateOld = 0; return MRESULT(TRUE); } MRESULT VIEWPORT::WM_MeasureItem (HWND hWnd, MPARAM m1, MPARAM m2) { /*+++ Speed it up! */ FONTMETRICS fm; HPS hps = WinGetPS(hList); GpiQueryFontMetrics(hps,sizeof(fm),&fm); WinReleasePS(hps); return MRFROM2SHORT((fm.lMaxBaselineExt+fm.lExternalLeading), 10000); } MRESULT VIEWPORT::WM_Control (HWND hWnd, MPARAM m1, MPARAM m2) { //if (nLockCtrl) return 0; if (!fLockLMSel && SHORT2FROMMP(m1)==LN_SELECT) { int nIt = (int) WinSendMsg(hList,LM_QUERYSELECTION, MPARAM(LIT_FIRST),0); PLISTLINE pLL = (PLISTLINE)WinSendMsg(hList,LM_QUERYITEMHANDLE,MPARAM(nIt), 0); if (pLL) pLL->ClickLine(); } else if (SHORT1FROMMP(m1)==HBN_TRACKING || SHORT1FROMMP(m1)==HBN_SIZE) MM_ApplyWidths(hWnd,m1,m2); return 0; } MRESULT VIEWPORT::MM_ApplyWidths (HWND hWnd, MPARAM m1, MPARAM m2) { lNumFract = xNumFract = (int)WinSendMsg(hHead, HM_QUERYBTNWIDTH, MPFROM2SHORT(HCMD_NUM,TRUE), 0); lTimeFract = xTimeFract = (int)WinSendMsg(hHead, HM_QUERYBTNWIDTH, MPFROM2SHORT(HCMD_TIME,TRUE), 0); lTime1Fract = xTime1Fract = (int)WinSendMsg(hHead, HM_QUERYBTNWIDTH, MPFROM2SHORT(HCMD_TIME1,TRUE),0); lNameFract = xNameFract = (int)WinSendMsg(hHead, HM_QUERYBTNWIDTH, MPFROM2SHORT(HCMD_NAME,TRUE), 0); WinInvalidateRect(hList,0,0); return 0; } MRESULT VIEWPORT::WM_Command (HWND hWnd, MPARAM m1, MPARAM m2) { int s1m1 = SHORT1FROMMP(m1); PSZ pszF = History.Cmd2File(s1m1); if (pszF) s1m1 = IDM_FILEOPEN; switch(s1m1) { case IDM_FILEOPEN: { FILEDLG fild; memset(&fild, 0, sizeof(FILEDLG)); if (!pszF) { strcpy(fild.szFullFile, "*.xpt"); fild.cbSize = sizeof(FILEDLG); fild.fl = FDS_CENTER | FDS_OPEN_DIALOG ; fild.pszTitle = "Open"; if (!WinFileDlg(HWND_DESKTOP, hWnd, &fild) || fild.lReturn!=DID_OK) break; } else strcpy(fild.szFullFile,pszF); if (fClearDBI) ClearDebugInfo(); int rc = LoadDebugInfo (fild.szFullFile); if (rc>0) { char szCapt[CCHMAXPATH+30]; nComponents = rc; History.AppItem(fild.szFullFile); sprintf(szCapt,"Components: %s",fild.szFullFile); VPortComponents.SetCaption(szCapt); // fClearDBI = TRUE; } else { char aszErr[7][200] = {"Error","Open prodile data error","Read error profile data error","Read debuf info error", "Wrong data format error","Not XDS profiler trace file","Unknown error"}; char sz[200+CCHMAXPATH]; sprintf(sz,"%s. \n(File: %s).",aszErr[rc>-6 ? -rc : 6],fild.szFullFile); WinMessageBox(HWND_DESKTOP, hWnd, sz, "ERROR", 0, MB_ERROR|MB_MOVEABLE|MB_OK); nComponents = 0; } llBottom.ClickLine(); break; } case HCMD_NUM: Sort(SORT_ORDER); break; case HCMD_TIME: case HCMD_TIME1: Sort(SORT_TIME); break; case HCMD_NAME: Sort(SORT_TEXT); break; case IDM_WINPOPALL: { for (int i=3; i>=0; i--) if (apVPorts[i]!=this) WinSetWindowPos(apVPorts[i]->hFrame,HWND_TOP,0,0,0,0,SWP_ZORDER); WinSetWindowPos(hFrame,HWND_TOP,0,0,0,0,SWP_ZORDER); break; } case IDM_WINCASCADE: case IDM_WINTILE: { int cx = WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); int cy = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); for (int i=3; i>=0; i--) { HWND hFr = apVPorts[i]->hFrame; if (s1m1==IDM_WINCASCADE) { int nPos = (i % 4) + 1; WinSetWindowPos(hFr,HWND_TOP,cx/10*nPos,cy/10*(5-nPos),cx/2,cy/2, SWP_ZORDER|SWP_MOVE|SWP_SIZE); } else WinSetWindowPos(hFr,HWND_TOP, (i&1) ? cx/2 : 4, (i&2) ? 4 : cy/2, cx/2-4, cy/2-4, SWP_ZORDER|SWP_MOVE|SWP_SIZE); WinSetFocus(HWND_DESKTOP,VPortComponents.hList); } break; } default: s1m1 -= IDM_WIN_MIN; if (s1m1<sizeof(apVPorts)/sizeof(apVPorts[0])) WinSetFocus(HWND_DESKTOP,apVPorts[s1m1]->hList); } return 0; } MRESULT VIEWPORT::WM_InitMenu (HWND hWnd, MPARAM m1, MPARAM m2) { switch(SHORT1FROMMP(m1)) { case IDM_WINDOW: { LONG i; HWND hm; MENUITEM mi; if (!WinSendMsg(HWND(WinWindowFromID(hFrame,FID_MENU)),MM_QUERYITEM,MPFROM2SHORT(IDM_WINDOW,TRUE),(MPARAM)&mi)) return 0; if (hm = mi.hwndSubMenu) for (i=0; i<sizeof(apVPorts)/sizeof(apVPorts[0]);i++) { HWND hFr = apVPorts[i]->hFrame; char sz[CCHMAXPATH+200] = "~1: ???"; sz[1] += i; BOOL fDisabled = !(WS_VISIBLE & (ULONG)WinQueryWindowULong(hFr,QWL_STYLE)); WinQueryWindowText(hFr,sizeof(sz)-4,sz+4); WinSendMsg(hm,MM_SETITEMTEXT,MPARAM(IDM_WIN_MIN+i),MPARAM(sz)); WinSendMsg(hm,MM_SETITEMATTR,MPFROM2SHORT(IDM_WIN_MIN+i,TRUE), MPFROM2SHORT(MIA_DISABLED|MIA_CHECKED, (fDisabled ? MIA_DISABLED : 0)|(this==apVPorts[i] ? MIA_CHECKED : 0))); } break; } case IDM_FILE: { MENUITEM mi; if (!WinSendMsg(HWND(WinWindowFromID(hFrame,FID_MENU)),MM_QUERYITEM,MPFROM2SHORT(IDM_FILE,TRUE),(MPARAM)&mi)) return 0; History.InitMenu(mi.hwndSubMenu); break; } default: return WinDefWindowProc(hWnd,WM_INITMENU,m1,m2); } return 0; } MRESULT VIEWPORT::WM_Size (HWND hWnd, MPARAM m1, MPARAM m2) { // Client's size means RECTL rcl; WinQueryWindowRect(hClient,&rcl); int dx = rcl.xRight; int dy = rcl.yTop; LONG dyh = min(dyHead,dy); WinSetWindowPos(hList, 0, 0, 0, dx, dy-dyh, SWP_MOVE|SWP_SIZE|SWP_HIDE); WinSetWindowPos(hHead, 0, 0, dy-dyh, dx, dyh, SWP_MOVE|SWP_SIZE|SWP_HIDE); WinShowWindow(hList,TRUE); WinShowWindow(hHead,TRUE); int nFrSum; if (!(nFrSum = lNumFract + lTimeFract + lTime1Fract + lNameFract)) nFrSum=4, lNumFract=lTimeFract=lTime1Fract=lNameFract=1; int nUsed; int nBit = dx * lNumFract / nFrSum; nUsed = nBit; WinSendMsg(hHead, HM_SETBTNWIDTH, MPFROM2SHORT(HCMD_NUM,TRUE), MPARAM(nBit)); nBit = dx * lTimeFract / nFrSum; nUsed += nBit; WinSendMsg(hHead, HM_SETBTNWIDTH, MPFROM2SHORT(HCMD_TIME,TRUE), MPARAM(nBit)); nBit = dx * lTime1Fract/ nFrSum; nUsed += nBit; WinSendMsg(hHead, HM_SETBTNWIDTH, MPFROM2SHORT(HCMD_TIME1,TRUE),MPARAM(nBit)); nBit = dx - nUsed; WinSendMsg(hHead, HM_SETBTNWIDTH, MPFROM2SHORT(HCMD_NAME,TRUE), MPARAM(nBit)); WinSendMsg(hList, MM_APPLYWIDTHS, 0,0); return 0; } /////////////////////////////////// M A I N ( ) //////////////////////////////////////////////////// int main(int argc, char **argv) { MRESULT EXPENTRY wpFrame (HWND hWnd, ULONG ulMsg, MPARAM m1, MPARAM m2); MRESULT EXPENTRY wpClient (HWND hWnd, ULONG ulMsg, MPARAM m1, MPARAM m2); Profile_BEGIN(); HMQ hMsgQ; QMSG qMsg; if ( ! (hAB = WinInitialize(0)) || ! (hMsgQ = WinCreateMsgQueue(hAB,32))) exit (4); History .Init(IDM_FILEHIST_MIN, IDM_FILEHIST_MAX-1, IDM_FILEHIST_MAX); VPortComponents.Init(0); // Create windows, show, add switch entry VPortModPub .Init(1); // Create windows VPortProcs .Init(2); // Create windows VPortLines .Init(3); // Create windows while(WinGetMsg(hAB,&qMsg,0,0,0)) WinDispatchMsg( hAB,&qMsg); VPortLines .Kill(); VPortProcs .Kill(); VPortModPub .Kill(); VPortComponents.Kill(); History .Kill(); if (fClearDBI) ClearDebugInfo(); WinRemoveSwitchEntry(hSwitch); WinDestroyMsgQueue(hMsgQ); WinTerminate(hAB); } MRESULT EXPENTRY wpVPFrame(HWND hWnd,ULONG ulMsg, MPARAM m1, MPARAM m2) { static PFNWP pWindowProc; PVIEWPORT pVP = (PVIEWPORT)WinQueryWindowULong(hWnd,QWL_USER); switch (ulMsg){ case MM_SUBCLASS: pWindowProc = PFNWP(ULONG(m1)); break; case MM_PROFILE: // m1 = TRUE/FALSE - read/write // m2 = nPrfItem; { int nWin = int(m2); char sz[100]; sprintf(sz,PRFKEYNAME "Frame%u",nWin); if (!WinRestoreWindowPos(PRFAPPNAME, sz, hWnd)) { int cx = WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); int cy = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); int nPos = (nWin % 4) + 1; WinSetWindowPos(hWnd,HWND_TOP,cx/10*nPos,cy/10*(5-nPos),cx/2,cy/2, SWP_MOVE|SWP_SIZE|(nWin ? 0 : SWP_SHOW|SWP_ACTIVATE|SWP_ZORDER)); } } case WM_MEASUREITEM: return pVP ? pVP->WM_MeasureItem(hWnd,m1,m2) : (MRESULT)10; case WM_DRAWITEM: return pVP ? pVP->WM_DrawItem (hWnd, m1, m2) : 0; case WM_COMMAND: if (pVP) return pVP->WM_Command(hWnd,m1,m2); break; case WM_CONTROL: if (pVP) return pVP->WM_Control(hWnd,m1,m2); break; default: return (*pWindowProc)(hWnd,ulMsg,m1,m2); } return 0; } MRESULT EXPENTRY wpVPClient(HWND hWnd,ULONG ulMsg, MPARAM m1, MPARAM m2) { PVIEWPORT pVP = (PVIEWPORT)WinQueryWindowULong(hWnd,QWL_USER); switch (ulMsg){ case WM_COMMAND: if (pVP) return pVP->WM_Command(hWnd,m1,m2); break; case WM_CONTROL: if (pVP) return pVP->WM_Control(hWnd,m1,m2); break; case WM_SIZE: return pVP ? pVP->WM_Size(hWnd,m1,m2) : 0; case WM_INITMENU: return pVP ? pVP->WM_InitMenu(hWnd,m1,m2) : 0; default: return WinDefWindowProc(hWnd,ulMsg,m1,m2); } return 0; } ULONG IOErMsg(APIRET err, HWND hWnd, char *szCapt, char *szErr, char *szFile, ULONG MBF) // if (hWnd) show message, return MBID_* // else returns PSZ szError { char *psz = szErr; switch((ULONG)err) { case 1: psz = "Invalid funstion number"; break; case 2: psz = "File not found"; break; case 3: psz = "Path not found"; break; case 4: psz = "Too many opened files (no handles left)"; break; case 5: psz = "Access denied"; break; case 6: psz = "Invalid handle"; break; case 8: psz = "Insufficient memory"; break; case 10: psz = "Invalid environment"; break; case 11: psz = "Invalid format"; break; case 12: psz = "Invalid access"; break; case 13: psz = "Invalid data"; break; case 19: psz = "Disk is write protected"; break; case 26: psz = "Uniknown media type"; break; case 29: psz = "Write fault"; break; case 32: psz = "Sharing violation"; break; case 33: psz = "Lock violation"; break; case 36: psz = "Sharing buffer overflov"; break; case 82: psz = "Cannot make directory entry"; break; case 84: psz = "Too many pipes"; break; case 87: psz = "Invalid parameter"; break; case 89: psz = "No process slots available"; break; case 95: psz = "Interrupted system call"; break; case 99: psz = "Device in use"; break; case 108: psz = "Drive locked by another process"; break; case 109: psz = "Broken pipe"; break; case 110: psz = "Open/create failed due to explicit fail command"; break; case 112: psz = "No enough space on the disk"; break; case 114: psz = "Invalid target handle"; break; case 127: psz = "Procedure address not found"; break; case 182: psz = "Invalid ordinal"; break; case 190: psz = "Invalid module type"; break; case 191: psz = "Invalid EXE signature"; break; case 192: psz = "EXE marked invalid"; break; case 195: psz = "Invalid minimum allocation size"; break; case 196: psz = "Dynamic link from invalid privilege level"; break; case 206: psz = "File name or extention is greater than 8.3 characters"; break; case 231: psz = "Pipe is busy"; break; } static char szErrMsg[CCHMAXPATH+150]; if (psz != szErr) sprintf(szErrMsg, "Error %u: %s", int(err), psz); else strcpy(szErrMsg, psz); if (szFile && szFile[0]) { strcat(szErrMsg," (File "); strcat(szErrMsg,szFile); strcat(szErrMsg,")"); } if (hWnd) return WinMessageBox(HWND_DESKTOP, hWnd, szErrMsg, szCapt, 0, MB_ERROR|MB_MOVEABLE|MBF); else return ULONG(szErrMsg); } //------------------------------------- HISTORY:: HISTORY() {memset(this,0,sizeof(*this));} HISTORY::~HISTORY() {sf_freelist(pllHist); pllHist = 0;} void HISTORY::Init(int nMinCmd, int nMaxCmd, int nSeparator) { sf_freelist(pllHist); pllHist = 0; this->nMinCmd = nMinCmd; this->nMaxCmd = nMaxCmd; this->nSeparator = nSeparator; char *pchBuf = 0; ULONG ulSize = 0; if ( !PrfQueryProfileSize(HINI_USERPROFILE,PRFAPPNAME,PRFKEYNAME "Hist",&ulSize) || !ulSize || !(pchBuf=(char*)malloc(ulSize+1)) || !PrfQueryProfileData(HINI_USERPROFILE,PRFAPPNAME,PRFKEYNAME "Hist",pchBuf,&ulSize) ) { free(pchBuf); return; } pchBuf[ulSize] = '\0'; LONG lN = *(PLONG)pchBuf; int nCmd = nMinCmd; for (PSZ psz=pchBuf+sizeof(lN); psz<pchBuf+ulSize && lN>0 && nCmd++<=nMaxCmd; psz += strlen(psz)+1, lN--) pllHist = sf_applist(pllHist,psz); free(pchBuf); } void HISTORY::Kill() { // Writes the hispory as N,"text1",...,"textN" // N is a LONG, text(s) are z-terminated lines LINELIST *pll; char *pchBuf; LONG lSize = 0; LONG lN = 0; for (pll=pllHist; pll; pll=pll->next,lN++) lSize += strlen(pll->text)+1; if (pchBuf=(char*)malloc(lSize+sizeof(lN))) { *PLONG(pchBuf) = lN; char *pchTarg = pchBuf+sizeof(lN); for (pll=pllHist; pll; pll=pll->next) { strcpy(pchTarg,pll->text); pchTarg += strlen(pchTarg)+1; } PrfWriteProfileData(HINI_USERPROFILE,PRFAPPNAME,PRFKEYNAME "Hist",pchBuf,pchTarg-pchBuf); free(pchBuf); } else PrfWriteProfileData(HINI_USERPROFILE,PRFAPPNAME,PRFKEYNAME "Hist",NULL,0); } void HISTORY::InitMenu(HWND hm) { LONG i; MENUITEM mi; PLINELIST pll; WinSendMsg(hm,MM_DELETEITEM,MPFROM2SHORT(nSeparator,FALSE),0); for (i=nMinCmd; i<=nMaxCmd; i++) WinSendMsg(hm,MM_DELETEITEM,MPFROM2SHORT(i,FALSE),0); if (!pllHist) return; memset(&mi,0,sizeof(mi)); mi.iPosition = MIT_END; mi.afStyle = MIS_SEPARATOR; mi.id = nSeparator; WinSendMsg(hm,MM_INSERTITEM,MPARAM(&mi),MPARAM("")); for (pll=pllHist, i=nMinCmd; pll && i<=nMaxCmd; pll=pll->next, i++) { mi.afStyle = MIS_TEXT; mi.id = i; WinSendMsg(hm,MM_INSERTITEM,MPARAM(&mi),MPARAM(pll->text)); } } PSZ HISTORY::Cmd2File(int nCmd) { PLINELIST pll; int i; for (pll=pllHist, i=nMinCmd; pll && i<=nMaxCmd; pll=pll->next, i++) if (i==nCmd) return pll->text; return 0; } void HISTORY::AppItem(PSZ pszIt) { PLINELIST *ppll; PLINELIST pll; int i; if(!pszIt || !*(pszIt=sf_skipspaces(pszIt))) return; for (ppll=&pllHist; *ppll; ppll=&(*ppll)->next) if (!sf_stricmp((*ppll)->text,pszIt)) { sf_cutlist(ppll); break; } for (pll=pllHist, i=nMinCmd; pll; pll=pll->next, i++) if (i>=nMaxCmd-1) { sf_freelist(pll->next); pll->next = 0; break; } pll = sf_applist(0,pszIt); pll->next = pllHist; pllHist = pll; }
[ "klvov@excelsior-usa.com" ]
klvov@excelsior-usa.com
24fceda068f16f51181371f4ce1b121bd7fdd9d2
1d82b21186e123529efc1b4b54d01922e53e84ab
/EvlTimeCourse0.h
be637f0ce1fb29d116f659bf51bfa7af16bd2777
[]
no_license
TaihaoJin/Abf_Processing
e315c03ddd6c6fa684073759f7948a65a7c30dd6
32ce464cd08731a87e766bc9e84464172b096727
refs/heads/master
2021-01-10T15:06:55.227764
2016-01-27T08:48:00
2016-01-27T08:48:00
50,493,276
0
0
null
null
null
null
UTF-8
C++
false
false
1,216
h
// EvlTimeCourse0.h: interface for the CEvlTimeCourse class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_EVLTIMECOURSE_H__6B243C42_992A_11D4_83DE_00C04F200B5B__INCLUDED_) #define AFX_EVLTIMECOURSE_H__6B243C42_992A_11D4_83DE_00C04F200B5B__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CEvlTimeCourse0 { public: CEvlTimeCourse0(CString sFileName, float fBinSize, float fTimePerPoint, int nNumEvent, int* pnLevelLength, int* pnLevelStart, short* pstEventCurrentLevel); CEvlTimeCourse0(); virtual ~CEvlTimeCourse0(); void DoEvlTimeCourse(); protected: CString ChangeFileExt(CString sFileName, CString sExt); void WriteTimeCourse(FILE* fpOut); void PreparePointers(); void OutputTimeCourse(); int* m_pnLevelStart; int* m_pnLevelLength; int m_nNumEvent; short* m_pstEventCurrentLevel; float m_fTimePerPoint; float* m_pfNumOpenings; float* m_pfTotalOpenTime; int* m_pnMaximumOpenLevel; float* m_pfElapsedTime; float m_fBinSize; int m_nNumBin; CString m_sEvlFileName; }; #endif // !defined(AFX_EVLTIMECOURSE_H__6B243C42_992A_11D4_83DE_00C04F200B5B__INCLUDED_)
[ "TaihaoJin2004@gmail.com" ]
TaihaoJin2004@gmail.com
5c6dc6b887d7231fadf9e96420602b3ef9ab28ed
3f89d8f9592dda6db7fbce1d5de56fd5d6eb09b1
/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoCutAttrPairTrack.h
0c636614b05089554abf879e8bb173a294917eb7
[]
permissive
KvapilJ/AliPhysics
6e94c9d990e98f43056c51ceb834f5acf404d78b
373b8c7819d77b39a5f993d26067d9cc411eae17
refs/heads/master
2020-04-17T21:47:42.685528
2019-02-26T14:11:30
2019-02-26T14:12:01
166,966,516
0
0
BSD-3-Clause
2019-01-22T09:32:50
2019-01-22T09:32:50
null
UTF-8
C++
false
false
13,971
h
/// /// \file AliFemtoUser/AliFemtoPairCutTrackAttr.h /// #pragma once #ifndef ALIFEMTOPAIRCUTTRACKATTR_H #define ALIFEMTOPAIRCUTTRACKATTR_H #include "AliFemtoConfigObject.h" #include "AliFemtoPair.h" #include "AliFemtoPairCut.h" // re-use static Δφ* calculation #include "AliFemtoPairCutDetaDphi.h" namespace pwgfemto { /// \class AddPairCutAttrs /// \brief Join cut-types together /// template <typename T1, typename T2> struct AddPairCutAttrs : public T1, public T2 { bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { return T1::Pass(track1, track2) && T2::Pass(track1, track2); } AddPairCutAttrs() : T1() , T2() { } AddPairCutAttrs(AliFemtoConfigObject &cfg) : T1(cfg) , T2(cfg) { } void FillConfiguration(AliFemtoConfigObject &cfg) const { T1::FillConfiguration(cfg); T2::FillConfiguration(cfg); } virtual ~AddPairCutAttrs() {} }; /// \class PairCutTrackAttrAvgSep /// \brief Range of average separation /// struct PairCutTrackAttrAvgSep { double avgsep_min; bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { return calc_avg_sep(track1, track2) > avgsep_min; } PairCutTrackAttrAvgSep() : avgsep_min(0.0) { } PairCutTrackAttrAvgSep(AliFemtoConfigObject &cfg) : avgsep_min(cfg.pop_float("avgsep_min", 0.0)) { } static bool is_valid_point(const AliFemtoThreeVector &point) { return point.x() > -9000.0 && point.y() > -9000.0 && point.z() > -9000.0; } static double calc_avg_sep(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { int count = 0; double sep_sum = 0.0; for (int i=0; i<9; ++i) { const auto &p1 = track1.NominalTpcPoint(i), &p2 = track2.NominalTpcPoint(i); if (!is_valid_point(p1) || !is_valid_point(p2)) { continue; } sep_sum += (p1 - p2).Mag(); count++; } double avg = __builtin_expect(count > 0, 1) ? sep_sum / count : -1.0; return avg; } void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.insert("avgsep_min", avgsep_min); } virtual ~PairCutTrackAttrAvgSep() {} }; /// Cut on the sum of the pT struct PairCutTrackAttrPt { static const std::pair<double, double> DEFAULT; std::pair<double, double> pt_range; bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { const double pt_sum = track1.Pt() + track2.Pt(); return pt_range.first <= pt_sum && pt_sum < pt_range.second; } PairCutTrackAttrPt() : pt_range(DEFAULT) { } PairCutTrackAttrPt(AliFemtoConfigObject &cfg) : pt_range(cfg.pop_range("pt_range", DEFAULT)) { } void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.insert("pt_range", pt_range); } virtual ~PairCutTrackAttrPt() {} }; /// Cut on share quality and fraction struct PairCutTrackAttrShareQuality { double share_fraction_max; double share_quality_max; bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { const std::pair<double, double> qual_and_frac = calc_share_quality_fraction(track1, track2); const double share_fraction = qual_and_frac.first, share_quality = qual_and_frac.second; return share_fraction <= share_fraction_max && share_quality <= share_quality_max; } static std::pair<double, double> calc_share_quality_fraction(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { const TBits &tpc_clusters_1 = track1.TPCclusters(), &tpc_sharing_1 = track1.TPCsharing(), &tpc_clusters_2 = track2.TPCclusters(), &tpc_sharing_2 = track2.TPCsharing(), cls1_and_cls2 = tpc_clusters_1 & tpc_clusters_2, cls1_xor_cls2 = tpc_clusters_1 ^ tpc_clusters_2, shr1_and_shr2 = tpc_sharing_1 & tpc_sharing_2, not_sharing = ~const_cast<TBits&>(shr1_and_shr2); const double cls1_xor_cls2_bits = cls1_xor_cls2.CountBits(), nh = cls1_xor_cls2_bits + 2 * cls1_and_cls2.CountBits(), ns = 2 * (cls1_and_cls2 & shr1_and_shr2).CountBits(), an = cls1_xor_cls2_bits + ns / 2 - (cls1_and_cls2 & not_sharing).CountBits(), share_quality = an / nh, share_fraction = ns / nh; return std::make_pair(share_quality, share_fraction); } PairCutTrackAttrShareQuality() : share_fraction_max(1.0) , share_quality_max(1.0) {} PairCutTrackAttrShareQuality(AliFemtoConfigObject &cfg) : share_fraction_max(cfg.pop_float("share_fraction_max", 1.0)) , share_quality_max(cfg.pop_float("share_quality_max", 1.0)) {} void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.insert("share_quality_max", share_quality_max); cfg.insert("share_fraction_max", share_fraction_max); } virtual ~PairCutTrackAttrShareQuality() {} }; /// \class PairCutTrackAttrDetaDphiStar /// \brief A pair cut which cuts on the Δη Δφ of the pair. /// /// Pairs pass which have |Δη| > delta_eta_min /// and √(Δφ² + Δη²) > delta_phi_min /// /// The difference in phi is calculated by examining the tracks' /// azimuthal angle at a particular radius, as determined by the /// magnetic field of the event. /// Note: fCurrentMagneticField should be set *before* using this cut /// It is recommended to do this in the EventBegin method of /// AliFemtoPairCut. /// /// The default value for this radius is 1.2 (inside the TPC) but /// this maybe changed via by changing the phistar_radius member. /// /// \Delta \phi_{min}* = \phi_1 - \phi_2 /// + arcsin \left( \frac{ z_1 \cdot B_z \cdot R}{2 p_{T1}} \right) /// - arcsin \left( \frac{ z_2 \cdot B_z \cdot R}{2 p_{T2}} \right) /// /// struct PairCutTrackAttrDetaDphiStar { float delta_eta_min, delta_phistar_min, phistar_radius; float fCurrentMagneticField; PairCutTrackAttrDetaDphiStar() : delta_eta_min(0.0) , delta_phistar_min(0.0) , phistar_radius(1.2) , fCurrentMagneticField(0.0) { } PairCutTrackAttrDetaDphiStar(AliFemtoConfigObject &cut) : delta_eta_min(cut.pop_float("delta_eta_min", 0.0)) , delta_phistar_min(cut.pop_float("delta_phistar_min", 0.0)) , phistar_radius(cut.pop_float("phistar_radius", 1.2)) , fCurrentMagneticField(0.0) { } bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { const AliFemtoThreeVector &p1 = track1.P(), &p2 = track2.P(); const double deta = calc_delta_eta(p1, p2); if (delta_eta_min <= std::fabs(deta)) { return true; } const double dphi = AliFemtoPairCutDetaDphi::CalculateDPhiStar( p1, track1.Charge(), p2, track2.Charge(), phistar_radius, fCurrentMagneticField); return delta_phistar_min * delta_phistar_min <= deta * deta + dphi * dphi; } static double calc_delta_eta(const AliFemtoThreeVector &p1, const AliFemtoThreeVector &p2) { return p1.PseudoRapidity() - p2.PseudoRapidity(); } void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.Update(AliFemtoConfigObject::BuildMap() ("delta_eta_min", delta_eta_min) ("delta_phistar_min", delta_phistar_min) ("phistar_radius", phistar_radius)); } virtual ~PairCutTrackAttrDetaDphiStar() {} }; /// Remove pairs of tracks with the same particle struct PairCutTrackAttrSameLabel { bool remove_same_label; bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { return remove_same_label ? abs(track1.Label()) == abs(track2.Label()) : true; } PairCutTrackAttrSameLabel() : remove_same_label(true) {} PairCutTrackAttrSameLabel(AliFemtoConfigObject &cfg) : remove_same_label(cfg.pop_bool("remove_same_label", true)) {} void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.insert("remove_same_label", remove_same_label); } virtual ~PairCutTrackAttrSameLabel() {} }; /// Cut on Minv of the pair /// /// This assumes highly relativistic particles and does not need an /// assumed particle mass. /// struct PairCutTrackAttrMinv { protected: /// Square of minv range std::pair<double, double> fMinvSqrRange; double fMass1; double fMass2; public: bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { // const double minv2 = CalcMinvSqrd(track1.P(), track2.P(), fMass1, fMass2); const double minv2 = CalcMinvSqrd(track1.P(), track2.P()); return fMinvSqrRange.first <= minv2 && minv2 < fMinvSqrRange.second; } /// Minv assuming highly relativistic particles (E >> m) /// /// Does not require need mass information /// /// $ M_{inv}^2 = 2 p_{T,1} p_{T,2} (\cosh(\eta_1 - \eta_2) - \cos(\phi_1 - \phi_2)) $ /// static double CalcMinvSqrd(const AliFemtoThreeVector &p1, const AliFemtoThreeVector &p2) { const double pt1 = p1.Perp2(), eta1 = p1.PseudoRapidity(), phi1 = p1.Phi(), pt2 = p2.Perp2(), eta2 = p2.PseudoRapidity(), phi2 = p2.Phi(); return 2 * std::sqrt(pt1 * pt2) * (std::cosh(eta1 - eta2) - std::cos(phi1 - phi2)); } /// Minv with assumed masses /// /// $ M_{inv}^2 = m_1^2 m_2^2 + 2 (E_1 E_2 - \vec{p_1} \cdot \vec{p_2}) $ /// static double CalcMinvSqrd(const AliFemtoThreeVector &p1, const AliFemtoThreeVector &p2, double mass1, double mass2) { const double m1sqrd = mass1*mass1, m2sqrd = mass2*mass2, e1sqrd = m1sqrd + p1.Mag2(), e2sqrd = m2sqrd + p2.Mag2(), E1E2 = std::sqrt(e1sqrd*e2sqrd); return m1sqrd + m2sqrd + 2*(E1E2 - p1.Dot(p2)); } /// Minv with assumed masses /// /// $ M_{inv}^2 = m_1^2 m_2^2 + 2 (E_1 E_2 - \vec{p_1} \cdot \vec{p_2}) $ /// static double CalcMinvSqrd(const AliFemtoLorentzVector &p1, const AliFemtoLorentzVector &p2) { return (p1 + p2).m2(); } void SetMinvRange(double lo, double hi) { fMinvSqrRange = std::make_pair(lo * lo, hi * hi); } void SetMinvRange(const std::pair<double, double> &range) { double lo = range.first * range.first, hi = range.second * range.second; fMinvSqrRange = std::make_pair(lo, hi); } std::pair<double, double> GetMinvRange() const { return std::make_pair(std::sqrt(fMinvSqrRange.first), std::sqrt(fMinvSqrRange.second)); } PairCutTrackAttrMinv() : fMinvSqrRange(0, 100) , fMass1(0.0) , fMass2(0.0) {} PairCutTrackAttrMinv(AliFemtoConfigObject &cfg) : fMinvSqrRange(cfg.pop_range("minv_range", std::make_pair(0.0, 100.0))) , fMass1(0.0) , fMass2(0.0) { fMinvSqrRange.first *= fMinvSqrRange.first; fMinvSqrRange.second *= fMinvSqrRange.second; } void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.insert("minv_range", GetMinvRange()); } virtual ~PairCutTrackAttrMinv() {} }; /// \class PairCutTrackAttrRemoveEE /// \brief Cut pairs with Minv near electron mass /// struct PairCutTrackAttrRemoveEE { float ee_minv_min; bool Pass(const AliFemtoTrack &track1, const AliFemtoTrack &track2) { const double E_MASS = 0.000511, minv_sqrd = PairCutTrackAttrMinv::CalcMinvSqrd(track1.P(), track2.P(), E_MASS, E_MASS), minv = std::sqrt(minv_sqrd); return std::abs(minv - E_MASS) >= ee_minv_min; } PairCutTrackAttrRemoveEE() : ee_minv_min(0.0) {} PairCutTrackAttrRemoveEE(AliFemtoConfigObject &cfg) : ee_minv_min(cfg.pop_float("ee_minv_min", 0.0)) {} void FillConfiguration(AliFemtoConfigObject &cfg) const { cfg.insert("ee_minv_min", ee_minv_min); } virtual ~PairCutTrackAttrRemoveEE() {} }; } // namespace pwgcf #include "AliFemtoPairCut.h" /// \class AliFemtoPairCutAttrTracks /// \brief Bridge from AliFemtoPairCut to a metaclass of PairCut-Attrs /// /// Note - This expects two tracks, not an AliFemtoPair /// /// Subclass and implement your method: /// `const char* GetName() const` /// /// template <typename CRTP, typename CutAttrType> class AliFemtoPairCutAttrTracks : public AliFemtoPairCut, public CutAttrType { public: typedef CutAttrType CutAttrs; virtual ~AliFemtoPairCutAttrTracks() { } AliFemtoPairCutAttrTracks() : AliFemtoPairCut() , CutAttrType() {} AliFemtoPairCutAttrTracks(AliFemtoConfigObject &cfg) : AliFemtoPairCut() , CutAttrType(cfg) {} /// user-written method to return string describing cuts virtual AliFemtoString Report() { return ""; } /// Return a TList of settings virtual TList* ListSettings() { TList* list = new TList(); AppendSettings(*list); return list; } virtual void AppendSettings(TCollection &) const = 0; virtual bool Pass(const AliFemtoPair *pair) { return CutAttrs::Pass(*pair->Track1()->Track(), *pair->Track2()->Track()); } void StoreConfiguration(AliFemtoConfigObject &cfg) const { CutAttrs::FillConfiguration(cfg); cfg.insert("_class", static_cast<CRTP*>(this)->GetName()); } AliFemtoConfigObject GetConfiguration() const { AliFemtoConfigObject result = AliFemtoConfigObject::BuildMap() ("_class", CRTP::ClassName()); CutAttrs::FillConfiguration(result); return result; } }; #endif
[ "andrew.kubera@cern.ch" ]
andrew.kubera@cern.ch
1f1eeae1d1fe0b77a2438d21a63ce0317731e4b4
21553f6afd6b81ae8403549467230cdc378f32c9
/arm/cortex/Freescale/MK40D7/include/arch/reg/uart4.hpp
63e7ccc4bcae0ff016e219fc3663829360d15a5d
[]
no_license
digint/openmptl-reg-arm-cortex
3246b68dcb60d4f7c95a46423563cab68cb02b5e
88e105766edc9299348ccc8d2ff7a9c34cddacd3
refs/heads/master
2021-07-18T19:56:42.569685
2017-10-26T11:11:35
2017-10-26T11:11:35
108,407,162
3
1
null
null
null
null
UTF-8
C++
false
false
12,160
hpp
/* * OpenMPTL - C++ Microprocessor Template Library * * This program is a derivative representation of a CMSIS System View * Description (SVD) file, and is subject to the corresponding license * (see "Freescale CMSIS-SVD License Agreement.pdf" in the parent directory). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ //////////////////////////////////////////////////////////////////////// // // Import from CMSIS-SVD: "Freescale/MK40D7.svd" // // vendor: Freescale Semiconductor, Inc. // vendorID: Freescale // name: MK40D7 // series: Kinetis_K // version: 1.6 // description: MK40D7 Freescale Microcontroller // -------------------------------------------------------------------- // // C++ Header file, containing architecture specific register // declarations for use in OpenMPTL. It has been converted directly // from a CMSIS-SVD file. // // https://digint.ch/openmptl // https://github.com/posborne/cmsis-svd // #ifndef ARCH_REG_UART4_HPP_INCLUDED #define ARCH_REG_UART4_HPP_INCLUDED #warning "using untested register declarations" #include <register.hpp> namespace mptl { /** * Serial Communication Interface */ struct UART4 { static constexpr reg_addr_t base_addr = 0x400ea000; /** * UART Baud Rate Registers:High */ struct BDH : public reg< uint8_t, base_addr + 0, rw, 0 > { using type = reg< uint8_t, base_addr + 0, rw, 0 >; using SBR = regbits< type, 0, 5 >; /**< UART Baud Rate Bits */ using RXEDGIE = regbits< type, 6, 1 >; /**< RxD Input Active Edge Interrupt Enable */ using LBKDIE = regbits< type, 7, 1 >; /**< LIN Break Detect Interrupt Enable */ }; /** * UART Baud Rate Registers: Low */ struct BDL : public reg< uint8_t, base_addr + 0x1, rw, 0x4 > { using type = reg< uint8_t, base_addr + 0x1, rw, 0x4 >; using SBR = regbits< type, 0, 8 >; /**< UART Baud Rate Bits */ }; /** * UART Control Register 1 */ struct C1 : public reg< uint8_t, base_addr + 0x2, rw, 0 > { using type = reg< uint8_t, base_addr + 0x2, rw, 0 >; using PT = regbits< type, 0, 1 >; /**< Parity Type */ using PE = regbits< type, 1, 1 >; /**< Parity Enable */ using ILT = regbits< type, 2, 1 >; /**< Idle Line Type Select */ using WAKE = regbits< type, 3, 1 >; /**< Receiver Wakeup Method Select */ using M = regbits< type, 4, 1 >; /**< 9-bit or 8-bit Mode Select */ using RSRC = regbits< type, 5, 1 >; /**< Receiver Source Select */ using UARTSWAI = regbits< type, 6, 1 >; /**< UART Stops in Wait Mode */ using LOOPS = regbits< type, 7, 1 >; /**< Loop Mode Select */ }; /** * UART Control Register 2 */ struct C2 : public reg< uint8_t, base_addr + 0x3, rw, 0 > { using type = reg< uint8_t, base_addr + 0x3, rw, 0 >; using SBK = regbits< type, 0, 1 >; /**< Send Break */ using RWU = regbits< type, 1, 1 >; /**< Receiver Wakeup Control */ using RE = regbits< type, 2, 1 >; /**< Receiver Enable */ using TE = regbits< type, 3, 1 >; /**< Transmitter Enable */ using ILIE = regbits< type, 4, 1 >; /**< Idle Line Interrupt Enable */ using RIE = regbits< type, 5, 1 >; /**< Receiver Full Interrupt or DMA Transfer Enable */ using TCIE = regbits< type, 6, 1 >; /**< Transmission Complete Interrupt Enable */ using TIE = regbits< type, 7, 1 >; /**< Transmitter Interrupt or DMA Transfer Enable. */ }; /** * UART Status Register 1 */ struct S1 : public reg< uint8_t, base_addr + 0x4, ro, 0xC0 > { using type = reg< uint8_t, base_addr + 0x4, ro, 0xC0 >; using PF = regbits< type, 0, 1 >; /**< Parity Error Flag */ using FE = regbits< type, 1, 1 >; /**< Framing Error Flag */ using NF = regbits< type, 2, 1 >; /**< Noise Flag */ using OR = regbits< type, 3, 1 >; /**< Receiver Overrun Flag */ using IDLE = regbits< type, 4, 1 >; /**< Idle Line Flag */ using RDRF = regbits< type, 5, 1 >; /**< Receive Data Register Full Flag */ using TC = regbits< type, 6, 1 >; /**< Transmit Complete Flag */ using TDRE = regbits< type, 7, 1 >; /**< Transmit Data Register Empty Flag */ }; /** * UART Status Register 2 */ struct S2 : public reg< uint8_t, base_addr + 0x5, rw, 0 > { using type = reg< uint8_t, base_addr + 0x5, rw, 0 >; using RAF = regbits< type, 0, 1 >; /**< Receiver Active Flag */ using LBKDE = regbits< type, 1, 1 >; /**< LIN Break Detection Enable */ using BRK13 = regbits< type, 2, 1 >; /**< Break Transmit Character Length */ using RWUID = regbits< type, 3, 1 >; /**< Receive Wakeup Idle Detect */ using RXINV = regbits< type, 4, 1 >; /**< Receive Data Inversion */ using MSBF = regbits< type, 5, 1 >; /**< Most Significant Bit First */ using RXEDGIF = regbits< type, 6, 1 >; /**< RxD Pin Active Edge Interrupt Flag */ using LBKDIF = regbits< type, 7, 1 >; /**< LIN Break Detect Interrupt Flag */ }; /** * UART Control Register 3 */ struct C3 : public reg< uint8_t, base_addr + 0x6, rw, 0 > { using type = reg< uint8_t, base_addr + 0x6, rw, 0 >; using PEIE = regbits< type, 0, 1 >; /**< Parity Error Interrupt Enable */ using FEIE = regbits< type, 1, 1 >; /**< Framing Error Interrupt Enable */ using NEIE = regbits< type, 2, 1 >; /**< Noise Error Interrupt Enable */ using ORIE = regbits< type, 3, 1 >; /**< Overrun Error Interrupt Enable */ using TXINV = regbits< type, 4, 1 >; /**< Transmit Data Inversion. */ using TXDIR = regbits< type, 5, 1 >; /**< Transmitter Pin Data Direction in Single-Wire mode */ using T8 = regbits< type, 6, 1 >; /**< Transmit Bit 8 */ using R8 = regbits< type, 7, 1 >; /**< Received Bit 8 */ }; /** * UART Data Register */ struct D : public reg< uint8_t, base_addr + 0x7, rw, 0 > { using type = reg< uint8_t, base_addr + 0x7, rw, 0 >; using RT = regbits< type, 0, 8 >; /**< no description available */ }; /** * UART Match Address Registers 1 */ struct MA1 : public reg< uint8_t, base_addr + 0x8, rw, 0 > { using type = reg< uint8_t, base_addr + 0x8, rw, 0 >; using MA = regbits< type, 0, 8 >; /**< Match Address */ }; /** * UART Match Address Registers 2 */ struct MA2 : public reg< uint8_t, base_addr + 0x9, rw, 0 > { using type = reg< uint8_t, base_addr + 0x9, rw, 0 >; using MA = regbits< type, 0, 8 >; /**< Match Address */ }; /** * UART Control Register 4 */ struct C4 : public reg< uint8_t, base_addr + 0xa, rw, 0 > { using type = reg< uint8_t, base_addr + 0xa, rw, 0 >; using BRFA = regbits< type, 0, 5 >; /**< Baud Rate Fine Adjust */ using M10 = regbits< type, 5, 1 >; /**< 10-bit Mode select */ using MAEN2 = regbits< type, 6, 1 >; /**< Match Address Mode Enable 2 */ using MAEN1 = regbits< type, 7, 1 >; /**< Match Address Mode Enable 1 */ }; /** * UART Control Register 5 */ struct C5 : public reg< uint8_t, base_addr + 0xb, rw, 0 > { using type = reg< uint8_t, base_addr + 0xb, rw, 0 >; using RDMAS = regbits< type, 5, 1 >; /**< Receiver Full DMA Select */ using TDMAS = regbits< type, 7, 1 >; /**< Transmitter DMA Select */ }; /** * UART Extended Data Register */ struct ED : public reg< uint8_t, base_addr + 0xc, ro, 0 > { using type = reg< uint8_t, base_addr + 0xc, ro, 0 >; using PARITYE = regbits< type, 6, 1 >; /**< no description available */ using NOISY = regbits< type, 7, 1 >; /**< no description available */ }; /** * UART Modem Register */ struct MODEM : public reg< uint8_t, base_addr + 0xd, rw, 0 > { using type = reg< uint8_t, base_addr + 0xd, rw, 0 >; using TXCTSE = regbits< type, 0, 1 >; /**< Transmitter clear-to-send enable */ using TXRTSE = regbits< type, 1, 1 >; /**< Transmitter request-to-send enable */ using TXRTSPOL = regbits< type, 2, 1 >; /**< Transmitter request-to-send polarity */ using RXRTSE = regbits< type, 3, 1 >; /**< Receiver request-to-send enable */ }; /** * UART Infrared Register */ struct IR : public reg< uint8_t, base_addr + 0xe, rw, 0 > { using type = reg< uint8_t, base_addr + 0xe, rw, 0 >; using TNP = regbits< type, 0, 2 >; /**< Transmitter narrow pulse */ using IREN = regbits< type, 2, 1 >; /**< Infrared enable */ }; /** * UART FIFO Parameters */ struct PFIFO : public reg< uint8_t, base_addr + 0x10, rw, 0 > { using type = reg< uint8_t, base_addr + 0x10, rw, 0 >; using RXFIFOSIZE = regbits< type, 0, 3 >; /**< Receive FIFO. Buffer Depth */ using RXFE = regbits< type, 3, 1 >; /**< Receive FIFO Enable */ using TXFIFOSIZE = regbits< type, 4, 3 >; /**< Transmit FIFO. Buffer Depth */ using TXFE = regbits< type, 7, 1 >; /**< Transmit FIFO Enable */ }; /** * UART FIFO Control Register */ struct CFIFO : public reg< uint8_t, base_addr + 0x11, rw, 0 > { using type = reg< uint8_t, base_addr + 0x11, rw, 0 >; using RXUFE = regbits< type, 0, 1 >; /**< Receive FIFO Underflow Interrupt Enable */ using TXOFE = regbits< type, 1, 1 >; /**< Transmit FIFO Overflow Interrupt Enable */ using RXFLUSH = regbits< type, 6, 1 >; /**< Receive FIFO/Buffer Flush */ using TXFLUSH = regbits< type, 7, 1 >; /**< Transmit FIFO/Buffer Flush */ }; /** * UART FIFO Status Register */ struct SFIFO : public reg< uint8_t, base_addr + 0x12, rw, 0xC0 > { using type = reg< uint8_t, base_addr + 0x12, rw, 0xC0 >; using RXUF = regbits< type, 0, 1 >; /**< Receiver Buffer Underflow Flag */ using TXOF = regbits< type, 1, 1 >; /**< Transmitter Buffer Overflow Flag */ using RXEMPT = regbits< type, 6, 1 >; /**< Receive Buffer/FIFO Empty */ using TXEMPT = regbits< type, 7, 1 >; /**< Transmit Buffer/FIFO Empty */ }; /** * UART FIFO Transmit Watermark */ struct TWFIFO : public reg< uint8_t, base_addr + 0x13, rw, 0 > { using type = reg< uint8_t, base_addr + 0x13, rw, 0 >; using TXWATER = regbits< type, 0, 8 >; /**< Transmit Watermark */ }; /** * UART FIFO Transmit Count */ struct TCFIFO : public reg< uint8_t, base_addr + 0x14, ro, 0 > { using type = reg< uint8_t, base_addr + 0x14, ro, 0 >; using TXCOUNT = regbits< type, 0, 8 >; /**< Transmit Counter */ }; /** * UART FIFO Receive Watermark */ struct RWFIFO : public reg< uint8_t, base_addr + 0x15, rw, 0x1 > { using type = reg< uint8_t, base_addr + 0x15, rw, 0x1 >; using RXWATER = regbits< type, 0, 8 >; /**< Receive Watermark */ }; /** * UART FIFO Receive Count */ struct RCFIFO : public reg< uint8_t, base_addr + 0x16, ro, 0 > { using type = reg< uint8_t, base_addr + 0x16, ro, 0 >; using RXCOUNT = regbits< type, 0, 8 >; /**< Receive Counter */ }; }; } // namespace mptl #endif // ARCH_REG_UART4_HPP_INCLUDED
[ "axel@tty0.ch" ]
axel@tty0.ch
9d6f73ebd327bd0bd25703d6523c28e961a2ac0e
0dd9cf13c4a9e5f28ae5f36e512e86de335c26b4
/LintCode/lintcode_continuous-subarray-sum-ii.cpp
bc9bddfce8606fc0ba765a4045eaf1324ace5cb1
[]
no_license
yular/CC--InterviewProblem
908dfd6d538ccd405863c27c65c78379e91b9fd3
c271ea63eda29575a7ed4a0bce3c0ed6f2af1410
refs/heads/master
2021-07-18T11:03:07.525048
2021-07-05T16:17:43
2021-07-05T16:17:43
17,499,294
37
13
null
null
null
null
UTF-8
C++
false
false
2,218
cpp
/* * * Tag: DP * Time: O(n) * Space: O(n) */ class Solution { public: /** * @param A an integer array * @return A list of integers includes the index of * the first number and the index of the last number */ vector<int> continuousSubarraySumII(vector<int>& A) { // Write your code here vector<int> ans(2); if(!A.size()) return ans; int start = 0, end = 0, maxval = INT_MIN; int sum = 0, n = A.size(); for(int i = 0; i < n; ++ i){ sum += A[i]; if(sum >= 0){ if(sum > maxval){ end = i; maxval = sum; ans[0] = start; ans[1] = end; } }else{ if(sum > maxval){ maxval = sum; end = i; ans[0] = start; ans[1] = end; } sum = 0; start = i + 1; } } vector<int> dp_start(n), dp_end(n); vector<int> idx_start(n), idx_end(n); sum = A[0]; dp_start[0] = sum; idx_start[0] = 0; for(int i = 1; i < n; ++ i){ sum += A[i]; if(sum > dp_start[i - 1]){ dp_start[i] = sum; idx_start[i] = i; }else{ dp_start[i] = dp_start[i - 1]; idx_start[i] = idx_start[i - 1]; } } sum = A[n - 1]; dp_end[n - 1] = sum; idx_end[n - 1] = n - 1; for(int i = n - 2; i >= 0; -- i){ sum += A[i]; if(sum > dp_end[i + 1]){ dp_end[i] = sum; idx_end[i] = i; }else{ dp_end[i] = dp_end[i + 1]; idx_end[i] = idx_end[i + 1]; } } for(int i = 0; i < n - 1; ++ i){ int tmpsum = dp_start[i] + dp_end[i + 1]; if(tmpsum > maxval){ maxval = tmpsum; ans[0] = idx_end[i + 1]; ans[1] = idx_start[i]; } } return ans; } };
[ "1062969706@qq.com" ]
1062969706@qq.com
fa020b0c960e58254a8e60fa53b567746eccc484
d386c45aa5ff031aea4ee418ed52c47318fabc7d
/.localhistory/C/Users/Bq/source/repos/threadtest/threadtest/threadtest/1566454464$threadtest.cpp
c5278aa398cebe8d5b549d8dd97ad5030d68bac2
[]
no_license
B-Qq/threadtest
150ac930ef6c73ed235e2e6db188011fec678446
c0c2681619a39a1e3bc0b9ef8ddafdfbcc7748f3
refs/heads/master
2020-07-08T03:33:57.766775
2019-08-27T01:26:47
2019-08-27T01:26:47
203,552,182
0
0
null
null
null
null
UTF-8
C++
false
false
4,101
cpp
//#include "pch.h" //#include <iostream> //#include <condition_variable> //#include <thread> // //std::condition_variable cv; //std::mutex mtx; //bool ready = false; // //void do_print_id(int id) //{ // std::unique_lock<std::mutex> lck(mtx); // while (!ready) // { // cv.wait(lck); // } // std::cout << "thread " << id << std::endl; //} // //void go() //{ // std::unique_lock<std::mutex> lck(mtx); // ready = true; // //cv.notify_one(); // cv.notify_all(); //} // //int main() //{ // std::thread threads[10]; // // for (int i = 0; i < 10; i++) // { // threads[i] = std::thread(do_print_id, i); // } // // std::cout << "10 threads ready to race ...." << std::endl; // go(); // // for (auto &th : threads) // { // if (th.joinable()) // { // th.join(); // } // } // // return 0; //} // //#include "pch.h" //#include <algorithm> // //std::mutex mtx; // //void add(int &num, int &sum) //{ // while (true) // { // std::lock_guard<std::mutex> lock(mtx); // if (num < 100) // { // num += 1; // sum += num; // } // else // { // break; // } // } //} // //int main() //{ // int sum = 0; // int num = 0; // std::vector<std::thread> ver; // std::array<int, 4> arrayInt = { 1, 2, 3, 4 }; // std::tuple<int, std::string, char> cct = { 1, "2", '3' }; // auto ccs = std::tie("11", "22", "33"); // auto css = std::make_tuple("11", "23", 1); // std::cout << std::get<0>(ccs) << std::endl; // std::cout << std::get<1>(ccs) << std::endl; // std::cout << std::get<2>(ccs) << std::endl; // // std::cout << std::get<0>(css) << std::endl; // std::cout << std::get<1>(css) << std::endl; // std::cout << std::get<2>(css) << std::endl; // // std::lock_guard<std::mutex> ccsa(mtx); // std::unique_lock<std::mutex> ccsss(mtx); // ccsss.unlock(); // // //for (auto &t : arrayInt) // //{ // // std::cout << t << std::endl; // //} // // //for (int i = 0; i < 20; i++) // //{ // // std::thread t = std::thread(add, std::ref(num), std::ref(sum)); // // //ver.push_back(std::move(t)); // // t.detach(); // //} // //std::cout << sum << std::endl; // // //while (true) // //{ // // std::this_thread::sleep_for(std::chrono::seconds(2)); // //} // // return 0; //} #include "pch.h" #include <algorithm> #include <regex> //std::mutex mtx; // //static int num = 0; //static int sum = 0; // //void add() //{ // //std::lock_guard<std::mutex> glock(mtx); // if (num < 5) // { // num += 1; // sum += num; // } //} // //int main() //{ // //std::vector<std::thread *> threads; // // //for (int i = 0; i < 5; i++) // //{ // // std::thread *t = new std::thread(add); // // threads.emplace_back(t); // //} // // //std::for_each(threads.begin(), threads.end(), [](std::thread *t) {t->detach(); }); // // //std::cout << "sum" << sum << std::endl; // // //std::string fnames[] = { "foo.txt", "bar.txt", "test", "a0.txt", "AAA.txt" }; // //std::regex txt_regex(R("[A-Z]+[0-9]+.txt")); // //for (const auto &fname : fnames) // // std::cout << fname << ": " << std::regex_match(fname, txt_regex) << std::endl; // return 0; //} //int sum(int a, int b) //{ // std::this_thread::sleep_for(std::chrono::seconds(5)); // return a + b; //} // //int main() //{ // std::packaged_task<int(int, int)> task(sum); // std::future<int> future = task.get_future(); // std::thread t(std::move(task), 1, 2); // while (1) // { // std::this_thread::sleep_for(std::chrono::seconds(1)); // std::cout << "1 + 2:" << future.get() << std::endl; // } // // t.join(); // return 0; //} std::deque<int> q; std::mutex mtx; std::condition_variable c; void function_1() { int count = 50; while (count > 0) { std::unique_lock<std::mutex> locker(mtx); q.push_back(count); locker.unlock(); c.notify_one(); std::this_thread::sleep_for(std::chrono::seconds(1)); count--; } } void function_2() { int data = 0; while (data != 1) { std::unique_lock<std::mutex> locker(mtx); while (q.empty()) c.wait(locker); data = q.back(); q.pop_back(); locker.unlock(); std::cout << "t2 got a value from t1:" << data << std::endl; } } int main() { std::thread t1(function_1); std::thread t2(function_2); t1.join(); t2.join(); return 0; }
[ "bq5773718@163.com" ]
bq5773718@163.com
93891c7a1f63970b591a3add279c0464e9e243fa
2c0222ce64b5d6573bf8f98b2c038e21d0db8aac
/Anton and Polyhedrons.cpp
3911014c522dc7bb49b0e00badd8fe2430f12895
[]
no_license
christsonhartono/codeforces-solution
1b58607e92ef23ab55ed4505f813332fb3cb4ac5
090eff32534652a38d4baebd5cc0274326fe0ae4
refs/heads/master
2022-12-02T00:38:00.983956
2020-07-29T05:14:15
2020-07-29T05:14:15
263,204,630
0
0
null
null
null
null
UTF-8
C++
false
false
433
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n, total=0; string s; cin>>n; for(int i=0; i<n; i++){ cin>>s; if(s.compare("Tetrahedron")==0){ total+=4; }else if(s.compare("Cube")==0){ total+=6; }else if(s.compare("Octahedron")==0){ total+=8; }else if(s.compare("Dodecahedron")==0){ total+=12; }else if(s.compare("Icosahedron")==0){ total+=20; } } cout<<total<<endl; return 0; }
[ "jhanacakro1@gmail.com" ]
jhanacakro1@gmail.com
72555085f4aaae1810c8f8d8dbecf0ad9bc3445e
6ca8e9d7da81d1a124ec8b0714ed463908d8ee82
/s.cpp
3155e0c9d81eff4d0afae3df8a0ba3034e988d42
[]
no_license
includelife/sicily_codes
a33b31df7e7c3f3451ad29c9c86fc09c5a495893
66873f2b0083dd1827968becdb7b9b2ad5130b6a
refs/heads/master
2016-09-03T07:30:47.018794
2015-07-11T15:20:21
2015-07-11T15:20:21
25,923,166
0
0
null
null
null
null
UTF-8
C++
false
false
68
cpp
#include<stdio.h> int main(){printf("153\n370\n371\n407");return 0;}
[ "262548467@qq.com" ]
262548467@qq.com
2943a5ad369d842a50f04c633ecabdd2b9a5f9d7
64c44e82d12bca08ea114e5ba5049136e6326af9
/src/unithealth.cpp
d5ce553e0ce5209c998870f433e67d8aa6ba992f
[ "MIT" ]
permissive
Senjai/Dwarf-Therapist
04474062b8d95d6e5d5ef9377218da5954d744e9
3fd1ca6d9b7e5b3f01f82ed960fd862e76f34c62
refs/heads/master
2021-05-06T23:01:42.271740
2017-12-02T17:26:54
2017-12-02T22:54:41
112,896,455
3
0
null
2017-12-03T03:19:57
2017-12-03T03:19:57
null
UTF-8
C++
false
false
25,772
cpp
/* Dwarf Therapist Copyright (c) 2009 Trey Stout (chmod) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "unithealth.h" #include "dfinstance.h" #include "memorylayout.h" #include "healthcategory.h" #include "dwarf.h" #include "caste.h" #include "dwarfjob.h" QHash<eHealth::H_INFO, HealthCategory*> UnitHealth::m_health_descriptions; QList<QPair<eHealth::H_INFO,QString> > UnitHealth::m_ordered_category_names; UnitHealth::UnitHealth() : m_df(0x0) , m_dwarf_addr(0x0) , m_dwarf(0x0) , m_critical_wounds(false) , m_req_diagnosis(false) , m_limb_stand_count(0) { } UnitHealth::UnitHealth(DFInstance *df, Dwarf *d, bool req_diagnosis) : m_df(df) , m_dwarf_addr(d->address()) , m_dwarf(d) , m_critical_wounds(false) , m_req_diagnosis(req_diagnosis) , m_limb_stand_count(0) { if(m_dwarf){ read_health_info(); read_wounds(); //sort everything by severity sort_severity(m_status_info); sort_severity(m_treatment_info); sort_severity(m_wounds_info); }else{ LOGW << "skipping health read due to invalid unit"; } } UnitHealth::~UnitHealth(){ m_wound_details.clear(); m_wounds_info.clear(); m_treatment_info.clear(); m_status_info.clear(); m_body_parts.clear(); m_wounds.clear(); m_df = 0; m_dwarf = 0; } void UnitHealth::sort_severity(QHash<eHealth::H_INFO, QList<HealthInfo*> > &hash) { foreach(const eHealth::H_INFO &info, hash.keys()){ QList<HealthInfo*> &list = hash[info]; qSort(list.begin(), list.end(), HealthInfo::less_than_severity); } } void UnitHealth::add_info(eHealth::H_INFO id, bool idx0, bool idx1, bool idx2, bool idx3){ if(!idx0 && !idx1 && !idx2 && !idx3) return; QList<short> desc_index; bool multiple = get_health_description(id)->allows_multiple(); if(multiple){ if(idx0) desc_index.append(0); if(idx1) desc_index.append(1); if(idx2) desc_index.append(2); if(idx2) desc_index.append(3); }else{ if(idx0) desc_index.append(0); else if(idx1) desc_index.append(1); else if(idx2) desc_index.append(2); else if(idx3) desc_index.append(3); } add_info(id,desc_index); } void UnitHealth::add_info(eHealth::H_INFO h, QList<short> indexes, bool wound_visible){ //figure out which list we should be adding the info to QList<HealthInfo*> info_list; if(get_health_description(h)->diff_subitem_types()){ foreach(short idx, indexes){ HealthInfo *hi = get_health_description(h)->description(idx); if(hi){ if(hi->is_status()){ info_list = m_status_info.take(h); add_info(hi,info_list); if(info_list.size() > 0) m_status_info.insert(h,info_list); } if(hi->is_treatment()){ info_list = m_treatment_info.take(h); add_info(hi,info_list); if(info_list.size() > 0) m_treatment_info.insert(h,info_list); } if(wound_visible && hi->is_wound()){ info_list = m_wounds_info.take(h); add_info(hi,info_list); if(info_list.size() > 0) m_wounds_info.insert(h,info_list); } } } }else{ if(get_health_description(h)->is_status()){ info_list = m_status_info.take(h); add_info(h,indexes,info_list); if(info_list.size() > 0) m_status_info.insert(h,info_list); } if(get_health_description(h)->is_treatment()){ info_list = m_treatment_info.take(h); add_info(h,indexes,info_list); if(info_list.size() > 0) m_treatment_info.insert(h,info_list); } if(wound_visible && get_health_description(h)->is_wound()){ info_list = m_wounds_info.take(h); add_info(h,indexes,info_list); if(info_list.size() > 0) m_wounds_info.insert(h,info_list); } } } void UnitHealth::add_info(eHealth::H_INFO h, QList<short> indexes, QList<HealthInfo *> &info_list){ HealthInfo* hi; foreach(short idx, indexes){ hi = get_health_info(h,idx); add_info(hi, info_list); } } void UnitHealth::add_info(HealthInfo *hi, QList<HealthInfo *> &info_list){ bool replaced = false; bool ignore = false; for(int list_index = 0; list_index < info_list.count(); list_index++){ if(!get_health_description(hi->h_category())->allows_multiple() && hi->h_category() == info_list.at(list_index)->h_category()){ if(info_list.at(list_index)->severity() > hi->severity()){ info_list.replace(list_index,hi); replaced = true; break; }else{ ignore = true; } } } if(!replaced && !info_list.contains(hi) && !ignore){ info_list.append(hi); } } void UnitHealth::read_health_info(){ MemoryLayout *mem = m_df->memory_layout(); VIRTADDR unit_health_addr = m_df->read_addr(m_dwarf_addr + mem->dwarf_offset("unit_health_info")); quint32 health_flags = 0; if(unit_health_addr){ //health flags contain the requests for treatment info health_flags = m_df->read_int(unit_health_addr + 0x4); //read bp flags for inoperable rot health_req_flags = m_df->enum_vec<qint32>(unit_health_addr + 0x8); } //1 << 2 << 4 << 8 << 16 << 32 << 64 << 128 << 256 << 512 << 1024 match with.. //diagnosis, recovery, unk, immobilization, dressing, cleaning, surgery, suture, setting, traction, crutch //these only have a single description associated with them. we also want to avoid the 4th (unknown) request int counter = 0; short sh_counter = 0; QList<short> vals; bool needs_diagnosis = (health_flags & 1); add_info(eHealth::HI_DIAGNOSIS,false,needs_diagnosis); add_info(eHealth::HI_IMMOBILIZATION, health_flags & (1 << 3)); add_info(eHealth::HI_DRESSING, health_flags & (1 << 4)); add_info(eHealth::HI_CLEANING, health_flags & (1 << 5)); add_info(eHealth::HI_SURGERY, health_flags & (1 << 6)); add_info(eHealth::HI_SUTURES, health_flags & (1 << 7)); add_info(eHealth::HI_SETTING, health_flags & (1 << 8)); add_info(eHealth::HI_TRACTION, health_flags & (1 << 9)); //stunned, webbed, dizziness bool unconscious = false; bool sleeping = false; VIRTADDR base_counter_addr = mem->dwarf_offset("counters1"); //starts at winded VIRTADDR base_counter2_addr = mem->dwarf_offset("counters2"); //starts at pain VIRTADDR base_counter3_addr = mem->dwarf_offset("counters3"); //starts at paralysis VIRTADDR base_limbs_addr = mem->dwarf_offset("limb_counters"); if(m_dwarf->get_caste()){ //the unconscious state seems to depend on whether or not the dwarf is sleeping //normally the unconscious counter doesn't seem to exceed 2 for a sleeping dwarf, but this is safer if(!m_dwarf->get_caste()->flags().has_flag(NO_SLEEP)) sleeping = (m_dwarf->current_job_id() == DwarfJob::JOB_SLEEP); vals.clear(); sh_counter = m_df->read_short(m_dwarf_addr + base_counter_addr+0x4); //unconscious if(!sleeping && sh_counter > 0){ vals.append(0); unconscious = true; } if(!m_dwarf->get_caste()->flags().has_flag(NO_STUN)){ sh_counter = m_df->read_short(m_dwarf_addr + base_counter_addr+0x2); //stunned if(sh_counter > 0){ vals.append(1); } } if(!m_dwarf->get_caste()->flags().has_flag(WEB_IMMUNE)){ sh_counter = m_df->read_short(m_dwarf_addr + base_counter_addr+0x8); //webbed if(sh_counter > 0) vals.append(2); } if(!m_dwarf->get_caste()->flags().has_flag(NO_DIZZINESS)){ counter = m_df->read_short(m_dwarf_addr + base_counter2_addr + 0x8); //dizzy if(counter > 0) vals.append(3); } if(vals.size() > 0) add_info(eHealth::HI_MOVEMENT,vals); //breathing problems/drowning/winded if(!m_dwarf->get_caste()->flags().has_flag(NO_BREATHE)){ // bool drowning = false; vals.clear(); sh_counter = m_df->read_short(m_dwarf_addr + base_counter_addr); if(sh_counter > 0) vals.push_front(3); //winded //it appears that amphibious creatures don't need breathing parts, and so can't have problems breathing? if(!m_dwarf->get_caste()->flags().has_flag(AMPHIBIOUS)){ if(m_dwarf->get_flag1() & 0x20){ vals.push_front(1); //drowning m_critical_wounds = true; // drowning = true; } if(!(m_dwarf->get_flag2() & 0x10000000)){ vals.push_front(0); //missing breathing part (can't breathe) m_critical_wounds = true; } else if(m_dwarf->get_flag2() & 0x20000000) vals.push_front(2); //trouble breathing } if(vals.size() > 0) add_info(eHealth::HI_BREATHING, vals); } //seems can't stand is set when drowning, unconscious?, or laying on the ground (0x8000 flag check) if(!m_dwarf->get_caste()->flags().has_flag(IMMOBILE_LAND)){ short limb_stand_max = m_df->read_short(m_dwarf_addr + base_limbs_addr); m_limb_stand_count = m_df->read_short(m_dwarf_addr + base_limbs_addr + 0x2); if(limb_stand_max > 0){ bool fallen_down = m_dwarf->get_flag1() & 0x8000 && !sleeping; //having a crutch doesn't seem to count as a limb to stand on?? bool has_crutch = m_dwarf->get_flag3() & 0x40; m_limb_stand_count += has_crutch; add_info(eHealth::HI_CRUTCH, health_flags & (1 << 10), has_crutch); vals.clear(); //seems if a dwarf only has a single good limb to stand on (including crutches) but has fallen, then they cannot stand if(m_limb_stand_count <= 0 || (m_limb_stand_count < limb_stand_max && fallen_down) || unconscious){ //if(unconscious || stunned || drowning || limb_stand_count <= 0) vals.append(0); if(needs_diagnosis && m_dwarf->current_job_id() != 52) //if already resting, then they've been recovered add_info(eHealth::HI_DIAGNOSIS, health_flags & (1 << 2)); //not diagnosed yet, but can't walk, and isn't resting yet. needs recovery }else if(m_limb_stand_count < limb_stand_max){ if(!has_crutch) vals.append(1); //stand impaired // else // vals.append(2); //can stand with crutch? } if(vals.size() > 0) add_info(eHealth::HI_STAND,vals); } } //check the grasp status vals.clear(); short limb_grasp_max = m_df->read_short(m_dwarf_addr + base_limbs_addr + 0x4); short limb_grasp_count = m_df->read_short(m_dwarf_addr + base_limbs_addr + 0x6); if(limb_grasp_max > 0){ if(limb_grasp_count <= 0) vals.append(0); else if(limb_grasp_count < limb_grasp_max) vals.append(1); if(vals.size() > 0) add_info(eHealth::HI_GRASP,vals); } //check the flight status if(m_dwarf->get_caste()->flags().has_flag(FLIER)){ vals.clear(); short limb_fly_max = m_df->read_short(m_dwarf_addr + base_limbs_addr + 0x8); short limb_fly_count = m_df->read_short(m_dwarf_addr + base_limbs_addr + 0xa); if(limb_fly_max > 0){ if(limb_fly_count <= 0) vals.append(0); else if(limb_fly_count < limb_fly_max) vals.append(1); if(vals.size() > 0) add_info(eHealth::HI_FLY,vals); } } //check blood loss int blood_max = m_df->read_short(m_dwarf_addr + mem->dwarf_offset("blood")); int blood_curr = m_df->read_short(m_dwarf_addr + mem->dwarf_offset("blood")+0x4); float blood_perc = (float)blood_curr / (float)blood_max; if(blood_perc > 0){ add_info(eHealth::HI_BLOOD_LOSS, (blood_perc < 0.25),(blood_perc < 0.50)); if(blood_perc <= 0.5) m_critical_wounds = true; } //check hunger if(!m_dwarf->get_caste()->flags().has_flag(NO_EAT)){ counter = m_df->read_int(m_dwarf_addr + base_counter3_addr + 0x10); add_info(eHealth::HI_HUNGER, (counter >= 75000),(counter >= 50000)); if(counter >= 75000) m_critical_wounds = true; } //check thirst if(!m_dwarf->get_caste()->flags().has_flag(NO_DRINK)){ counter = m_df->read_int(m_dwarf_addr + base_counter3_addr + 0x14); add_info(eHealth::HI_THIRST, (counter >= 50000),(counter >= 25000)); if(counter >= 50000) m_critical_wounds = true; } //check drowsiness if(!m_dwarf->get_caste()->flags().has_flag(NO_EXERT)){ counter = m_df->read_int(m_dwarf_addr + base_counter3_addr + 0x18); add_info(eHealth::HI_SLEEPLESS,(counter >= 150000), (counter >= 57600)); } //check exhaustion if(!m_dwarf->get_caste()->flags().has_flag(NO_EXERT)){ counter = m_df->read_int(m_dwarf_addr + base_counter3_addr + 0xc); add_info(eHealth::HI_TIREDNESS, (counter >= 6000),(counter >= 4000),(counter >= 2000)); } //check paralysis if(!m_dwarf->get_caste()->flags().has_flag(PARALYZE_IMMUNE)){ counter = m_df->read_int(m_dwarf_addr + base_counter3_addr); add_info(eHealth::HI_PARALYSIS, (counter >= 100), (counter >= 50), (counter >= 1)); if(counter >= 100) m_critical_wounds = true; } //check numbness counter = m_df->read_int(m_dwarf_addr + base_counter3_addr + 0x4); add_info(eHealth::HI_NUMBNESS, (counter >= 100), (counter >= 50), (counter >= 1)); //check fever if(!m_dwarf->get_caste()->flags().has_flag(NO_FEVERS)){ counter = m_df->read_int(m_dwarf_addr + base_counter3_addr + 0x8); add_info(eHealth::HI_FEVER, (counter >= 100), (counter >= 50), (counter >= 1)); } //check nausea if(!m_dwarf->get_caste()->flags().has_flag(NO_NAUSEA)){ counter = m_df->read_int(m_dwarf_addr + base_counter2_addr + 0x4); add_info(eHealth::HI_NAUSEOUS, (counter > 0)); } //check pain if(!m_dwarf->get_caste()->flags().has_flag(NO_PAIN)){ counter = m_df->read_int(m_dwarf_addr + base_counter2_addr); add_info(eHealth::HI_PAIN, (counter > 50), (counter > 25), (counter > 0)); } //vision if(!m_dwarf->get_caste()->flags().has_flag(EXTRAVISION)){ add_info(eHealth::HI_VISION,!(m_dwarf->get_flag2() & 0x02000000), m_dwarf->get_flag2() & 0x04000000, m_dwarf->get_flag2() & 0x08000000); } //gutted bool gutted = m_dwarf->get_flag2() & 0x00004000; add_info(eHealth::HI_GUTTED, gutted); if(gutted) m_critical_wounds = true; }else{ LOGW << "skipping health status read due to invalid caste for unit" << m_dwarf->nice_name(); } } void UnitHealth::read_wounds(){ VIRTADDR addr = m_df->memory_layout()->dwarf_offset("body_component_info"); body_part_status_flags = m_df->enum_vec<qint32>(m_dwarf_addr + addr); layer_status_flags = m_df->enum_vec<qint32>(m_dwarf_addr + addr + m_df->memory_layout()->dwarf_offset("layer_status_vector")); //add the wounds based on the wounded parts QVector<VIRTADDR> wounds = m_df->enumerate_vector(m_dwarf_addr + m_df->memory_layout()->dwarf_offset("wounds_vector")); FlagArray caste_flags; if(m_dwarf->get_caste()){ caste_flags = m_dwarf->get_caste()->flags(); } foreach(VIRTADDR addr, wounds){ m_wounds.append(UnitWound(m_df,addr,caste_flags,this)); } //check body parts for old wounds (specifically missing parts), these wounds haven't been made during the course //of this fortress, so they won't show up under the wounds section we just examined int idx = 0; foreach(int bps, body_part_status_flags){ //filter this down to checking exact bits, since we're currently only check for motor/sensory nerve or missing part if(bps & 0x602){ UnitWound uw = UnitWound(m_df,idx,this); if(uw.get_wounded_parts().size() > 0){ m_wounds.append(uw); } } idx++; } build_wounds_summary(); //other grouping ideas: //group wounds by health category, to allow us to show only those wounds which are related to the column type //for example, if the column is for infection, then only show those bodyparts/wounds that are infected //the problem with this grouping is that there's no way to see ALL the wounds together //group the wounds by main body parts (right lower leg, head, upper body, etc..) this is primarily for showing wounds in body part columns //it seems the only way to accomplish this will be to read the tokens (LLL = left lower leg) and match them to appropriate pre-defined groups that we'd use as columns //for example, RLL and RUL would both be assigned to right leg. however the issue then is if our playable race has multiple right legs.. we'll have to use some kind of pattern matching //to map things appropriately RA* would match all instances of right arms } void UnitHealth::build_wounds_summary(){ foreach(UnitWound w, m_wounds){ //wound details by body part QHash<QString,QList<HealthInfo*> > wounds_info = w.get_wound_details(); foreach(QString bp_name, wounds_info.uniqueKeys()){ QList<HealthInfo*> wnd_details = wounds_info.take(bp_name); //keep a list of body parts and their related health info stuff QList<HealthInfo*> info_summary = m_wound_details.take(bp_name); foreach(HealthInfo* hi, wnd_details){ add_info(hi,info_summary); } if(info_summary.size() > 0){ m_wound_details.insert(bp_name,info_summary); if(!m_critical_wounds && w.is_critical()) m_critical_wounds = true; } } } } BodyPartDamage UnitHealth::get_body_part(int body_part_id){ if(!m_body_parts.keys().contains(body_part_id)){ quint32 bp_status = 0; quint32 bp_req = 0; if(body_part_id < body_part_status_flags.size()) bp_status = body_part_status_flags.at(body_part_id); if(body_part_id < health_req_flags.size()) bp_req = health_req_flags.at(body_part_id); BodyPartDamage bpd = BodyPartDamage(); if(m_dwarf->get_caste()){ BodyPart *bp = m_dwarf->get_caste()->get_body_part(body_part_id); bpd = BodyPartDamage(bp,bp_status,bp_req); m_body_parts.insert(body_part_id,bpd); }else{ m_body_parts.insert(body_part_id,bpd); } } return m_body_parts.value(body_part_id); } HealthInfo *UnitHealth::get_most_severe(eHealth::H_INFO h){ if(m_treatment_info.contains(h)){ return m_treatment_info.value(h).at(0); } if(m_status_info.contains(h)){ return m_status_info.value(h).at(0); } if(m_wounds_info.contains(h)){ return m_wounds_info.value(h).at(0); } return 0x0; } bool UnitHealth::has_info_detail(eHealth::H_INFO h, int idx){ if(m_treatment_info.contains(h)){ if(m_treatment_info.value(h).contains(get_health_info(h,idx))) return true; } if(m_status_info.contains(h)){ if(m_status_info.value(h).contains(get_health_info(h,idx))) return true; } if(m_wounds_info.contains(h)){ if(m_wounds_info.value(h).contains(get_health_info(h,idx))) return true; } return false; } QStringList UnitHealth::get_all_category_desc(eHealth::H_INFO hs, bool symbol_only, bool colored){ return get_health_description(hs)->get_all_descriptions(symbol_only,colored); } QMap<QString, QStringList> UnitHealth::get_wound_summary(bool colored, bool symbols){ int key = ((int)colored << 1) | (int)symbols; if(m_wound_summary.value(key).isEmpty()){ QMap<QString, QStringList> summary = m_wound_summary.value(key); foreach(QString bp, m_wound_details.uniqueKeys()){ QList<HealthInfo*> infos = m_wound_details.value(bp); QStringList bp_summary = summary.value(bp); foreach(HealthInfo* hi, infos){ QString desc = hi->formatted_value(colored,symbols); if(!bp_summary.contains(desc)) bp_summary.append(desc); } if(bp_summary.size() > 0){ qSort(bp_summary); summary.insert(bp,bp_summary); } } m_wound_summary.insert(key, summary); } return m_wound_summary.value(key); } QStringList UnitHealth::get_treatment_summary(bool colored, bool symbols){ int key = ((int)colored << 1) | (int)symbols; if(m_treatment_summary.value(key).isEmpty()){ QStringList summary = m_treatment_summary.value(key); foreach(eHealth::H_INFO h, m_treatment_info.uniqueKeys()){ foreach(HealthInfo* hi, m_treatment_info.value(h)){ summary.append(hi->formatted_value(colored,symbols)); } } qSort(summary); m_treatment_summary.insert(key,summary); } return m_treatment_summary.value(key); } QStringList UnitHealth::get_status_summary(bool colored, bool symbols){ int key = ((int)colored << 1) | (int)symbols; if(m_status_summary.value(key).isEmpty()){ QStringList summary = m_status_summary.value(key); foreach(eHealth::H_INFO h, m_status_info.uniqueKeys()){ if(m_status_info.value(h).count() > 0){ if(get_health_description(h)->allows_multiple()){ //m_display_descriptions.value(h).at(0)->can_have_multiple()){ foreach(HealthInfo *hi,m_status_info.value(h)){ summary.append(hi->formatted_value(colored,symbols)); } }else{ summary.append(m_status_info.value(h).at(0)->formatted_value(colored,symbols)); } } } qSort(summary); m_status_summary.insert(key,summary); } return m_status_summary.value(key); } HealthInfo* UnitHealth::get_health_info(eHealth::H_INFO hs, short idx){ return get_health_description(hs)->description(idx); } void UnitHealth::load_health_descriptors(QSettings &s){ if(m_health_descriptions.count() <= 0){ //add a blank default category m_health_descriptions.insert(eHealth::HI_UNK,new HealthCategory()); int categories = s.beginReadArray("health_info"); QStringList cat_names; for(int i = 0; i < categories; ++i) { s.setArrayIndex(i); HealthCategory *hc = new HealthCategory(s); m_health_descriptions.insert(hc->id(),hc); cat_names.append(hc->name()); } s.endArray(); qSort(cat_names); foreach(QString name, cat_names) { foreach(eHealth::H_INFO id, m_health_descriptions.uniqueKeys()) { if (m_health_descriptions.value(id)->name() == name) { m_ordered_category_names << qMakePair<eHealth::H_INFO, QString>(id, name); break; } } } } } HealthCategory *UnitHealth::get_health_description(eHealth::H_INFO id){ if(!m_health_descriptions.contains(id)){ id = eHealth::HI_UNK; } return m_health_descriptions.value(id); } void UnitHealth::cleanup(){ qDeleteAll(m_health_descriptions); m_health_descriptions.clear(); }
[ "clement.vuchener@gmail.com" ]
clement.vuchener@gmail.com
006524abb13e3ad6b89b328a247b7dd83f1019c4
6d5f2e99ae89e6c59bdafed707f5a5db673dec23
/src/cli/main_dbExport.cpp
c24310e7f957561d1b2da5ea6b5fff1465627c66
[ "MIT" ]
permissive
bencabrera/grawitas
b633ae1dbbbb3da8a37b61b2cb48c493d7c299d2
8eda68846ed283afe70d56d68375525a1140de70
refs/heads/master
2022-03-27T08:27:16.948509
2018-01-19T09:48:37
2018-01-19T09:48:37
81,924,748
7
7
MIT
2022-01-25T18:14:46
2017-02-14T08:49:49
C++
UTF-8
C++
false
false
4,718
cpp
#include <iostream> #include <fstream> #include "../../libs/cxxopts/include/cxxopts.hpp" #include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/replace.hpp> #include "../misc/stepTimer.h" #include "../misc/readLinesFromFile.h" #include "../output/formats.h" #include "../output/outputHelpers.h" #include "../talkPageParser/models.h" #include "../output/outputWrapper.h" #include "../xmlToSql/getArticlesFromDb.h" #include "../xmlToSql/getUsersFromDb.h" #include "../xmlToSql/getFilteredCommentsFromDb.h" #include "../xmlToSql/getIdsFromDb.h" #include <cstdlib> #include <sqlite3.h> using namespace Grawitas; int main(int argc, char** argv) { StepTimer timings; timings.startTiming("global", "Total"); cxxopts::Options options("grawitas_cli_xml", "Parses talk pages in Wikipedia xml dumps to a sqlite file containing the structured comments."); options.add_options() ("h,help", "Produces this help message.") ("i,sqlite-file", "Sqlite file created by grawitas_cli_xml_to_db.", cxxopts::value<std::string>()) ("a,article-filter-file", "File containing articles for which to extract comments.", cxxopts::value<std::string>()) ("u,user-filter-file", "File containing users for which to extract comments.", cxxopts::value<std::string>()) // network output ("user-network-gml", "Output file for user network (GML).", cxxopts::value<std::string>()) ("user-network-graphml", "Output file for user network (GraphML).", cxxopts::value<std::string>()) ("user-network-graphviz", "Output file for user network (GraphViz).", cxxopts::value<std::string>()) ("comment-network-gml", "Output file for comment network (GML).", cxxopts::value<std::string>()) ("comment-network-graphml", "Output file for comment network (GraphML).", cxxopts::value<std::string>()) ("comment-network-graphviz", "Output file for comment network (GraphViz).", cxxopts::value<std::string>()) ("two-mode-network-gml", "Output file for two-mode user-/comment network (GML).", cxxopts::value<std::string>()) ("two-mode-network-graphml", "Output file for two-mode user-/comment network (GraphML).", cxxopts::value<std::string>()) ("two-mode-network-graphviz", "Output file for two-mode user-/comment network (GraphViz).", cxxopts::value<std::string>()) // list output ("comment-list-csv", "Output file for comment list (csv).", cxxopts::value<std::string>()) ("comment-list-human-readable", "Output file for comment list (human readable).", cxxopts::value<std::string>()) ("comment-list-json", "Output file for comment list (json).", cxxopts::value<std::string>()) ("t,show-timings", "Flag to show timings.") ; options.positional_help("<input-paths-file> <output-sqlite-file>"); options.parse_positional(std::vector<std::string>{"input-paths-file","output-sqlite-file"}); options.parse(argc, argv); // display help if --help was specified if (options.count("help")) { std::cout << options.help() << std::endl; return 0; } if(!options.count("sqlite-file")) throw std::invalid_argument("Input sqlite database file not specified."); const std::string sqlite_file_path = options["sqlite-file"].as<std::string>(); // Open database sqlite3* sqlite_db; auto rc = sqlite3_open(sqlite_file_path.c_str(), &sqlite_db); if(rc) { std::string msg = sqlite3_errmsg(sqlite_db); sqlite3_close(sqlite_db); throw std::logic_error("Can't open database: %s\n" + msg); } std::vector<std::size_t> article_ids, user_ids; if(options.count("article-filter-file")) { const std::string article_filter_file_path = options["article-filter-file"].as<std::string>(); std::ifstream article_filter_file(article_filter_file_path); std::vector<std::string> article_titles = read_lines_from_file(article_filter_file); article_ids = get_article_ids_from_db(sqlite_db, article_titles); } if(options.count("user-filter-file")) { const std::string user_filter_file_path = options["user-filter-file"].as<std::string>(); std::ifstream user_filter_file(user_filter_file_path); std::vector<std::string> usernames = read_lines_from_file(user_filter_file); user_ids = get_user_ids_from_db(sqlite_db, usernames); } auto users = get_users_from_db(sqlite_db); auto articles = get_articles_from_db(sqlite_db); auto comments = get_filtered_comments(sqlite_db, user_ids, article_ids, &users, &articles); std::map<Format, std::string> formats; for (auto form_parameter : FormatParameterStrings) { if(options.count(form_parameter)) formats.insert({ parameter_to_format(form_parameter), options[form_parameter].as<std::string>() }); } output_in_formats_to_files(formats, comments, {"id", "parent_id", "user", "date", "section", "article", "text"}); return 0; }
[ "benny@bcabrera.de" ]
benny@bcabrera.de
be4c76c12360f87384dc0a872eb015435c982baa
15b122079a9342a41239b77463bc1c5b8345b8a8
/histograma.h
ec246bd0d37dcb8459bda9a07b27243f344eb64f
[]
no_license
AndreyGoncalves/Analisadordepacotesderede
05c4666147e86bddf07b15845ecb2b61f5a931ed
c7784e58ef5ad092ed73fd92777979e3000d7a07
refs/heads/master
2020-03-30T12:49:57.442637
2018-10-02T11:26:00
2018-10-02T11:26:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
686
h
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: histograma.h * Author: destroy * * Created on 3 de Outubro de 2016, 18:35 */ #ifndef HISTOGRAMA_H #define HISTOGRAMA_H #include <cstdlib> #include <iostream> #include <prglib.h> #include <string> #include <fstream> #include <math.h> using namespace std; using prglib::lista; class histograma { public: histograma(); histograma(const histograma& orig); virtual ~histograma(); void montagem(lista<long> dados, long desvio); private: }; #endif /* HISTOGRAMA_H */
[ "“andreygoncalves@live.com”" ]
“andreygoncalves@live.com”
43158d4fd5cdad56a527ee1d13e3d6707d68ac41
76f0efb245ff0013e0428ee7636e72dc288832ab
/out/Default/gen/blink/bindings/core/v8/V8HTMLFontElement.cpp
0e0c9fa6ef079ebfaaa068e26399432fd84ee86b
[]
no_license
dckristiono/chromium
e8845d2a8754f39e0ca1d3d3d44d01231957367c
8ad7c1bd5778bfda3347cf6b30ef60d3e4d7c0b9
refs/heads/master
2020-04-22T02:34:41.775069
2016-08-24T14:05:09
2016-08-24T14:05:09
66,465,243
0
2
null
null
null
null
UTF-8
C++
false
false
8,606
cpp
// 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. // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! #include "V8HTMLFontElement.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/V8DOMConfiguration.h" #include "bindings/core/v8/V8ObjectConstructor.h" #include "core/HTMLNames.h" #include "core/animation/ElementAnimation.h" #include "core/dom/Document.h" #include "core/dom/ElementFullscreen.h" #include "core/dom/custom/CEReactionsScope.h" #include "core/dom/custom/V0CustomElementProcessingStack.h" #include "wtf/GetPtr.h" #include "wtf/RefPtr.h" namespace blink { // Suppress warning: global constructors, because struct WrapperTypeInfo is trivial // and does not depend on another global objects. #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wglobal-constructors" #endif const WrapperTypeInfo V8HTMLFontElement::wrapperTypeInfo = { gin::kEmbedderBlink, V8HTMLFontElement::domTemplate, V8HTMLFontElement::trace, V8HTMLFontElement::traceWrappers, 0, 0, V8HTMLFontElement::preparePrototypeAndInterfaceObject, nullptr, "HTMLFontElement", &V8HTMLElement::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::NodeClassId, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Dependent }; #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) #pragma clang diagnostic pop #endif // This static member must be declared by DEFINE_WRAPPERTYPEINFO in HTMLFontElement.h. // For details, see the comment of DEFINE_WRAPPERTYPEINFO in // bindings/core/v8/ScriptWrappable.h. const WrapperTypeInfo& HTMLFontElement::s_wrapperTypeInfo = V8HTMLFontElement::wrapperTypeInfo; static_assert( !std::is_base_of<ActiveScriptWrappable, HTMLFontElement>::value, "HTMLFontElement inherits from ActiveScriptWrappable, but does not specify " "[ActiveScriptWrappable] extended attribute in the IDL file. " "Be consistent."); namespace HTMLFontElementV8Internal { static void colorAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); HTMLFontElement* impl = V8HTMLFontElement::toImpl(holder); v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::colorAttr), info.GetIsolate()); } static void colorAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { HTMLFontElementV8Internal::colorAttributeGetter(info); } static void colorAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); HTMLFontElement* impl = V8HTMLFontElement::toImpl(holder); V8StringResource<TreatNullAsEmptyString> cppValue = v8Value; if (!cppValue.prepare()) return; impl->setAttribute(HTMLNames::colorAttr, cppValue); } static void colorAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Value> v8Value = info[0]; CEReactionsScope ceReactionsScope; V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; HTMLFontElementV8Internal::colorAttributeSetter(v8Value, info); } static void faceAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); HTMLFontElement* impl = V8HTMLFontElement::toImpl(holder); v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::faceAttr), info.GetIsolate()); } static void faceAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { HTMLFontElementV8Internal::faceAttributeGetter(info); } static void faceAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); HTMLFontElement* impl = V8HTMLFontElement::toImpl(holder); V8StringResource<> cppValue = v8Value; if (!cppValue.prepare()) return; impl->setAttribute(HTMLNames::faceAttr, cppValue); } static void faceAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Value> v8Value = info[0]; CEReactionsScope ceReactionsScope; V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; HTMLFontElementV8Internal::faceAttributeSetter(v8Value, info); } static void sizeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); HTMLFontElement* impl = V8HTMLFontElement::toImpl(holder); v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::sizeAttr), info.GetIsolate()); } static void sizeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { HTMLFontElementV8Internal::sizeAttributeGetter(info); } static void sizeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); HTMLFontElement* impl = V8HTMLFontElement::toImpl(holder); V8StringResource<> cppValue = v8Value; if (!cppValue.prepare()) return; impl->setAttribute(HTMLNames::sizeAttr, cppValue); } static void sizeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Value> v8Value = info[0]; CEReactionsScope ceReactionsScope; V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; HTMLFontElementV8Internal::sizeAttributeSetter(v8Value, info); } } // namespace HTMLFontElementV8Internal const V8DOMConfiguration::AccessorConfiguration V8HTMLFontElementAccessors[] = { {"color", HTMLFontElementV8Internal::colorAttributeGetterCallback, HTMLFontElementV8Internal::colorAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, {"face", HTMLFontElementV8Internal::faceAttributeGetterCallback, HTMLFontElementV8Internal::faceAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, {"size", HTMLFontElementV8Internal::sizeAttributeGetterCallback, HTMLFontElementV8Internal::sizeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, }; static void installV8HTMLFontElementTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) { // Initialize the interface object's template. V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8HTMLFontElement::wrapperTypeInfo.interfaceName, V8HTMLElement::domTemplate(isolate, world), V8HTMLFontElement::internalFieldCount); v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate); ALLOW_UNUSED_LOCAL(signature); v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate(); ALLOW_UNUSED_LOCAL(instanceTemplate); v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate(); ALLOW_UNUSED_LOCAL(prototypeTemplate); // Register DOM constants, attributes and operations. V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8HTMLFontElementAccessors, WTF_ARRAY_LENGTH(V8HTMLFontElementAccessors)); } v8::Local<v8::FunctionTemplate> V8HTMLFontElement::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) { return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8HTMLFontElementTemplate); } bool V8HTMLFontElement::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) { return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); } v8::Local<v8::Object> V8HTMLFontElement::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) { return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); } HTMLFontElement* V8HTMLFontElement::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) { return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr; } } // namespace blink
[ "dckristiono@gmail.com" ]
dckristiono@gmail.com
e2012dc94f114c1c7dc28fb020d2f974ce7167ef
38b9daafe39f937b39eefc30501939fd47f7e668
/tutorials/2WayCouplingOceanWave3D/EvalResults180628-Eta-ux-uy/17/p_rgh
f2f65400d2562ee8675e57eba5fe9aa5289c5a17
[]
no_license
rubynuaa/2-way-coupling
3a292840d9f56255f38c5e31c6b30fcb52d9e1cf
a820b57dd2cac1170b937f8411bc861392d8fbaa
refs/heads/master
2020-04-08T18:49:53.047796
2018-08-29T14:22:18
2018-08-29T14:22:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
195,224
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 3.0.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "17"; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField nonuniform List<scalar> 21420 ( 169.595 201.613 233.103 263.548 292.531 319.475 343.974 365.594 383.993 398.897 410.053 417.272 420.333 418.962 413.34 403.707 390.068 372.631 351.661 327.458 300.395 270.829 239.166 205.872 171.374 136.11 100.461 64.8043 29.6719 -1.27769 -34.3186 -66.241 -96.749 -125.658 -152.842 -178.204 -201.693 -223.281 -242.96 -260.749 -276.678 -290.788 -303.126 -313.742 -322.688 -330.012 -335.758 -339.97 -342.684 -343.91 -343.641 -341.574 -338.034 -332.943 -326.283 -318.04 -308.172 -296.637 -283.421 -268.496 -251.838 -233.456 -213.334 -191.495 -167.978 -142.832 -116.131 -87.9877 -58.5182 -27.89 3.71247 35.3206 68.1734 101.296 134.4 167.168 199.287 230.409 260.171 288.205 314.145 337.622 358.281 375.798 389.882 400.277 406.793 409.277 407.714 402.073 392.466 378.955 361.744 341.08 317.24 290.551 261.395 230.169 197.286 163.167 128.235 92.911 57.5732 22.5695 -11.7322 -45.0769 -77.214 -107.927 -137.031 -164.372 -189.823 -213.289 -234.705 -254.037 -271.286 -286.473 -299.64 -310.855 -320.177 -327.665 -333.397 -337.428 -339.838 -340.642 -339.852 -337.571 -333.791 -328.527 -321.77 -313.501 -303.683 -292.285 -279.289 -264.658 -248.348 -230.34 -210.627 -189.211 -166.109 -141.366 -115.044 -87.2404 -58.0791 -27.719 3.65118 35.8345 68.5298 101.486 134.388 166.907 198.686 229.374 258.618 286.064 311.367 334.209 354.284 371.327 385.107 395.423 402.137 405.112 404.258 399.597 391.177 379.003 363.209 343.941 321.398 295.833 267.52 236.799 204.049 169.653 134.05 97.7056 61.0843 24.6486 -11.1683 -45.9536 -79.3398 -111.021 -140.744 -168.312 -193.592 -216.508 -237.03 -255.173 -270.994 -284.577 -296.037 -305.505 -313.114 -319.004 -323.305 -326.137 -327.63 -327.864 -326.904 -324.842 -321.684 -317.442 -312.116 -305.687 -298.118 -289.33 -279.245 -267.795 -254.876 -240.386 -224.238 -206.345 -186.635 -165.05 -141.564 -116.183 -88.9502 -59.9635 -29.3718 2.63616 35.8158 69.8379 104.381 139.048 173.424 207.079 239.543 270.362 299.086 325.284 348.568 368.584 385.032 397.669 406.308 410.849 411.142 407.289 399.382 387.499 371.834 352.631 330.189 304.836 276.941 246.894 215.119 182.045 148.059 113.571 78.9763 44.5659 9.75597 -23.3202 -55.3335 -86.118 -115.504 -143.347 -169.533 -193.974 -216.607 -237.38 -256.268 -273.268 -288.387 -301.644 -313.063 -322.681 -330.528 -336.614 -340.965 -343.628 -344.598 -343.874 -341.531 -337.536 -331.915 -324.669 -315.787 -305.276 -293.129 -279.342 -263.919 -246.855 -228.167 -207.887 -186.034 -162.653 -137.819 -111.61 -84.1392 -55.5286 -25.9174 4.68181 36.5027 68.36 100.188 131.749 162.816 193.083 222.269 250.059 276.131 300.197 321.963 341.141 357.49 370.783 380.834 387.483 390.67 390.245 386.245 378.699 367.734 353.537 336.297 316.251 293.66 268.865 242.195 213.994 184.649 154.512 123.932 93.2332 62.7053 32.8322 6.57755 -21.3012 -48.1737 -73.7741 -97.9326 -120.537 -141.512 -160.803 -178.384 -194.242 -208.382 -220.825 -231.596 -240.731 -248.271 -254.261 -258.758 -261.802 -263.43 -263.408 -261.987 -259.192 -255.065 -249.651 -242.978 -235.084 -226.005 -215.734 -204.278 169.588 201.622 233.13 263.593 292.594 319.557 344.074 365.71 384.123 399.039 410.205 417.429 420.503 419.124 413.501 403.859 390.209 372.759 351.774 327.554 300.473 270.888 239.207 205.894 171.378 136.098 100.436 64.7679 29.6294 -1.35176 -34.3949 -66.3208 -96.832 -125.743 -152.928 -178.29 -201.778 -223.364 -243.042 -260.828 -276.755 -290.861 -303.197 -313.81 -322.754 -330.076 -335.82 -340.03 -342.743 -343.969 -343.698 -341.634 -338.094 -333.004 -326.346 -318.104 -308.238 -296.705 -283.492 -268.568 -251.913 -233.532 -213.411 -191.573 -168.055 -142.908 -116.205 -88.0582 -58.5848 -27.9515 3.65823 35.275 68.1376 101.27 134.386 167.167 199.3 230.438 260.215 288.267 314.223 337.717 358.391 375.923 390.019 400.424 406.946 409.438 407.866 402.222 392.609 379.09 361.867 341.188 317.332 290.625 261.451 230.207 197.305 163.168 128.22 92.8806 57.5297 22.5142 -11.7968 -45.1497 -77.2933 -108.011 -137.12 -164.464 -189.917 -213.383 -234.798 -254.129 -271.375 -286.559 -299.723 -310.934 -320.253 -327.739 -333.467 -337.496 -339.904 -340.703 -339.915 -337.632 -333.853 -328.589 -321.833 -313.565 -303.749 -292.353 -279.359 -264.73 -248.422 -230.416 -210.705 -189.289 -166.187 -141.443 -115.12 -87.3133 -58.1479 -27.7822 3.59563 35.7862 68.492 101.46 134.375 166.908 198.702 229.405 258.666 286.128 311.446 334.303 354.391 371.445 385.235 395.559 402.279 405.263 404.402 399.74 391.317 379.137 363.334 344.055 321.499 295.919 267.59 236.852 204.083 169.668 134.047 97.6838 61.0449 24.593 -11.2383 -46.0358 -79.4317 -111.12 -140.848 -168.419 -193.7 -216.615 -237.133 -255.273 -271.089 -284.667 -296.12 -305.582 -313.186 -319.07 -323.366 -326.194 -327.683 -327.912 -326.952 -324.888 -321.729 -317.487 -312.163 -305.736 -298.169 -289.385 -279.304 -267.859 -254.944 -240.459 -224.315 -206.427 -186.72 -165.138 -141.653 -116.273 -89.0392 -60.0492 -29.4522 2.56377 35.7521 69.7864 104.343 139.027 173.421 207.094 239.578 270.417 299.16 325.378 348.68 368.711 385.172 397.818 406.464 411.013 411.299 407.442 399.53 387.637 371.961 352.742 330.285 304.914 277 246.936 215.142 182.051 148.049 113.546 78.9396 44.5262 9.68867 -23.3867 -55.405 -86.1943 -115.583 -143.43 -169.617 -194.059 -216.692 -237.464 -256.351 -273.35 -288.466 -301.722 -313.139 -322.755 -330.6 -336.685 -341.035 -343.698 -344.664 -343.942 -341.598 -337.603 -331.982 -324.736 -315.855 -305.344 -293.199 -279.413 -263.991 -246.927 -228.24 -207.96 -186.106 -162.725 -137.889 -111.677 -84.2031 -55.5879 -25.9711 4.63287 36.4647 68.3321 100.171 131.743 162.823 193.103 222.302 250.107 276.193 300.274 322.053 341.243 357.604 370.907 380.965 387.622 390.812 390.38 386.377 378.828 367.857 353.65 336.398 316.338 293.733 268.922 242.236 214.019 184.66 154.508 123.916 93.2061 62.6694 32.7915 6.51128 -21.3688 -48.2439 -73.8467 -98.007 -120.612 -141.587 -160.878 -178.458 -194.314 -208.452 -220.893 -231.662 -240.795 -248.332 -254.32 -258.815 -261.857 -263.483 -263.46 -262.036 -259.241 -255.113 -249.698 -243.024 -235.13 -226.051 -215.779 -204.323 169.573 201.641 233.183 263.684 292.722 319.721 344.273 365.942 384.384 399.324 410.509 417.744 420.84 419.451 413.825 404.164 390.492 373.016 352 327.747 300.629 271.007 239.288 205.939 171.388 136.076 100.387 64.695 29.5437 -1.49928 -34.5471 -66.4804 -96.998 -125.913 -153.101 -178.463 -201.949 -223.532 -243.205 -260.987 -276.908 -291.009 -303.339 -313.947 -322.885 -330.203 -335.943 -340.15 -342.86 -344.085 -343.812 -341.753 -338.213 -333.124 -326.469 -318.231 -308.369 -296.84 -283.631 -268.711 -252.059 -233.682 -213.563 -191.725 -168.207 -143.056 -116.349 -88.1958 -58.7145 -28.0711 3.55209 35.1889 68.0701 101.224 134.363 167.17 199.332 230.5 260.31 288.395 314.386 337.913 358.62 376.18 390.3 400.724 407.26 409.77 408.176 402.531 392.906 379.368 362.121 341.413 317.524 290.782 261.572 230.29 197.35 163.179 128.198 92.8281 57.4507 22.4116 -11.918 -45.2872 -77.4441 -108.173 -137.289 -164.639 -190.095 -213.563 -234.977 -254.305 -271.547 -286.725 -299.882 -311.087 -320.399 -327.879 -333.602 -337.627 -340.03 -340.821 -340.035 -337.75 -333.97 -328.708 -321.953 -313.688 -303.875 -292.484 -279.495 -264.869 -248.565 -230.562 -210.854 -189.44 -166.338 -141.593 -115.266 -87.4533 -58.2796 -27.9028 3.4903 35.6958 68.4224 101.413 134.355 166.916 198.741 229.475 258.767 286.261 311.611 334.497 354.611 371.69 385.5 395.839 402.57 405.569 404.697 400.034 391.603 379.411 363.591 344.29 321.709 296.1 267.739 236.965 204.159 169.706 134.047 97.648 60.9739 24.4893 -11.3707 -46.1926 -79.6079 -111.311 -141.049 -168.625 -193.907 -216.82 -237.334 -255.466 -271.272 -284.839 -296.281 -305.73 -313.322 -319.195 -323.482 -326.3 -327.782 -328.001 -327.041 -324.973 -321.813 -317.572 -312.25 -305.827 -298.266 -289.488 -279.415 -267.978 -255.072 -240.596 -224.461 -206.582 -186.883 -165.306 -141.825 -116.446 -89.2094 -60.2129 -29.605 2.427 35.633 69.6916 104.277 138.993 173.423 207.134 239.657 270.537 299.319 325.575 348.912 368.973 385.46 398.126 406.786 411.341 411.63 407.759 399.835 387.924 372.222 352.975 330.484 305.078 277.128 247.027 215.197 182.071 148.036 113.504 78.8742 44.4533 9.56342 -23.5116 -55.5401 -86.3393 -115.736 -143.587 -169.778 -194.222 -216.855 -237.627 -256.512 -273.507 -288.62 -301.872 -313.285 -322.898 -330.739 -336.823 -341.172 -343.832 -344.791 -344.073 -341.727 -337.733 -332.112 -324.866 -315.987 -305.478 -293.334 -279.55 -264.129 -247.067 -228.382 -208.103 -186.248 -162.865 -138.026 -111.809 -84.3276 -55.7036 -26.0758 4.53798 36.391 68.279 100.138 131.733 162.837 193.143 222.371 250.204 276.319 300.427 322.234 341.449 357.832 371.154 381.228 387.899 391.102 390.649 386.641 379.086 368.103 353.876 336.601 316.514 293.878 269.036 242.319 214.07 184.68 154.5 123.884 93.152 62.5976 32.7095 6.37907 -21.5038 -48.3843 -73.9919 -98.1558 -120.763 -141.738 -161.027 -178.605 -194.459 -208.593 -221.03 -231.794 -240.922 -248.455 -254.439 -258.929 -261.967 -263.587 -263.565 -262.136 -259.338 -255.208 -249.791 -243.116 -235.222 -226.141 -215.869 -204.412 169.551 201.668 233.264 263.82 292.913 319.968 344.571 366.29 384.776 399.753 410.966 418.216 421.335 419.953 414.312 404.622 390.917 373.402 352.339 328.035 300.863 271.185 239.409 206.005 171.401 136.042 100.312 64.5855 29.4141 -1.71993 -34.7755 -66.7198 -97.2471 -126.169 -153.36 -178.722 -202.205 -223.784 -243.451 -261.225 -277.137 -291.23 -303.552 -314.151 -323.083 -330.393 -336.128 -340.33 -343.034 -344.259 -343.985 -341.932 -338.39 -333.304 -326.653 -318.421 -308.565 -297.043 -283.84 -268.926 -252.28 -233.907 -213.791 -191.953 -168.434 -143.28 -116.565 -88.4025 -58.9093 -28.2509 3.3912 35.0607 67.9688 101.154 134.328 167.175 199.379 230.594 260.452 288.588 314.631 338.208 358.963 376.567 390.723 401.174 407.73 410.261 408.649 402.998 393.352 379.786 362.502 341.75 317.813 291.018 261.753 230.414 197.419 163.196 128.165 92.7493 57.3321 22.2578 -12.1001 -45.4938 -77.6705 -108.415 -137.543 -164.902 -190.364 -213.833 -235.246 -254.57 -271.804 -286.974 -300.121 -311.316 -320.619 -328.089 -333.804 -337.824 -340.218 -341 -340.215 -337.927 -334.147 -328.886 -322.134 -313.873 -304.065 -292.68 -279.698 -265.078 -248.779 -230.782 -211.078 -189.666 -166.565 -141.817 -115.485 -87.6636 -58.4774 -28.0838 3.33183 35.5603 68.318 101.344 134.325 166.928 198.798 229.579 258.92 286.462 311.857 334.788 354.943 372.057 385.896 396.259 403.007 406.018 405.15 400.479 392.035 379.824 363.977 344.644 322.024 296.371 267.961 237.135 204.273 169.764 134.049 97.5943 60.8673 24.3337 -11.5696 -46.4281 -79.8727 -111.597 -141.35 -168.934 -194.219 -217.129 -237.635 -255.756 -271.548 -285.098 -296.522 -305.953 -313.527 -319.384 -323.655 -326.461 -327.93 -328.137 -327.174 -325.102 -321.94 -317.7 -312.381 -305.965 -298.412 -289.643 -279.582 -268.158 -255.265 -240.803 -224.682 -206.815 -187.127 -165.559 -142.084 -116.706 -89.4651 -60.4587 -29.8346 2.22137 35.4542 69.5494 104.178 138.942 173.425 207.194 239.777 270.716 299.558 325.871 349.26 369.368 385.893 398.588 407.268 411.827 412.132 408.239 400.294 388.354 372.615 353.324 330.785 305.326 277.321 247.164 215.281 182.101 148.018 113.442 78.7755 44.3418 9.37753 -23.6985 -55.7429 -86.5569 -115.964 -143.824 -170.021 -194.467 -217.101 -237.871 -256.753 -273.743 -288.851 -302.097 -313.504 -323.112 -330.949 -337.029 -341.376 -344.033 -344.984 -344.269 -341.921 -337.927 -332.307 -325.062 -316.184 -305.678 -293.538 -279.756 -264.338 -247.278 -228.595 -208.316 -186.461 -163.075 -138.23 -112.006 -84.5148 -55.8773 -26.233 4.39582 36.2804 68.1989 100.09 131.718 162.859 193.204 222.473 250.349 276.507 300.658 322.505 341.758 358.174 371.526 381.624 388.315 391.528 391.062 387.041 379.474 368.473 354.216 336.905 316.777 294.096 269.208 242.442 214.146 184.711 154.489 123.835 93.0706 62.4897 32.5857 6.18135 -21.7062 -48.5949 -74.2098 -98.379 -120.989 -141.965 -161.252 -178.827 -194.675 -208.804 -221.234 -231.993 -241.113 -248.64 -254.617 -259.099 -262.131 -263.746 -263.721 -262.286 -259.483 -255.351 -249.932 -243.255 -235.359 -226.277 -216.004 -204.547 169.521 201.703 233.371 264 293.169 320.296 344.97 366.755 385.299 400.324 411.576 418.85 421.986 420.623 414.962 405.233 391.483 373.916 352.792 328.419 301.175 271.422 239.57 206.092 171.419 135.995 100.211 64.4391 29.2397 -2.01314 -35.0797 -67.0392 -97.5794 -126.51 -153.705 -179.068 -202.547 -224.119 -243.778 -261.542 -277.444 -291.525 -303.835 -314.424 -323.345 -330.647 -336.374 -340.569 -343.268 -344.488 -344.218 -342.169 -338.627 -333.545 -326.9 -318.675 -308.827 -297.314 -284.119 -269.213 -252.574 -234.207 -214.094 -192.258 -168.737 -143.578 -116.854 -88.6783 -59.1695 -28.4913 3.17502 34.8906 67.8336 101.06 134.281 167.18 199.443 230.718 260.642 288.846 314.957 338.601 359.421 377.082 391.286 401.776 408.357 410.902 409.292 403.623 393.947 380.344 363.01 342.201 318.197 291.333 261.995 230.58 197.511 163.217 128.12 92.6437 57.1734 22.0521 -12.3433 -45.7698 -77.9728 -108.738 -137.882 -165.253 -190.722 -214.194 -235.605 -254.923 -272.148 -287.306 -300.44 -311.622 -320.911 -328.37 -334.074 -338.085 -340.469 -341.24 -340.455 -338.162 -334.382 -329.123 -322.375 -314.119 -304.318 -292.942 -279.97 -265.356 -249.065 -231.076 -211.377 -189.968 -166.868 -142.117 -115.778 -87.9444 -58.7416 -28.3256 3.11947 35.3798 68.1783 101.252 134.284 166.945 198.874 229.719 259.124 286.729 312.187 335.176 355.385 372.547 386.426 396.82 403.59 406.609 405.757 401.074 392.611 380.375 364.493 345.116 322.445 296.733 268.258 237.361 204.425 169.841 134.05 97.5221 60.7246 24.1256 -11.8353 -46.7429 -80.2265 -111.98 -141.753 -169.347 -194.635 -217.541 -238.037 -256.143 -271.916 -285.444 -296.844 -306.25 -313.801 -319.636 -323.886 -326.674 -328.127 -328.32 -327.352 -325.274 -322.109 -317.87 -312.556 -306.149 -298.606 -289.849 -279.805 -268.398 -255.523 -241.079 -224.975 -207.126 -187.453 -165.897 -142.428 -117.052 -89.8066 -60.787 -30.1412 1.94604 35.2156 69.3593 104.045 138.873 173.428 207.273 239.935 270.956 299.877 326.266 349.725 369.895 386.471 399.206 407.91 412.479 412.793 408.883 400.908 388.928 373.139 353.79 331.185 305.655 277.577 247.347 215.391 182.142 147.993 113.358 78.642 44.1896 9.13227 -23.947 -56.0137 -86.8475 -116.27 -144.14 -170.344 -194.794 -217.429 -238.197 -257.074 -274.059 -289.159 -302.397 -313.798 -323.398 -331.228 -337.304 -341.648 -344.298 -345.246 -344.53 -342.179 -338.187 -332.567 -325.323 -316.448 -305.945 -293.808 -280.031 -264.616 -247.56 -228.88 -208.602 -186.745 -163.355 -138.504 -112.269 -84.7647 -56.1094 -26.443 4.20672 36.1326 68.0919 100.026 131.697 162.887 193.285 222.609 250.542 276.758 300.965 322.867 342.17 358.631 372.021 382.15 388.868 392.088 391.621 387.581 379.994 368.966 354.67 337.31 317.127 294.387 269.436 242.606 214.247 184.752 154.473 123.769 92.962 62.3451 32.4191 5.91875 -21.9758 -48.8757 -74.5006 -98.677 -121.29 -142.267 -161.552 -179.122 -194.964 -209.085 -221.507 -232.257 -241.369 -248.886 -254.853 -259.326 -262.347 -263.958 -263.928 -262.485 -259.678 -255.541 -250.119 -243.44 -235.542 -226.459 -216.185 -204.726 169.483 201.747 233.504 264.226 293.488 320.707 345.469 367.336 385.952 401.039 412.34 419.644 422.801 421.45 415.772 405.996 392.191 374.558 353.358 328.9 301.565 271.719 239.772 206.202 171.44 135.937 100.084 64.2556 29.019 -2.37801 -35.4598 -67.4387 -97.9953 -126.937 -154.137 -179.5 -202.975 -224.539 -244.187 -261.938 -277.827 -291.894 -304.19 -314.765 -323.674 -330.965 -336.682 -340.869 -343.56 -344.774 -344.509 -342.463 -338.923 -333.845 -327.207 -318.992 -309.155 -297.652 -284.468 -269.571 -252.941 -234.582 -214.474 -192.639 -169.116 -143.95 -117.216 -89.0237 -59.4951 -28.7925 2.90285 34.6786 67.6641 100.942 134.221 167.187 199.521 230.873 260.878 289.167 315.364 339.093 359.993 377.727 391.991 402.528 409.142 411.698 410.096 404.407 394.692 381.041 363.647 342.764 318.678 291.726 262.296 230.787 197.625 163.243 128.063 92.511 56.9742 21.7945 -12.6483 -46.1155 -78.3512 -109.142 -138.307 -165.693 -191.171 -214.646 -236.054 -255.364 -272.578 -287.721 -300.839 -312.005 -321.278 -328.721 -334.412 -338.411 -340.781 -341.543 -340.754 -338.456 -334.676 -329.42 -322.676 -314.427 -304.634 -293.27 -280.309 -265.705 -249.423 -231.443 -211.751 -190.346 -167.246 -142.492 -116.144 -88.2959 -59.0724 -28.6284 2.85276 35.154 68.0032 101.135 134.233 166.964 198.969 229.892 259.378 287.063 312.598 335.661 355.938 373.159 387.088 397.522 404.319 407.351 406.511 401.821 393.331 381.063 365.138 345.706 322.97 297.185 268.629 237.644 204.615 169.936 134.052 97.4312 60.5455 23.8646 -12.1685 -47.1374 -80.6698 -112.46 -142.257 -169.865 -195.156 -218.057 -238.54 -256.626 -272.375 -285.876 -297.247 -306.621 -314.143 -319.951 -324.175 -326.94 -328.372 -328.551 -327.573 -325.488 -322.321 -318.083 -312.774 -306.378 -298.849 -290.107 -280.083 -268.698 -255.845 -241.424 -225.343 -207.514 -187.861 -166.319 -142.86 -117.486 -90.2341 -61.1982 -30.5253 1.60009 34.9168 69.121 103.878 138.786 173.431 207.371 240.133 271.254 300.275 326.759 350.306 370.553 387.195 399.978 408.714 413.295 413.613 409.691 401.676 389.646 373.795 354.373 331.686 306.067 277.897 247.575 215.528 182.191 147.961 113.252 78.4724 43.9912 8.83234 -24.2565 -56.3525 -87.2114 -116.652 -144.536 -170.748 -195.204 -217.839 -238.605 -257.477 -274.453 -289.544 -302.772 -314.164 -323.756 -331.577 -337.647 -341.987 -344.629 -345.574 -344.856 -342.503 -338.511 -332.891 -325.649 -316.778 -306.279 -294.147 -280.375 -264.964 -247.912 -229.236 -208.958 -187.1 -163.705 -138.846 -112.599 -85.0776 -56.4001 -26.7058 3.97058 35.9477 67.9577 99.9445 131.67 162.921 193.386 222.779 250.784 277.071 301.349 323.319 342.685 359.203 372.641 382.809 389.556 392.786 392.32 388.262 380.647 369.583 355.237 337.817 317.565 294.751 269.721 242.812 214.374 184.802 154.453 123.685 92.8252 62.1636 32.2083 5.59221 -22.3125 -49.227 -74.8643 -99.0497 -121.668 -142.645 -161.926 -179.491 -195.325 -209.437 -221.849 -232.587 -241.688 -249.193 -255.149 -259.609 -262.619 -264.223 -264.186 -262.734 -259.92 -255.779 -250.353 -243.67 -235.77 -226.685 -216.41 -204.949 169.436 201.799 233.664 264.496 293.871 321.2 346.067 368.033 386.737 401.898 413.257 420.601 423.781 422.438 416.741 406.912 393.042 375.33 354.037 329.476 302.033 272.074 240.013 206.332 171.465 135.865 99.9296 64.034 28.7498 -2.81337 -35.9155 -67.9184 -98.4949 -127.45 -154.656 -180.019 -203.489 -225.043 -244.678 -262.415 -278.286 -292.336 -304.616 -315.175 -324.068 -331.346 -337.052 -341.229 -343.911 -345.119 -344.857 -342.814 -339.277 -334.206 -327.577 -319.372 -309.548 -298.058 -284.887 -270.001 -253.382 -235.033 -214.93 -193.096 -169.571 -144.398 -117.65 -89.4388 -59.8866 -29.1548 2.57453 34.4243 67.4601 100.8 134.149 167.194 199.614 231.058 261.161 289.552 315.852 339.683 360.68 378.501 392.838 403.431 410.084 412.658 411.06 405.348 395.588 381.879 364.41 343.44 319.256 292.197 262.658 231.035 197.761 163.273 127.993 92.3508 56.7342 21.4844 -13.0153 -46.5312 -78.8061 -109.628 -138.817 -166.221 -191.71 -215.188 -236.594 -255.895 -273.094 -288.219 -301.319 -312.464 -321.717 -329.142 -334.817 -338.802 -341.155 -341.908 -341.112 -338.809 -335.029 -329.775 -323.038 -314.797 -305.014 -293.663 -280.715 -266.123 -249.853 -231.884 -212.2 -190.801 -167.702 -142.943 -116.584 -88.7185 -59.47 -28.9927 2.53153 34.8823 67.7923 100.994 134.171 166.987 199.083 230.1 259.682 287.464 313.092 336.243 356.601 373.894 387.883 398.364 405.194 408.244 407.414 402.716 394.198 381.891 365.912 346.415 323.602 297.728 269.074 237.984 204.843 170.05 134.053 97.3213 60.3297 23.5504 -12.5695 -47.6123 -81.2031 -113.037 -142.863 -170.487 -195.783 -218.677 -239.144 -257.207 -272.927 -286.395 -297.731 -307.067 -314.554 -320.328 -324.52 -327.259 -328.666 -328.828 -327.839 -325.745 -322.574 -318.337 -313.036 -306.654 -299.139 -290.416 -280.417 -269.058 -256.231 -241.838 -225.784 -207.981 -188.35 -166.827 -143.379 -118.008 -90.7481 -61.6927 -30.9875 1.18309 34.5572 68.834 103.676 138.681 173.434 207.489 240.37 271.612 300.752 327.351 351.004 371.344 388.063 400.905 409.68 414.278 414.598 410.66 402.598 390.509 374.582 355.072 332.286 306.561 278.28 247.848 215.692 182.25 147.922 113.123 78.2652 43.7326 8.49127 -24.6263 -56.7596 -87.6486 -117.111 -145.011 -171.234 -195.695 -218.331 -239.095 -257.96 -274.927 -290.006 -303.222 -314.604 -324.185 -331.996 -338.059 -342.393 -345.027 -345.969 -345.246 -342.89 -338.899 -333.28 -326.041 -317.173 -306.68 -294.554 -280.787 -265.381 -248.335 -229.663 -209.387 -187.527 -164.127 -139.258 -112.996 -85.4536 -56.7497 -27.0219 3.68704 35.7256 67.7963 99.8464 131.639 162.963 193.506 222.982 251.073 277.447 301.811 323.862 343.304 359.889 373.385 383.6 390.381 393.627 393.159 389.082 381.433 370.325 355.919 338.426 318.092 295.187 270.063 243.058 214.525 184.862 154.427 123.583 92.6595 61.9446 31.9517 5.20289 -22.7161 -49.6487 -75.3013 -99.4975 -122.121 -143.098 -162.377 -179.934 -195.759 -209.859 -222.259 -232.984 -242.07 -249.562 -255.504 -259.949 -262.945 -264.54 -264.494 -263.032 -260.212 -256.064 -250.633 -243.947 -236.044 -226.958 -216.68 -205.218 169.38 201.859 233.849 264.811 294.318 321.776 346.766 368.847 387.654 402.901 414.329 421.719 424.926 423.588 417.869 407.981 394.035 376.231 354.83 330.149 302.578 272.488 240.294 206.483 171.493 135.78 99.7471 63.7733 28.4298 -3.31802 -36.4467 -68.4786 -99.0785 -128.049 -155.263 -180.626 -204.089 -225.632 -245.252 -262.97 -278.823 -292.852 -305.112 -315.652 -324.528 -331.79 -337.483 -341.648 -344.32 -345.521 -345.263 -343.223 -339.69 -334.626 -328.008 -319.816 -310.006 -298.531 -285.375 -270.504 -253.898 -235.559 -215.463 -193.631 -170.103 -144.921 -118.157 -89.9243 -60.3445 -29.5782 2.19034 34.1268 67.221 100.632 134.064 167.201 199.721 231.273 261.49 290 316.422 340.372 361.482 379.404 393.827 404.486 411.185 413.78 412.185 406.447 396.635 382.857 365.302 344.229 319.93 292.748 263.079 231.324 197.919 163.306 127.911 92.1624 56.4529 21.1214 -13.4449 -47.0173 -79.3379 -110.196 -139.414 -166.838 -192.34 -215.823 -237.225 -256.515 -273.697 -288.801 -301.878 -313 -322.23 -329.633 -335.29 -339.257 -341.592 -342.333 -341.529 -339.221 -335.44 -330.189 -323.459 -315.228 -305.458 -294.122 -281.19 -266.611 -250.355 -232.398 -212.724 -191.331 -168.233 -143.469 -117.098 -89.2124 -59.9351 -29.4189 2.15523 34.5642 67.5452 100.829 134.097 167.012 199.214 230.342 260.037 287.931 313.668 336.923 357.376 374.753 388.811 399.348 406.216 409.289 408.469 403.761 395.21 382.857 366.817 347.243 324.339 298.362 269.594 238.38 205.108 170.183 134.054 97.1917 60.0767 23.1821 -13.0391 -48.1681 -81.827 -113.711 -143.571 -171.214 -196.514 -219.401 -239.849 -257.886 -273.572 -287.001 -298.295 -307.588 -315.033 -320.768 -324.924 -327.63 -329.009 -329.151 -328.148 -326.044 -322.868 -318.634 -313.342 -306.974 -299.477 -290.777 -280.807 -269.478 -256.682 -242.321 -226.299 -208.526 -188.922 -167.42 -143.986 -118.618 -91.349 -62.2711 -31.5286 0.694398 34.1362 68.4976 103.439 138.557 173.435 207.624 240.646 272.03 301.309 328.042 351.818 372.267 389.077 401.989 410.809 415.428 415.749 411.79 403.676 391.516 375.501 355.888 332.987 307.137 278.727 248.165 215.882 182.318 147.875 112.971 78.0192 43.4105 8.11115 -25.0562 -57.2351 -88.1597 -117.647 -145.566 -171.802 -196.27 -218.907 -239.666 -258.524 -275.48 -290.545 -303.747 -315.117 -324.685 -332.485 -338.54 -342.867 -345.493 -346.429 -345.701 -343.343 -339.352 -333.734 -326.497 -317.635 -307.147 -295.028 -281.268 -265.868 -248.829 -230.161 -209.887 -188.025 -164.619 -139.738 -113.459 -85.8931 -57.1586 -27.3916 3.35565 35.4663 67.6075 99.7306 131.602 163.011 193.645 223.219 251.411 277.886 302.348 324.496 344.026 360.69 374.254 384.523 391.344 394.609 394.138 390.041 382.353 371.192 356.715 339.137 318.706 295.696 270.462 243.345 214.7 184.931 154.396 123.462 92.4634 61.6874 31.6475 4.75207 -23.1863 -50.141 -75.8117 -100.021 -122.65 -143.628 -162.902 -180.452 -196.265 -210.352 -222.737 -233.447 -242.517 -249.992 -255.918 -260.345 -263.325 -264.909 -264.853 -263.38 -260.551 -256.397 -250.961 -244.27 -236.364 -227.275 -216.995 -205.531 169.314 201.925 234.06 265.171 294.829 322.434 347.565 369.779 388.702 404.049 415.556 423 426.236 424.903 419.155 409.204 395.172 377.262 355.737 330.918 303.201 272.96 240.614 206.655 171.523 135.681 99.5355 63.472 28.0566 -3.89055 -37.0534 -69.1196 -99.7467 -128.735 -155.957 -181.32 -204.776 -226.305 -245.908 -263.606 -279.436 -293.442 -305.68 -316.198 -325.053 -332.297 -337.975 -342.127 -344.788 -345.982 -345.725 -343.688 -340.161 -335.106 -328.5 -320.324 -310.531 -299.073 -285.933 -271.079 -254.488 -236.161 -216.071 -194.242 -170.712 -145.52 -118.738 -90.4806 -60.8692 -30.0632 1.75052 33.7851 66.9464 100.44 133.965 167.208 199.842 231.517 261.865 290.512 317.073 341.159 362.399 380.437 394.958 405.693 412.446 415.067 413.472 407.703 397.833 383.976 366.323 345.132 320.7 293.376 263.559 231.653 198.098 163.343 127.815 91.9452 56.1297 20.7049 -13.9377 -47.5743 -79.9469 -110.847 -140.096 -167.544 -193.06 -216.549 -237.947 -257.224 -274.386 -289.466 -302.517 -313.612 -322.815 -330.195 -335.829 -339.776 -342.092 -342.819 -342.005 -339.691 -335.91 -330.662 -323.94 -315.72 -305.964 -294.647 -281.732 -267.169 -250.929 -232.986 -213.324 -191.938 -168.841 -144.072 -117.687 -89.7779 -60.468 -29.9075 1.7232 34.1995 67.2614 100.639 134.011 167.04 199.364 230.618 260.442 288.465 314.327 337.7 358.262 375.735 389.873 400.474 407.386 410.484 409.675 404.955 396.368 383.962 367.851 348.189 325.182 299.087 270.188 238.832 205.412 170.335 134.053 97.0423 59.7861 22.759 -13.578 -48.8057 -82.5426 -114.485 -144.383 -172.047 -197.352 -220.23 -240.657 -258.662 -274.31 -287.694 -298.94 -308.183 -315.58 -321.27 -325.384 -328.054 -329.402 -329.52 -328.5 -326.384 -323.204 -318.973 -313.692 -307.34 -299.863 -291.19 -281.252 -269.957 -257.197 -242.873 -226.887 -209.15 -189.577 -168.099 -144.68 -119.316 -92.0374 -62.9342 -32.1491 0.133298 33.653 68.1111 103.167 138.414 173.435 207.778 240.96 272.506 301.946 328.831 352.75 373.324 390.237 403.228 412.102 416.744 417.066 413.082 404.91 392.669 376.553 356.821 333.788 307.795 279.237 248.527 216.098 182.394 147.82 112.796 77.7336 43.023 7.69287 -25.5465 -57.7795 -88.7451 -118.262 -146.201 -172.451 -196.927 -219.565 -240.32 -259.17 -276.112 -291.161 -304.347 -315.704 -325.257 -333.043 -339.089 -343.408 -346.026 -346.955 -346.222 -343.86 -339.868 -334.253 -327.02 -318.163 -307.682 -295.57 -281.817 -266.426 -249.394 -230.732 -210.46 -188.596 -165.182 -140.288 -113.989 -86.3965 -57.6273 -27.8157 2.97613 35.1699 67.3911 99.5973 131.555 163.064 193.804 223.488 251.796 278.386 302.963 325.22 344.851 361.607 375.248 385.579 392.444 395.733 395.259 391.138 383.406 372.183 357.626 339.951 319.408 296.277 270.917 243.671 214.9 185.009 154.36 123.322 92.2356 61.3907 31.2942 4.24103 -23.7231 -50.7041 -76.3958 -100.619 -123.256 -144.235 -163.504 -181.043 -196.845 -210.916 -223.284 -233.976 -243.028 -250.484 -256.391 -260.799 -263.761 -265.329 -265.263 -263.777 -260.939 -256.777 -251.334 -244.64 -236.729 -227.637 -217.356 -205.889 169.238 201.998 234.295 265.574 295.402 323.174 348.464 370.827 389.883 405.342 416.939 424.444 427.712 426.382 420.603 410.581 396.453 378.424 356.758 331.783 303.901 273.49 240.972 206.846 171.554 135.566 99.2938 63.1284 27.6281 -4.52968 -37.7355 -69.8417 -100.5 -129.508 -156.739 -182.102 -205.549 -227.063 -246.646 -264.321 -280.126 -294.106 -306.318 -316.812 -325.644 -332.868 -338.528 -342.666 -345.315 -346.5 -346.244 -344.211 -340.691 -335.646 -329.054 -320.895 -311.121 -299.682 -286.562 -271.726 -255.152 -236.838 -216.757 -194.931 -171.397 -146.194 -119.392 -91.1082 -61.4612 -30.6101 1.25519 33.3981 66.6356 100.221 133.853 167.214 199.977 231.791 262.286 291.087 317.805 342.045 363.431 381.601 396.233 407.054 413.867 416.517 414.921 409.118 399.183 385.237 367.472 346.149 321.568 294.084 264.099 232.021 198.299 163.383 127.704 91.6986 55.7636 20.2344 -14.4942 -48.2027 -80.6337 -111.58 -140.866 -168.339 -193.872 -217.366 -238.76 -258.023 -275.163 -290.215 -303.236 -314.3 -323.474 -330.827 -336.436 -340.36 -342.655 -343.365 -342.539 -340.22 -336.438 -331.194 -324.48 -316.274 -306.535 -295.237 -282.341 -267.797 -251.576 -233.648 -213.999 -192.621 -169.527 -144.751 -118.351 -90.4157 -61.0692 -30.459 1.23482 33.7874 66.9402 100.423 133.912 167.07 199.53 230.928 260.897 289.065 315.068 338.574 359.259 376.84 391.07 401.742 408.704 411.832 411.033 406.299 397.673 385.207 369.016 349.256 326.131 299.903 270.857 239.342 205.753 170.505 134.051 96.8728 59.4571 22.2803 -14.1871 -49.5258 -83.3507 -115.358 -145.3 -172.987 -198.297 -221.164 -241.567 -259.537 -275.14 -288.474 -299.666 -308.853 -316.194 -321.834 -325.9 -328.53 -329.843 -329.935 -328.895 -326.766 -323.581 -319.354 -314.084 -307.75 -300.297 -291.654 -281.753 -270.496 -257.776 -243.494 -227.55 -209.852 -190.314 -168.864 -145.463 -120.103 -92.8142 -63.6828 -32.85 -0.50105 33.1068 67.6735 102.857 138.25 173.433 207.949 241.312 273.042 302.663 329.72 353.798 374.513 391.544 404.626 413.559 418.228 418.55 414.537 406.3 393.968 377.737 357.872 334.69 308.536 279.811 248.933 216.34 182.478 147.756 112.596 77.408 42.5662 7.2389 -26.0979 -58.3935 -89.4051 -118.954 -146.917 -173.183 -197.667 -220.306 -241.057 -259.896 -276.823 -291.855 -305.022 -316.363 -325.901 -333.672 -339.706 -344.017 -346.625 -347.547 -346.807 -344.441 -340.449 -334.836 -327.607 -318.756 -308.283 -296.18 -282.435 -267.053 -250.03 -231.374 -211.105 -189.239 -165.817 -140.909 -114.587 -86.9642 -58.1563 -28.2951 2.54834 34.8363 67.1466 99.4467 131.502 163.122 193.981 223.791 252.228 278.949 303.654 326.035 345.781 362.639 376.367 386.768 393.683 397 396.523 392.375 384.594 373.301 358.653 340.867 320.199 296.932 271.429 244.038 215.124 185.094 154.316 123.162 91.9753 61.0517 30.8917 3.67096 -24.3264 -51.3383 -77.0539 -101.294 -123.938 -144.918 -164.181 -181.71 -197.497 -211.551 -223.899 -234.571 -243.602 -251.037 -256.923 -261.31 -264.251 -265.802 -265.723 -264.225 -261.374 -257.204 -251.755 -245.054 -237.14 -228.045 -217.761 -206.292 169.151 202.077 234.555 266.021 296.039 323.996 349.463 371.993 391.196 406.781 418.478 426.051 429.355 428.027 422.211 412.113 397.878 379.716 357.894 332.744 304.678 274.078 241.369 207.056 171.586 135.436 99.0206 62.74 27.143 -5.23437 -38.493 -70.6454 -101.338 -130.368 -157.609 -182.972 -206.409 -227.907 -247.467 -265.116 -280.892 -294.844 -307.027 -317.494 -326.301 -333.502 -339.143 -343.265 -345.9 -347.076 -346.821 -344.79 -341.278 -336.245 -329.668 -321.529 -311.776 -300.359 -287.26 -272.445 -255.89 -237.591 -217.519 -195.697 -172.16 -146.944 -120.121 -91.8074 -62.1209 -31.2191 0.70434 32.9648 66.2877 99.976 133.726 167.217 200.124 232.093 262.752 291.724 318.617 343.03 364.578 382.896 397.653 408.57 415.449 418.132 416.534 410.693 400.685 386.64 368.75 347.279 322.532 294.87 264.698 232.43 198.52 163.424 127.579 91.4221 55.3533 19.7092 -15.1152 -48.9031 -81.399 -112.396 -141.722 -169.225 -194.777 -218.277 -239.665 -258.912 -276.027 -291.048 -304.036 -315.065 -324.206 -331.529 -337.11 -341.008 -343.279 -343.972 -343.132 -340.806 -337.023 -331.784 -325.08 -316.888 -307.168 -295.893 -283.019 -268.496 -252.294 -234.384 -214.75 -193.382 -170.29 -145.507 -119.09 -91.1263 -61.7392 -31.074 0.689463 33.3271 66.5811 100.18 133.8 167.101 199.714 231.27 261.401 289.732 315.892 339.547 360.368 378.07 392.401 403.154 410.17 413.332 412.544 407.794 399.125 386.592 370.313 350.442 327.188 300.811 271.6 239.908 206.132 170.692 134.048 96.6828 59.0885 21.745 -14.8676 -50.3294 -84.2525 -116.331 -146.321 -174.034 -199.35 -222.204 -242.579 -260.51 -276.064 -289.342 -300.472 -309.597 -316.877 -322.46 -326.474 -329.058 -330.333 -330.394 -329.333 -327.189 -323.998 -319.776 -314.519 -308.205 -300.777 -292.169 -282.309 -271.094 -258.42 -244.185 -228.287 -210.633 -191.134 -169.716 -146.335 -120.98 -93.6799 -64.5175 -33.6325 -1.20939 32.4968 67.1836 102.509 138.066 173.428 208.137 241.702 273.636 303.46 330.709 354.964 375.837 392.999 406.181 415.182 419.881 420.202 416.155 407.846 395.413 379.056 359.042 335.692 309.359 280.447 249.383 216.606 182.569 147.683 112.371 77.0422 42.0453 6.74243 -26.7118 -59.0778 -90.1404 -119.726 -147.714 -173.997 -198.49 -221.131 -241.877 -260.704 -277.615 -292.626 -305.773 -317.094 -326.615 -334.371 -340.392 -344.693 -347.291 -348.204 -347.458 -345.086 -341.094 -335.484 -328.26 -319.416 -308.951 -296.857 -283.123 -267.752 -250.737 -232.088 -211.822 -189.954 -166.524 -141.599 -115.253 -87.5966 -58.7463 -28.8315 2.07235 34.4657 66.874 99.2772 131.444 163.184 194.176 224.125 252.707 279.574 304.422 326.941 346.815 363.787 377.612 388.091 395.061 398.409 397.929 393.753 385.916 374.546 359.795 341.886 321.078 297.659 271.997 244.445 215.37 185.188 154.265 122.981 91.6815 60.6668 30.4403 3.04277 -24.9963 -52.0439 -77.7866 -102.045 -124.698 -145.678 -164.934 -182.451 -198.222 -212.256 -224.583 -235.232 -244.241 -251.652 -257.514 -261.878 -264.796 -266.327 -266.234 -264.722 -261.859 -257.679 -252.221 -245.515 -237.596 -228.498 -218.212 -206.74 169.052 202.161 234.839 266.511 296.739 324.9 350.563 373.276 392.643 408.367 420.174 427.823 431.165 429.839 423.983 413.801 399.448 381.14 359.145 333.803 305.532 274.722 241.804 207.285 171.619 135.288 98.7146 62.3022 26.6019 -6.00394 -39.3262 -71.5311 -102.263 -131.317 -158.568 -183.93 -207.356 -228.835 -248.371 -265.991 -281.736 -295.656 -307.807 -318.244 -327.023 -334.198 -339.818 -343.923 -346.544 -347.709 -347.453 -345.427 -341.923 -336.903 -330.345 -322.226 -312.497 -301.104 -288.029 -273.238 -256.703 -238.42 -218.359 -196.541 -173.001 -147.771 -120.925 -92.5792 -62.8485 -31.8908 0.0977494 32.4842 65.9019 99.704 133.583 167.219 200.283 232.422 263.263 292.424 319.51 344.113 365.84 384.322 399.217 410.24 417.193 419.912 418.311 412.428 402.341 388.187 370.158 348.524 323.594 295.734 265.355 232.877 198.76 163.467 127.438 91.1146 54.8978 19.1285 -15.8015 -49.6761 -82.2434 -113.296 -142.667 -170.202 -195.773 -219.281 -240.663 -259.891 -276.978 -291.965 -304.916 -315.906 -325.01 -332.301 -337.851 -341.72 -343.966 -344.638 -343.784 -341.451 -337.667 -332.432 -325.74 -317.564 -307.865 -296.615 -283.764 -269.264 -253.085 -235.195 -215.577 -194.22 -171.131 -146.342 -119.906 -91.9104 -62.4785 -31.7534 0.0863441 32.8177 66.1831 99.911 133.675 167.133 199.913 231.646 261.956 290.464 316.798 340.617 361.59 379.424 393.867 404.709 411.787 414.985 414.209 409.441 400.725 388.119 371.741 351.748 328.351 301.811 272.419 240.53 206.548 170.897 134.042 96.4715 58.6796 21.1521 -15.6206 -51.2175 -85.2491 -117.406 -147.448 -175.189 -200.511 -223.351 -243.695 -261.582 -277.082 -290.297 -301.36 -310.415 -317.628 -323.148 -327.104 -329.638 -330.871 -330.899 -329.813 -327.654 -324.457 -320.239 -314.997 -308.704 -301.304 -292.735 -282.92 -271.752 -259.128 -244.944 -229.098 -211.493 -192.038 -170.654 -147.296 -121.948 -94.6355 -65.4395 -34.4975 -1.9928 31.8216 66.6405 102.123 137.859 173.419 208.342 242.129 274.289 304.336 331.798 356.248 377.296 394.602 407.895 416.971 421.703 422.022 417.938 409.55 397.006 380.508 360.329 336.795 310.263 281.146 249.875 216.897 182.666 147.6 112.121 76.6365 41.4752 6.18698 -27.3902 -59.8332 -90.9517 -120.576 -148.592 -174.893 -199.397 -222.04 -242.779 -261.594 -278.486 -293.475 -306.599 -317.898 -327.401 -335.139 -341.147 -345.436 -348.024 -348.927 -348.173 -345.795 -341.803 -336.197 -328.977 -320.141 -309.685 -297.602 -283.879 -268.52 -251.516 -232.875 -212.612 -190.742 -167.304 -142.36 -115.986 -88.2943 -59.3977 -29.4252 1.54667 34.0579 66.5728 99.088 131.378 163.252 194.389 224.492 253.233 280.261 305.267 327.938 347.953 365.051 378.984 389.548 396.579 399.96 399.479 395.271 387.375 375.917 361.053 343.009 322.046 298.459 272.621 244.891 215.64 185.288 154.207 122.778 91.3532 60.2356 29.9378 2.35668 -25.7329 -52.8212 -78.5941 -102.872 -125.535 -146.515 -165.764 -183.267 -199.02 -213.033 -225.336 -235.96 -244.943 -252.329 -258.165 -262.502 -265.395 -266.905 -266.795 -265.268 -262.391 -258.2 -252.735 -246.022 -238.098 -228.997 -218.707 -207.233 168.94 202.249 235.146 267.045 297.502 325.886 351.763 374.677 394.223 410.1 422.028 429.761 433.145 431.819 425.918 415.646 401.165 382.696 360.512 334.958 306.464 275.424 242.275 207.531 171.651 135.122 98.3744 61.8143 26.0023 -6.83846 -40.2356 -72.4995 -103.274 -132.355 -159.617 -184.978 -208.391 -229.849 -249.359 -266.946 -282.657 -296.541 -308.657 -319.061 -327.81 -334.958 -340.554 -344.64 -347.245 -348.399 -348.143 -346.119 -342.625 -337.621 -331.082 -322.987 -313.283 -301.917 -288.869 -274.103 -257.591 -239.326 -219.276 -197.464 -173.919 -148.675 -121.805 -93.4243 -63.6445 -32.6256 -0.564901 31.9552 65.4774 99.4043 133.424 167.217 200.454 232.78 263.818 293.186 320.483 345.295 367.219 385.879 400.926 412.068 419.1 421.859 420.255 414.325 404.152 389.877 371.696 349.884 324.753 296.676 266.071 233.363 199.02 163.511 127.28 90.775 54.396 18.4916 -16.5541 -50.5225 -83.1674 -114.281 -143.7 -171.269 -196.863 -220.378 -241.753 -260.962 -278.017 -292.966 -305.876 -316.823 -325.888 -333.144 -338.659 -342.496 -344.714 -345.364 -344.495 -342.154 -338.368 -333.138 -326.458 -318.3 -308.625 -297.402 -284.577 -270.103 -253.948 -236.08 -216.481 -195.136 -172.051 -147.254 -120.797 -92.7686 -63.288 -32.498 -0.575251 32.2585 65.7455 99.6138 133.535 167.165 200.129 232.053 262.559 291.263 317.787 341.786 362.924 380.904 395.47 406.408 413.553 416.792 416.027 411.24 402.473 389.786 373.302 353.176 329.622 302.903 273.312 241.209 207.001 171.12 134.034 96.2375 58.2296 20.5005 -16.4474 -52.1918 -86.3417 -118.584 -148.683 -176.453 -201.781 -224.605 -244.915 -262.754 -278.193 -291.34 -302.328 -311.307 -318.447 -323.897 -327.79 -330.27 -331.457 -331.448 -330.335 -328.159 -324.956 -320.744 -315.516 -309.247 -301.879 -293.352 -283.586 -272.469 -259.901 -245.774 -229.983 -212.432 -193.026 -171.681 -148.348 -123.008 -95.6818 -66.4499 -35.4462 -2.85245 31.08 66.043 101.697 137.628 173.405 208.561 242.592 275 305.292 332.987 357.65 378.889 396.355 409.769 418.928 423.697 424.013 419.886 411.413 398.746 382.094 361.735 337.999 311.25 281.908 250.41 217.212 182.769 147.506 111.844 76.1912 40.8594 5.56715 -28.1352 -60.6608 -91.8395 -121.506 -149.552 -175.874 -200.388 -223.032 -243.766 -262.566 -279.437 -294.402 -307.5 -318.775 -328.257 -335.978 -341.97 -346.247 -348.824 -349.716 -348.953 -346.57 -342.577 -336.973 -329.76 -320.931 -310.486 -298.414 -284.705 -269.359 -252.366 -233.734 -213.476 -191.604 -168.155 -143.192 -116.789 -89.0577 -60.1112 -30.0767 0.969917 33.6128 66.2425 98.8792 131.302 163.323 194.618 224.89 253.806 281.009 306.189 329.026 349.195 366.431 380.483 391.141 398.237 401.655 401.173 396.931 388.969 377.416 362.429 344.235 323.103 299.332 273.302 245.376 215.932 185.394 154.139 122.552 90.9891 59.7574 29.3824 1.61251 -26.5365 -53.6707 -79.4771 -103.777 -126.45 -147.43 -166.671 -184.159 -199.891 -213.88 -226.158 -236.755 -245.71 -253.067 -258.875 -263.184 -266.049 -267.535 -267.407 -265.863 -262.972 -258.769 -253.294 -246.574 -238.645 -229.54 -219.248 -207.77 168.815 202.341 235.476 267.62 298.328 326.954 353.064 376.197 395.938 411.98 424.042 431.866 435.295 433.968 428.018 417.648 403.027 384.384 361.994 336.211 307.473 276.182 242.783 207.795 171.681 134.936 97.9982 61.2754 25.3422 -7.73838 -41.2218 -73.5513 -104.373 -133.482 -160.756 -186.115 -209.514 -230.949 -250.429 -267.982 -283.655 -297.5 -309.578 -319.947 -328.663 -335.781 -341.352 -345.416 -348.005 -349.146 -348.883 -346.867 -343.385 -338.398 -331.88 -323.81 -314.136 -302.797 -289.78 -275.042 -258.554 -240.307 -220.271 -198.465 -174.916 -149.656 -122.762 -94.3429 -64.5096 -33.4242 -1.28411 31.3768 65.0131 99.0758 133.247 167.21 200.635 233.163 264.417 294.01 321.536 346.574 368.714 387.57 402.782 414.053 421.171 423.973 422.366 416.384 406.118 391.711 373.366 351.36 326.01 297.698 266.846 233.888 199.299 163.554 127.104 90.402 53.8477 17.7964 -17.374 -51.4433 -84.1718 -115.351 -144.821 -172.429 -198.046 -221.57 -242.938 -262.124 -279.145 -294.051 -306.916 -317.817 -326.839 -334.055 -339.533 -343.337 -345.524 -346.149 -345.265 -342.914 -339.126 -333.902 -327.236 -319.097 -309.448 -298.256 -285.459 -271.012 -254.884 -237.04 -217.461 -196.13 -173.049 -148.245 -121.767 -93.7017 -64.1687 -33.3087 -1.29612 31.6484 65.2673 99.2879 133.379 167.196 200.36 232.493 263.212 292.128 318.859 343.054 364.371 382.509 397.208 408.253 415.471 418.753 418 413.192 404.37 391.597 374.996 354.725 331.002 304.088 274.281 241.944 207.491 171.359 134.022 95.98 57.7375 19.7893 -17.3495 -53.2539 -87.532 -119.866 -150.026 -177.828 -203.161 -225.967 -246.24 -264.026 -279.399 -292.471 -303.377 -312.275 -319.333 -324.707 -328.533 -330.954 -332.091 -332.042 -330.899 -328.704 -325.495 -321.289 -316.078 -309.832 -302.5 -294.02 -284.306 -273.246 -260.738 -246.672 -230.943 -213.451 -194.098 -172.796 -149.491 -124.16 -96.8201 -67.5499 -36.4796 -3.78973 30.2707 65.3899 101.228 137.374 173.385 208.796 243.092 275.77 306.327 334.276 359.172 380.618 398.258 411.804 421.053 425.862 426.174 422.001 413.435 400.635 383.815 363.26 339.304 312.319 282.731 250.988 217.549 182.877 147.4 111.541 75.7059 40.1975 4.88085 -28.9487 -61.5617 -92.8044 -122.516 -150.595 -176.937 -201.463 -224.11 -244.836 -263.62 -280.468 -295.406 -308.477 -319.725 -329.184 -336.887 -342.861 -347.125 -349.689 -350.57 -349.797 -347.409 -343.414 -337.814 -330.607 -321.788 -311.354 -299.295 -285.601 -270.269 -253.289 -234.665 -214.413 -192.54 -169.08 -144.096 -117.661 -89.8874 -60.8873 -30.7868 0.34076 33.1302 65.8828 98.6496 131.216 163.396 194.864 225.318 254.424 281.819 307.187 330.206 350.543 367.929 382.109 392.869 400.036 403.49 403.012 398.734 390.701 379.044 363.921 345.566 324.25 300.278 274.039 245.9 216.245 185.506 154.062 122.303 90.5884 59.231 28.7727 0.809783 -27.4077 -54.5931 -80.4361 -104.76 -127.443 -148.423 -167.654 -185.126 -200.836 -214.8 -227.048 -237.616 -246.54 -253.867 -259.644 -263.923 -266.758 -268.217 -268.069 -266.507 -263.6 -259.384 -253.9 -247.173 -239.238 -230.129 -219.833 -208.353 168.674 202.435 235.828 268.238 299.215 328.104 354.465 377.835 397.787 414.01 426.215 434.139 437.617 436.289 430.285 419.809 405.038 386.206 363.592 337.56 308.56 276.997 243.326 208.074 171.708 134.73 97.5843 60.6844 24.6196 -8.70439 -42.2855 -74.6874 -105.56 -134.7 -161.986 -187.342 -210.726 -232.136 -251.583 -269.098 -284.73 -298.533 -310.57 -320.9 -329.58 -336.667 -342.209 -346.252 -348.822 -349.95 -349.678 -347.671 -344.202 -339.233 -332.739 -324.698 -315.053 -303.746 -290.761 -276.053 -259.591 -241.366 -221.344 -199.545 -175.992 -150.718 -123.797 -95.3354 -65.4445 -34.2872 -2.06045 30.7478 64.5087 98.7169 133.052 167.199 200.826 233.572 265.058 294.895 322.668 347.951 370.326 389.393 404.785 416.197 423.408 426.257 424.646 418.607 408.24 393.691 375.168 352.951 327.365 298.797 267.678 234.449 199.595 163.596 126.909 89.9947 53.252 17.0415 -18.2623 -52.4393 -85.2567 -116.507 -146.032 -173.681 -199.324 -222.856 -244.216 -263.378 -280.361 -295.221 -308.036 -318.887 -327.862 -335.037 -340.473 -344.24 -346.395 -346.995 -346.092 -343.731 -339.941 -334.722 -328.072 -319.954 -310.335 -299.174 -286.408 -271.992 -255.893 -238.075 -218.518 -197.203 -174.128 -149.315 -122.814 -94.7104 -65.1215 -34.1864 -2.07726 30.9864 64.7474 98.9321 133.207 167.226 200.605 232.964 263.913 293.059 320.013 344.42 365.931 384.241 399.085 410.243 417.541 420.869 420.129 415.299 406.416 393.55 376.823 356.397 332.49 305.365 275.325 242.736 208.018 171.615 134.007 95.6982 57.2025 19.0175 -18.3288 -54.4053 -88.8214 -121.254 -151.478 -179.315 -204.652 -227.439 -247.671 -265.398 -280.7 -293.69 -304.508 -313.316 -320.287 -325.577 -329.331 -331.689 -332.771 -332.678 -331.504 -329.289 -326.075 -321.874 -316.68 -310.461 -303.167 -294.738 -285.08 -274.082 -261.639 -247.64 -231.978 -214.549 -195.254 -174 -150.725 -125.405 -98.0517 -68.7407 -37.5991 -4.80611 29.392 64.6799 100.717 137.095 173.359 209.043 243.627 276.596 307.442 335.666 360.815 382.484 400.312 414.002 423.348 428.202 428.508 424.283 415.617 402.674 385.672 364.905 340.71 313.469 283.616 251.607 217.908 182.989 147.28 111.21 75.1801 39.4886 4.12699 -29.8323 -62.537 -93.8469 -123.608 -151.72 -178.085 -202.623 -225.272 -245.99 -264.758 -281.58 -296.488 -309.528 -320.747 -330.182 -337.865 -343.821 -348.07 -350.621 -351.489 -350.706 -348.311 -344.315 -338.718 -331.519 -322.711 -312.289 -300.244 -286.565 -271.249 -254.283 -235.67 -215.424 -193.549 -170.078 -145.072 -118.603 -90.7839 -61.7267 -31.5561 -0.342113 32.61 65.4929 98.3986 131.12 163.472 195.126 225.777 255.089 282.69 308.262 331.477 351.996 369.545 383.864 394.734 401.978 405.469 404.997 400.68 392.571 380.801 365.532 347.001 325.485 301.296 274.831 246.462 216.58 185.622 153.974 122.028 90.1495 58.6553 28.1077 -0.0521629 -28.3468 -55.5891 -81.4718 -105.821 -128.516 -149.495 -168.715 -186.168 -201.855 -215.79 -228.008 -238.543 -247.435 -254.729 -260.473 -264.718 -267.521 -268.951 -268.781 -267.2 -264.277 -260.047 -254.552 -247.817 -239.876 -230.763 -220.464 -208.98 168.517 202.53 236.201 268.897 300.165 329.336 355.967 379.591 399.771 416.189 428.55 436.581 440.115 438.781 432.72 422.13 407.197 388.162 365.308 339.007 309.723 277.868 243.904 208.367 171.731 134.502 97.1308 60.0397 23.8331 -9.73776 -43.4277 -75.9087 -106.836 -136.008 -163.308 -188.66 -212.026 -233.409 -252.821 -270.295 -285.883 -299.64 -311.633 -321.921 -330.563 -337.615 -343.128 -347.146 -349.698 -350.811 -350.526 -348.531 -345.076 -340.128 -333.659 -325.648 -316.036 -304.765 -291.814 -277.138 -260.703 -242.501 -222.496 -200.704 -177.148 -151.859 -124.909 -96.4023 -66.4498 -35.2153 -2.89462 30.0669 63.9634 98.3256 132.838 167.183 201.026 234.006 265.743 295.84 323.881 349.427 372.054 391.351 406.937 418.501 425.812 428.712 427.095 420.995 410.519 395.817 377.102 354.658 328.818 299.976 268.569 235.048 199.908 163.636 126.694 89.5513 52.6069 16.2264 -19.2201 -53.5123 -86.4229 -117.75 -147.334 -175.026 -200.697 -224.239 -245.59 -264.725 -281.666 -296.475 -309.236 -320.034 -328.959 -336.088 -341.481 -345.208 -347.328 -347.901 -346.977 -344.606 -340.812 -335.6 -328.966 -320.872 -311.285 -300.158 -287.425 -273.043 -256.975 -239.186 -219.653 -198.356 -175.286 -150.465 -123.94 -95.7956 -66.1473 -35.1322 -2.91994 30.2711 64.1845 98.5454 133.018 167.253 200.864 233.465 264.663 294.056 321.25 345.886 367.606 386.099 401.099 412.38 419.765 423.14 422.414 417.56 408.614 395.647 378.786 358.191 334.087 306.736 276.445 243.585 208.581 171.887 133.986 95.3916 56.6238 18.1829 -19.3865 -55.6476 -90.2115 -122.75 -153.042 -180.913 -206.255 -229.02 -249.207 -266.871 -282.096 -294.998 -305.719 -314.432 -321.308 -326.509 -330.186 -332.475 -333.499 -333.357 -332.149 -329.914 -326.694 -322.499 -317.322 -311.132 -303.881 -295.506 -285.908 -274.977 -262.605 -248.678 -233.087 -215.728 -196.496 -175.293 -152.053 -126.745 -99.3779 -70.0238 -38.8062 -5.90323 28.4421 63.9116 100.162 136.787 173.324 209.303 244.196 277.481 308.636 337.156 362.578 384.488 402.518 416.364 425.814 430.716 431.016 426.734 417.961 404.863 387.666 366.669 342.218 314.701 284.563 252.267 218.289 183.105 147.147 110.85 74.6129 38.7316 3.30433 -30.7877 -63.5882 -94.9678 -124.781 -152.928 -179.318 -203.869 -226.52 -247.229 -265.978 -282.772 -297.648 -310.655 -321.842 -331.251 -338.913 -344.85 -349.082 -351.62 -352.475 -351.68 -349.278 -345.28 -339.687 -332.497 -323.699 -313.29 -301.262 -287.599 -272.3 -255.349 -236.749 -216.51 -194.632 -171.149 -146.12 -119.616 -91.748 -62.63 -32.3857 -1.08007 32.0522 65.0722 98.1251 131.012 163.548 195.402 226.266 255.798 283.622 309.413 332.839 353.554 371.279 385.747 396.736 404.063 407.593 407.129 402.772 394.579 382.689 367.261 348.541 326.81 302.388 275.679 247.062 216.936 185.743 153.874 121.727 89.6714 58.0286 27.3866 -0.974027 -29.3547 -56.6593 -82.5849 -106.961 -129.668 -150.646 -169.854 -187.287 -202.948 -216.852 -229.037 -239.537 -248.393 -255.652 -261.361 -265.571 -268.338 -269.736 -269.543 -267.941 -265.001 -260.757 -255.251 -248.507 -240.56 -231.442 -221.14 -209.653 168.343 202.626 236.594 269.597 301.176 330.65 357.57 381.466 401.892 418.519 431.048 439.194 442.791 441.449 435.324 424.613 409.506 390.252 367.14 340.552 310.963 278.795 244.516 208.674 171.75 134.252 96.6363 59.3388 22.9818 -10.84 -44.6495 -77.2161 -108.202 -137.409 -164.721 -190.069 -213.416 -234.769 -254.143 -271.573 -287.113 -300.821 -312.766 -323.009 -331.611 -338.626 -344.106 -348.098 -350.631 -351.728 -351.428 -349.445 -346.007 -341.081 -334.64 -326.661 -317.085 -305.851 -292.938 -278.296 -261.891 -243.714 -223.727 -201.943 -178.385 -153.081 -126.099 -97.5444 -67.5264 -36.2093 -3.78757 29.3334 63.3759 97.9011 132.603 167.159 201.233 234.464 266.468 296.845 325.172 351.001 373.9 393.444 409.238 420.966 428.386 431.339 429.715 423.55 412.957 398.091 379.169 356.482 330.37 301.233 269.517 235.682 200.237 163.671 126.459 89.0705 51.911 15.3495 -20.2482 -54.6634 -87.6717 -119.08 -148.727 -176.466 -202.165 -225.718 -247.06 -266.165 -283.061 -297.815 -310.517 -321.257 -330.129 -337.207 -342.554 -346.239 -348.322 -348.866 -347.92 -345.536 -341.739 -336.534 -329.918 -321.851 -312.298 -301.207 -288.51 -274.165 -258.13 -240.371 -220.866 -199.588 -176.526 -151.695 -125.145 -96.9581 -67.2473 -36.1472 -3.82542 29.5015 63.5775 98.1264 132.81 167.277 201.136 233.997 265.461 295.119 322.57 347.45 369.394 388.086 403.252 414.664 422.142 425.569 424.857 419.977 410.963 397.89 380.883 360.109 335.794 308.201 277.641 244.49 209.181 172.174 133.96 95.0595 56.0004 17.2837 -20.5247 -56.9832 -91.7039 -124.356 -154.719 -182.626 -207.972 -230.713 -250.852 -268.447 -283.588 -296.394 -307.013 -315.622 -322.396 -327.502 -331.095 -333.312 -334.272 -334.081 -332.835 -330.578 -327.352 -323.163 -318.005 -311.845 -304.64 -296.324 -286.79 -275.931 -263.635 -249.785 -234.271 -216.987 -197.824 -176.678 -153.475 -128.181 -100.8 -71.4006 -40.1025 -7.0828 27.4194 63.083 99.5618 136.45 173.279 209.574 244.8 278.422 309.91 338.748 364.462 386.63 404.877 418.891 428.453 433.406 433.699 429.356 420.468 407.203 389.797 368.554 343.827 316.014 285.57 252.967 218.691 183.221 146.999 110.46 74.0032 37.9267 2.40994 -31.8163 -64.7164 -96.1682 -126.036 -154.221 -180.636 -205.2 -227.854 -248.553 -267.281 -284.045 -298.886 -311.857 -323.01 -332.391 -340.03 -345.947 -350.161 -352.684 -353.526 -352.718 -350.309 -346.308 -340.72 -333.539 -324.753 -314.359 -302.347 -288.703 -273.422 -256.488 -237.902 -217.669 -195.79 -172.296 -147.242 -120.699 -92.7802 -63.598 -33.2767 -1.87439 31.4567 64.6199 97.8282 130.891 163.625 195.692 226.784 256.552 284.614 310.641 334.294 355.218 373.131 387.761 398.877 406.293 409.867 409.41 405.009 396.729 384.708 369.111 350.187 328.225 303.552 276.582 247.7 217.311 185.866 153.762 121.398 89.1516 57.3491 26.6091 -1.9568 -30.4322 -57.8046 -83.7763 -108.181 -130.899 -151.876 -171.071 -188.482 -204.115 -217.987 -230.135 -240.598 -249.416 -256.638 -262.309 -266.481 -269.21 -270.573 -270.355 -268.732 -265.773 -261.513 -255.995 -249.243 -241.289 -232.166 -221.861 -210.37 168.149 202.721 237.006 270.338 302.249 332.045 359.273 383.461 404.149 421.001 433.709 441.979 445.643 444.292 438.1 427.258 411.965 392.478 369.09 342.194 312.279 279.776 245.162 208.995 171.762 133.976 96.0998 58.5785 22.0652 -12.013 -45.9523 -78.6109 -109.66 -138.903 -166.228 -191.57 -214.896 -236.216 -255.55 -272.932 -288.42 -302.076 -313.97 -324.165 -332.723 -339.7 -345.145 -349.109 -351.621 -352.702 -352.385 -350.414 -346.995 -342.092 -335.681 -327.738 -318.201 -307.007 -294.134 -279.528 -263.155 -245.004 -225.037 -203.262 -179.704 -154.384 -127.369 -98.7627 -68.6751 -37.2702 -4.74052 28.5467 62.744 97.4427 132.346 167.127 201.447 234.946 267.233 297.908 326.542 352.675 375.863 395.673 411.691 423.594 431.13 434.14 432.506 426.273 415.554 400.513 381.37 358.424 332.02 302.569 270.521 236.353 200.579 163.702 126.2 88.5508 51.1627 14.409 -21.348 -55.8937 -89.0048 -120.498 -150.212 -178 -203.731 -227.295 -248.626 -267.7 -284.546 -299.241 -311.878 -322.556 -331.371 -338.396 -343.693 -347.334 -349.379 -349.89 -348.921 -346.523 -342.722 -337.526 -330.928 -322.89 -313.374 -302.321 -289.663 -275.358 -259.359 -241.633 -222.157 -200.901 -177.847 -153.008 -126.431 -98.199 -68.4225 -37.2326 -4.795 28.676 62.925 97.674 132.583 167.296 201.42 234.559 266.306 296.248 323.973 349.114 371.298 390.2 405.545 417.097 424.674 428.156 427.459 422.551 413.465 400.278 383.117 362.152 337.611 309.76 278.913 245.452 209.816 172.475 133.927 94.7007 55.3314 16.3179 -21.7456 -58.4143 -93.3003 -126.072 -156.509 -184.455 -209.804 -232.518 -252.604 -270.125 -285.176 -297.88 -308.389 -316.885 -323.55 -328.555 -332.06 -334.198 -335.091 -334.846 -333.56 -331.282 -328.048 -323.866 -318.727 -312.601 -305.445 -297.189 -287.725 -276.945 -264.73 -250.962 -235.53 -218.327 -199.239 -178.153 -154.992 -129.714 -102.319 -72.8727 -41.4899 -8.34678 26.3222 62.1915 98.9143 136.081 173.224 209.855 245.436 279.419 311.263 340.441 366.469 388.913 407.391 421.585 431.265 436.273 436.559 432.15 423.139 409.696 392.066 370.56 345.538 317.409 286.637 253.707 219.111 183.338 146.837 110.039 73.3502 37.0713 1.44246 -32.9192 -65.9229 -97.4493 -127.374 -155.598 -182.039 -206.618 -229.274 -249.963 -268.668 -285.4 -300.202 -313.134 -324.25 -333.601 -341.216 -347.112 -351.307 -353.816 -354.643 -353.82 -351.402 -347.4 -341.817 -334.646 -325.873 -315.494 -303.5 -289.876 -274.615 -257.7 -239.129 -218.904 -197.024 -173.518 -148.438 -121.855 -93.8812 -64.6314 -34.2303 -2.72646 30.8233 64.135 97.5066 130.757 163.7 195.996 227.33 257.351 285.668 311.945 335.84 356.989 375.104 389.905 401.157 408.668 412.292 411.839 407.394 399.019 386.859 371.08 351.939 329.73 304.789 277.54 248.373 217.705 185.992 153.636 121.041 88.5892 56.6134 25.7754 -3.00176 -31.5803 -59.0259 -85.0468 -109.481 -132.212 -153.186 -172.367 -189.754 -205.356 -219.193 -231.303 -241.727 -250.504 -257.685 -263.316 -267.448 -270.137 -271.461 -271.216 -269.57 -266.593 -262.316 -256.786 -250.024 -242.063 -232.935 -222.627 -211.133 167.935 202.814 237.436 271.118 303.383 333.522 361.077 385.575 406.543 423.636 436.536 444.938 448.672 447.313 441.047 430.067 414.577 394.841 371.159 343.934 313.671 280.812 245.841 209.327 171.766 133.675 95.5199 57.7549 21.0835 -13.2587 -47.3377 -80.0945 -111.209 -140.491 -167.829 -193.164 -216.466 -237.751 -257.04 -274.371 -289.805 -303.406 -315.244 -325.388 -333.899 -340.835 -346.245 -350.179 -352.668 -353.732 -353.397 -351.437 -348.038 -343.162 -336.783 -328.878 -319.382 -308.231 -295.4 -280.832 -264.495 -246.373 -226.426 -204.663 -181.106 -155.769 -128.719 -100.058 -69.897 -38.3989 -5.7546 27.7065 62.0655 96.9496 132.067 167.086 201.667 235.449 268.037 299.03 327.989 354.447 377.945 398.037 414.295 426.386 434.046 437.119 435.472 429.165 418.313 403.084 383.706 360.484 333.77 303.982 271.583 237.059 200.935 163.725 125.917 87.9905 50.3608 13.4031 -22.5212 -57.2038 -90.4225 -122.006 -151.789 -179.631 -205.395 -228.971 -250.29 -269.329 -286.121 -300.752 -313.319 -323.932 -332.686 -339.653 -344.898 -348.492 -350.496 -350.973 -349.978 -347.564 -343.76 -338.573 -331.996 -323.989 -314.513 -303.5 -290.884 -276.622 -260.661 -242.971 -223.527 -202.294 -179.251 -154.402 -127.798 -99.5192 -69.6739 -38.3898 -5.83011 27.7935 62.2253 97.1872 132.334 167.31 201.715 235.149 267.197 297.442 325.46 350.877 373.316 392.444 407.979 419.679 427.362 430.904 430.221 425.283 416.121 402.813 385.488 364.319 339.539 311.415 280.262 246.471 210.488 172.79 133.886 94.3139 54.6151 15.2831 -23.0514 -59.9434 -95.0025 -127.901 -158.416 -186.4 -211.751 -234.436 -254.466 -271.906 -286.861 -299.455 -309.847 -318.223 -324.771 -329.669 -333.078 -335.133 -335.955 -335.65 -334.325 -332.024 -328.782 -324.606 -319.487 -313.397 -306.295 -298.103 -288.714 -278.018 -265.889 -252.208 -236.865 -219.749 -200.74 -179.721 -156.605 -131.346 -103.937 -74.4419 -42.9703 -9.69701 25.1485 61.2347 98.2174 135.68 173.156 210.146 246.104 280.471 312.695 342.237 368.598 391.337 410.061 424.446 434.253 439.321 439.599 435.118 425.975 412.343 394.474 372.687 347.351 318.885 287.765 254.485 219.55 183.455 146.656 109.584 72.6524 36.1623 0.402232 -34.0978 -67.2087 -98.8125 -128.794 -157.061 -183.529 -208.123 -230.782 -251.46 -270.14 -286.836 -301.597 -314.486 -325.563 -334.881 -342.471 -348.345 -352.522 -355.013 -355.825 -354.987 -352.559 -348.556 -342.978 -335.817 -327.058 -316.696 -304.722 -291.12 -275.88 -258.985 -240.429 -220.213 -198.333 -174.815 -149.709 -123.083 -95.0517 -65.7309 -35.248 -3.63807 30.1521 63.6167 97.1591 130.608 163.773 196.312 227.904 258.194 286.781 313.326 337.479 358.867 377.196 392.18 403.579 411.191 414.867 414.421 409.927 401.452 389.143 373.171 353.798 331.325 306.099 278.552 249.083 218.117 186.119 153.496 120.655 87.9838 55.8203 24.8833 -4.1106 -32.7999 -60.3242 -86.3973 -110.863 -133.606 -154.577 -173.742 -191.103 -206.673 -220.471 -232.54 -242.922 -251.656 -258.794 -264.382 -268.472 -271.119 -272.4 -272.127 -270.457 -267.46 -263.166 -257.623 -250.851 -242.882 -233.75 -223.438 -211.941 167.698 202.902 237.884 271.936 304.577 335.08 362.983 387.808 409.075 426.426 439.53 448.071 451.878 450.511 444.169 433.042 417.342 397.342 373.346 345.771 315.141 281.902 246.551 209.669 171.76 133.346 94.8954 56.8681 20.0333 -14.5796 -48.8071 -81.6684 -112.853 -142.174 -169.525 -194.852 -218.128 -239.374 -258.616 -275.893 -291.268 -304.809 -316.589 -326.678 -335.14 -342.032 -347.405 -351.307 -353.771 -354.817 -354.467 -352.516 -349.138 -344.289 -337.946 -330.082 -320.628 -309.523 -296.737 -282.211 -265.911 -247.821 -227.896 -206.148 -182.591 -157.236 -130.149 -101.432 -71.1933 -39.5966 -6.83061 26.8111 61.3389 96.4204 131.764 167.034 201.891 235.972 268.879 300.208 329.515 356.317 380.145 400.539 417.054 429.343 437.137 440.265 438.613 432.227 421.234 405.806 386.179 362.663 335.618 305.474 272.701 237.798 201.303 163.74 125.607 87.3882 49.5032 12.3297 -23.77 -58.5947 -91.9262 -123.603 -153.461 -181.358 -207.158 -230.746 -252.052 -271.053 -287.788 -302.348 -314.841 -325.384 -334.073 -340.979 -346.169 -349.714 -351.675 -352.115 -351.091 -348.66 -344.853 -339.676 -333.122 -325.149 -315.714 -304.743 -292.175 -277.957 -262.036 -244.385 -224.976 -203.77 -180.738 -155.88 -129.247 -100.92 -71.0025 -39.6203 -6.93235 26.8524 61.4771 96.6642 132.064 167.318 202.021 235.767 268.135 298.701 327.03 352.742 375.45 394.818 410.554 422.412 430.208 433.813 433.145 428.175 418.932 405.496 387.997 366.612 341.579 313.165 281.688 247.546 211.196 173.118 133.837 93.8982 53.8501 14.1766 -24.4444 -61.5724 -96.8138 -129.845 -160.442 -188.464 -213.817 -236.469 -256.438 -273.793 -288.643 -301.12 -311.387 -319.634 -326.059 -330.843 -334.15 -336.116 -336.863 -336.494 -335.129 -332.804 -329.553 -325.383 -320.286 -314.235 -307.19 -299.065 -289.757 -279.15 -267.112 -253.524 -238.275 -221.251 -202.329 -181.382 -158.316 -133.078 -105.656 -76.11 -44.5459 -11.1351 23.8958 60.2105 97.4686 135.245 173.074 210.444 246.803 281.579 314.206 344.134 370.852 393.905 412.889 427.477 437.418 442.549 442.819 438.261 428.977 415.145 397.021 374.936 349.265 320.441 288.951 255.3 220.006 183.569 146.455 109.097 71.9083 35.1973 -0.711076 -35.3536 -68.5755 -100.259 -130.299 -158.61 -185.107 -209.716 -232.377 -253.043 -271.696 -288.353 -303.069 -315.912 -326.949 -336.233 -343.794 -349.646 -353.805 -356.278 -357.071 -356.218 -353.779 -349.774 -344.203 -337.053 -328.309 -317.965 -306.011 -292.433 -277.217 -260.343 -241.803 -221.598 -199.719 -176.189 -151.055 -124.384 -96.2926 -66.8972 -36.3305 -4.61219 29.4427 63.0638 96.784 130.442 163.844 196.639 228.505 259.079 287.954 314.783 339.21 360.852 379.409 394.588 406.142 413.862 417.595 417.155 412.611 404.029 391.562 375.384 355.764 333.011 307.481 279.618 249.828 218.546 186.247 153.34 120.239 87.3343 54.9731 23.9263 -5.285 -34.0922 -61.7008 -87.8288 -112.326 -135.082 -156.05 -175.197 -192.53 -208.064 -221.822 -233.848 -244.184 -252.873 -259.965 -265.508 -269.553 -272.156 -273.39 -273.087 -271.393 -268.374 -264.063 -258.505 -251.723 -243.746 -234.609 -224.294 -212.795 167.437 202.986 238.348 272.793 305.832 336.72 364.988 390.161 411.746 429.37 442.693 451.381 455.261 453.889 447.467 436.185 420.261 399.981 375.652 347.707 316.685 283.045 247.292 210.021 171.743 132.987 94.225 55.9207 18.909 -15.9784 -50.3625 -83.334 -114.592 -143.954 -171.317 -196.633 -219.881 -241.086 -260.277 -277.495 -292.808 -306.286 -318.004 -328.035 -336.445 -343.291 -348.624 -352.494 -354.932 -355.958 -355.597 -353.652 -350.293 -345.475 -339.17 -331.349 -321.941 -310.884 -298.145 -283.664 -267.404 -249.347 -229.447 -207.716 -184.16 -158.786 -131.662 -102.885 -72.5649 -40.8641 -7.96908 25.8582 60.5628 95.854 131.436 166.971 202.12 236.513 269.757 301.442 331.117 358.287 382.466 403.179 419.967 432.467 440.404 443.586 441.933 435.462 424.318 408.68 388.788 364.96 337.567 307.044 273.874 238.571 201.682 163.746 125.268 86.742 48.587 11.1875 -25.0954 -60.0684 -93.5175 -125.29 -155.228 -183.183 -209.02 -232.622 -253.915 -272.875 -289.546 -304.03 -316.443 -326.911 -335.532 -342.374 -347.506 -350.999 -352.915 -353.314 -352.26 -349.811 -346 -340.835 -334.305 -326.368 -316.976 -306.052 -293.535 -279.364 -263.486 -245.875 -226.504 -205.328 -182.309 -157.442 -130.78 -102.403 -72.4099 -40.9258 -8.1032 25.8511 60.6792 96.1027 131.769 167.318 202.335 236.413 269.119 300.026 328.684 354.707 377.701 397.321 413.271 425.297 433.212 436.885 436.231 431.228 421.9 408.328 390.645 369.032 343.731 315.01 283.191 248.68 211.939 173.458 133.778 93.4521 53.035 12.9959 -25.9268 -63.3039 -98.7377 -131.905 -162.587 -190.649 -216.002 -238.617 -258.52 -275.785 -290.524 -302.876 -313.009 -321.119 -327.412 -332.077 -335.275 -337.148 -337.815 -337.38 -335.972 -333.621 -330.36 -326.197 -321.122 -315.115 -308.127 -300.074 -290.853 -280.341 -268.399 -254.91 -239.76 -222.835 -204.007 -183.138 -160.125 -134.911 -107.478 -77.8792 -46.2186 -12.6628 22.5608 59.1173 96.6659 134.773 172.976 210.748 247.532 282.741 315.796 346.133 373.229 396.616 415.878 430.68 440.762 445.961 446.222 441.581 432.149 418.104 399.709 377.307 351.282 322.079 290.195 256.152 220.477 183.68 146.233 108.574 71.1158 34.1746 -1.8993 -36.6884 -70.0244 -101.79 -131.889 -160.245 -186.771 -211.397 -234.06 -254.714 -273.338 -289.953 -304.62 -317.414 -328.407 -337.654 -345.186 -351.016 -355.156 -357.609 -358.383 -357.511 -355.062 -351.056 -345.491 -338.354 -329.626 -319.301 -307.369 -293.816 -278.626 -261.774 -243.252 -223.059 -201.182 -177.64 -152.477 -125.76 -97.6044 -68.1305 -37.4771 -5.65268 28.695 62.4748 96.3798 130.258 163.909 196.976 229.131 260.007 289.186 316.316 341.033 362.944 381.743 397.13 408.848 416.684 420.478 420.045 415.446 406.752 394.118 377.72 357.838 334.788 308.936 280.738 250.607 218.99 186.372 153.167 119.791 86.6396 54.0727 22.9009 -6.52626 -35.4585 -63.1567 -89.3425 -113.873 -136.642 -157.604 -176.732 -194.034 -209.531 -223.245 -235.224 -245.513 -254.154 -261.198 -266.694 -270.691 -273.246 -274.43 -274.097 -272.377 -269.336 -265.006 -259.433 -252.64 -244.656 -235.513 -225.196 -213.694 167.15 203.063 238.826 273.686 307.147 338.441 367.095 392.634 414.556 432.472 446.025 454.87 458.821 457.449 450.943 439.496 423.336 402.759 378.078 349.74 318.305 284.24 248.063 210.38 171.714 132.597 93.5073 54.9132 17.7064 -17.4572 -52.0056 -85.0932 -116.428 -145.831 -173.206 -198.51 -221.726 -242.887 -262.024 -279.179 -294.427 -307.837 -319.49 -329.46 -337.813 -344.611 -349.904 -353.738 -356.149 -357.155 -356.785 -354.842 -351.505 -346.719 -340.453 -332.679 -323.319 -312.313 -299.624 -285.192 -268.975 -250.951 -231.081 -209.369 -185.814 -160.421 -133.257 -104.418 -74.013 -42.2023 -9.17005 24.8441 59.7365 95.2489 131.082 166.894 202.349 237.072 270.672 302.732 332.794 360.354 384.906 405.958 423.036 435.76 443.85 447.104 445.432 438.871 427.568 411.707 391.535 367.378 339.615 308.693 275.102 239.374 202.072 163.742 124.899 86.0497 47.6096 9.97523 -26.4987 -61.6266 -95.1976 -127.07 -157.091 -185.108 -210.984 -234.6 -255.878 -274.793 -291.396 -305.798 -318.127 -328.515 -337.063 -343.838 -348.91 -352.349 -354.215 -354.571 -353.484 -351.016 -347.201 -342.049 -335.545 -327.647 -318.3 -307.427 -294.964 -280.842 -265.009 -247.442 -228.112 -206.97 -183.965 -159.089 -132.397 -103.968 -73.8977 -42.3076 -9.34427 24.7877 59.83 95.5006 131.449 167.308 202.657 237.084 270.148 301.414 330.422 356.774 380.07 399.956 416.132 428.334 436.376 440.121 439.482 434.443 425.024 411.309 393.432 371.579 345.996 316.951 284.772 249.871 212.719 173.81 133.709 92.9738 52.1691 11.7386 -27.5008 -65.1412 -100.777 -134.086 -164.855 -192.956 -218.307 -240.883 -260.715 -277.884 -292.504 -304.722 -314.714 -322.677 -328.831 -333.368 -336.453 -338.228 -338.811 -338.305 -336.853 -334.474 -331.202 -327.046 -321.997 -316.034 -309.107 -301.13 -292.003 -281.59 -269.751 -256.365 -241.32 -224.502 -205.773 -184.988 -162.035 -136.847 -109.403 -79.7516 -47.9905 -14.2837 21.1413 57.9533 95.806 134.264 172.859 211.057 248.29 283.957 317.465 348.234 375.731 399.473 419.028 434.056 444.287 449.558 449.81 445.081 435.49 421.219 402.539 379.8 353.4 323.796 291.497 257.038 220.962 183.786 145.988 108.015 70.2724 33.0914 -3.16416 -38.1039 -71.5561 -103.406 -133.566 -161.968 -188.525 -213.168 -235.833 -256.474 -275.067 -291.635 -306.248 -318.99 -329.936 -339.145 -346.647 -352.455 -356.575 -359.008 -359.76 -358.867 -356.408 -352.4 -346.844 -339.72 -331.009 -320.704 -308.796 -295.27 -280.107 -263.278 -244.776 -224.596 -202.722 -179.17 -153.977 -127.211 -98.988 -69.4311 -38.688 -6.76244 27.9086 61.8483 95.9445 130.055 163.969 197.323 229.783 260.976 290.477 317.925 342.949 365.145 384.2 399.806 411.699 419.657 423.519 423.09 418.435 409.622 396.81 380.181 360.021 336.657 310.464 281.911 251.42 219.45 186.495 152.975 119.31 85.898 53.1176 21.8057 -7.83517 -36.9002 -64.6933 -90.9396 -115.504 -138.285 -159.242 -178.348 -195.617 -211.073 -224.741 -236.671 -246.91 -255.5 -262.494 -267.939 -271.887 -274.391 -275.52 -275.156 -273.409 -270.345 -265.994 -260.406 -253.602 -245.609 -236.462 -226.143 -214.638 166.835 203.132 239.318 274.616 308.521 340.243 369.303 395.227 417.506 435.732 449.53 458.539 462.559 461.192 454.599 442.979 426.569 405.677 380.625 351.871 319.999 285.487 248.862 210.746 171.67 132.173 92.7398 53.8451 16.4225 -19.018 -53.7385 -86.9476 -118.361 -147.808 -175.194 -200.482 -223.663 -244.778 -263.857 -280.945 -296.123 -309.461 -321.045 -330.951 -339.246 -345.993 -351.242 -355.041 -357.423 -358.407 -358.026 -356.088 -352.773 -348.021 -341.798 -334.072 -324.762 -313.809 -301.175 -286.794 -270.622 -252.636 -232.799 -211.106 -187.553 -162.141 -134.936 -106.033 -75.5379 -43.6123 -10.4353 23.7669 58.8586 94.6032 130.698 166.804 202.577 237.648 271.62 304.075 334.547 362.519 387.468 408.879 426.263 439.223 447.476 450.81 449.114 442.455 430.985 414.888 394.421 369.917 341.763 310.419 276.383 240.208 202.469 163.724 124.498 85.3084 46.5685 8.69129 -27.982 -63.2701 -96.9672 -128.944 -159.05 -187.132 -213.051 -236.682 -257.945 -276.811 -293.338 -307.652 -319.892 -330.194 -338.665 -345.37 -350.379 -353.761 -355.576 -355.886 -354.762 -352.274 -348.456 -343.318 -336.842 -328.984 -319.685 -308.868 -296.463 -282.392 -266.607 -249.086 -229.801 -208.696 -185.706 -160.822 -134.1 -105.618 -75.4677 -43.7671 -10.6574 23.6605 58.9272 94.8563 131.101 167.289 202.986 237.781 271.222 302.867 332.243 358.943 382.558 402.724 419.137 431.525 439.701 443.522 442.899 437.822 428.308 414.442 396.361 374.255 348.375 318.99 286.431 251.12 213.532 174.175 133.627 92.4617 51.2513 10.4015 -29.1688 -67.0868 -102.935 -136.39 -167.248 -195.387 -220.736 -243.268 -263.022 -280.089 -294.585 -306.661 -316.5 -324.309 -330.315 -334.717 -337.682 -339.354 -339.85 -339.27 -337.771 -335.362 -332.079 -327.931 -322.909 -316.992 -310.128 -302.234 -293.206 -282.898 -271.167 -257.89 -242.956 -226.251 -207.63 -186.935 -164.046 -138.887 -111.434 -81.7292 -49.8643 -16.0013 19.6357 56.7163 94.8855 133.715 172.723 211.368 249.074 285.226 319.213 350.438 378.357 402.476 422.342 437.608 447.996 453.341 453.585 448.762 439.003 424.493 405.511 382.418 355.622 325.593 292.855 257.958 221.459 183.884 145.719 107.415 69.3768 31.944 -4.50713 -39.6019 -73.1716 -105.108 -135.329 -163.778 -190.368 -215.028 -237.696 -258.322 -276.882 -293.401 -307.955 -320.64 -331.537 -340.706 -348.175 -353.961 -358.062 -360.475 -361.202 -360.287 -357.815 -353.807 -348.259 -341.15 -332.457 -322.174 -310.291 -296.793 -281.659 -264.856 -246.376 -226.209 -204.341 -180.779 -155.556 -128.739 -100.444 -70.7996 -39.9634 -7.94407 27.0835 61.1823 95.4766 129.832 164.021 197.677 230.459 261.987 291.827 319.61 344.957 367.455 386.78 402.618 414.695 422.783 426.719 426.294 421.579 412.641 399.642 382.767 362.314 338.617 312.064 283.136 252.266 219.923 186.614 152.762 118.793 85.1071 52.1037 20.6421 -9.212 -38.4188 -66.3124 -92.6212 -117.22 -140.012 -160.963 -180.045 -197.278 -212.691 -226.311 -238.189 -248.374 -256.912 -263.853 -269.245 -273.139 -275.59 -276.663 -276.264 -274.489 -271.401 -267.029 -261.424 -254.609 -246.608 -237.455 -227.134 -215.629 166.488 203.19 239.821 275.58 309.955 342.126 371.611 397.94 420.597 439.151 453.21 462.392 466.489 465.121 458.438 446.634 429.961 408.737 383.291 354.099 321.767 286.785 249.688 211.118 171.61 131.713 91.9187 52.715 15.0555 -20.6622 -55.5634 -88.8993 -120.395 -149.885 -177.281 -202.551 -225.694 -246.759 -265.776 -282.794 -297.897 -311.16 -322.671 -332.509 -340.742 -347.435 -352.639 -356.401 -358.754 -359.713 -359.319 -357.391 -354.096 -349.38 -343.202 -335.526 -326.269 -315.375 -302.799 -288.472 -272.347 -254.402 -234.601 -212.929 -189.378 -163.947 -136.701 -107.73 -77.1406 -45.0952 -11.7668 22.6242 57.9275 93.9154 130.285 166.698 202.804 238.238 272.601 305.472 336.375 364.782 390.151 411.943 429.651 442.86 451.284 454.697 452.982 446.218 434.57 418.225 397.447 372.577 344.011 312.222 277.718 241.071 202.873 163.689 124.065 84.5158 45.4615 7.33359 -29.5479 -64.9996 -98.8276 -130.911 -161.108 -189.258 -215.222 -238.868 -260.115 -278.928 -295.374 -309.592 -321.736 -331.948 -340.337 -346.971 -351.914 -355.235 -356.996 -357.257 -356.093 -353.585 -349.765 -344.641 -338.194 -330.379 -321.132 -310.376 -298.031 -284.014 -268.28 -250.808 -231.571 -210.506 -187.535 -162.643 -135.889 -107.353 -77.1213 -45.3064 -12.0445 22.4679 57.9681 94.1683 130.725 167.256 203.321 238.502 272.34 304.384 334.148 361.214 385.165 405.625 422.287 434.872 443.189 447.089 446.484 441.366 431.751 417.726 399.431 377.059 350.868 321.127 288.17 252.426 214.378 174.549 133.532 91.914 50.28 8.98072 -30.933 -69.1441 -105.213 -138.82 -169.767 -197.946 -223.288 -245.773 -265.444 -282.401 -296.765 -308.692 -318.369 -326.014 -331.864 -336.123 -338.963 -340.528 -340.933 -340.278 -338.724 -336.284 -332.991 -328.851 -323.858 -317.988 -311.19 -303.386 -294.46 -284.264 -272.647 -259.485 -244.669 -228.083 -209.576 -188.98 -166.161 -141.034 -113.572 -83.8138 -51.8432 -17.8179 18.0417 55.4033 93.9029 133.121 172.566 211.681 249.885 286.547 321.039 352.747 381.111 405.625 425.821 441.338 451.891 457.314 457.547 452.626 442.69 427.928 408.627 385.16 357.947 327.471 294.269 258.909 221.967 183.974 145.424 106.775 68.4283 30.7281 -5.92952 -41.1843 -74.8731 -106.896 -137.181 -165.677 -192.3 -216.979 -239.65 -260.261 -278.785 -295.25 -309.741 -322.365 -333.208 -342.335 -349.773 -355.534 -359.618 -362.01 -362.71 -361.769 -359.284 -355.276 -349.739 -342.646 -333.971 -323.71 -311.853 -298.387 -283.283 -266.508 -248.05 -227.9 -206.04 -182.469 -157.213 -130.343 -101.973 -72.2363 -41.3036 -9.20018 26.2198 60.4748 94.9736 129.586 164.065 198.037 231.157 263.037 293.234 321.371 347.059 369.873 389.484 405.567 417.838 426.064 430.077 429.657 424.879 415.81 402.613 385.48 364.717 340.669 313.736 284.414 253.144 220.408 186.726 152.527 118.238 84.2622 51.0211 19.4184 -10.6567 -40.0161 -68.0155 -94.3886 -119.023 -141.826 -162.768 -181.824 -199.019 -214.386 -227.953 -239.776 -249.905 -258.388 -265.274 -270.611 -274.45 -276.844 -277.858 -277.422 -275.616 -272.503 -268.108 -262.487 -255.66 -247.651 -238.493 -228.171 -216.665 166.107 203.237 240.335 276.578 311.447 344.09 374.019 400.771 423.829 442.733 457.066 466.432 470.614 469.241 462.462 450.465 433.514 411.94 386.08 356.425 323.608 288.131 250.54 211.492 171.531 131.216 91.0405 51.5171 13.607 -22.3908 -57.4825 -90.9503 -122.531 -152.065 -179.469 -204.718 -227.819 -248.831 -267.782 -284.724 -299.749 -312.932 -324.366 -334.133 -342.302 -348.938 -354.095 -357.819 -360.141 -361.075 -360.664 -358.745 -355.477 -350.797 -344.665 -337.041 -327.842 -317.009 -304.494 -290.225 -274.151 -256.249 -236.486 -214.837 -191.291 -165.841 -138.551 -109.51 -78.8232 -46.653 -13.1678 21.4162 56.9414 93.184 129.841 166.572 203.027 238.842 273.613 306.919 338.277 367.141 392.955 415.151 433.199 446.672 455.278 458.787 457.037 450.161 438.326 421.72 400.615 375.36 346.362 314.104 279.106 241.962 203.281 163.637 123.595 83.6697 44.2868 5.90009 -31.1987 -66.8167 -100.779 -132.974 -163.264 -191.486 -217.498 -241.162 -262.391 -281.147 -297.505 -311.618 -323.66 -333.778 -342.082 -348.641 -353.514 -356.771 -358.476 -358.684 -357.477 -354.949 -351.127 -346.018 -339.602 -331.832 -322.64 -311.95 -299.668 -285.709 -270.027 -252.606 -233.422 -212.402 -189.453 -164.552 -137.765 -109.174 -78.8601 -46.9276 -13.5076 21.2081 56.9507 93.4344 130.319 167.209 203.659 239.246 273.5 305.964 336.137 363.588 387.892 408.662 425.585 438.376 446.84 450.826 450.238 445.076 435.355 421.165 402.645 379.995 353.478 323.364 289.988 253.79 215.256 174.933 133.421 91.3289 49.2526 7.47382 -32.7978 -71.3163 -107.613 -141.378 -172.416 -200.633 -225.967 -248.4 -267.982 -284.822 -299.047 -310.816 -320.321 -327.792 -333.476 -337.585 -340.294 -341.748 -342.059 -341.323 -339.713 -337.239 -333.936 -329.806 -324.842 -319.021 -312.293 -304.583 -295.766 -285.688 -274.192 -261.15 -246.457 -229.997 -211.614 -191.124 -168.379 -143.29 -115.821 -86.0083 -53.9296 -19.735 16.3569 54.01 92.8563 132.482 172.385 211.994 250.72 287.918 322.942 355.158 383.992 408.922 429.467 445.249 455.976 461.478 461.699 456.677 446.553 431.526 411.888 388.028 360.375 329.428 295.738 259.892 222.484 184.052 145.101 106.091 67.4239 29.4414 -7.43303 -42.853 -76.6619 -108.772 -139.122 -167.666 -194.323 -219.021 -241.696 -262.291 -280.776 -297.183 -311.606 -324.163 -334.951 -344.034 -351.439 -357.176 -361.241 -363.612 -364.285 -363.311 -360.814 -356.808 -351.282 -344.206 -335.551 -325.313 -313.484 -300.05 -284.98 -268.233 -249.8 -229.671 -207.82 -184.24 -158.952 -132.026 -103.577 -73.7418 -42.7084 -10.5331 25.3177 59.7231 94.4332 129.316 164.098 198.403 231.878 264.126 294.698 323.208 349.254 372.401 392.312 408.653 421.13 429.5 433.594 433.182 428.339 419.131 405.726 388.32 367.231 342.813 315.481 285.743 254.052 220.904 186.832 152.268 117.644 83.3606 49.8564 18.1434 -12.1695 -41.694 -69.8045 -96.2434 -120.912 -143.725 -164.658 -183.685 -200.839 -216.157 -229.669 -241.434 -251.504 -259.929 -266.757 -272.036 -275.818 -278.153 -279.104 -278.63 -276.791 -273.652 -269.233 -263.595 -256.756 -248.738 -239.575 -229.254 -217.748 165.689 203.271 240.858 277.608 312.997 346.135 376.528 403.722 427.204 446.478 461.101 470.66 474.933 473.555 466.674 454.474 437.229 415.287 388.99 358.848 325.521 289.525 251.415 211.868 171.432 130.679 90.1021 50.2365 12.0857 -24.2045 -59.4983 -93.1029 -124.77 -154.348 -181.759 -206.983 -230.039 -250.994 -269.876 -286.737 -301.679 -314.778 -326.131 -335.823 -343.925 -350.502 -355.608 -359.293 -361.585 -362.492 -362.059 -360.153 -356.913 -352.271 -346.188 -338.619 -329.479 -318.712 -306.262 -292.054 -276.035 -258.179 -238.456 -216.832 -193.293 -167.823 -140.489 -111.376 -80.5882 -48.2881 -14.6406 20.1434 55.899 92.408 129.364 166.426 203.245 239.457 274.656 308.417 340.252 369.598 395.88 418.505 436.912 450.661 459.459 463.069 461.281 454.285 442.253 425.374 403.924 378.266 348.813 316.062 280.544 242.878 203.691 163.565 123.085 82.7685 43.0405 4.38877 -32.9372 -68.7235 -102.823 -135.133 -165.52 -193.818 -219.881 -243.564 -264.774 -283.468 -299.73 -313.732 -325.663 -335.683 -343.898 -350.38 -355.179 -358.369 -360.016 -360.168 -358.914 -356.365 -352.541 -347.447 -341.064 -333.341 -324.211 -313.59 -301.375 -287.477 -271.849 -254.481 -235.355 -214.386 -191.461 -166.55 -139.73 -111.082 -80.6851 -48.6329 -15.0487 19.8787 55.8733 92.6527 129.881 167.145 203.999 240.013 274.704 307.608 338.209 366.065 390.741 411.835 429.031 442.038 450.657 454.73 454.163 448.955 439.122 424.758 406.004 383.061 356.205 325.701 291.885 255.21 216.165 175.324 133.295 90.7043 48.1701 5.87532 -34.7677 -73.6051 -110.142 -144.066 -175.196 -203.449 -228.774 -251.152 -270.636 -287.353 -301.431 -313.032 -322.356 -329.643 -335.152 -339.103 -341.677 -343.013 -343.226 -342.408 -340.736 -338.228 -334.914 -330.795 -325.86 -320.089 -313.437 -305.826 -297.123 -287.17 -275.801 -262.885 -248.32 -231.995 -213.744 -193.368 -170.705 -145.655 -118.182 -88.3157 -56.1259 -21.7554 14.5774 52.5337 91.7427 131.795 172.175 212.304 251.581 289.341 324.923 357.674 387.001 412.37 433.282 449.343 460.254 465.836 466.044 460.914 450.594 435.286 415.295 391.02 362.906 331.464 297.261 260.904 223.007 184.116 144.748 105.361 66.3602 28.0826 -9.01923 -44.6105 -78.5397 -110.736 -141.153 -169.745 -196.437 -221.155 -243.834 -264.412 -282.856 -299.2 -313.55 -326.035 -336.764 -345.801 -353.173 -358.885 -362.932 -365.283 -365.927 -364.914 -362.403 -358.401 -352.889 -345.831 -337.196 -326.982 -315.182 -301.783 -286.748 -270.031 -251.628 -231.521 -209.682 -186.095 -160.772 -133.788 -105.256 -75.3163 -44.1774 -11.9445 24.3765 58.9243 93.8522 129.016 164.119 198.772 232.619 265.254 296.219 325.121 351.542 375.04 395.267 411.879 424.572 433.094 437.268 436.87 431.959 422.607 408.983 391.289 369.857 345.05 317.298 287.124 254.99 221.41 186.927 151.983 117.009 82.4 48.6048 16.8184 -13.7518 -43.4548 -71.6816 -98.1871 -122.889 -145.712 -166.634 -185.63 -202.74 -218.004 -231.459 -243.162 -253.171 -261.535 -268.303 -273.522 -277.243 -279.518 -280.402 -279.887 -278.015 -274.847 -270.402 -264.746 -257.896 -249.869 -240.702 -230.381 -218.877 165.23 203.29 241.388 278.669 314.606 348.261 379.137 406.791 430.721 450.389 465.317 475.08 479.448 478.065 471.077 458.663 441.11 418.78 392.025 361.37 327.506 290.966 252.312 212.243 171.312 130.101 89.1002 48.8636 10.4953 -26.1044 -61.6138 -95.3593 -127.114 -156.738 -184.153 -209.348 -232.353 -253.25 -272.057 -288.834 -303.688 -316.698 -327.966 -337.579 -345.612 -352.127 -357.18 -360.823 -363.086 -363.964 -363.504 -361.612 -358.403 -353.802 -347.769 -340.26 -331.182 -320.484 -308.102 -293.96 -277.999 -260.19 -240.51 -218.915 -195.384 -169.894 -142.516 -113.328 -82.4371 -50.0025 -16.1867 18.8047 54.7992 91.5852 128.852 166.258 203.457 240.081 275.725 309.962 342.296 372.151 398.927 422.004 440.79 454.831 463.83 467.577 465.718 458.593 446.355 429.188 407.379 381.297 351.367 318.1 282.035 243.82 204.102 163.474 122.534 81.8113 41.7172 2.79716 -34.7658 -70.7221 -104.96 -137.39 -167.878 -196.255 -222.371 -246.077 -267.266 -285.894 -302.052 -315.932 -327.745 -337.661 -345.785 -352.186 -356.909 -360.03 -361.614 -361.71 -360.403 -357.832 -354.006 -348.929 -342.579 -334.908 -325.845 -315.296 -303.152 -289.318 -273.745 -256.434 -237.371 -216.458 -193.561 -168.641 -141.785 -113.079 -82.5979 -50.4246 -16.6702 18.4766 54.7331 91.8198 129.407 167.062 204.341 240.8 275.949 309.313 340.365 368.645 393.709 415.146 432.627 445.861 454.641 458.809 458.259 453.003 443.055 428.511 409.509 386.261 359.051 328.139 293.865 256.688 217.108 175.722 133.154 90.038 47.0293 4.18291 -36.8464 -76.0126 -112.802 -146.888 -178.108 -206.398 -231.711 -254.03 -273.411 -289.996 -303.919 -315.343 -324.475 -331.565 -336.89 -340.677 -343.11 -344.323 -344.434 -343.542 -341.792 -339.248 -335.926 -331.818 -326.911 -321.192 -314.622 -307.113 -298.531 -288.711 -277.475 -264.69 -250.259 -234.076 -215.967 -195.714 -173.139 -148.134 -120.658 -90.7386 -58.4349 -23.8828 12.6999 50.971 90.5579 131.057 171.932 212.609 252.463 290.813 326.982 360.293 390.138 415.968 437.267 453.622 464.726 470.392 470.583 465.342 454.816 439.213 418.85 394.14 365.541 333.579 298.838 261.946 223.537 184.166 144.363 104.585 65.2341 26.6495 -10.6909 -46.4594 -80.509 -112.788 -143.273 -171.916 -198.643 -223.382 -246.067 -266.627 -285.027 -301.303 -315.572 -327.981 -338.647 -347.637 -354.975 -360.661 -364.691 -367.023 -367.636 -366.58 -364.053 -360.056 -354.56 -347.52 -338.906 -328.717 -316.949 -303.587 -288.588 -271.906 -253.534 -233.45 -211.626 -188.034 -162.675 -135.631 -107.011 -76.9603 -45.7092 -13.4334 23.394 58.0743 93.2306 128.669 164.124 199.143 233.38 266.418 297.797 327.109 353.924 377.789 398.348 415.246 428.166 436.847 441.102 440.723 435.743 426.239 412.385 394.389 372.595 347.38 319.187 288.555 255.957 221.924 187.013 151.671 116.331 81.3788 47.2586 15.4473 -15.4056 -45.3009 -73.6489 -100.221 -124.956 -147.786 -168.698 -187.659 -204.721 -219.929 -233.323 -244.961 -254.906 -263.206 -269.911 -275.068 -278.727 -280.938 -281.756 -281.194 -279.285 -276.088 -271.615 -265.942 -259.079 -251.044 -241.872 -231.553 -220.053 164.726 203.294 241.922 279.759 316.272 350.468 381.846 409.977 434.382 454.468 469.718 479.694 484.163 482.775 475.673 463.035 445.157 422.421 395.183 363.989 329.563 292.453 253.229 212.614 171.167 129.479 88.0312 47.3927 8.83613 -28.0931 -63.8317 -97.7218 -129.566 -159.234 -186.652 -211.813 -234.764 -255.598 -274.327 -291.013 -305.776 -318.691 -329.869 -339.401 -347.36 -353.812 -358.81 -362.408 -364.643 -365.492 -364.99 -363.122 -359.947 -355.389 -349.41 -341.962 -332.949 -322.325 -310.015 -295.944 -280.044 -262.281 -242.649 -221.087 -197.565 -172.057 -144.634 -115.371 -84.3704 -51.7972 -17.8075 17.3985 53.6407 90.713 128.301 166.068 203.66 240.713 276.821 311.555 344.411 374.802 402.098 425.651 444.836 459.184 468.393 472.26 470.347 463.086 450.633 433.165 410.978 384.452 354.023 320.212 283.575 244.785 204.508 163.356 121.938 80.7924 40.3266 1.10785 -36.6867 -72.8155 -107.189 -139.745 -170.339 -198.798 -224.971 -248.701 -269.869 -288.425 -304.47 -318.221 -329.905 -339.712 -347.744 -354.059 -358.704 -361.752 -363.273 -363.307 -361.943 -359.35 -355.522 -350.461 -344.147 -336.532 -327.54 -317.068 -304.999 -291.233 -275.717 -258.464 -239.471 -218.62 -195.755 -170.823 -143.931 -115.166 -84.5996 -52.3038 -18.3741 16.9999 53.5286 90.9335 128.898 166.959 204.683 241.607 277.236 311.081 342.603 371.329 396.801 418.595 436.376 449.846 458.794 463.058 462.528 457.222 447.156 432.422 413.161 389.595 362.015 330.677 295.925 258.221 218.081 176.126 132.993 89.3257 45.8224 2.39768 -39.0361 -78.5455 -115.596 -149.849 -181.157 -209.482 -234.781 -257.035 -276.307 -292.752 -306.511 -317.749 -326.677 -333.56 -338.69 -342.307 -344.592 -345.677 -345.681 -344.724 -342.879 -340.301 -336.97 -332.871 -327.994 -322.331 -315.845 -308.443 -299.99 -290.311 -279.214 -266.564 -252.273 -236.241 -218.283 -198.165 -175.683 -150.727 -123.252 -93.2791 -60.8596 -26.1203 10.7222 49.3184 89.2981 130.266 171.657 212.904 253.366 292.336 329.121 363.021 393.405 419.719 441.424 458.089 469.395 475.146 475.318 469.961 459.22 443.306 422.553 397.387 368.281 335.773 300.466 263.013 224.068 184.198 143.941 103.759 64.0408 25.1373 -12.452 -48.4018 -82.5714 -114.932 -145.484 -174.179 -200.942 -225.703 -248.393 -268.937 -287.289 -303.49 -317.673 -329.999 -340.599 -349.542 -356.843 -362.505 -366.518 -368.832 -369.413 -368.305 -365.762 -361.771 -356.293 -349.273 -340.681 -330.518 -318.782 -305.46 -290.501 -273.857 -255.518 -235.461 -213.655 -190.059 -164.661 -137.556 -108.844 -78.6743 -47.3024 -14.9933 22.3624 57.1687 92.5643 128.296 164.111 199.515 234.159 267.619 299.43 329.172 356.399 380.65 401.556 418.754 431.914 440.761 445.103 444.742 439.692 430.03 415.933 397.62 375.447 349.804 321.148 290.036 256.951 222.444 187.085 151.331 115.61 80.2945 45.8067 14.0381 -17.1343 -47.2351 -75.7088 -102.348 -127.114 -149.95 -170.849 -189.773 -206.783 -221.932 -235.261 -246.831 -256.708 -264.942 -271.582 -276.673 -280.268 -282.413 -283.164 -282.551 -280.603 -277.376 -272.873 -267.18 -260.307 -252.263 -243.085 -232.771 -221.276 164.172 203.281 242.458 280.875 317.996 352.756 384.655 413.279 438.188 458.717 474.305 484.505 489.088 487.687 480.465 467.592 449.373 426.21 398.466 366.705 331.691 293.984 254.164 212.979 170.995 128.811 86.8926 45.815 7.11118 -30.1741 -66.1559 -100.193 -132.127 -161.84 -189.259 -214.38 -237.27 -258.04 -276.686 -293.275 -307.943 -320.758 -331.842 -341.288 -349.171 -355.557 -360.497 -364.049 -366.255 -367.075 -366.518 -364.681 -361.545 -357.032 -351.11 -343.727 -334.781 -324.236 -312.003 -298.007 -282.169 -264.454 -244.876 -223.349 -199.838 -174.314 -146.845 -117.503 -86.3893 -53.6739 -19.5051 15.9236 52.4205 89.7879 127.71 165.852 203.853 241.351 277.939 313.191 346.595 377.547 405.391 429.448 449.053 463.723 473.151 477.164 475.17 467.768 455.089 437.305 414.722 387.733 356.783 322.403 285.167 245.774 204.911 163.212 121.297 79.7112 38.861 -0.670607 -38.7011 -75.0056 -109.513 -142.198 -172.904 -201.449 -227.681 -251.439 -272.585 -291.064 -306.986 -320.596 -332.144 -341.836 -349.772 -355.999 -360.563 -363.536 -364.991 -364.962 -363.532 -360.918 -357.087 -352.044 -345.769 -338.215 -329.297 -318.904 -306.917 -293.222 -277.763 -260.571 -241.654 -220.873 -198.045 -173.098 -146.17 -117.346 -86.6932 -54.2737 -20.1647 15.446 52.2558 89.9893 128.346 166.83 205.023 242.431 278.563 312.912 344.925 374.117 400.015 422.184 440.278 453.995 463.118 467.484 466.973 461.616 451.425 436.493 416.96 393.064 365.1 333.319 298.067 259.814 219.088 176.535 132.81 88.5648 44.5278 0.539401 -41.339 -81.2111 -118.526 -152.952 -184.346 -212.702 -237.988 -260.17 -279.325 -295.621 -309.21 -320.251 -328.962 -335.625 -340.551 -343.991 -346.122 -347.074 -346.965 -345.917 -343.996 -341.385 -338.045 -333.954 -329.108 -323.504 -317.105 -309.816 -301.499 -291.969 -281.018 -268.508 -254.361 -238.488 -220.694 -200.721 -178.34 -153.437 -125.965 -95.941 -63.4035 -28.4709 8.64115 47.5719 87.9598 129.414 171.346 213.187 254.285 293.906 331.335 365.854 396.805 423.624 445.756 462.748 474.266 480.105 480.254 474.775 463.808 447.569 426.405 400.762 371.124 338.044 302.146 264.106 224.602 184.211 143.484 102.884 62.7803 23.5455 -14.304 -50.4388 -84.7281 -117.167 -147.786 -176.534 -203.335 -228.118 -250.816 -271.343 -289.643 -305.764 -319.852 -332.09 -342.621 -351.513 -358.779 -364.417 -368.413 -370.71 -371.259 -370.09 -367.529 -363.546 -358.088 -351.091 -342.522 -332.386 -320.683 -307.403 -292.489 -275.883 -257.581 -237.553 -215.769 -192.169 -166.733 -139.564 -110.757 -80.4595 -48.9562 -16.6048 21.2621 56.2029 91.8493 127.899 164.08 199.886 234.955 268.854 301.117 331.311 358.969 383.622 404.893 422.406 435.818 444.839 449.272 448.931 443.809 433.981 419.631 400.984 378.413 352.32 323.18 291.566 257.97 222.969 187.144 150.96 114.843 79.149 44.229 12.6049 -18.9427 -49.2608 -77.8641 -104.568 -129.363 -152.204 -173.09 -191.971 -208.927 -224.012 -237.274 -248.772 -258.578 -266.744 -273.316 -278.339 -281.867 -283.944 -284.621 -283.962 -281.968 -278.712 -274.173 -268.461 -261.576 -253.527 -244.342 -234.033 -222.546 163.561 203.252 242.994 282.016 319.778 355.125 387.562 416.694 442.138 463.139 479.083 489.516 494.218 492.805 485.457 472.336 453.761 430.15 401.875 369.52 333.889 295.559 255.115 213.338 170.792 128.097 85.6842 44.1156 5.32773 -32.352 -68.5904 -102.775 -134.799 -164.558 -191.974 -217.049 -239.872 -260.577 -279.135 -295.62 -310.189 -322.898 -333.883 -343.24 -351.043 -357.361 -362.242 -365.746 -367.923 -368.714 -368.086 -366.289 -363.196 -358.73 -352.869 -345.554 -336.677 -326.217 -314.065 -300.147 -284.374 -266.709 -247.19 -225.701 -202.205 -176.666 -149.151 -119.728 -88.4956 -55.6343 -21.2806 14.3781 51.1359 88.8093 127.08 165.61 204.034 241.993 279.078 314.87 348.846 380.387 408.807 433.393 453.441 468.448 478.103 482.278 480.187 472.64 459.727 441.613 418.619 391.144 359.649 324.673 286.81 246.783 205.309 163.034 120.605 78.5603 37.3135 -2.54738 -40.8131 -77.2946 -111.934 -144.751 -175.575 -204.21 -230.505 -254.294 -275.415 -293.81 -309.599 -323.057 -334.462 -344.032 -351.87 -358.008 -362.487 -365.382 -366.771 -366.674 -365.169 -362.534 -358.702 -353.678 -347.445 -339.955 -331.114 -320.804 -308.906 -295.287 -279.885 -262.755 -243.919 -223.219 -200.432 -175.467 -148.5 -119.62 -88.8799 -56.336 -22.0423 13.8152 50.9147 88.9891 127.756 166.68 205.358 243.27 279.93 314.804 347.329 377.009 403.354 425.911 444.333 458.308 467.614 472.087 471.595 466.186 455.867 440.727 420.912 396.67 368.306 336.065 300.293 261.465 220.126 176.947 132.601 87.7497 43.1087 -1.36476 -43.7606 -84.0149 -121.597 -156.2 -187.679 -216.062 -241.332 -263.437 -282.465 -298.606 -312.016 -322.85 -331.331 -337.762 -342.474 -345.727 -347.698 -348.512 -348.286 -347.132 -345.141 -342.498 -339.15 -335.068 -330.254 -324.711 -318.401 -311.231 -303.059 -293.685 -282.886 -270.521 -256.523 -240.819 -223.2 -203.384 -181.112 -156.265 -128.802 -98.7284 -66.0704 -30.9397 6.45068 45.7288 86.542 128.497 170.998 213.459 255.219 295.521 333.624 368.79 400.335 427.682 450.262 467.598 479.338 485.268 485.394 479.786 468.584 452.003 430.41 404.268 374.074 340.396 303.877 265.222 225.134 184.199 142.988 101.951 61.4466 21.8675 -16.2521 -52.5763 -86.9822 -119.498 -150.182 -178.984 -205.822 -230.629 -253.335 -273.844 -292.091 -308.124 -322.109 -334.253 -344.711 -353.552 -360.781 -366.396 -370.377 -372.658 -373.174 -371.931 -369.355 -365.381 -359.946 -352.974 -344.429 -334.32 -322.652 -309.418 -294.551 -277.987 -259.723 -239.726 -217.967 -194.368 -168.891 -141.658 -112.75 -82.3166 -50.6693 -18.2172 20.0409 55.1696 91.0848 127.469 164.028 200.253 235.767 270.123 302.859 333.525 361.632 386.707 408.36 426.203 439.878 449.083 453.61 453.292 448.096 438.096 423.48 404.482 381.494 354.931 325.283 293.145 259.014 223.495 187.185 150.557 114.032 77.946 42.5403 11.1287 -20.8385 -51.3812 -80.1175 -106.884 -131.705 -154.549 -175.422 -194.256 -211.153 -226.17 -239.361 -250.784 -260.515 -268.61 -275.112 -280.065 -283.524 -285.531 -286.125 -285.423 -283.381 -280.094 -275.518 -269.785 -262.887 -254.834 -245.642 -235.34 -223.865 162.886 203.207 243.525 283.177 321.618 357.577 390.569 420.22 446.234 467.737 484.053 494.73 499.552 498.131 490.651 477.27 458.321 434.242 405.411 372.432 336.157 297.176 256.079 213.687 170.557 127.333 84.4066 42.2892 3.48496 -34.6331 -71.1398 -105.472 -137.584 -167.389 -194.801 -219.821 -242.571 -263.209 -281.674 -298.047 -312.514 -325.112 -335.994 -345.256 -352.977 -359.225 -364.044 -367.497 -369.647 -370.411 -369.706 -367.945 -364.901 -360.484 -354.685 -347.442 -338.639 -328.269 -316.2 -302.366 -286.661 -269.046 -249.592 -228.146 -204.671 -179.114 -151.551 -122.045 -90.6914 -57.6805 -23.1367 12.7576 49.7815 87.7742 126.405 165.336 204.199 242.635 280.235 316.59 351.164 383.325 412.351 437.494 458.009 473.366 483.255 487.61 485.399 477.703 464.546 446.086 422.661 394.677 362.616 327.015 288.497 247.807 205.695 162.823 119.861 77.3436 35.6864 -4.51823 -43.0183 -79.6765 -114.448 -147.401 -178.35 -207.079 -233.441 -257.267 -278.363 -296.668 -312.312 -325.605 -336.857 -346.3 -354.036 -360.084 -364.476 -367.289 -368.609 -368.442 -366.847 -364.198 -360.366 -355.361 -349.175 -341.753 -332.991 -322.773 -310.97 -297.429 -282.082 -265.015 -246.269 -225.662 -202.921 -177.933 -150.925 -121.99 -91.1663 -58.4992 -24.0137 12.0995 49.4995 87.9248 127.117 166.502 205.686 244.125 281.336 316.758 349.819 380.006 406.82 429.786 448.549 462.793 472.287 476.868 476.395 470.932 460.479 445.122 425.013 400.412 371.633 338.914 302.601 263.172 221.193 177.36 132.369 86.8855 41.6117 -3.35845 -46.3009 -86.9574 -124.814 -159.594 -191.157 -219.562 -244.813 -266.838 -285.727 -301.705 -314.93 -325.548 -333.784 -339.968 -344.456 -347.514 -349.32 -349.992 -349.644 -348.377 -346.315 -343.638 -340.282 -336.211 -331.431 -325.948 -319.733 -312.691 -304.67 -295.461 -284.821 -272.604 -258.758 -243.233 -225.804 -206.157 -184 -159.215 -131.766 -101.644 -68.8652 -33.5334 4.14393 43.7843 85.0376 127.507 170.604 213.713 256.167 297.181 335.991 371.838 404.005 431.904 454.951 472.649 484.619 490.64 490.74 484.996 473.548 456.608 434.566 407.9 377.124 342.819 305.651 266.352 225.658 184.16 142.449 100.963 60.0435 20.1081 -18.2921 -54.8128 -89.3289 -121.918 -152.668 -181.525 -208.402 -233.235 -255.951 -276.444 -294.633 -310.572 -324.445 -336.486 -346.868 -355.656 -362.85 -368.442 -372.41 -374.678 -375.161 -373.829 -371.239 -367.277 -361.871 -354.925 -346.402 -336.32 -324.688 -311.503 -296.688 -280.167 -261.946 -241.98 -220.252 -196.658 -171.136 -143.84 -114.827 -84.2458 -52.4401 -19.8333 18.698 54.0667 90.2619 127.027 163.959 200.617 236.593 271.422 304.653 335.814 364.389 389.905 411.957 430.147 444.099 453.496 458.125 457.827 452.555 442.377 427.482 408.116 384.691 357.636 327.458 294.771 260.08 224.023 187.206 150.118 113.176 76.6906 40.7603 9.58633 -22.8304 -53.6 -82.4724 -109.298 -134.141 -156.985 -177.846 -196.627 -213.461 -228.407 -241.524 -252.867 -262.521 -270.542 -276.972 -281.85 -285.239 -287.174 -287.678 -286.934 -284.843 -281.521 -276.905 -271.151 -264.24 -256.186 -246.985 -236.692 -225.233 162.137 203.151 244.048 284.356 323.517 360.11 393.675 423.853 450.476 472.515 489.218 500.147 505.088 503.668 496.049 482.398 463.056 438.487 409.073 375.44 338.492 298.835 257.055 214.024 170.284 126.519 83.062 40.354 1.55901 -37.0255 -73.8091 -108.285 -140.484 -170.336 -197.741 -222.697 -245.367 -265.938 -284.303 -300.558 -314.919 -327.399 -338.172 -347.337 -354.973 -361.146 -365.903 -369.301 -371.427 -372.167 -371.369 -369.648 -366.659 -362.292 -356.56 -349.396 -340.667 -330.392 -318.409 -304.664 -289.031 -271.465 -252.083 -230.685 -207.233 -181.66 -154.048 -124.456 -92.9774 -59.8135 -25.0731 11.0611 48.3557 86.6822 125.685 165.031 204.343 243.271 281.402 318.341 353.538 386.35 416.014 441.743 462.75 478.476 488.605 493.197 490.806 482.962 469.553 450.732 426.859 398.349 365.696 329.445 290.24 248.854 206.08 162.589 119.067 76.0605 33.9713 -6.59038 -45.3273 -82.1597 -117.063 -150.154 -181.236 -210.063 -236.496 -260.365 -281.434 -299.639 -315.127 -328.236 -339.324 -348.635 -356.266 -362.223 -366.526 -369.255 -370.505 -370.266 -368.564 -365.91 -362.078 -357.091 -350.954 -343.602 -334.925 -324.806 -313.106 -299.646 -284.352 -267.35 -248.701 -228.2 -205.509 -180.49 -153.44 -124.453 -93.547 -60.7609 -26.0727 10.3034 48.0129 86.7976 126.428 166.292 206 244.987 282.774 318.771 352.388 383.105 410.403 433.797 452.919 467.443 477.135 481.836 481.376 475.859 465.269 449.688 429.272 404.297 375.088 341.874 305.005 264.953 222.301 177.788 132.122 85.9769 40.0494 -5.45892 -48.9681 -90.0472 -128.184 -163.141 -194.783 -223.208 -248.435 -270.375 -289.112 -304.918 -317.951 -328.339 -336.316 -342.242 -346.495 -349.351 -350.988 -351.512 -351.039 -349.698 -347.513 -344.804 -341.443 -337.383 -332.636 -327.212 -321.097 -314.19 -306.328 -297.295 -286.822 -274.758 -261.07 -245.732 -228.507 -209.044 -187.01 -162.29 -134.858 -104.691 -71.7923 -36.2539 1.71865 41.7362 83.4414 126.448 170.158 213.943 257.118 298.875 338.424 374.979 407.8 436.281 459.817 477.895 490.108 496.225 496.297 490.413 478.706 461.391 438.879 411.669 380.287 345.329 307.482 267.509 226.186 184.104 141.872 99.921 58.5686 18.26 -20.4338 -57.1568 -91.7786 -124.434 -155.253 -184.164 -211.08 -235.94 -258.671 -279.147 -297.274 -313.108 -326.858 -338.788 -349.089 -357.823 -364.981 -370.552 -374.511 -376.767 -377.219 -375.777 -373.178 -369.231 -363.857 -356.939 -348.44 -338.385 -326.792 -313.66 -298.902 -282.426 -264.247 -244.316 -222.625 -199.04 -173.471 -146.111 -116.988 -86.2491 -54.2692 -21.4581 17.2358 52.8892 89.3793 126.535 163.867 200.974 237.431 272.751 306.5 338.179 367.24 393.216 415.685 434.238 448.481 458.079 462.814 462.541 457.191 446.826 431.639 411.887 388.006 360.435 329.703 296.444 261.167 224.548 187.205 149.642 112.269 75.3887 38.9226 7.94223 -24.9282 -55.921 -84.9322 -111.811 -136.672 -159.514 -180.364 -199.086 -215.853 -230.723 -243.762 -255.022 -264.593 -272.54 -278.895 -283.696 -287.011 -288.874 -289.28 -288.496 -286.353 -282.994 -278.336 -272.56 -265.632 -257.584 -248.37 -238.088 -226.65 161.3 203.087 244.556 285.548 325.476 362.727 396.88 427.587 454.865 477.477 494.583 505.773 510.817 509.419 501.655 487.72 467.968 442.887 412.862 378.543 340.894 300.533 258.038 214.349 169.971 125.651 81.6518 38.3333 -0.477986 -39.5377 -76.6037 -111.219 -143.503 -173.402 -200.797 -225.678 -248.257 -268.765 -287.024 -303.149 -317.403 -329.757 -340.418 -349.481 -357.028 -363.126 -367.816 -371.159 -373.264 -373.986 -373.097 -371.409 -368.477 -364.158 -358.496 -351.413 -342.759 -332.583 -320.691 -307.042 -291.484 -273.964 -254.668 -233.32 -209.895 -184.306 -156.645 -126.965 -95.3559 -62.0364 -27.0936 9.28642 46.8592 85.5314 124.921 164.696 204.473 243.909 282.588 320.133 355.977 389.47 419.804 446.146 467.67 483.776 494.145 498.912 496.405 488.418 474.748 455.554 431.214 402.15 368.881 331.95 292.023 249.911 206.444 162.309 118.203 74.692 32.1561 -8.7703 -47.7405 -84.7395 -119.765 -153 -184.224 -213.148 -239.656 -263.575 -284.613 -302.706 -318.027 -330.939 -341.856 -351.035 -358.561 -364.426 -368.637 -371.278 -372.459 -372.146 -370.322 -367.667 -363.835 -358.866 -352.78 -345.502 -336.917 -326.905 -315.315 -301.942 -286.702 -269.763 -251.22 -230.846 -208.214 -183.156 -156.058 -127.021 -96.0288 -63.125 -28.2291 8.41807 46.449 85.6114 125.696 166.064 206.307 245.868 284.255 320.852 355.046 386.317 414.119 437.955 457.45 472.264 482.161 486.976 486.536 480.967 470.236 454.422 433.684 408.321 378.665 344.945 307.492 266.788 223.432 178.211 131.842 85.008 38.4093 -7.678 -51.7705 -93.2864 -131.705 -166.838 -198.549 -226.989 -252.194 -274.039 -292.606 -308.232 -321.067 -331.225 -338.931 -344.581 -348.589 -351.234 -352.698 -353.071 -352.466 -350.996 -348.73 -345.996 -342.632 -338.583 -333.867 -328.505 -322.495 -315.728 -308.032 -299.188 -288.889 -276.983 -263.454 -248.314 -231.309 -212.048 -190.143 -165.493 -138.082 -107.87 -74.8547 -39.1013 -0.825907 39.5821 81.7535 125.321 169.67 214.159 258.086 300.62 340.938 378.23 411.73 440.818 464.868 483.34 495.806 502.021 502.065 496.035 484.06 466.353 443.35 415.571 383.557 347.915 309.354 268.672 226.694 184.007 141.241 98.8062 57.0109 16.3093 -22.6845 -59.6074 -94.325 -127.036 -157.924 -186.892 -213.843 -238.73 -261.478 -281.936 -299.996 -315.718 -329.334 -341.146 -351.368 -360.049 -367.173 -372.726 -376.681 -378.928 -379.351 -377.772 -375.17 -371.24 -365.901 -359.015 -350.54 -340.514 -328.96 -315.887 -301.191 -284.76 -266.628 -246.733 -225.088 -201.518 -175.895 -148.474 -119.237 -88.3278 -56.1588 -23.0903 15.6513 51.6358 88.4353 125.972 163.747 201.322 238.281 274.107 308.398 340.619 370.185 396.642 419.546 438.479 453.027 462.835 467.68 467.434 462.006 451.447 435.953 415.797 391.438 363.329 332.019 298.163 262.272 225.069 187.178 149.126 111.312 74.0416 37.1064 6.1163 -27.1414 -58.347 -87.5008 -114.425 -139.3 -162.135 -182.978 -201.632 -218.328 -233.117 -246.077 -257.248 -266.734 -274.602 -280.882 -285.602 -288.841 -290.632 -290.934 -290.107 -287.91 -284.515 -279.806 -274.009 -267.065 -259.026 -249.799 -239.528 -228.117 160.358 203.024 245.043 286.748 327.497 365.428 400.186 431.415 459.402 482.627 500.151 511.612 516.772 515.387 507.47 493.242 473.06 447.444 416.78 381.741 343.36 302.268 259.025 214.657 169.613 124.73 80.1754 36.2694 -2.67135 -42.1793 -79.5305 -114.274 -146.638 -176.586 -203.97 -228.763 -251.243 -271.692 -289.839 -305.824 -319.97 -332.19 -342.735 -351.693 -359.149 -365.167 -369.788 -373.069 -375.158 -375.868 -374.825 -373.198 -370.336 -366.066 -360.478 -353.479 -344.895 -334.822 -323.025 -309.487 -294.013 -276.538 -257.342 -236.047 -212.658 -187.054 -159.344 -129.577 -97.8307 -64.3538 -29.2074 7.42837 45.2838 84.3102 124.096 164.313 204.572 244.537 283.779 321.957 358.475 392.684 423.727 450.717 472.783 489.285 499.887 504.744 502.198 494.073 480.133 460.548 435.72 406.079 372.175 334.535 293.858 250.99 206.806 162.006 117.303 73.2719 30.2767 -11.0311 -50.2357 -87.4024 -122.543 -155.936 -187.312 -216.328 -242.915 -266.892 -287.91 -305.885 -321.032 -333.731 -344.467 -353.512 -360.93 -366.697 -370.809 -373.357 -374.471 -374.095 -372.106 -369.461 -365.627 -360.676 -354.643 -347.444 -338.956 -329.056 -317.583 -304.303 -289.117 -272.238 -253.817 -233.593 -211.027 -185.928 -158.784 -129.695 -98.6259 -65.6058 -30.5029 6.42323 44.7812 84.3396 124.891 165.782 206.586 246.748 285.762 322.989 357.783 389.634 417.963 442.265 462.151 477.268 487.375 492.309 491.88 486.258 475.382 459.324 438.251 412.489 382.37 348.134 310.077 268.696 224.607 178.654 131.565 84.0143 36.7257 -9.9879 -54.6862 -96.6578 -135.365 -170.678 -202.448 -230.894 -256.078 -277.825 -296.221 -311.661 -324.291 -334.215 -341.632 -346.985 -350.733 -353.161 -354.448 -354.668 -353.929 -352.459 -349.972 -347.215 -343.847 -339.806 -335.12 -329.821 -323.919 -317.298 -309.777 -301.131 -291.013 -279.272 -265.904 -250.974 -234.21 -215.17 -193.405 -168.831 -141.447 -111.193 -78.0655 -42.0951 -3.50891 37.298 79.9523 124.101 169.116 214.342 259.052 302.405 343.533 381.598 415.804 445.527 470.117 489 501.726 508.038 508.047 501.866 489.609 471.491 447.979 419.605 386.933 350.578 311.269 269.854 227.204 183.893 140.582 97.649 55.4013 14.2856 -25.0214 -62.1472 -96.9545 -129.715 -160.68 -189.7 -216.683 -241.601 -264.369 -284.82 -302.815 -318.42 -331.895 -343.582 -353.721 -362.346 -369.431 -374.964 -378.918 -381.162 -381.564 -379.78 -377.195 -373.289 -367.992 -361.142 -352.691 -342.693 -331.179 -318.172 -303.544 -287.161 -269.083 -249.225 -227.639 -204.092 -178.412 -150.931 -121.578 -90.4835 -58.1133 -24.7253 13.9352 50.3054 87.4291 125.337 163.596 201.662 239.141 275.489 310.345 343.135 373.224 400.182 423.541 442.871 457.738 467.766 472.72 472.51 467.003 456.243 440.428 419.847 394.988 366.318 334.404 299.928 263.393 225.584 187.121 148.566 110.299 72.652 35.3492 4.06765 -29.4776 -60.881 -90.1832 -117.142 -142.025 -164.849 -185.692 -204.266 -220.888 -235.589 -248.467 -259.545 -268.941 -276.73 -282.933 -287.568 -290.729 -292.446 -292.65 -291.763 -289.511 -286.089 -281.313 -275.496 -268.536 -260.513 -251.271 -241.011 -229.635 159.287 202.973 245.498 287.951 329.582 368.215 403.592 435.33 464.09 487.971 505.926 517.667 522.953 521.581 513.5 498.967 478.334 452.16 420.827 385.032 345.887 304.039 260.012 214.948 169.205 123.753 78.6308 34.2479 -5.11519 -44.9538 -82.5899 -117.451 -149.893 -179.897 -207.27 -231.958 -254.325 -274.717 -292.731 -308.556 -322.6 -334.677 -345.101 -353.949 -361.307 -367.239 -371.778 -374.983 -377.052 -377.742 -376.306 -375.001 -372.243 -368.031 -362.517 -355.6 -347.072 -337.112 -325.417 -312.006 -296.614 -279.171 -260.082 -238.842 -215.5 -189.888 -162.133 -132.287 -100.399 -66.7647 -31.4126 5.48993 43.633 83.024 123.216 163.886 204.64 245.149 284.963 323.795 361.014 395.969 427.761 455.435 478.073 494.99 505.828 510.917 508.19 499.939 485.72 465.732 440.401 410.164 375.604 337.225 295.767 252.107 207.174 161.683 116.35 71.7743 28.295 -13.4181 -52.8587 -90.1851 -125.419 -158.97 -190.504 -219.614 -246.277 -270.31 -291.3 -309.119 -324.051 -336.507 -347.036 -355.94 -363.251 -368.924 -372.938 -375.386 -376.428 -375.905 -373.781 -371.24 -367.42 -362.493 -356.522 -349.407 -341.022 -331.241 -319.899 -306.719 -291.57 -274.738 -256.452 -236.4 -213.906 -188.76 -161.581 -132.453 -101.31 -68.1854 -32.8655 4.34443 43.0324 82.9998 124.033 165.469 206.84 247.627 287.289 325.178 360.588 393.046 421.92 446.707 467.003 482.439 492.768 497.841 497.411 491.741 480.723 464.411 442.99 416.813 386.226 351.462 312.785 270.699 225.844 179.125 131.279 82.982 34.975 -12.4177 -57.7542 -100.183 -139.171 -174.66 -206.472 -234.921 -260.078 -281.714 -299.914 -315.147 -327.562 -337.232 -344.35 -349.395 -352.879 -355.087 -356.201 -356.265 -355.383 -353.656 -351.163 -348.416 -345.056 -341.026 -336.37 -331.141 -325.351 -318.885 -311.55 -303.111 -293.179 -281.604 -268.394 -253.682 -237.183 -218.382 -196.767 -172.28 -144.936 -114.649 -81.4196 -45.2316 -6.32076 34.8833 78.0446 122.785 168.489 214.484 260.003 304.209 346.179 385.051 419.995 450.383 475.547 494.865 507.867 514.276 514.252 507.917 495.368 476.824 452.784 423.794 390.437 353.346 313.257 271.083 227.726 183.765 139.895 96.4326 53.7176 12.156 -27.485 -64.8206 -99.6962 -132.487 -163.527 -192.603 -219.617 -244.562 -267.346 -287.778 -305.683 -321.135 -334.432 -345.968 -356.005 -364.57 -371.611 -377.117 -381.065 -383.301 -383.56 -381.688 -379.223 -375.371 -370.132 -363.316 -354.879 -344.899 -333.432 -320.496 -305.946 -289.605 -271.582 -251.764 -230.255 -206.748 -181.005 -153.478 -124.007 -92.7152 -60.1366 -26.4013 12.1193 48.8945 86.3543 124.674 163.409 201.987 240.009 276.893 312.342 345.728 376.357 403.837 427.67 447.417 462.619 472.875 477.935 477.77 472.185 461.216 445.064 424.038 398.658 369.402 336.858 301.738 264.527 226.09 187.032 147.96 109.226 71.2173 33.6559 1.78559 -31.9404 -63.5233 -92.9817 -119.961 -144.846 -167.653 -188.507 -206.987 -223.533 -238.141 -250.935 -261.913 -271.216 -278.924 -285.047 -289.594 -292.676 -294.316 -294.433 -293.465 -291.151 -287.723 -282.849 -277.021 -270.046 -262.045 -252.79 -242.534 -231.205 158.051 202.95 245.907 289.147 331.735 371.088 407.103 439.317 468.93 493.517 511.911 523.941 529.36 528.003 519.749 504.898 483.791 457.038 425.005 388.416 348.477 305.845 260.992 215.219 168.739 122.717 77.0095 32.341 -7.8806 -47.8627 -85.7978 -120.769 -153.276 -183.318 -210.645 -235.208 -257.459 -277.803 -295.652 -311.247 -324.987 -336.527 -346.023 -353.352 -358.41 -361.079 -361.333 -359.296 -355.494 -350.071 -343.454 -337.352 -332.685 -329.669 -328.002 -326.862 -326.076 -324.433 -320.447 -312.675 -299.183 -281.784 -262.791 -241.653 -218.395 -192.773 -164.967 -135.054 -103.033 -69.254 -33.7018 3.47102 41.9064 81.676 122.288 163.429 204.69 245.762 286.162 325.668 363.614 399.346 431.921 460.313 483.549 500.893 511.959 516.936 514.356 505.999 491.494 471.092 445.239 414.377 379.137 339.983 297.712 253.222 207.497 161.304 115.313 70.1919 26.2175 -15.8973 -55.5341 -92.9848 -128.237 -161.866 -193.435 -222.398 -248.648 -271.753 -290.813 -305.218 -315.079 -320.995 -323.661 -323.619 -321.461 -318.186 -314.859 -312.21 -310.652 -310.33 -310.858 -312.583 -314.587 -316.77 -318.821 -320.351 -320.818 -319.507 -315.541 -307.494 -293.988 -277.176 -259.037 -239.222 -216.839 -191.611 -164.397 -135.26 -104.059 -70.8549 -35.3155 2.18115 41.2054 81.5937 123.132 165.145 207.09 248.529 288.864 327.445 363.487 396.577 426.016 451.303 472.023 487.786 498.336 503.47 503.082 497.387 486.232 469.656 447.878 421.271 390.21 354.898 315.575 272.744 227.095 179.579 130.945 81.88 33.1545 -14.9449 -60.917 -103.782 -142.986 -178.527 -210.11 -238.152 -262.471 -282.443 -297.771 -308.777 -315.73 -319.317 -320.642 -320.774 -320.373 -319.936 -319.633 -319.667 -319.891 -319.882 -320.205 -320.607 -320.861 -320.873 -320.434 -319.424 -317.646 -314.839 -310.569 -304.347 -295.362 -283.921 -270.83 -256.362 -240.16 -221.646 -200.175 -175.77 -148.478 -118.183 -84.8696 -48.4843 -9.24067 32.3594 76.0498 121.399 167.812 214.613 260.97 306.064 348.906 388.618 424.324 455.4 481.166 500.936 514.227 520.738 520.655 514.173 501.324 482.337 457.749 428.113 394.044 356.186 315.276 272.309 228.207 183.581 139.143 95.137 51.9531 9.93363 -30.0392 -67.5565 -102.452 -135.209 -166.244 -195.255 -222.07 -246.605 -268.57 -287.401 -302.473 -313.596 -320.93 -324.784 -325.431 -323.301 -319.261 -314.32 -309.68 -306.483 -305.223 -305.876 -308.05 -310.801 -313.989 -317.306 -320.061 -321.505 -320.679 -316.352 -307.148 -291.98 -273.993 -254.237 -232.869 -209.437 -183.621 -156.069 -126.493 -94.9989 -62.2164 -28.1503 10.2536 47.4103 85.2032 124.01 163.195 202.299 240.883 278.315 314.385 348.398 379.582 407.608 431.935 452.117 467.672 478.166 483.334 483.215 477.556 466.371 449.866 428.373 402.447 372.58 339.38 303.593 265.672 226.586 186.905 147.306 108.087 69.7298 32.0507 -0.746637 -34.5239 -66.2728 -95.9054 -122.89 -147.774 -170.562 -191.435 -209.79 -226.251 -240.754 -253.463 -264.336 -273.541 -281.173 -287.22 -291.677 -294.676 -296.231 -296.28 -295.222 -292.827 -289.424 -284.406 -278.574 -271.592 -263.609 -254.346 -244.082 -232.816 156.604 202.977 246.253 290.33 333.961 374.049 410.722 443.361 473.926 499.272 518.11 530.44 535.998 534.658 526.22 511.038 489.434 462.083 429.314 391.892 351.128 307.683 261.961 215.469 168.208 121.626 75.3014 30.4512 -10.9415 -50.9111 -89.1194 -124.138 -156.686 -186.722 -213.658 -236.357 -252.246 -254.88 -233.8 -202.701 -173.578 -147.077 -123.313 -102.29 -84.1968 -69.3753 -58.9264 -52.7543 -50.1666 -51.4982 -56.3305 -63.565 -72.7032 -83.9417 -96.8776 -112.036 -130.19 -150.599 -173.62 -197.367 -218.964 -229.793 -232.354 -229.384 -218.029 -195.471 -167.653 -137.793 -105.667 -71.7611 -36.036 1.38297 40.11 80.2594 121.304 162.931 204.713 246.369 287.368 327.575 366.276 402.824 436.22 465.369 489.233 507.017 518.303 523.026 520.706 512.257 497.457 476.628 450.234 418.726 382.791 342.838 299.729 254.364 207.836 160.941 114.289 68.6456 24.1897 -18.2925 -58.0396 -95.5328 -130.602 -163.846 -193.944 -218.197 -232.705 -232.05 -212.373 -186.24 -162.118 -140.987 -122.687 -107.136 -94.5761 -85.2441 -79.0813 -75.7098 -74.581 -75.7009 -78.7993 -84.0114 -91.4481 -100.751 -111.852 -125.101 -140.787 -158.875 -179.12 -200.221 -218.413 -227.269 -230.173 -227.255 -216.256 -194.245 -167.052 -138.01 -106.799 -73.5541 -37.8192 -0.0606676 39.282 80.0972 122.157 164.779 207.315 249.43 290.467 329.778 366.473 400.225 430.253 456.059 477.222 493.328 504.105 509.307 508.935 503.219 491.922 475.072 452.927 425.878 394.334 358.461 318.472 274.887 228.415 180.095 130.68 80.8463 31.4526 -17.3262 -63.873 -107.064 -146.198 -180.871 -209.102 -228.354 -234.061 -222.679 -199.066 -175.888 -155.839 -140.146 -128.963 -121.538 -116.76 -114.077 -113.14 -113.936 -116.331 -119.979 -124.536 -129.965 -136.442 -144.114 -152.842 -162.384 -172.545 -183.381 -194.718 -206.165 -216.866 -224.367 -228.506 -229.604 -227.139 -219.191 -203.139 -179.11 -151.941 -121.715 -88.3295 -51.8014 -12.2531 29.7243 73.9464 119.928 167.067 214.715 261.943 307.964 351.718 392.311 428.808 460.596 486.991 507.235 520.825 527.437 527.26 520.635 507.476 488.029 462.87 432.565 397.765 359.112 317.349 273.559 228.706 183.406 138.392 93.866 50.2227 7.76375 -32.4987 -70.1311 -104.933 -137.424 -167.927 -195.304 -217.663 -231.935 -233.624 -218.47 -193.039 -168.228 -145.5 -125.062 -107.019 -91.7795 -79.6885 -70.6048 -64.3646 -61.0368 -60.6612 -63.2785 -68.2573 -75.3978 -84.8796 -97.5099 -113.656 -133.009 -155.152 -179.166 -202.925 -221.615 -229.369 -230.978 -225.521 -210.919 -186.021 -158.523 -128.961 -97.2724 -64.3193 -29.9635 8.37827 45.8629 83.9887 123.277 162.947 202.595 241.763 279.753 316.473 351.147 382.9 411.496 436.335 456.973 472.898 483.642 488.919 488.849 483.121 471.71 454.836 432.854 406.357 375.855 341.971 305.493 266.823 227.069 186.737 146.604 106.882 68.1836 30.4796 -3.51986 -37.2419 -69.1451 -98.949 -125.867 -150.73 -173.508 -194.424 -212.643 -229.025 -243.419 -256.043 -266.788 -275.822 -283.077 -287.603 -286.019 -281.726 -280.459 -280.928 -284.073 -286.414 -282.745 -277.14 -271.795 -266.075 -258.868 -250.828 -241.938 -232.512 154.876 203.077 246.513 291.486 336.265 377.1 414.454 447.437 479.083 505.245 524.524 537.164 542.867 541.547 532.917 517.392 495.264 467.296 433.754 395.457 353.838 309.553 262.908 215.703 167.606 120.472 73.4398 28.336 -13.975 -53.9522 -92.3688 -126.766 -153.97 -159.058 -130.182 -97.3781 -65.1506 -36.6047 -21.8453 -14.562 -9.23523 -5.27972 -2.53025 -0.845162 -0.0573512 0.040311 0.0461803 -0.0019172 -0.0598608 -0.142715 -0.233848 -0.348333 -0.51602 -0.755914 -1.09671 -1.6805 -2.64302 -4.22438 -7.18942 -12.5895 -22.8769 -41.679 -65.7208 -93.5584 -122.061 -142.978 -143.463 -132.34 -107.977 -74.0692 -38.316 -0.706825 38.2895 78.796 120.268 162.395 204.708 246.964 288.567 329.5 368.981 406.381 440.648 470.593 495.122 513.368 524.88 529.353 527.268 518.733 503.627 482.354 455.401 423.233 386.582 345.799 301.829 255.548 208.217 160.607 113.284 67.1306 22.1935 -20.5878 -60.252 -96.7829 -127.262 -145.485 -136.883 -109.257 -78.8787 -51.6318 -33.0685 -22.0037 -14.6463 -9.76962 -6.44963 -4.23781 -2.8778 -2.12693 -1.7605 -1.60839 -1.57196 -1.60985 -1.7274 -1.92997 -2.25881 -2.71842 -3.3493 -4.27276 -5.70179 -7.98365 -11.7797 -18.3897 -30.0189 -48.7456 -70.9372 -95.5882 -121.779 -141.351 -142.267 -131.895 -108.911 -76.0391 -40.2465 -2.27552 37.3202 78.533 121.124 164.371 207.512 250.325 292.085 332.161 369.528 403.978 434.622 460.965 482.59 499.06 510.078 515.355 514.973 509.248 497.809 480.675 458.148 430.638 398.603 362.162 321.493 277.139 229.821 180.682 130.481 79.8569 29.8136 -19.5839 -66.5421 -108.232 -138.414 -144.508 -120.233 -89.7446 -61.093 -39.6475 -27.0951 -18.6592 -12.9993 -9.31865 -7.04491 -5.65982 -4.75437 -4.15827 -3.82063 -3.70706 -3.77374 -4.02232 -4.40772 -4.8922 -5.51932 -6.36387 -7.49054 -8.94155 -10.8021 -13.2863 -16.7832 -21.8497 -29.5726 -41.4468 -56.7404 -74.2187 -93.9544 -115.423 -135.291 -142.839 -137.987 -121.738 -91.527 -54.9899 -15.242 27.0452 71.748 118.364 166.24 214.774 262.903 309.884 354.592 396.107 433.427 465.963 493.016 513.757 527.666 534.381 534.087 527.325 513.844 493.921 468.167 437.171 401.621 362.142 319.5 274.856 229.238 183.258 137.666 92.6353 48.5489 5.67535 -34.7951 -72.2092 -105.371 -132.1 -146.26 -136.021 -110.446 -82.3015 -56.1923 -36.4769 -24.444 -16.1707 -10.472 -6.54551 -3.91336 -2.31851 -1.47721 -1.1206 -1.0367 -1.06632 -1.13339 -1.21494 -1.3467 -1.54865 -1.85469 -2.36106 -3.21451 -4.62185 -6.97154 -11.0253 -18.2262 -31.19 -52.1167 -77.2799 -104.542 -130.884 -144.436 -140.963 -126.765 -99.2172 -66.2684 -31.7488 6.51662 44.2759 82.7192 122.485 162.672 202.88 242.653 281.204 318.604 353.976 386.309 415.501 440.873 461.987 478.302 489.307 494.692 494.674 488.883 477.239 459.976 437.481 410.389 379.226 344.63 307.44 267.979 227.545 186.528 145.853 105.586 66.5357 28.7644 -6.32699 -39.9706 -72.014 -101.977 -128.547 -152.116 -168.616 -164.063 -139.874 -115.064 -92.0289 -70.7766 -51.258 -33.8499 -19.579 -9.05163 -3.77352 -1.83264 -0.414761 0.00896853 -0.202759 -3.11615 -10.7657 -20.3608 -31.8716 -45.1967 -60.8088 -78.6375 -98.5525 -119.845 152.767 203.27 246.66 292.605 338.657 380.241 418.312 451.516 484.408 511.449 531.157 544.117 549.957 548.667 539.848 523.963 501.28 472.685 438.325 399.109 356.603 311.457 263.836 215.918 166.874 119.228 71.5603 26.185 -16.6712 -54.1416 -71.5603 -54.9524 -34.0011 -14.6589 -7.01625 -2.65999 -0.184676 0.159681 0.155434 0.143203 0.13653 0.125509 0.114732 0.100574 0.0828167 0.0673133 0.0653764 0.0617602 0.0565764 0.0504523 0.043014 0.0353799 0.0295191 0.0236795 0.0194257 0.0135992 0.00524904 -0.00456414 -0.027375 -0.0735612 -0.165449 -0.376498 -0.86506 -2.13226 -5.39875 -13.7192 -30.19 -48.818 -62.7478 -56.8035 -36.021 -2.58481 36.554 77.3582 119.21 161.829 204.674 247.546 289.76 331.442 371.723 410.013 445.197 475.985 501.212 519.944 531.701 535.615 534.013 525.405 509.975 488.236 460.695 427.838 390.452 348.785 303.926 256.695 208.499 160.124 112.101 65.4479 20.262 -21.0031 -52.0409 -59.9766 -47.9992 -30.7896 -15.7866 -7.26503 -2.39911 -0.259739 0.0200159 0.0384989 0.0487123 0.0520649 0.0429971 0.036105 0.0314738 0.0284575 0.0260587 0.0234825 0.0211308 0.0186795 0.0149672 0.0112301 0.00584979 -0.000448634 -0.0073939 -0.0167065 -0.0315486 -0.0555464 -0.0974771 -0.17516 -0.328079 -0.643154 -1.29456 -2.71642 -6.19627 -14.7514 -30.5398 -48.2531 -61.7891 -57.1299 -37.2083 -4.18198 35.5032 76.9793 120.068 163.913 207.68 251.221 293.727 334.604 372.652 407.831 439.117 466.023 488.128 504.979 516.249 521.553 521.134 515.437 503.858 486.421 463.49 435.497 402.953 365.924 324.539 279.366 231.144 181.093 130.049 78.5805 28.0137 -20.2786 -55.7202 -56.2316 -39.253 -20.8124 -9.8683 -3.73483 -0.757528 0.0251736 0.0431695 0.0543661 0.0542276 0.0338935 0.0207927 0.011299 0.00384363 -0.00263116 -0.00822728 -0.0133817 -0.0195147 -0.0271126 -0.0349309 -0.0424933 -0.0508634 -0.0617779 -0.0758878 -0.092881 -0.113205 -0.140269 -0.180585 -0.242282 -0.336953 -0.474281 -0.793312 -1.46637 -2.68738 -5.18338 -10.6562 -22.4982 -38.8765 -55.6525 -62.1715 -47.0839 -17.2905 24.5555 69.5869 116.764 165.329 214.773 263.846 311.83 357.524 400.007 438.177 471.496 499.242 520.505 534.749 541.573 541.075 534.206 520.399 499.975 473.606 441.885 405.558 365.214 321.653 276.116 229.687 182.987 136.826 91.262 46.7974 3.94781 -33.2939 -57.9815 -57.7566 -45.0097 -28.8564 -15.5018 -7.59664 -2.81886 -0.481687 0.0128066 0.0298175 0.0402606 0.045065 0.0464238 0.0392045 0.0355387 0.0340997 0.0328427 0.0311001 0.0294896 0.0273076 0.0238824 0.0211438 0.0181526 0.0146813 0.00874799 -0.0014674 -0.0175385 -0.0428822 -0.0858336 -0.163936 -0.321592 -0.664259 -1.45002 -3.31838 -7.90789 -19.0842 -36.161 -54.0658 -63.8115 -53.1759 -30.6486 4.74688 42.7377 81.4122 121.639 162.363 203.156 243.567 282.672 320.784 356.893 389.809 419.623 445.549 467.16 483.887 495.165 500.654 500.691 494.848 482.96 465.29 442.259 414.542 382.695 347.36 309.441 269.141 228.017 186.252 145.046 104.222 64.9296 27.0584 -8.87673 -41.6384 -68.0316 -71.1596 -55.295 -38.1772 -20.0361 -8.96953 -5.0372 -2.73899 -1.16279 -0.173106 0.252853 0.239257 0.218975 0.199854 0.147628 0.0703846 0.0284315 0.0273344 0.02498 -0.147325 -0.247471 -0.272823 -0.372096 -0.458528 -0.546371 -0.63115 -0.711696 -0.766615 150.246 203.541 246.661 293.646 341.143 383.477 422.312 455.555 489.915 517.899 538.009 551.304 557.263 556.006 547.022 530.754 507.478 478.258 443.023 402.844 359.428 313.393 264.688 216.066 166.184 118.105 69.7831 27.1872 7.4292 1.62806 0.707159 0.563085 0.431532 0.376445 0.320426 0.282676 0.244488 0.216488 0.186442 0.158996 0.142091 0.125927 0.111893 0.0963667 0.0800882 0.0662801 0.0631254 0.0596957 0.0548342 0.0491124 0.0426741 0.0359246 0.0314122 0.0276552 0.025656 0.0245718 0.0239308 0.024679 0.0252291 0.023827 0.0217767 0.0214681 0.0243755 0.0280691 0.0313561 0.0350206 0.0491203 0.0917153 0.229615 0.809678 3.42872 14.222 40.7555 76.341 118.226 161.265 204.607 248.096 290.918 333.388 374.496 413.71 449.858 481.533 507.5 526.738 538.777 541.94 540.964 532.269 516.488 494.247 466.076 432.48 394.338 351.704 305.887 257.619 208.455 159.296 110.707 64.9268 27.762 9.85779 2.07614 0.389094 0.200035 0.144163 0.112889 0.0890609 0.070555 0.0834044 0.0800212 0.0701901 0.0639468 0.0591158 0.0547197 0.0516756 0.0494784 0.0477778 0.04601 0.0441419 0.042627 0.0412667 0.0395682 0.0388564 0.0382513 0.0383225 0.0393151 0.0410803 0.0429648 0.0447674 0.0463193 0.0477412 0.0495136 0.051511 0.0560241 0.0614268 0.0664332 0.0725857 0.0909475 0.139776 0.284715 0.835447 3.25359 13.5991 40.0019 75.9782 119.117 163.478 207.839 252.117 295.404 337.136 375.854 411.783 443.734 471.215 493.822 511.071 522.617 527.923 527.443 521.794 510.062 492.284 468.917 440.407 407.309 369.654 327.478 281.369 232.109 181.095 129.263 77.6663 33.0513 10.0989 1.48938 0.381538 0.184012 0.151451 0.125782 0.0960075 0.0882565 0.0983146 0.0830013 0.0743152 0.0680408 0.0612903 0.0556076 0.050406 0.0459351 0.0421961 0.0390336 0.0362016 0.0334687 0.030584 0.02876 0.0278772 0.0275566 0.0276114 0.0280303 0.0290581 0.0309433 0.0336087 0.0367907 0.040077 0.0428701 0.0478815 0.0548276 0.0602876 0.0657953 0.0723967 0.0762494 0.0887977 0.118396 0.19831 0.483631 1.75475 8.08089 31.1984 68.4763 115.301 164.451 214.739 264.767 313.805 360.515 404.003 443.044 477.178 505.658 527.467 542.067 549.012 548.25 541.288 527.135 506.175 479.153 446.657 409.506 368.25 323.681 277.153 229.839 182.384 135.729 90.0058 48.1588 18.9609 6.33178 0.980045 0.291595 0.153275 0.118187 0.105447 0.07982 0.0638818 0.0688789 0.0751785 0.0647626 0.0588161 0.0544824 0.0513818 0.0489915 0.0480377 0.0479206 0.0473143 0.0459601 0.0444796 0.0428264 0.0408681 0.0401038 0.0397614 0.0399329 0.0400703 0.0399837 0.0398974 0.0398799 0.039521 0.0391407 0.0387184 0.0383916 0.0389533 0.0393806 0.0415844 0.0424756 0.0593691 0.115212 0.305908 1.10811 4.47716 18.2699 45.7867 80.24 120.791 161.992 203.383 244.441 284.141 323.007 359.912 393.402 423.867 450.364 472.491 489.655 501.22 506.809 506.9 501.019 488.878 470.78 447.189 418.82 386.27 350.17 311.496 270.293 228.504 185.986 144.407 103.038 63.791 28.6889 9.26354 2.93088 0.863665 0.611587 0.540289 0.470709 0.457827 0.420777 0.393252 0.368821 0.336321 0.288615 0.265956 0.24164 0.213339 0.190193 0.139805 0.0689689 0.0315726 0.0240926 0.0113804 -0.132842 -0.22817 -0.263558 -0.352263 -0.434424 -0.51713 -0.596571 -0.670242 -0.719327 147.176 203.769 246.563 294.529 343.718 386.788 426.481 459.498 495.623 524.611 545.077 558.728 564.771 563.565 554.445 537.769 513.854 484.016 447.849 406.665 362.264 315.284 265.541 216.379 165.336 115.5 67.2307 28.1357 8.86608 1.88991 0.758758 0.546872 0.427492 0.360705 0.305916 0.267242 0.234383 0.205874 0.178044 0.15245 0.135621 0.12022 0.106537 0.091644 0.0767476 0.0643013 0.0602384 0.0566565 0.0520352 0.0466648 0.0406545 0.034781 0.0304081 0.0267379 0.0247131 0.0236332 0.0227802 0.0232389 0.0238147 0.0223218 0.0205983 0.020249 0.0231113 0.0255889 0.0286425 0.032853 0.0464809 0.0826517 0.210981 0.753738 3.17173 13.3603 39.3585 74.6571 116.926 160.451 204.469 248.638 292.017 335.32 377.319 417.502 454.66 487.251 513.993 533.756 546.132 548.34 548.158 539.319 523.129 500.33 471.482 437.071 398.106 354.36 307.47 258.136 207.97 157.866 108.55 62.5168 25.9537 9.019 1.86056 0.368638 0.194684 0.128114 0.106174 0.0851995 0.0705482 0.0781604 0.0750852 0.0673169 0.0614199 0.0567316 0.0525815 0.0496106 0.0474099 0.0456887 0.0439854 0.0422264 0.0407809 0.039546 0.0381791 0.0373853 0.0368433 0.0369813 0.0378798 0.0394942 0.0412391 0.0428986 0.0443907 0.0457602 0.0474081 0.0492919 0.0529774 0.0570047 0.0617895 0.0692039 0.0867872 0.130467 0.26722 0.774492 3.03549 12.7121 38.4787 74.1121 117.738 162.898 207.988 253.046 297.102 339.765 379.172 415.872 448.506 476.559 499.682 517.332 529.176 534.493 533.946 528.341 516.419 498.253 474.396 445.307 411.591 373.223 330.11 282.947 232.639 180.598 127.748 75.2952 30.8615 9.13664 1.32164 0.356547 0.179342 0.141141 0.117989 0.0936014 0.0858758 0.0912515 0.0795836 0.0714246 0.0651941 0.0588116 0.0533262 0.0483554 0.0440698 0.0404651 0.037392 0.0346692 0.0320936 0.029838 0.0279434 0.0269725 0.0265691 0.026609 0.0270607 0.0280895 0.0298803 0.032398 0.0354372 0.0386115 0.0416075 0.0459404 0.0521541 0.0574548 0.0626292 0.0678712 0.0719488 0.0844051 0.111344 0.18347 0.434944 1.57914 7.2986 29.3765 66.0254 113.257 163.396 214.752 265.739 315.838 363.612 408.152 448.074 483.032 512.281 534.642 549.607 556.674 555.589 548.565 534.026 512.475 484.748 451.396 413.352 371.073 325.346 277.744 229.576 181.25 133.957 87.7919 45.9696 17.6384 5.76698 0.886888 0.275269 0.150412 0.106432 0.0970723 0.0764551 0.0634788 0.065834 0.0696583 0.0619441 0.0565199 0.0523931 0.0493729 0.0471084 0.0460735 0.0457748 0.045112 0.0438721 0.0424987 0.0409464 0.0394102 0.0385518 0.0381602 0.0382826 0.038401 0.0383239 0.0382486 0.0381576 0.0377981 0.0373403 0.0368483 0.0364004 0.0365441 0.0365151 0.0381166 0.0408744 0.0565328 0.105455 0.282088 1.05846 4.22055 17.0511 44.5574 79.0503 119.789 161.547 203.558 245.113 285.502 325.202 362.983 397.067 428.233 455.322 477.98 495.607 507.476 513.158 513.293 507.399 494.996 476.448 452.282 423.222 389.946 353.055 313.583 271.548 229.236 185.893 143.44 100.341 61.7065 28.8018 10.4183 3.49273 0.836384 0.629327 0.525237 0.46572 0.436609 0.399208 0.373599 0.349911 0.318188 0.27581 0.253289 0.229813 0.202689 0.178543 0.132166 0.0686598 0.033169 0.0205006 -0.000244491 -0.122682 -0.210877 -0.253347 -0.333867 -0.411585 -0.489269 -0.563455 -0.630651 -0.674334 99.44 198.378 245.312 295.543 346.432 390.121 430.8 463.251 501.554 531.608 552.359 566.399 572.508 571.362 562.114 545.01 520.415 489.968 452.775 410.488 365.091 317.36 266.375 210.093 128.193 46.4854 12.2841 1.83054 1.02918 0.702184 0.536759 0.44049 0.377553 0.330913 0.287128 0.252098 0.222933 0.195178 0.16934 0.145544 0.129037 0.114322 0.101066 0.0870172 0.0733346 0.0620597 0.0574477 0.0537156 0.0492447 0.0441763 0.0386038 0.0330664 0.0289903 0.0255987 0.0236425 0.0225153 0.0218127 0.0220932 0.0224488 0.0211011 0.0196341 0.019402 0.0214812 0.0233316 0.0248106 0.0254632 0.0272959 0.0299396 0.0369298 0.0609083 0.148973 0.524919 2.47784 13.3123 57.0057 123.239 191.009 246.454 292.834 337.159 380.129 421.383 459.651 493.21 520.755 541.066 553.838 555.641 555.67 546.59 529.922 506.487 476.877 441.503 401.564 356.574 308.455 256.491 194.828 114.014 43.6412 12.585 1.55042 0.535317 0.254134 0.153542 0.101492 0.0871328 0.0853905 0.075673 0.067144 0.0732916 0.0706118 0.0640978 0.0586214 0.0541413 0.0502521 0.0474093 0.0452565 0.0435543 0.0419112 0.0402611 0.0388978 0.0377617 0.0365208 0.0357416 0.0352858 0.0354529 0.0362743 0.0377502 0.0393641 0.0408792 0.0423065 0.043674 0.0452445 0.046974 0.0498653 0.0524614 0.0546175 0.056274 0.0580247 0.058711 0.0653282 0.0929438 0.177696 0.533821 2.45143 13.1781 58.0669 127.219 196.021 251.884 298.615 342.348 382.471 420.071 453.442 482.074 505.744 523.79 535.953 541.354 540.662 535.107 522.958 504.352 479.942 450.161 415.69 376.503 332.372 283.761 228.437 152.409 67.4227 19.0108 2.51533 0.678834 0.301644 0.162279 0.106737 0.108298 0.101943 0.0873461 0.0823071 0.085141 0.0757756 0.0681983 0.0621484 0.0561534 0.0509209 0.0461945 0.0421021 0.0386313 0.0356588 0.0330404 0.0306146 0.0285348 0.0267948 0.0258316 0.0253997 0.0254471 0.0259368 0.0269601 0.0286662 0.0310522 0.0339426 0.0369867 0.0400749 0.0442373 0.0495217 0.0536763 0.0561837 0.0584391 0.0614038 0.0644016 0.0666005 0.0713852 0.0875737 0.132083 0.329305 1.43374 9.0706 51.3247 127.431 204.721 265.758 317.763 366.736 412.444 453.303 489.119 519.188 542.095 557.415 564.549 563.19 556.085 541.09 518.871 490.348 456 416.913 373.478 326.505 277.14 223.345 152.314 76.3645 26.8464 6.18543 0.840864 0.374242 0.192533 0.120313 0.0818518 0.0752462 0.0790073 0.0682628 0.0600938 0.0625403 0.0649752 0.0588886 0.0539253 0.0500359 0.0471549 0.0450451 0.0439998 0.0435954 0.0428998 0.0417496 0.0404962 0.0390154 0.0376639 0.0368165 0.0364037 0.0364989 0.0366078 0.0365242 0.0364298 0.0362845 0.0359413 0.0355281 0.034926 0.0343004 0.0338258 0.0326235 0.0313929 0.0282181 0.0259322 0.0238179 0.0263578 0.054031 0.152645 0.622199 3.10646 15.2822 60.5302 126.091 191.191 243.556 286.617 327.299 365.911 400.646 432.664 460.396 483.616 501.738 513.933 519.72 519.852 513.988 501.316 482.281 457.52 427.699 393.698 356.17 315.889 272.673 226.203 162.948 90.8524 31.208 10.0761 1.46187 0.888301 0.631742 0.556242 0.500788 0.452898 0.423485 0.406121 0.376756 0.353455 0.331186 0.301659 0.26375 0.240865 0.218133 0.192127 0.167427 0.124649 0.0676055 0.0339329 0.0174109 -0.00878403 -0.113651 -0.195299 -0.241947 -0.315732 -0.388927 -0.461739 -0.530852 -0.59216 -0.631153 -2.9007 34.7799 159.387 284.253 348.346 393.64 435.095 466.559 507.717 538.905 559.848 574.332 580.553 579.42 570.032 552.486 527.141 496.028 457.76 414.52 367.851 310.931 200.978 75.0883 17.3314 2.47718 1.34037 0.884465 0.654908 0.539881 0.46306 0.401226 0.352189 0.311152 0.271499 0.239175 0.211503 0.184851 0.160715 0.138565 0.122518 0.10845 0.0956675 0.0824396 0.0698284 0.0595504 0.0546422 0.0508314 0.0465266 0.0417664 0.0366071 0.0317126 0.0276917 0.024428 0.022506 0.021401 0.0207194 0.0208516 0.0210514 0.0198732 0.0185632 0.0185697 0.0203097 0.0219474 0.0232247 0.0237631 0.0247999 0.0254272 0.0257518 0.0262183 0.028284 0.0421555 0.0988588 0.374622 2.00468 12.3053 65.8946 164.655 262.1 331.707 382.435 425.075 464.634 499.276 527.729 548.664 561.962 565.075 563.725 554.291 537.065 512.877 482.404 445.942 404.851 356.505 289.868 177.103 67.2171 17.439 1.85928 0.753231 0.344698 0.178363 0.115712 0.0967409 0.0777468 0.0755634 0.0773071 0.0708874 0.0645609 0.0687451 0.0664306 0.0608273 0.0557839 0.0515399 0.0478855 0.0451626 0.0430538 0.0413711 0.0397752 0.0382246 0.0369467 0.0359885 0.0347321 0.0339846 0.0336121 0.0337941 0.0345571 0.0359062 0.0373774 0.0387971 0.0401728 0.0415486 0.043111 0.044838 0.047419 0.0495734 0.0514144 0.0530055 0.0538865 0.0524289 0.0515418 0.0542488 0.0537149 0.0621104 0.122191 0.397538 2.11368 13.8907 73.7426 176.728 273.153 339.527 385.33 424.195 458.439 487.661 511.933 530.417 542.965 548.79 547.91 542.337 529.902 510.769 485.72 455.156 419.931 379.369 328.454 241.306 119.316 35.418 5.08588 1.13998 0.476631 0.218509 0.139876 0.10549 0.0868337 0.0960205 0.0937863 0.083012 0.0785895 0.0796885 0.0718981 0.0649139 0.0591122 0.0534608 0.0484784 0.0439896 0.0400925 0.0367649 0.0339125 0.03141 0.0291502 0.0272539 0.0256051 0.0246572 0.0242228 0.0242703 0.0247807 0.0257866 0.0274082 0.0296637 0.032409 0.0352921 0.0383897 0.0424304 0.0469322 0.0505404 0.0528046 0.0553921 0.0585436 0.0607973 0.0617774 0.0627926 0.0651413 0.0634546 0.0697959 0.104106 0.292323 1.64804 13.6401 86.7801 207.04 304.891 368.753 416.499 458.458 495.248 526.298 549.814 565.521 572.727 571.189 564.005 548.472 525.467 496.014 460.576 420.349 374.838 318.204 223.527 109.081 35.3136 6.57052 1.16531 0.49629 0.237551 0.132619 0.100269 0.08156 0.0655641 0.0665572 0.071494 0.0640759 0.0576951 0.0592876 0.0607773 0.0557977 0.051279 0.0476511 0.0449282 0.0429402 0.0418828 0.0413779 0.0406431 0.0395616 0.038415 0.0370285 0.0358121 0.0350003 0.0345944 0.034656 0.0347432 0.0346691 0.0345678 0.0343873 0.0340573 0.0336742 0.0330838 0.0324805 0.0319095 0.0306378 0.0291792 0.0261855 0.0227639 0.0177134 0.0111887 0.00629496 0.0027608 0.0117622 0.0786119 0.345276 1.98175 12.4728 64.2833 160.796 255.251 320.147 368.637 404.204 437.088 465.475 489.305 507.997 520.579 526.457 526.554 520.77 507.807 488.22 462.874 432.247 397.516 357.947 306.608 216.88 108.519 33.8473 7.43043 1.54509 0.904189 0.667656 0.546832 0.474555 0.47312 0.453373 0.421782 0.398485 0.382449 0.356547 0.334205 0.312968 0.285183 0.251174 0.228419 0.206423 0.181605 0.15686 0.11735 0.0659635 0.0339086 0.0146425 -0.0149248 -0.105671 -0.181077 -0.2298 -0.297853 -0.366523 -0.434585 -0.498797 -0.554719 -0.589609 -2.75379 -2.81712 -2.24727 52.8201 238.904 378.955 438.206 469.239 514.086 546.42 567.495 582.533 589.031 587.763 578.187 560.149 533.98 502.333 462.77 409.44 283.194 117.988 26.1798 3.39618 1.78055 1.05766 0.756218 0.64348 0.552941 0.487292 0.429187 0.37651 0.332339 0.293752 0.256696 0.226347 0.200013 0.174719 0.152117 0.131469 0.115997 0.102575 0.0903255 0.0778854 0.0662639 0.0568525 0.051809 0.0479583 0.0438244 0.0393582 0.0345889 0.030297 0.0263106 0.0232482 0.0213805 0.0202824 0.0196258 0.0196776 0.0197357 0.0186932 0.0175689 0.0176838 0.0191043 0.0205101 0.0216006 0.0221645 0.0230012 0.0234293 0.0234426 0.0232434 0.0218908 0.0208804 0.0206276 0.0277063 0.0733337 0.312502 1.77717 12.1635 70.029 199.598 330.907 414.419 468.753 505.201 534.64 556.341 570.32 574.323 571.959 562.228 544.436 519.455 487.653 446.666 382.118 251.274 104.494 27.7759 3.13792 1.11836 0.465844 0.213111 0.138276 0.0977596 0.08364 0.081129 0.0707727 0.0704257 0.0718015 0.0667984 0.0618608 0.0645807 0.0623878 0.0574477 0.052793 0.0487935 0.0453672 0.0427644 0.0407285 0.039092 0.037566 0.0361082 0.0348833 0.033757 0.0328049 0.0321266 0.0318137 0.031996 0.0326903 0.0339218 0.0352513 0.036579 0.0378927 0.0392155 0.040726 0.0423931 0.0447277 0.0467066 0.0484582 0.0498883 0.0506213 0.0492211 0.0482191 0.049379 0.0458344 0.0406849 0.0397148 0.0441327 0.0888335 0.36312 2.1336 15.2742 87.8395 219.966 338.277 412.997 461.81 493.216 518.003 537.002 549.993 555.919 554.938 549.597 536.913 517.23 491.312 458.018 411.273 319.559 177.73 59.9457 11.1039 1.80491 0.721151 0.299976 0.162801 0.103383 0.0968398 0.0887127 0.0804634 0.088646 0.0872734 0.0788362 0.0748276 0.074589 0.0678809 0.0614428 0.0559147 0.0506077 0.0458923 0.0416544 0.0379658 0.0348028 0.0320849 0.0297065 0.027579 0.025802 0.0242882 0.0233772 0.0229565 0.0230062 0.0235036 0.0244674 0.0259937 0.0281072 0.0306702 0.0333593 0.0363408 0.040146 0.0441217 0.0473933 0.0496973 0.052762 0.0556257 0.0575364 0.0584145 0.0593173 0.060867 0.0580689 0.056314 0.0526918 0.0527273 0.0847737 0.343497 2.61548 24.8857 142.183 297.006 401.464 461.988 501.06 533.251 557.561 573.778 581.131 579.438 572.242 556.124 532.295 501.654 463.3 410.05 303.271 153.448 48.9798 8.67801 1.60165 0.660192 0.291694 0.147108 0.103429 0.0801351 0.0779624 0.0707161 0.0609168 0.0624143 0.0660822 0.0603864 0.0551951 0.0561382 0.056875 0.0526376 0.048527 0.045141 0.0425664 0.0406897 0.0396325 0.0390603 0.0383216 0.0373216 0.0362491 0.0349502 0.03382 0.0330665 0.0326762 0.0327042 0.032762 0.0326918 0.0325913 0.0324066 0.0321052 0.0317319 0.0311844 0.0306244 0.0300312 0.0287982 0.0271894 0.024426 0.0210292 0.0160945 0.00964059 0.0039084 -0.00356211 -0.0120128 -0.0169742 -0.0171959 0.0163332 0.231823 1.43451 10.1826 56.5399 172.965 298.523 381.473 435.923 470.685 495.151 514.376 527.406 533.242 533.431 527.731 514.368 494.034 467.396 431.431 371.522 251.987 115.662 36.4519 5.79995 1.65657 0.969542 0.643102 0.506049 0.485123 0.459815 0.42774 0.436675 0.423421 0.397663 0.376302 0.360248 0.336681 0.315316 0.295031 0.268931 0.238211 0.215949 0.194733 0.171099 0.1467 0.110198 0.0638728 0.0333258 0.0122251 -0.0192654 -0.0984039 -0.167907 -0.217157 -0.280159 -0.344356 -0.407793 -0.467283 -0.518258 -0.54953 -2.59142 -2.62878 -2.43442 -2.60552 -0.565963 82.4624 290.099 443.265 512.266 554.213 575.422 591.058 597.836 596.38 586.593 568.057 540.325 491.863 352.216 155.469 36.4682 4.46171 2.16841 1.2621 0.88942 0.716732 0.60704 0.567107 0.507728 0.454664 0.402876 0.354055 0.313398 0.276826 0.24208 0.21331 0.188543 0.164617 0.143454 0.124202 0.109405 0.096647 0.0849812 0.0733395 0.062629 0.053985 0.0489396 0.0451063 0.0411568 0.0369618 0.0325728 0.0287965 0.0249044 0.022012 0.0201959 0.0191317 0.018514 0.0184702 0.0183915 0.0175639 0.0165922 0.0167352 0.017873 0.0190799 0.0200035 0.0205668 0.0212444 0.0215855 0.0215249 0.0212939 0.0198833 0.0182017 0.0160199 0.013354 0.00988037 0.0136808 0.0484442 0.283146 1.65311 11.8715 73.9596 226.598 382.985 478.605 532.903 562.205 577.141 580.944 578.985 568.453 547.388 511.241 437.928 299.504 140.713 43.3894 5.97492 1.58421 0.670637 0.277304 0.151888 0.0918354 0.0886865 0.0778114 0.0739572 0.0739009 0.0666292 0.0662736 0.06702 0.0628806 0.058799 0.060371 0.0583216 0.0539818 0.0497102 0.0459706 0.0427733 0.0403028 0.0383551 0.0367801 0.0353294 0.0339658 0.0327931 0.0316196 0.0308416 0.0302276 0.0299638 0.0301389 0.0307728 0.0318929 0.0330974 0.0343339 0.0355675 0.0368149 0.038239 0.0398103 0.0418751 0.0435724 0.045207 0.0465325 0.0470576 0.0460639 0.0453465 0.0457275 0.0423222 0.037202 0.0338105 0.028118 0.0204347 0.0206765 0.0681126 0.385983 2.39448 16.5554 86.061 225.966 359.141 445.908 499.498 532.545 551.602 559.391 559.266 553.372 537.407 507.547 449.872 339.359 197.75 78.3193 18.9694 2.43459 1.05356 0.42738 0.194475 0.0989922 0.0839683 0.0743606 0.0826491 0.0809183 0.076221 0.0824952 0.0813335 0.0744172 0.0706884 0.0695928 0.063757 0.0578524 0.0526337 0.047673 0.0432371 0.0392563 0.0357833 0.0327944 0.030222 0.0279746 0.0259756 0.0243024 0.022912 0.0220511 0.0216506 0.0217 0.0221704 0.0230821 0.024512 0.0264807 0.0288514 0.0313653 0.0342122 0.0376693 0.0412797 0.044245 0.0464579 0.0494283 0.0521288 0.0539922 0.0550364 0.0559041 0.0569448 0.0544113 0.0520946 0.0474841 0.0409946 0.032112 0.0313587 0.0803397 0.538412 5.04508 45.4972 196.968 364.101 470.433 531.045 563.859 580.724 588.115 586.51 579.401 561.295 530.687 474.156 354.173 193.561 68.7536 13.6163 2.11492 0.882219 0.380705 0.179124 0.101618 0.0709492 0.0719985 0.0669558 0.0697077 0.0651863 0.0578433 0.0588655 0.0613745 0.056815 0.0524512 0.0528258 0.0530113 0.0494121 0.0456956 0.0425563 0.0401376 0.0383733 0.0373308 0.0367163 0.0359879 0.035065 0.0340673 0.0329022 0.031839 0.0311251 0.030747 0.030742 0.0307708 0.030698 0.0305914 0.0303985 0.0301149 0.0297399 0.0292092 0.0286614 0.0280271 0.0268317 0.0252374 0.0226737 0.0194451 0.0148314 0.00877117 0.00319438 -0.00404535 -0.0126787 -0.0203484 -0.0294218 -0.0408974 -0.0465845 -0.0349245 0.134537 0.971384 6.74501 41.2873 148.287 281.987 396.745 462.53 503.057 527.255 537.258 537.456 529.96 509.305 464.394 369.127 234.806 103.679 34.0131 4.08817 1.70371 0.965571 0.614263 0.494656 0.444619 0.411667 0.429727 0.422388 0.40138 0.407969 0.396601 0.374136 0.354507 0.338462 0.316856 0.296595 0.277143 0.252743 0.2249 0.203405 0.183048 0.160625 0.136884 0.103174 0.0613637 0.0323106 0.0101577 -0.0220092 -0.0916383 -0.155568 -0.204204 -0.262616 -0.32242 -0.381353 -0.436299 -0.482709 -0.510766 -2.42663 -2.44338 -2.30332 -2.3875 -2.05774 -1.90033 -0.215528 71.9523 266.091 448.048 551.296 587.305 605.63 604.244 578.289 480.391 319.212 134.931 40.1075 4.56342 2.32805 1.4473 0.968919 0.777581 0.667051 0.614169 0.550981 0.522632 0.472319 0.425339 0.377425 0.331956 0.294323 0.259826 0.227288 0.200188 0.176916 0.154482 0.134715 0.116811 0.102761 0.090684 0.0796402 0.0687925 0.0589286 0.0509802 0.046026 0.0422562 0.0385031 0.0345726 0.0305479 0.0271497 0.0234515 0.0207511 0.0189999 0.0179964 0.0173892 0.01723 0.0170859 0.0163847 0.015563 0.0157431 0.0165832 0.0176142 0.0183835 0.0189352 0.0195067 0.0197657 0.0196396 0.0192272 0.0179711 0.016422 0.0141558 0.0112233 0.00624502 0.00136912 -0.00734345 -0.00528437 0.0220753 0.251212 1.65943 11.4603 69.2526 214.111 354.76 454.755 510.722 528.201 519.11 473.036 386.671 263.06 130.676 48.2642 8.53468 2.27373 1.13814 0.337463 0.158788 0.0816649 0.0759268 0.0636601 0.0737141 0.0702155 0.0685583 0.0684285 0.0628391 0.0622451 0.0623593 0.058892 0.0554935 0.0562345 0.0543119 0.0504877 0.0465877 0.0431133 0.0401424 0.0378121 0.0359609 0.0344561 0.0330835 0.0318108 0.0306937 0.0295502 0.0288621 0.0283131 0.0280896 0.0282518 0.0288356 0.0298427 0.0309394 0.0320884 0.0332327 0.0344003 0.0357265 0.0371969 0.0390337 0.0405234 0.0419967 0.0431692 0.0435292 0.0426214 0.0418886 0.0417728 0.0387344 0.0345962 0.0309974 0.0246727 0.0154574 0.00556937 -0.00439069 -0.00126423 0.0512195 0.400306 2.30683 12.9141 56.9636 158.155 269.198 355.462 412.142 439.929 440.399 413.266 350.267 254.268 144.952 64.9097 17.4169 2.47674 1.62489 0.602263 0.220205 0.106841 0.0665937 0.0511171 0.0625821 0.065211 0.0749896 0.0750517 0.0720833 0.0766125 0.075538 0.0698568 0.0663777 0.0647377 0.0596035 0.0542117 0.0493226 0.0447032 0.0405514 0.0368277 0.0335724 0.0307621 0.0283407 0.0262263 0.0243543 0.0227659 0.0214941 0.0206903 0.0203142 0.0203615 0.0208012 0.021656 0.0229886 0.0248101 0.0269945 0.0293348 0.0320228 0.0351602 0.0384372 0.0411458 0.0433002 0.0460794 0.0484777 0.050142 0.0510438 0.0518114 0.0526171 0.0507562 0.0484408 0.0437343 0.0368894 0.0272257 0.0176086 0.00393207 0.00281498 0.101758 0.954525 8.11412 54.6797 196.85 349.913 460.799 520.264 544.141 543.476 517.21 442.568 324.41 180.227 72.8216 17.4532 2.74269 1.59412 0.508633 0.206243 0.108375 0.0696806 0.0583013 0.0535435 0.0619604 0.0613078 0.0641565 0.0606425 0.0548392 0.0553413 0.0568677 0.0531759 0.0495085 0.0494642 0.0492606 0.0461715 0.0428265 0.0399309 0.0376732 0.0360211 0.0350035 0.0343662 0.0336575 0.0328059 0.0318804 0.030824 0.0298496 0.0291807 0.0288163 0.0287883 0.028793 0.0287188 0.0286076 0.0284115 0.0281412 0.027769 0.0272494 0.026705 0.0260344 0.0248629 0.0233035 0.0208719 0.0177796 0.0134425 0.00788929 0.00253772 -0.00416834 -0.012118 -0.0195905 -0.028783 -0.0408349 -0.0541044 -0.0732646 -0.0810689 -0.0799156 0.0126916 0.553317 3.04361 15.6423 61.2083 153.923 245.491 308.917 335.316 330.823 296.227 222.322 128.034 61.8165 19.7165 2.38573 1.39112 0.796508 0.549404 0.442292 0.391595 0.383293 0.3872 0.376702 0.396498 0.392797 0.377285 0.380837 0.370289 0.350457 0.332603 0.31679 0.296924 0.277848 0.25933 0.236613 0.211323 0.190789 0.171369 0.150181 0.127344 0.0962589 0.0585023 0.030965 0.00839887 -0.0235168 -0.0852212 -0.143885 -0.19107 -0.245203 -0.300705 -0.355253 -0.405828 -0.448008 -0.473181 -2.2615 -2.26491 -2.15561 -2.19075 -1.91104 -1.75405 -1.46147 -1.38241 -1.18649 2.10064 52.9329 136.59 166.785 145.654 81.5476 46.1648 21.5063 2.3989 1.82518 1.24943 0.932275 0.799548 0.683248 0.6406 0.589867 0.560381 0.511929 0.484731 0.439167 0.396591 0.35215 0.309947 0.275037 0.242754 0.212406 0.187037 0.165215 0.144306 0.125907 0.109309 0.0960615 0.0846883 0.074299 0.0642364 0.0551696 0.0478637 0.0430733 0.0394125 0.0358556 0.0321935 0.0285125 0.0253178 0.0219589 0.0194546 0.0177891 0.0168324 0.0162487 0.0160198 0.0158327 0.015152 0.0145174 0.0147088 0.0153124 0.0161555 0.0168269 0.0173415 0.0176915 0.0179546 0.0177912 0.0172802 0.0161071 0.0145507 0.012319 0.00950146 0.00505386 -5.11087e-05 -0.00911513 -0.0159706 -0.0291012 -0.0337406 -0.0180149 0.172538 1.38733 8.09444 30.9198 75.7776 133.091 159.051 150.889 116.051 69.352 27.2006 5.38064 2.73648 1.357 0.38221 0.135896 0.0532302 0.0418443 0.0368552 0.0555377 0.0556544 0.066055 0.0648461 0.0638473 0.0633164 0.0588822 0.0580923 0.057798 0.0548758 0.0520165 0.0521805 0.0503716 0.0469861 0.0434405 0.0402324 0.0374829 0.0352971 0.0335489 0.0321227 0.0308309 0.0296469 0.0285881 0.0275039 0.0268751 0.0263969 0.0262028 0.0263565 0.0268927 0.0277936 0.0287934 0.0298529 0.0309112 0.0319998 0.0332191 0.0345882 0.0362194 0.0375439 0.0388371 0.0398364 0.0401034 0.0392833 0.0385438 0.0380598 0.035245 0.0313698 0.0275411 0.0216436 0.0136178 0.00382295 -0.00831787 -0.0186795 -0.0326089 -0.0346499 0.0204839 0.345296 1.68922 6.63023 18.9597 42.2366 68.7852 88.9801 91.0384 79.6589 52.4805 23.0147 4.95161 2.40992 1.4954 0.517808 0.164482 0.072831 0.0350438 0.0304637 0.0359559 0.0396815 0.0545451 0.0600136 0.0687961 0.0694957 0.0676354 0.0708884 0.0698881 0.0651977 0.0619714 0.0600085 0.0554522 0.0505407 0.0459928 0.0417085 0.0378426 0.0343754 0.0313389 0.0287116 0.0264442 0.0244655 0.0227156 0.0212007 0.020053 0.0193093 0.0189575 0.0189967 0.0194057 0.0202004 0.0214358 0.0231122 0.0251207 0.0272957 0.0298023 0.0326584 0.0356311 0.0380967 0.0401554 0.0427107 0.044834 0.0463249 0.0471367 0.047765 0.0482048 0.0463864 0.0438901 0.0395768 0.0335644 0.0246968 0.0145271 -0.000375382 -0.0159962 -0.03253 -0.0318888 0.128026 1.15259 6.8645 29.9146 81.8924 146.231 183.521 181.288 150.421 98.1314 46.4535 11.8321 3.43293 2.03487 0.671331 0.207135 0.0945063 0.0520307 0.0451553 0.0443239 0.0470152 0.0481326 0.05624 0.0569659 0.0592103 0.0562518 0.0515952 0.0516914 0.0525326 0.049509 0.046416 0.0460836 0.0456131 0.0429334 0.0399297 0.0372736 0.0351792 0.0336392 0.0326577 0.0320146 0.0313325 0.0305474 0.0296934 0.0287426 0.0278611 0.0272329 0.0268854 0.0268372 0.0268218 0.026746 0.0266312 0.0264338 0.0261732 0.0258072 0.0253107 0.0247742 0.0240868 0.0229478 0.0214369 0.0191217 0.016162 0.0120778 0.00694505 0.00185449 -0.00440962 -0.0117652 -0.0188814 -0.0276524 -0.0385648 -0.0514793 -0.0694823 -0.0822252 -0.0997514 -0.111489 -0.111734 -0.0809449 0.0741903 0.67901 2.48232 6.52205 13.531 20.989 25.6531 21.9365 9.9045 1.15723 0.914106 0.65151 0.489416 0.38732 0.335175 0.313976 0.322413 0.330859 0.343051 0.355319 0.351467 0.367774 0.364926 0.352995 0.354112 0.344337 0.326726 0.310486 0.295214 0.276945 0.259084 0.241575 0.220523 0.197532 0.178103 0.159696 0.139771 0.118028 0.0894336 0.0553466 0.0293674 0.00686316 -0.0241809 -0.079045 -0.132719 -0.177846 -0.227908 -0.279202 -0.329479 -0.375848 -0.414088 -0.436654 -2.09617 -2.09139 -2.00497 -2.00719 -1.7737 -1.61742 -1.37377 -1.27989 -1.11395 -0.843373 -0.66965 -0.458323 -0.259195 -0.128655 0.168641 0.676064 0.727033 0.689738 0.706712 0.667097 0.63251 0.628751 0.590429 0.576926 0.542287 0.516616 0.475205 0.448091 0.406686 0.367888 0.326907 0.287953 0.255604 0.22559 0.19744 0.173832 0.15346 0.134086 0.117037 0.101712 0.0893092 0.078662 0.0689533 0.0596647 0.0513559 0.0446541 0.0400821 0.0365677 0.0332164 0.0298228 0.0264626 0.02345 0.020436 0.01812 0.0165532 0.0156378 0.0150804 0.0148325 0.0145815 0.0139789 0.0134694 0.0136335 0.0141003 0.0147817 0.0154096 0.0158246 0.0160017 0.0162092 0.0160037 0.0154044 0.0143009 0.0127919 0.0107311 0.0080214 0.00381513 -0.00138875 -0.00951253 -0.0164832 -0.0284801 -0.0395256 -0.058528 -0.0771446 -0.101369 -0.122509 -0.131142 -0.137745 -0.146439 -0.142816 -0.121611 0.746811 1.38927 1.40088 0.696387 0.285526 0.0941638 0.00170424 -0.00712824 -0.00829846 0.0157216 0.027155 0.0473066 0.0509914 0.0599209 0.0597755 0.0590841 0.0583402 0.054795 0.0538862 0.0533357 0.0508492 0.0484203 0.0481902 0.0464903 0.0434839 0.0402738 0.0373312 0.0347974 0.0327609 0.0311216 0.0297807 0.0285726 0.0274759 0.0264854 0.0254928 0.0249093 0.024481 0.0243138 0.0244578 0.0249429 0.0257559 0.0266546 0.0276216 0.0285973 0.0296037 0.0307186 0.0319688 0.0334043 0.0345643 0.0357092 0.036544 0.036715 0.0359669 0.0352158 0.0344731 0.0318658 0.028272 0.0244798 0.0188422 0.0112856 0.0019056 -0.00896558 -0.0190941 -0.0339139 -0.0497444 -0.0662623 -0.0803647 -0.0951613 -0.108048 -0.113818 -0.121538 -0.122889 -0.123403 -0.117703 0.155869 0.743992 0.856112 0.458037 0.220117 0.0792365 0.00415295 -0.0214455 -0.0144077 -0.00376585 0.0137214 0.027723 0.0354861 0.0491871 0.0553615 0.0629443 0.0640446 0.0629623 0.0653049 0.0643697 0.0604699 0.0574992 0.055373 0.0513068 0.046847 0.0426482 0.0386942 0.0351152 0.031904 0.0290877 0.026646 0.0245357 0.0226952 0.0210735 0.0196724 0.0186223 0.0179319 0.0176051 0.0176376 0.0180194 0.0187546 0.019896 0.0214329 0.0232739 0.0252833 0.0276015 0.0301953 0.0328735 0.0351014 0.0370144 0.0393397 0.0412262 0.0425315 0.0432516 0.0437572 0.0439212 0.0422119 0.0396652 0.0354969 0.0295981 0.0212064 0.011632 -0.00137902 -0.0166077 -0.0369651 -0.0620991 -0.0810194 -0.0881735 -0.058327 0.08665 0.467728 1.03113 1.31515 1.0609 0.828814 1.79657 2.13548 1.27564 0.521028 0.185109 0.0481223 0.0153525 0.0134173 0.018963 0.0304192 0.0371177 0.0420477 0.0445986 0.0514069 0.0526408 0.0543746 0.0519225 0.0481733 0.0479795 0.0483457 0.0458401 0.0432202 0.0426923 0.042051 0.0397082 0.0370169 0.0345954 0.0326654 0.0312365 0.0303 0.0296638 0.029013 0.0282903 0.0275061 0.0266513 0.0258565 0.025271 0.0249474 0.0248837 0.0248498 0.0247717 0.0246527 0.0244555 0.0242032 0.0238423 0.0233639 0.0228372 0.0221388 0.0210464 0.0195853 0.0174111 0.0146275 0.0108061 0.00607335 0.00124984 -0.00462038 -0.0114755 -0.0182257 -0.0265873 -0.0366672 -0.0490505 -0.0654924 -0.0778984 -0.0934899 -0.107124 -0.119303 -0.132551 -0.14457 -0.149813 -0.144534 -0.135338 -0.128273 -0.116362 -0.0995019 -0.0387083 0.0515799 0.128794 0.158832 0.157311 0.180941 0.2002 0.235076 0.254887 0.282527 0.29999 0.314659 0.32882 0.327236 0.339906 0.337598 0.328271 0.327728 0.318663 0.303022 0.288224 0.2737 0.256927 0.240306 0.223867 0.204456 0.183571 0.165349 0.148026 0.129394 0.108895 0.0826824 0.0519472 0.027582 0.00552912 -0.0241659 -0.0730337 -0.121965 -0.16459 -0.210724 -0.2579 -0.304015 -0.346334 -0.380888 -0.401078 -1.93102 -1.92156 -1.85203 -1.832 -1.6368 -1.48493 -1.27497 -1.17253 -1.0178 -0.787082 -0.611477 -0.422716 -0.24364 -0.116511 0.0444075 0.237037 0.327052 0.429591 0.493909 0.52682 0.542199 0.557579 0.538044 0.527433 0.498951 0.474722 0.438636 0.412116 0.374554 0.339176 0.301637 0.265913 0.236055 0.208341 0.182394 0.160564 0.141658 0.12382 0.108109 0.0940305 0.0825068 0.0726074 0.0636005 0.0550749 0.0474929 0.0413667 0.0370543 0.0337177 0.0305846 0.0274637 0.0243939 0.021588 0.0188833 0.0167658 0.0153038 0.0144475 0.0138965 0.0136289 0.0133667 0.0128564 0.0123876 0.012517 0.0128255 0.0133467 0.0138648 0.0140805 0.0144417 0.0144372 0.0141907 0.0135419 0.0124797 0.0109858 0.00900805 0.00635876 0.00235946 -0.00269652 -0.0100303 -0.0170116 -0.0278 -0.0386264 -0.0557591 -0.0732347 -0.0956783 -0.115462 -0.122768 -0.126828 -0.137036 -0.127062 -0.105269 -0.0405328 -0.00890676 -0.0222197 -0.0541604 -0.0701483 -0.0590151 -0.0526095 -0.032598 -0.0176501 0.00909929 0.0235087 0.0415401 0.0467025 0.0542793 0.0547649 0.0542945 0.0534693 0.0506091 0.0496486 0.0489439 0.0468128 0.0447313 0.0442464 0.0426558 0.0399857 0.0370931 0.0344109 0.03209 0.0302076 0.0286822 0.0274321 0.0263111 0.0253007 0.0243855 0.0234945 0.0229478 0.0225587 0.0224134 0.0225457 0.0229829 0.0237045 0.0245098 0.025384 0.0262675 0.0271855 0.0281907 0.0293089 0.0305524 0.0315579 0.0325513 0.0332293 0.0332958 0.0325858 0.0318117 0.0308952 0.0284424 0.0250965 0.0214197 0.0161153 0.00911113 0.000436507 -0.00940433 -0.0192481 -0.0327878 -0.0476279 -0.0627626 -0.076629 -0.0912621 -0.103437 -0.108668 -0.116235 -0.1138 -0.113368 -0.110581 -0.0998923 -0.0650384 -0.0607373 -0.0697965 -0.0754031 -0.0716325 -0.0592225 -0.0509633 -0.0285074 -0.00982373 0.00916896 0.0237341 0.0323793 0.0445051 0.0507727 0.0573242 0.0586717 0.0581364 0.0598264 0.0589579 0.0556932 0.0529787 0.0508096 0.0471708 0.04314 0.0392924 0.0356651 0.0323726 0.0294171 0.0268221 0.0245673 0.022617 0.0209162 0.0194231 0.0181418 0.01718 0.0165439 0.0162415 0.0162697 0.0166199 0.017294 0.018339 0.0197385 0.0214129 0.0232565 0.0253754 0.0277138 0.0301138 0.032117 0.0338754 0.0359811 0.0376557 0.0387872 0.0393976 0.0397629 0.0397172 0.0381097 0.0355877 0.0315939 0.0259971 0.0181973 0.00914901 -0.00294244 -0.0176793 -0.0364707 -0.0593215 -0.0807694 -0.100587 -0.117525 -0.12712 -0.134694 -0.129955 -0.121036 -0.105596 -0.0491244 0.0418691 0.0512766 0.00577115 -0.0505703 -0.0580703 -0.0399153 -0.0216501 -0.00226902 0.0119088 0.0252278 0.0330443 0.0381093 0.0411729 0.0468388 0.0483185 0.0496684 0.047649 0.0446162 0.044233 0.0442721 0.0421747 0.0399461 0.0392987 0.0385555 0.036496 0.034095 0.0318998 0.0301327 0.0288139 0.0279292 0.0273102 0.0266959 0.0260341 0.0253166 0.0245457 0.0238177 0.0232868 0.0229887 0.0229132 0.0228647 0.0227843 0.0226611 0.022464 0.0222147 0.0218635 0.0213998 0.0208789 0.0201791 0.0191282 0.01772 0.0156783 0.0130747 0.00951231 0.0051929 0.000672483 -0.00480856 -0.0111222 -0.0174477 -0.0255443 -0.0349046 -0.0465793 -0.0615643 -0.0734002 -0.0871354 -0.099586 -0.110867 -0.122976 -0.13367 -0.138611 -0.134182 -0.125546 -0.117124 -0.104162 -0.0880343 -0.0721264 -0.0402339 0.0207251 0.0596514 0.0827087 0.123952 0.158887 0.203169 0.228392 0.256573 0.273175 0.287271 0.302987 0.302699 0.312561 0.310638 0.303244 0.3016 0.293206 0.279328 0.26586 0.252229 0.236877 0.221511 0.206197 0.1884 0.169472 0.152532 0.136358 0.119051 0.0999092 0.0759916 0.0483474 0.0256567 0.00433991 -0.0236082 -0.0671335 -0.111537 -0.151343 -0.193645 -0.236788 -0.278844 -0.317257 -0.348344 -0.366351 -1.76627 -1.75446 -1.69726 -1.66385 -1.49926 -1.35584 -1.1751 -1.06887 -0.924414 -0.723101 -0.556397 -0.386485 -0.225756 -0.106556 0.0327319 0.180395 0.260269 0.360616 0.425508 0.467211 0.491205 0.505152 0.490665 0.480563 0.456523 0.433734 0.402008 0.376527 0.342635 0.310466 0.276334 0.243811 0.216415 0.191015 0.167273 0.147234 0.129817 0.113507 0.0991279 0.0862762 0.0756575 0.066526 0.0582379 0.050465 0.0435851 0.038014 0.0339927 0.0308612 0.0279573 0.0251119 0.0223086 0.0197339 0.0173117 0.0153959 0.0140457 0.0132424 0.0126989 0.0124285 0.0121696 0.0117372 0.0112944 0.0114054 0.0115502 0.011929 0.0123183 0.0123266 0.0127684 0.0126207 0.0123179 0.0115921 0.0104856 0.0089884 0.00702556 0.00438523 0.000579801 -0.0042514 -0.0109228 -0.0176329 -0.0272183 -0.037453 -0.0529351 -0.0696189 -0.0902177 -0.108113 -0.12009 -0.125979 -0.130958 -0.124941 -0.114929 -0.107965 -0.10779 -0.113049 -0.107798 -0.0948423 -0.0715822 -0.0568222 -0.0348794 -0.0180657 0.00619454 0.0209087 0.0366858 0.0424712 0.0489295 0.0497973 0.049502 0.0486732 0.0463478 0.0453866 0.0446028 0.0427718 0.0409759 0.0403407 0.0388622 0.0364965 0.0339055 0.0314771 0.029367 0.0276403 0.0262346 0.0250788 0.0240472 0.0231228 0.0222837 0.021494 0.020981 0.0206288 0.0205027 0.0206201 0.0210106 0.0216433 0.0223609 0.0231428 0.0239336 0.0247605 0.0256501 0.0266358 0.0276963 0.0285597 0.0293928 0.0299069 0.029882 0.0291779 0.0283656 0.0273138 0.0250053 0.0218551 0.0183015 0.013323 0.00685783 -0.00111677 -0.0100404 -0.0193268 -0.0314757 -0.0450274 -0.058859 -0.0720187 -0.0858772 -0.0973706 -0.104813 -0.110429 -0.112372 -0.112014 -0.107666 -0.107398 -0.106437 -0.106298 -0.100519 -0.0922672 -0.0794974 -0.0629514 -0.0505866 -0.0293 -0.0107542 0.00699796 0.0208128 0.0294985 0.0401271 0.0462018 0.051885 0.0533669 0.0532067 0.0544313 0.0536372 0.0508914 0.0484307 0.0463042 0.0430502 0.039425 0.0359258 0.0326225 0.0296159 0.0269162 0.0245427 0.0224765 0.0206882 0.0191286 0.0177635 0.0165977 0.0157249 0.0151437 0.0148662 0.0148891 0.0152079 0.0158196 0.016767 0.0180276 0.0195358 0.0212039 0.0231162 0.0251979 0.02732 0.0291088 0.0307161 0.0325806 0.0340328 0.0350033 0.0354928 0.0356977 0.0354617 0.033908 0.0314187 0.0276081 0.0223366 0.0151223 0.00662892 -0.00447056 -0.0180302 -0.035124 -0.0558047 -0.076089 -0.0950477 -0.112208 -0.124082 -0.12998 -0.131758 -0.128706 -0.120197 -0.115317 -0.109922 -0.104274 -0.103516 -0.0969411 -0.0775235 -0.0492555 -0.0260146 -0.00580074 0.00910986 0.0218132 0.0296071 0.0344831 0.0376947 0.0424383 0.0440046 0.0450746 0.0434136 0.0409487 0.0404555 0.0402766 0.0385092 0.0366069 0.0359002 0.0351068 0.0332923 0.0311616 0.0291851 0.027579 0.0263714 0.0255451 0.0249538 0.0243809 0.0237787 0.0231281 0.0224379 0.0217823 0.0213014 0.0210248 0.0209442 0.0208851 0.0208017 0.0206757 0.0204791 0.0202342 0.0198872 0.0194349 0.0189211 0.0182229 0.0172111 0.0158506 0.013934 0.0115036 0.0081858 0.00421057 -3.58611e-05 -0.0051339 -0.0110936 -0.0168796 -0.0246802 -0.033323 -0.0441854 -0.0573759 -0.0685513 -0.0807688 -0.0918582 -0.102171 -0.113058 -0.122247 -0.126681 -0.123629 -0.116996 -0.110279 -0.099282 -0.0857284 -0.0724735 -0.0433786 0.00732631 0.0432022 0.0688 0.107027 0.142256 0.183181 0.205756 0.231233 0.246798 0.261789 0.276921 0.277929 0.285533 0.283937 0.277999 0.275671 0.267935 0.255641 0.243426 0.230783 0.216803 0.202702 0.188556 0.172348 0.155262 0.139658 0.124689 0.108739 0.0910433 0.0693499 0.0445838 0.0236308 0.00343155 -0.0226143 -0.0613061 -0.101369 -0.138128 -0.176668 -0.215853 -0.253947 -0.288587 -0.316399 -0.332383 -1.60203 -1.58945 -1.54165 -1.50151 -1.36144 -1.22892 -1.07228 -0.967071 -0.834566 -0.658657 -0.503279 -0.350499 -0.206392 -0.0948983 0.0295572 0.156843 0.231678 0.321159 0.380157 0.420498 0.44073 0.455291 0.444742 0.435065 0.414375 0.393154 0.365262 0.341254 0.310873 0.281785 0.251007 0.22164 0.196702 0.173621 0.152081 0.133843 0.117939 0.10315 0.0900975 0.0784575 0.0687649 0.0604198 0.0528643 0.0458347 0.0396371 0.0346059 0.0309014 0.0279974 0.0253317 0.02276 0.0202162 0.017883 0.0157254 0.0139954 0.0127717 0.0120067 0.0114924 0.0112373 0.010959 0.0106283 0.0101881 0.0102769 0.0103037 0.0105934 0.0108453 0.0107545 0.0110061 0.0108127 0.0104275 0.00959848 0.00841274 0.00689691 0.00489284 0.00228185 -0.00115013 -0.00563895 -0.0117457 -0.0180784 -0.0265349 -0.0360262 -0.0497262 -0.0648493 -0.0833497 -0.100283 -0.111901 -0.120064 -0.123794 -0.119632 -0.111193 -0.106096 -0.106166 -0.108983 -0.102024 -0.0885863 -0.0680329 -0.0533049 -0.0333414 -0.0167438 0.00460435 0.0186491 0.0323311 0.0382486 0.0437928 0.0448755 0.0447174 0.0439353 0.042036 0.0411115 0.0403049 0.0387302 0.0371774 0.036465 0.0351056 0.0330171 0.0307119 0.0285314 0.0266291 0.0250599 0.0237778 0.0227196 0.0217791 0.0209408 0.0201782 0.0194689 0.0189995 0.0186867 0.018575 0.0186786 0.0190232 0.0195748 0.0202069 0.0208949 0.0215931 0.022326 0.0231006 0.0239519 0.0248401 0.0255611 0.0262396 0.0266028 0.0264931 0.0257789 0.0249288 0.0237732 0.0215901 0.0186227 0.015213 0.0105582 0.00462299 -0.00267206 -0.01069 -0.0193239 -0.0301782 -0.0423616 -0.0546962 -0.0665955 -0.0790619 -0.0896113 -0.0974128 -0.10265 -0.105094 -0.104985 -0.101612 -0.101091 -0.10095 -0.100287 -0.0937217 -0.0853858 -0.0735763 -0.0588662 -0.0467482 -0.0277711 -0.0103304 0.00568652 0.0183226 0.0266454 0.0359351 0.041651 0.0465923 0.0481272 0.0482166 0.0491125 0.048393 0.046079 0.0438685 0.0418408 0.0389428 0.0357032 0.0325493 0.0295669 0.0268462 0.024402 0.0222504 0.0203749 0.0187509 0.0173343 0.016098 0.0150439 0.0142589 0.0137325 0.0134811 0.0134998 0.0137877 0.0143367 0.0151886 0.016314 0.0176606 0.0191504 0.0208534 0.0226898 0.0245392 0.0261129 0.0275537 0.0291647 0.0303941 0.0311913 0.0315492 0.0315992 0.0311836 0.02965 0.0271977 0.0235651 0.0185992 0.0119278 0.00400197 -0.00616294 -0.0185961 -0.0340773 -0.0523801 -0.0706229 -0.087891 -0.103812 -0.115874 -0.123318 -0.126667 -0.12511 -0.118344 -0.114524 -0.11189 -0.106587 -0.102343 -0.092295 -0.0730392 -0.0475987 -0.0256757 -0.00683891 0.00746513 0.0190785 0.0264307 0.0309919 0.0341595 0.0381581 0.0397074 0.0405724 0.0392103 0.0372046 0.0366566 0.0363439 0.03485 0.0332255 0.0325005 0.0317004 0.0301041 0.0282227 0.026458 0.0250102 0.0239148 0.0231521 0.0225965 0.0220686 0.0215244 0.0209403 0.0203284 0.0197525 0.0193152 0.0190595 0.0189753 0.0189086 0.0188228 0.0186941 0.0184997 0.0182594 0.0179191 0.0174761 0.016974 0.0162858 0.0153121 0.0140109 0.0122214 0.00996773 0.00689907 0.00323038 -0.000760964 -0.00541742 -0.0110271 -0.0164269 -0.023764 -0.0318156 -0.041604 -0.0531579 -0.0634182 -0.0745389 -0.084393 -0.0936861 -0.103328 -0.111086 -0.114627 -0.112013 -0.106298 -0.100081 -0.0901609 -0.0784442 -0.065367 -0.0384393 0.00484105 0.0375849 0.0629249 0.0955581 0.127675 0.164185 0.184968 0.2077 0.221972 0.236867 0.251044 0.25298 0.258769 0.257439 0.252608 0.249901 0.242819 0.231962 0.220944 0.209355 0.196708 0.183878 0.170938 0.156294 0.140962 0.126734 0.11302 0.0984557 0.0822743 0.0627475 0.0406876 0.021533 0.00272213 -0.0212718 -0.0555243 -0.0914085 -0.124961 -0.159786 -0.195083 -0.229305 -0.260291 -0.284992 -0.299087 -1.43833 -1.42608 -1.38579 -1.34325 -1.22389 -1.1036 -0.967615 -0.866927 -0.746692 -0.592889 -0.450858 -0.314469 -0.186234 -0.0832485 0.0270342 0.138094 0.207736 0.286696 0.337542 0.375452 0.392708 0.407415 0.39934 0.390149 0.372316 0.35289 0.32845 0.306248 0.279234 0.253149 0.225661 0.199404 0.176929 0.156169 0.136824 0.120395 0.10603 0.0927528 0.0810231 0.0705826 0.061833 0.0542903 0.0474782 0.0411838 0.0356525 0.0311506 0.0277823 0.0251263 0.0227084 0.0204052 0.0181218 0.0160335 0.0141242 0.0125831 0.0114835 0.0107645 0.0102902 0.0100587 0.00976626 0.00948849 0.00900841 0.00901601 0.00902515 0.00924393 0.00932455 0.00919875 0.0092709 0.00901825 0.00855877 0.00764738 0.00639131 0.00487352 0.00283992 0.000366472 -0.00257053 -0.00669959 -0.01232 -0.0181738 -0.0256867 -0.0344007 -0.0464539 -0.0598619 -0.0758757 -0.0905975 -0.101121 -0.108514 -0.111744 -0.108425 -0.101338 -0.0967814 -0.0963394 -0.0977436 -0.0914614 -0.0796868 -0.0621888 -0.04822 -0.0303424 -0.0148827 0.00356324 0.01648 0.0282983 0.0340411 0.0388197 0.0400018 0.0399488 0.0392419 0.0376868 0.0368232 0.0360347 0.0346802 0.0333403 0.0326046 0.0313709 0.0295392 0.0275077 0.0255695 0.0238725 0.0224642 0.021308 0.0203523 0.019505 0.0187535 0.0180697 0.017435 0.0170125 0.0167384 0.0166395 0.0167301 0.0170305 0.0175034 0.0180535 0.0186489 0.0192521 0.0198862 0.0205455 0.0212628 0.0219881 0.0225653 0.023088 0.0233101 0.0231152 0.0223837 0.0214923 0.020265 0.0181858 0.0153938 0.0121477 0.00783498 0.00241198 -0.00420014 -0.0113056 -0.0191778 -0.028783 -0.0396105 -0.0504229 -0.0609703 -0.0718026 -0.0809264 -0.0878779 -0.0924792 -0.0946931 -0.0945793 -0.0919966 -0.0913308 -0.0909348 -0.0898549 -0.0841233 -0.0767049 -0.0663033 -0.0534591 -0.0418129 -0.0251239 -0.00942748 0.0047177 0.0160323 0.0237802 0.0318733 0.03713 0.0414253 0.0429443 0.0431927 0.0438534 0.0432054 0.0412567 0.0392912 0.0374041 0.0348413 0.0319745 0.0291622 0.0264982 0.0240637 0.0218752 0.0199466 0.0182634 0.0168056 0.0155334 0.0144257 0.0134797 0.0127831 0.0123116 0.012086 0.0121003 0.0123559 0.0128413 0.0135964 0.0145889 0.0157749 0.0170913 0.0185853 0.0201835 0.0217773 0.0231391 0.0244014 0.0257636 0.0267847 0.0274083 0.027625 0.0275248 0.0269558 0.0254265 0.0230329 0.0195723 0.0149199 0.0087713 0.00145181 -0.00778469 -0.0190773 -0.0329732 -0.049132 -0.0652633 -0.0804366 -0.0943113 -0.105075 -0.111944 -0.115116 -0.113903 -0.108424 -0.104711 -0.101728 -0.0968242 -0.0922605 -0.0829747 -0.0661273 -0.0438845 -0.0237172 -0.00681448 0.00628661 0.0166423 0.0233768 0.0275717 0.0305832 0.0339644 0.0354334 0.0361451 0.0350339 0.033403 0.0328412 0.0324569 0.0311899 0.0298061 0.0290979 0.0283222 0.0269241 0.0252758 0.0237169 0.0224257 0.0214431 0.0207492 0.0202356 0.0197558 0.0192696 0.0187491 0.0182086 0.0176988 0.0173123 0.0170813 0.0169943 0.0169226 0.0168348 0.0167044 0.0165115 0.0162732 0.0159401 0.0155104 0.0150182 0.014347 0.0134111 0.0121851 0.0105233 0.0084453 0.00562876 0.00225068 -0.00145649 -0.00565399 -0.0104659 -0.0159294 -0.0225606 -0.0300205 -0.0386631 -0.0490718 -0.0580817 -0.0682341 -0.0769205 -0.0852262 -0.0936282 -0.100094 -0.102843 -0.100482 -0.0954283 -0.0895367 -0.0805061 -0.0701037 -0.0575104 -0.0330058 0.00378268 0.0328847 0.0570859 0.0855855 0.114215 0.146491 0.166381 0.18675 0.199184 0.212856 0.224277 0.227947 0.232218 0.231106 0.227124 0.224261 0.217833 0.208292 0.19843 0.187937 0.176595 0.165041 0.153337 0.140234 0.126589 0.113764 0.101348 0.0881981 0.0735835 0.0561765 0.0366847 0.0193807 0.00212778 -0.019652 -0.0497699 -0.081614 -0.11185 -0.142996 -0.174467 -0.204896 -0.232338 -0.254068 -0.266386 -1.27516 -1.26401 -1.2301 -1.18827 -1.08675 -0.979525 -0.861925 -0.768298 -0.660439 -0.526579 -0.399089 -0.278536 -0.165613 -0.0726115 0.0243455 0.120542 0.184317 0.252665 0.297443 0.331018 0.349186 0.360437 0.354141 0.345657 0.330347 0.31288 0.291604 0.271456 0.247684 0.224556 0.200296 0.177101 0.1571 0.13866 0.121503 0.106893 0.0940877 0.0823151 0.0719068 0.0626573 0.0548647 0.0481391 0.0420798 0.0365142 0.0316369 0.0276567 0.0246391 0.022248 0.0200876 0.0180465 0.0160248 0.0141837 0.012514 0.0111638 0.0101842 0.00951103 0.00908979 0.00885175 0.00859005 0.00828393 0.00783061 0.00771543 0.0077621 0.00790225 0.00783766 0.00764828 0.00759311 0.00729377 0.00677559 0.00583878 0.00451153 0.00302973 0.00101597 -0.00124596 -0.00386099 -0.00774601 -0.0128706 -0.0181115 -0.024873 -0.0327301 -0.0431894 -0.0548784 -0.0685543 -0.0809924 -0.0899577 -0.0961015 -0.0985564 -0.0957477 -0.0898426 -0.0859415 -0.0853226 -0.0859401 -0.0805173 -0.0701637 -0.0551652 -0.0423677 -0.0268712 -0.0129907 0.00277164 0.0143506 0.0245039 0.0298689 0.0339814 0.0351767 0.0351987 0.0345803 0.0333063 0.0325196 0.0317806 0.0306204 0.0294723 0.0287546 0.0276517 0.026062 0.0242946 0.0225943 0.021101 0.0198554 0.0188281 0.0179778 0.0172262 0.0165625 0.0159587 0.0154174 0.0150317 0.0147892 0.0147021 0.0147782 0.0150351 0.0154335 0.0159029 0.0164091 0.0169188 0.017454 0.0179987 0.018582 0.0191542 0.0195941 0.019965 0.0200501 0.0197699 0.0190178 0.0180859 0.0168117 0.0148306 0.0122132 0.00914589 0.00517495 0.000274034 -0.00567567 -0.0119522 -0.019015 -0.027428 -0.0368803 -0.0462371 -0.0553282 -0.0645359 -0.0722206 -0.0780661 -0.0818496 -0.0836184 -0.083398 -0.0813682 -0.0806859 -0.0802315 -0.0790715 -0.0741785 -0.0675736 -0.0584124 -0.0471949 -0.0365347 -0.0221446 -0.00842148 0.00390628 0.0138717 0.0209168 0.0279174 0.032652 0.0363644 0.0378083 0.0381457 0.0386339 0.0380589 0.0364261 0.0346996 0.0329857 0.0307435 0.0282373 0.0257628 0.0234154 0.0212671 0.0193352 0.0176305 0.0161413 0.0148514 0.0137257 0.0127475 0.0119135 0.011301 0.0108847 0.0106845 0.0106943 0.0109173 0.01134 0.0119987 0.0128602 0.0138878 0.0150302 0.016317 0.017681 0.0190264 0.0201758 0.0212537 0.0223787 0.0231957 0.0236423 0.0237153 0.023476 0.0227742 0.0212377 0.0189073 0.0156184 0.0112771 0.0056488 -0.00105053 -0.00936977 -0.0195179 -0.0317733 -0.045743 -0.0597158 -0.0727962 -0.084554 -0.0936442 -0.0993829 -0.101907 -0.100727 -0.0962235 -0.0928467 -0.090014 -0.0857491 -0.0814475 -0.0730665 -0.0582102 -0.0389583 -0.0211778 -0.00637601 0.0052709 0.0143633 0.0204057 0.0242013 0.0269828 0.0298384 0.0311874 0.0317778 0.0308777 0.0295532 0.0290094 0.0285985 0.0275239 0.0263527 0.0256875 0.0249607 0.0237464 0.0223188 0.0209604 0.0198252 0.0189569 0.018336 0.0178711 0.0174423 0.0170135 0.0165578 0.01609 0.0156562 0.0153131 0.0151054 0.0150201 0.0149451 0.014856 0.0147243 0.0145348 0.0143005 0.0139731 0.0135553 0.0130739 0.0124203 0.0115316 0.0103758 0.00884387 0.00695835 0.00438568 0.00131953 -0.00207126 -0.00584615 -0.00984919 -0.0153298 -0.0212527 -0.0280601 -0.0362373 -0.0446916 -0.052362 -0.062146 -0.0695529 -0.0768127 -0.0839828 -0.0892435 -0.0913163 -0.0891482 -0.0846219 -0.0790735 -0.0709191 -0.0616699 -0.0498276 -0.0277886 0.00348334 0.0290319 0.051138 0.0765044 0.10205 0.129796 0.147989 0.166144 0.17702 0.189883 0.197178 0.202799 0.205821 0.204901 0.201578 0.198721 0.192951 0.18463 0.175894 0.166523 0.156467 0.146191 0.135747 0.124164 0.112156 0.100755 0.0896737 0.0779632 0.0649556 0.0496303 0.0325963 0.017187 0.001639 -0.0178112 -0.0440301 -0.071952 -0.0987954 -0.12629 -0.153989 -0.180699 -0.204692 -0.223572 -0.234204 -1.11248 -1.10302 -1.07482 -1.03587 -0.950186 -0.856351 -0.755337 -0.670635 -0.57549 -0.460133 -0.347818 -0.242648 -0.144632 -0.0624186 0.0214987 0.103724 0.160857 0.21912 0.258584 0.287237 0.305488 0.314105 0.309126 0.301523 0.288495 0.273094 0.254769 0.236853 0.216224 0.196022 0.17493 0.154751 0.137237 0.121113 0.106136 0.09335 0.0821232 0.0718482 0.0627588 0.0546923 0.0478669 0.0419693 0.0366689 0.0318255 0.0275916 0.0241271 0.0214718 0.01936 0.0174647 0.0156823 0.013925 0.0123314 0.0108932 0.00972414 0.00887203 0.00823564 0.00788481 0.00757512 0.0074182 0.00700855 0.00667502 0.00648214 0.00650349 0.00655142 0.00634704 0.00607268 0.00590511 0.00553421 0.00489852 0.0039293 0.00260259 0.00113226 -0.000783472 -0.00283452 -0.00530612 -0.00897939 -0.0133986 -0.0180189 -0.0240855 -0.0310055 -0.0398827 -0.0497753 -0.0612035 -0.0714602 -0.0788209 -0.083643 -0.0852725 -0.0827286 -0.0778546 -0.0745933 -0.0738938 -0.073977 -0.0692514 -0.060321 -0.0477103 -0.0364319 -0.0233023 -0.0111684 0.00214543 0.0122806 0.0209066 0.0257492 0.029254 0.0303931 0.0304637 0.0299391 0.028904 0.0282069 0.0275397 0.0265596 0.0255879 0.0249183 0.023952 0.0225922 0.0210765 0.019611 0.0183194 0.0172363 0.0163417 0.0155976 0.0149446 0.014369 0.0138452 0.0134183 0.0130538 0.0128352 0.0127558 0.0128157 0.0130272 0.0133541 0.0137417 0.0141585 0.0145731 0.0150071 0.0154348 0.0158847 0.0163061 0.0166136 0.0168408 0.0167933 0.0164304 0.0156533 0.0146891 0.0133883 0.0115033 0.00906285 0.00619399 0.00257517 -0.00182017 -0.00709892 -0.0125344 -0.018774 -0.0260345 -0.0341268 -0.0420641 -0.0497325 -0.0573259 -0.063587 -0.0682925 -0.071218 -0.0724867 -0.0721184 -0.0704688 -0.0698169 -0.0693457 -0.0681523 -0.0639701 -0.0582123 -0.0503543 -0.0407578 -0.0313353 -0.0191762 -0.00737471 0.00320512 0.0118248 0.0180683 0.0240456 0.0282099 0.0313808 0.0327072 0.0330819 0.0334454 0.032948 0.0315927 0.0301026 0.0285852 0.0266528 0.0244971 0.022357 0.0203247 0.0184618 0.0167855 0.015305 0.0140116 0.0128918 0.0119166 0.0110781 0.0103895 0.00982975 0.00946102 0.00928334 0.00928601 0.00947422 0.00983232 0.0103924 0.0111201 0.0119882 0.0129521 0.0140302 0.0151624 0.0162656 0.0172031 0.0180989 0.0189987 0.0196204 0.0198966 0.0198315 0.0194615 0.0186477 0.0171068 0.0148547 0.0117477 0.00773113 0.0026115 -0.0034487 -0.0108235 -0.0198707 -0.0305281 -0.0424372 -0.0542526 -0.0651858 -0.0748314 -0.0821736 -0.0866479 -0.0883836 -0.0871063 -0.0833742 -0.0804394 -0.0778699 -0.074211 -0.0702011 -0.0627371 -0.0499969 -0.0337016 -0.0185038 -0.00576526 0.00435419 0.0122099 0.0175148 0.0208788 0.0233759 0.0257679 0.0269683 0.0274587 0.0267376 0.0256705 0.0251679 0.0247635 0.0238628 0.0228824 0.0222762 0.021617 0.0205781 0.0193599 0.0181936 0.017213 0.0164592 0.0159145 0.0155026 0.0151267 0.0147555 0.0143623 0.0139645 0.0135995 0.0133028 0.0131205 0.0130375 0.0129612 0.0128707 0.0127386 0.0125528 0.0123211 0.0120012 0.0115972 0.0111269 0.0104965 0.00965752 0.0085792 0.0071833 0.00551213 0.00318448 0.00043042 -0.00262141 -0.00606065 -0.00956888 -0.0147219 -0.0201563 -0.0263507 -0.0337795 -0.0398839 -0.0463965 -0.0557906 -0.0622053 -0.0684149 -0.0743665 -0.0785 -0.0799202 -0.0778717 -0.0738315 -0.0686995 -0.0614349 -0.0533231 -0.0425401 -0.0231321 0.00334642 0.0255854 0.0451352 0.0670931 0.0896839 0.113169 0.129368 0.145098 0.15471 0.166496 0.171047 0.177295 0.179571 0.17881 0.176007 0.173272 0.168162 0.160981 0.153349 0.145114 0.136327 0.127331 0.118166 0.108086 0.0976748 0.0877121 0.0779956 0.0677476 0.0563778 0.0431034 0.0284399 0.0149656 0.00124155 -0.0157949 -0.0382969 -0.0623958 -0.0857974 -0.109663 -0.133637 -0.156691 -0.177319 -0.193451 -0.20247 -0.950219 -0.942919 -0.920041 -0.885518 -0.814226 -0.733875 -0.648387 -0.573809 -0.491563 -0.393615 -0.296816 -0.206812 -0.123395 -0.0525474 0.0185545 0.0875624 0.137181 0.1861 0.220009 0.244229 0.258953 0.268246 0.264236 0.257647 0.246727 0.233458 0.217924 0.20237 0.184798 0.167506 0.14953 0.132327 0.117312 0.103506 0.0907015 0.0797477 0.070117 0.0613367 0.0535673 0.0466809 0.0408341 0.0357768 0.0312432 0.0271199 0.0235238 0.0205733 0.0182904 0.01647 0.0148444 0.0133189 0.0118255 0.0104776 0.0092669 0.00827816 0.00755503 0.0069812 0.00667611 0.0063314 0.00623292 0.00574277 0.00547391 0.00525473 0.00516909 0.0051218 0.00473278 0.00436109 0.0040163 0.00365739 0.00290211 0.00184405 0.00056555 -0.000886984 -0.00279865 -0.00454152 -0.00689616 -0.0102913 -0.0139205 -0.0179348 -0.0231681 -0.0291425 -0.0365158 -0.0446745 -0.0539324 -0.0620692 -0.0677808 -0.0712735 -0.0721251 -0.0697892 -0.0657558 -0.0630552 -0.0623312 -0.0621085 -0.0581258 -0.0506101 -0.0402449 -0.0306733 -0.0197133 -0.00939953 0.00164029 0.0102682 0.0174588 0.0216792 0.0246151 0.0256502 0.025753 0.025321 0.0244983 0.0238959 0.0233142 0.022505 0.0216972 0.0210976 0.020271 0.0191296 0.0178551 0.0166224 0.0155295 0.014609 0.0138488 0.0132127 0.0126585 0.01217 0.0117251 0.0113675 0.011043 0.0108581 0.0107879 0.010831 0.0109969 0.0112524 0.0115573 0.0118822 0.0121999 0.0125273 0.0128373 0.0131528 0.0134232 0.0135964 0.0136791 0.0135041 0.0130584 0.0122517 0.0112605 0.00994978 0.00816282 0.0058995 0.00324903 3.31717e-07 -0.00387988 -0.0084657 -0.0130382 -0.0184671 -0.0246094 -0.0313615 -0.037889 -0.0441635 -0.0501783 -0.0550601 -0.0586025 -0.0606693 -0.0614115 -0.060893 -0.0595174 -0.0589008 -0.0584307 -0.0573169 -0.0538355 -0.0489587 -0.0423734 -0.0343848 -0.0263084 -0.0162153 -0.00630059 0.00258042 0.00986168 0.0152332 0.0202376 0.0238044 0.0264649 0.0276474 0.0280225 0.0282929 0.0278751 0.0267629 0.0255062 0.0241994 0.0225685 0.0207562 0.0189455 0.017227 0.0156485 0.0142268 0.0129708 0.0118736 0.0109235 0.0100959 0.00938413 0.00879712 0.00832269 0.00800899 0.00785515 0.00785064 0.00800183 0.00829235 0.00875068 0.00934337 0.0100482 0.0108284 0.0116935 0.0125936 0.0134621 0.0141957 0.014902 0.0155714 0.0159944 0.0161072 0.0159016 0.0153977 0.0144836 0.0129483 0.0107893 0.00788179 0.00421187 -0.00039448 -0.00578986 -0.0122347 -0.0200214 -0.0291194 -0.0390523 -0.0487943 -0.0576139 -0.0652042 -0.0707911 -0.0739941 -0.0749446 -0.0735353 -0.0703962 -0.0678647 -0.0655979 -0.0625191 -0.0589684 -0.0525708 -0.0419278 -0.028504 -0.0157725 -0.00504781 0.00352361 0.010159 0.0146936 0.0175945 0.0197673 0.0217412 0.0227784 0.0231818 0.0226166 0.0217721 0.0213229 0.0209497 0.020211 0.0194041 0.0188668 0.0182887 0.0174194 0.0164016 0.0154201 0.0145921 0.0139515 0.0134843 0.013129 0.0128079 0.0124942 0.0121633 0.0118349 0.0115353 0.0112845 0.0111271 0.0110478 0.0109717 0.0108803 0.0107478 0.0105636 0.0103347 0.0100218 0.00962952 0.00917061 0.00856251 0.00777368 0.00677431 0.00552496 0.00406222 0.00194282 -0.000557546 -0.00329326 -0.0064527 -0.009671 -0.0140501 -0.0189638 -0.0244513 -0.0302421 -0.0354354 -0.0409345 -0.0489473 -0.0550572 -0.0601009 -0.06485 -0.0679074 -0.0687009 -0.0667196 -0.063118 -0.0584457 -0.0520492 -0.0451836 -0.0356775 -0.0190919 0.00289781 0.0219223 0.0388517 0.0575924 0.0770389 0.0967199 0.110883 0.124071 0.132608 0.141514 0.146197 0.152049 0.153461 0.152784 0.1504 0.147874 0.143429 0.137328 0.130784 0.123696 0.11617 0.108456 0.100587 0.0919952 0.0831521 0.074639 0.0663131 0.0575477 0.0478396 0.0365914 0.0242302 0.0127256 0.000921052 -0.0136397 -0.0325651 -0.0529237 -0.0728518 -0.0931059 -0.113395 -0.13285 -0.150185 -0.163652 -0.171116 -0.788111 -0.783229 -0.765785 -0.736777 -0.678856 -0.611943 -0.541243 -0.477649 -0.408453 -0.327159 -0.246019 -0.171015 -0.101964 -0.0428996 0.0155476 0.0718838 0.113508 0.15355 0.181811 0.201558 0.21236 0.222246 0.219484 0.214016 0.205086 0.19399 0.181139 0.168038 0.153463 0.139071 0.124165 0.109903 0.0973984 0.0859063 0.075263 0.0661456 0.0581213 0.050829 0.0443759 0.038662 0.0337964 0.0295832 0.0258167 0.0224054 0.0194369 0.0169932 0.0150848 0.0135631 0.0122106 0.0109448 0.00971537 0.00861672 0.00762439 0.00682796 0.00623349 0.00575154 0.00546256 0.00514161 0.00497158 0.004522 0.00420575 0.00394146 0.00376086 0.00358892 0.00310614 0.00266292 0.00208302 0.00163843 0.000834669 -0.000281118 -0.0015395 -0.00294469 -0.00488282 -0.00623093 -0.00849657 -0.0115922 -0.0145307 -0.0177766 -0.021978 -0.0269899 -0.033027 -0.0395795 -0.0467238 -0.052795 -0.0568528 -0.0590353 -0.059151 -0.0569735 -0.0536801 -0.0514971 -0.0508324 -0.0504592 -0.047197 -0.0411295 -0.0328533 -0.0249983 -0.016116 -0.00766123 0.00123019 0.00831679 0.0141377 0.0176698 0.0200636 0.0209586 0.0210767 0.0207268 0.0200899 0.0195836 0.0190952 0.018445 0.0177911 0.0172777 0.0165936 0.0156638 0.0146255 0.0136211 0.0127264 0.0119703 0.0113448 0.0108206 0.0103641 0.0099619 0.00959512 0.00922064 0.00898098 0.00885434 0.00880193 0.0088326 0.00895599 0.00914522 0.00936944 0.00960409 0.00982595 0.0100455 0.0102376 0.0104137 0.0105352 0.0105668 0.0104997 0.0102032 0.00966388 0.00881604 0.00779195 0.0064797 0.00478339 0.0026926 0.000274435 -0.0026102 -0.00594971 -0.00983113 -0.0136168 -0.0181531 -0.0231541 -0.0285789 -0.0337145 -0.0385858 -0.0430691 -0.0466077 -0.0489983 -0.0502172 -0.0504255 -0.0497449 -0.0485836 -0.0480406 -0.0476183 -0.0466433 -0.0438333 -0.0398545 -0.034518 -0.0280661 -0.0213901 -0.0132522 -0.00519829 0.00202442 0.00797462 0.0124264 0.0165039 0.0194522 0.0216156 0.0226239 0.0229646 0.0231581 0.0228161 0.0219243 0.0208964 0.0198104 0.018477 0.0170003 0.0155181 0.0141124 0.0128186 0.0116536 0.0106244 0.00972476 0.00894514 0.00826123 0.00766068 0.0070989 0.00676778 0.00652385 0.00640022 0.00639279 0.0065095 0.00673661 0.00709605 0.0075584 0.00810415 0.00870628 0.0093626 0.0100325 0.0106671 0.0111961 0.0117021 0.0121358 0.0123516 0.012284 0.0119247 0.0112819 0.0102654 0.00872391 0.00665125 0.00394866 0.000634794 -0.00344984 -0.00815905 -0.0137046 -0.0201442 -0.0276808 -0.0356826 -0.0433604 -0.0500819 -0.055671 -0.0595172 -0.0614577 -0.0616243 -0.0600624 -0.0574213 -0.0553135 -0.0534256 -0.0509318 -0.0479274 -0.0426706 -0.0340826 -0.0233135 -0.0129811 -0.00424131 0.00277297 0.00819825 0.0119397 0.0143518 0.0161706 0.0177615 0.0186279 0.0189475 0.0185182 0.0178653 0.0174757 0.0171503 0.0165594 0.0159131 0.0154544 0.0149681 0.014262 0.0134368 0.0126374 0.0119602 0.0114332 0.0110464 0.0107509 0.0104861 0.0102298 0.0099612 0.00970253 0.00946374 0.00925942 0.00912855 0.00905382 0.00897729 0.00888422 0.00875036 0.00856784 0.00834103 0.00803303 0.00765031 0.00720239 0.00661709 0.00587334 0.00495168 0.00381602 0.00247061 0.000468589 -0.00182037 -0.00426353 -0.00706777 -0.0101339 -0.0134402 -0.0174978 -0.0220646 -0.0265335 -0.0312543 -0.035843 -0.0421412 -0.0477319 -0.0517745 -0.0554455 -0.0573865 -0.0575604 -0.0556121 -0.0523871 -0.0482162 -0.0427163 -0.0368852 -0.0288326 -0.0150955 0.00268844 0.0184246 0.0326015 0.0481695 0.0644356 0.0805402 0.0925237 0.103284 0.110391 0.115825 0.121606 0.126711 0.127526 0.126795 0.124814 0.122559 0.11878 0.11371 0.10824 0.1023 0.0960198 0.0895858 0.0830184 0.0758997 0.0686012 0.0615447 0.0546291 0.047362 0.0393328 0.0300905 0.0199786 0.010472 0.000663373 -0.0113759 -0.0268321 -0.0435178 -0.0599533 -0.0766105 -0.0932488 -0.109152 -0.123255 -0.134125 -0.140077 -0.626089 -0.623849 -0.612117 -0.589396 -0.544117 -0.490514 -0.433801 -0.381961 -0.325959 -0.260796 -0.195356 -0.135248 -0.0804023 -0.0334367 0.0124272 0.0564544 0.0897085 0.121346 0.143995 0.159747 0.166718 0.175393 0.174371 0.170078 0.163077 0.154217 0.144026 0.133484 0.121893 0.110413 0.0985806 0.0872572 0.0772879 0.0681345 0.0596665 0.0524014 0.0460041 0.0402093 0.0350838 0.0305503 0.0266822 0.0233334 0.0203464 0.0176537 0.0153172 0.0133873 0.0118689 0.0106641 0.00959508 0.00859264 0.00762084 0.00676082 0.00602478 0.00538394 0.00490067 0.00450043 0.00423751 0.00390376 0.00363929 0.00331616 0.00298703 0.00266471 0.00248113 0.00217351 0.00177628 0.00130588 0.000605091 -0.000188791 -0.00104063 -0.00216054 -0.0033989 -0.00480604 -0.00654359 -0.00790357 -0.0100388 -0.0126385 -0.0149232 -0.0175545 -0.0208775 -0.0248923 -0.0296193 -0.0345631 -0.0396326 -0.04366 -0.0460621 -0.0469571 -0.0463561 -0.0442859 -0.0416791 -0.0399683 -0.0393947 -0.0389898 -0.0364591 -0.0317924 -0.0254761 -0.0193669 -0.0125087 -0.00593405 0.000902494 0.00641746 0.010914 0.0137099 0.0155724 0.0162923 0.0164018 0.0161286 0.0156501 0.0152475 0.0148609 0.0143566 0.0138515 0.0134382 0.0129028 0.0121842 0.0113817 0.0106004 0.00990622 0.00931723 0.00882838 0.00842007 0.00806304 0.00774949 0.00746452 0.00711881 0.0069441 0.00686467 0.00682802 0.00684812 0.00693301 0.00706162 0.00721146 0.00736127 0.00749037 0.00760639 0.00768337 0.00772756 0.00770792 0.00760181 0.00739122 0.00697465 0.00634218 0.00544527 0.00438006 0.0030634 0.00143969 -0.000498512 -0.00269537 -0.00523075 -0.00809357 -0.0113093 -0.0143762 -0.0179865 -0.0218045 -0.0259 -0.0296246 -0.0330844 -0.0360563 -0.038249 -0.0394998 -0.0398656 -0.0395416 -0.0386844 -0.0376999 -0.0372521 -0.0369031 -0.0361047 -0.0339424 -0.030851 -0.0267269 -0.0217594 -0.0165347 -0.0102794 -0.00405605 0.00153479 0.00614128 0.00964226 0.0128139 0.0151202 0.016794 0.0175962 0.0178765 0.0180123 0.0177423 0.0170628 0.0162643 0.015411 0.0143742 0.0132272 0.0120774 0.0109838 0.00997602 0.00906993 0.00826974 0.00756958 0.0069624 0.00642818 0.00595529 0.00548372 0.00524801 0.00506398 0.00496703 0.00495664 0.00504013 0.00520596 0.00547033 0.0058083 0.00620284 0.00663236 0.00708896 0.00754133 0.00795104 0.0082724 0.00857978 0.00879563 0.00880871 0.00856001 0.00804538 0.00726306 0.00614539 0.00458255 0.00257728 5.67371e-05 -0.00293163 -0.00652671 -0.0105655 -0.0152591 -0.0204924 -0.0264623 -0.0324836 -0.0380975 -0.042704 -0.0462977 -0.0484088 -0.0490756 -0.0484513 -0.0467174 -0.0445176 -0.0428571 -0.041374 -0.0394482 -0.0370672 -0.032963 -0.026349 -0.0181049 -0.0101292 -0.00335808 0.00209567 0.0063161 0.00924072 0.011145 0.0125859 0.0138102 0.014493 0.0147323 0.0144148 0.0139248 0.0136096 0.0133446 0.0128866 0.0123917 0.0120266 0.0116405 0.0110919 0.0104539 0.00983763 0.00931142 0.00890174 0.00860004 0.00836762 0.00816073 0.00796207 0.00775473 0.00756377 0.00737586 0.00722464 0.0071214 0.00705567 0.00698335 0.00689189 0.0067615 0.00658593 0.0063665 0.00607382 0.00571227 0.00528744 0.00474326 0.00405822 0.00321894 0.00215063 0.000857632 -0.000905409 -0.00288124 -0.00497166 -0.00737305 -0.0100456 -0.0126767 -0.0157397 -0.0193845 -0.0230328 -0.0268607 -0.0306389 -0.0350142 -0.0393774 -0.0428202 -0.0456501 -0.0468364 -0.0465554 -0.0446406 -0.0417626 -0.0381179 -0.0334444 -0.0289981 -0.022443 -0.0115429 0.00230754 0.0147877 0.0261175 0.0385507 0.0516412 0.0642729 0.0739193 0.0823911 0.0879605 0.0922904 0.0958681 0.0996047 0.101291 0.100535 0.0989877 0.0970662 0.0939808 0.0899328 0.0855513 0.0807934 0.0757815 0.0706476 0.065411 0.0597723 0.0540079 0.0484161 0.0429295 0.0371777 0.0308448 0.023596 0.0156952 0.0082112 0.000458324 -0.00902696 -0.0210954 -0.034163 -0.0470956 -0.0601681 -0.0731824 -0.0855735 -0.0964941 -0.104819 -0.109282 -0.464903 -0.465632 -0.459311 -0.443283 -0.409974 -0.369454 -0.326249 -0.286729 -0.243982 -0.194537 -0.144762 -0.0994858 -0.0587147 -0.0240141 0.00943125 0.0415249 0.0662313 0.0894336 0.106267 0.118552 0.121553 0.128401 0.128462 0.125386 0.120309 0.113799 0.106335 0.098508 0.0899582 0.0814598 0.0727612 0.0644225 0.0570447 0.050285 0.0440304 0.0386456 0.0339026 0.0296193 0.0258319 0.0224844 0.0196225 0.0171458 0.0149345 0.0129479 0.0112269 0.0098022 0.00867077 0.00776393 0.00695747 0.00620565 0.00548993 0.00488329 0.00427117 0.00383188 0.0034939 0.0032134 0.0030335 0.00272611 0.00247318 0.00219738 0.00192726 0.00160192 0.00137221 0.000957441 0.000566941 1.24711e-05 -0.000749913 -0.00180452 -0.00275532 -0.00390329 -0.00515265 -0.00657907 -0.00809107 -0.0098725 -0.0117767 -0.0135706 -0.0153513 -0.0177612 -0.0202384 -0.0232227 -0.0266082 -0.0298117 -0.0328142 -0.0347591 -0.0354637 -0.0350551 -0.0337211 -0.0316929 -0.0297311 -0.0284809 -0.0280333 -0.0276798 -0.0258728 -0.0225714 -0.0181273 -0.0137716 -0.00891635 -0.00422424 0.000619331 0.00454734 0.00774542 0.0097665 0.011101 0.0116247 0.0117033 0.0115144 0.0111763 0.0108869 0.0106127 0.0102494 0.00989124 0.00959019 0.00920847 0.00869991 0.00813125 0.00757116 0.00707787 0.00665707 0.00630679 0.00601564 0.00576014 0.00553659 0.00533687 0.0050789 0.00495359 0.00490463 0.00487786 0.00488471 0.00493091 0.00500032 0.00507684 0.00514354 0.00518441 0.00520089 0.00516944 0.00508732 0.00493539 0.0047023 0.00436461 0.00383918 0.00312732 0.00219341 0.00110516 -0.000204782 -0.00175274 -0.00354168 -0.00552844 -0.00773582 -0.0101388 -0.01277 -0.0151265 -0.0178688 -0.0205648 -0.0233875 -0.0257272 -0.02776 -0.029228 -0.0300497 -0.0301378 -0.0296209 -0.0287538 -0.0276999 -0.0268657 -0.026528 -0.0262656 -0.0256735 -0.0241359 -0.0219311 -0.0189991 -0.0154854 -0.0117405 -0.00731899 -0.00290194 0.00107236 0.00434269 0.00686811 0.00913383 0.010784 0.0119758 0.0125552 0.0127623 0.0128609 0.0126631 0.0121897 0.011623 0.0110104 0.010269 0.00944932 0.00863186 0.00784993 0.00712839 0.00648142 0.00591049 0.00541047 0.00497639 0.00459436 0.00425672 0.00391199 0.00375097 0.00362041 0.00354795 0.00353466 0.00358568 0.00369146 0.00386214 0.00407763 0.00432344 0.00458134 0.00484202 0.00508218 0.0052744 0.00539293 0.00550897 0.00552648 0.00535497 0.00494571 0.00429422 0.00339559 0.00219853 0.000630309 -0.00130099 -0.00363874 -0.00632478 -0.00945602 -0.0128846 -0.0168056 -0.0209174 -0.0254269 -0.02949 -0.0330824 -0.0355852 -0.0371662 -0.0375148 -0.0368713 -0.0354357 -0.0335016 -0.0317016 -0.0305 -0.0294304 -0.028058 -0.02633 -0.023392 -0.0187079 -0.0129009 -0.0072421 -0.00242712 0.00146703 0.00447348 0.00656944 0.00794772 0.00899537 0.00985773 0.0103426 0.0105118 0.0102889 0.00994493 0.00972143 0.00952726 0.00919617 0.00884827 0.00858787 0.00830879 0.00791621 0.00746276 0.00702856 0.00665383 0.00636165 0.0061472 0.00597988 0.005832 0.00569125 0.00554506 0.00542014 0.00530914 0.00520762 0.00513319 0.00507968 0.00501468 0.00492843 0.00480559 0.00464054 0.00443245 0.00416387 0.00383425 0.00344518 0.00295357 0.00234551 0.00159461 0.000591515 -0.00063507 -0.00200193 -0.00356605 -0.00527195 -0.00724347 -0.00928442 -0.0115637 -0.0138017 -0.0165816 -0.0193986 -0.0223054 -0.0252056 -0.0280122 -0.0309432 -0.0334398 -0.035316 -0.0361111 -0.0354837 -0.0335973 -0.0310408 -0.0279267 -0.0241922 -0.020659 -0.0158219 -0.00778625 0.00230414 0.0115801 0.0200278 0.0291122 0.0387143 0.0478397 0.0549842 0.0611722 0.0657864 0.0694448 0.0704574 0.0722521 0.074574 0.0740111 0.0728684 0.0713584 0.0690237 0.0660202 0.0627617 0.0592362 0.0555267 0.0517202 0.0478412 0.0436816 0.0394339 0.0353108 0.0312661 0.0270373 0.0223965 0.0171173 0.0113894 0.00594173 0.000281193 -0.00662624 -0.0153631 -0.0248501 -0.0342713 -0.0437664 -0.0531787 -0.0620893 -0.0698676 -0.0756906 -0.0786703 -0.303302 -0.307662 -0.306844 -0.298218 -0.277151 -0.250344 -0.221383 -0.193886 -0.164006 -0.129466 -0.0947362 -0.0638773 -0.0370275 -0.0149175 0.00579743 0.0258664 0.041629 0.0558888 0.0664776 0.074656 0.0757151 0.0801528 0.080316 0.0784163 0.0752504 0.071156 0.0664798 0.061519 0.0561339 0.0507742 0.0453257 0.0401001 0.0354618 0.0312212 0.0272979 0.023915 0.0209396 0.0182636 0.0159026 0.0138201 0.0120399 0.010502 0.00912907 0.00790016 0.00684375 0.00598435 0.0053141 0.00476455 0.00428283 0.00382632 0.00338489 0.00302444 0.00279022 0.00252708 0.00231831 0.00213032 0.00197961 0.00170301 0.00145146 0.00102293 0.0006406 0.000173503 -0.000293758 -0.000907408 -0.00155951 -0.00233085 -0.00327079 -0.00440094 -0.00548137 -0.00669189 -0.00795526 -0.0093163 -0.0107155 -0.0124518 -0.0139471 -0.0151766 -0.0164934 -0.0182759 -0.0197836 -0.0216113 -0.0235688 -0.0250288 -0.026018 -0.025942 -0.0249603 -0.0232646 -0.0211988 -0.0191761 -0.0178079 -0.0170325 -0.0167447 -0.0165029 -0.0154185 -0.0134572 -0.0108274 -0.00822955 -0.00533878 -0.00253534 0.000349799 0.0027089 0.00462196 0.00583491 0.00663454 0.00695666 0.00700478 0.00690065 0.00669848 0.00652515 0.00636552 0.00614664 0.00593332 0.00575068 0.00552251 0.00521943 0.00487978 0.00454298 0.00424796 0.00399538 0.0037852 0.00361039 0.00345773 0.0033263 0.00321271 0.00312518 0.00304786 0.00299835 0.00296778 0.0029523 0.00295268 0.00295609 0.00295238 0.00292898 0.00287318 0.00278151 0.00263075 0.00241209 0.00211807 0.00174716 0.00127707 0.000636114 -0.000155871 -0.00112738 -0.00222576 -0.00351643 -0.00497347 -0.00659709 -0.00834809 -0.010201 -0.0121141 -0.0140853 -0.0157069 -0.0175098 -0.0191322 -0.0207297 -0.0217458 -0.0223677 -0.0223908 -0.0218722 -0.0208251 -0.0194307 -0.0180256 -0.0167652 -0.0160731 -0.015862 -0.0156999 -0.0153364 -0.0144154 -0.0130943 -0.0113437 -0.00925412 -0.00701197 -0.00437958 -0.00174909 0.000618053 0.00259109 0.00411098 0.00545554 0.00644705 0.00717015 0.0075231 0.0076501 0.00771533 0.00759475 0.0073167 0.00697862 0.00660964 0.00616328 0.00567146 0.00518191 0.00471256 0.004279 0.00389089 0.0035482 0.0032482 0.00298817 0.00276212 0.00257211 0.00242127 0.00229047 0.00220253 0.00215028 0.00213169 0.00214861 0.0021929 0.00226748 0.00235561 0.00244644 0.00252538 0.00258162 0.00259689 0.00255765 0.00246382 0.00237864 0.0021925 0.00183077 0.00125208 0.000461838 -0.000549836 -0.001817 -0.00338337 -0.00521767 -0.00735033 -0.00969009 -0.0123228 -0.0150882 -0.0181254 -0.0210422 -0.0240196 -0.026335 -0.0279308 -0.0284024 -0.0280425 -0.0266847 -0.0247494 -0.0225179 -0.0203704 -0.0189518 -0.0182219 -0.017576 -0.0167525 -0.0157034 -0.0139457 -0.0111578 -0.00771599 -0.00434546 -0.00147173 0.00086257 0.00266045 0.00392257 0.00475324 0.00538931 0.0058973 0.00618681 0.00629566 0.00616302 0.00595913 0.00582986 0.0057128 0.00551182 0.0053066 0.00515137 0.00498304 0.0047473 0.00447636 0.00421835 0.00399422 0.0038189 0.00369068 0.00359026 0.00350196 0.00341864 0.0033381 0.00328602 0.00328624 0.00320689 0.00314857 0.00309374 0.00301918 0.00291685 0.00277374 0.00258475 0.00234536 0.00204219 0.00167721 0.001248 0.000719748 9.12347e-05 -0.000669109 -0.00162795 -0.00276332 -0.00395192 -0.00529596 -0.00677226 -0.00842538 -0.0100937 -0.011977 -0.0137755 -0.015849 -0.0179283 -0.0199202 -0.0218616 -0.0235913 -0.0251186 -0.0261543 -0.0265878 -0.0263455 -0.0250477 -0.0230138 -0.0206366 -0.0179287 -0.0150056 -0.0132921 -0.0100666 -0.00485918 0.00155214 0.00756427 0.0130958 0.0186761 0.0244645 0.0300824 0.0345704 0.0384279 0.0417825 0.0438853 0.0442206 0.0448461 0.0463872 0.0460413 0.0452829 0.0442756 0.0427752 0.0408889 0.0388476 0.0366491 0.0343399 0.0319702 0.0295607 0.026985 0.0243551 0.0218093 0.0193144 0.0167064 0.0138329 0.0105714 0.00704221 0.00368018 0.000179743 -0.00412293 -0.0095748 -0.0155314 -0.0214661 -0.0274181 -0.0332662 -0.0387295 -0.0433907 -0.0467226 -0.048193 -0.118499 -0.124646 -0.128344 -0.127971 -0.12159 -0.111995 -0.101068 -0.0890645 -0.0754987 -0.0592333 -0.0424444 -0.0276858 -0.015232 -0.0052325 0.00430606 0.0135938 0.0212206 0.027753 0.0328673 0.0367297 0.0378725 0.0397365 0.0398139 0.0389236 0.0374046 0.035389 0.0330752 0.0305841 0.0279338 0.0252918 0.0226522 0.0201195 0.0178305 0.0157191 0.013764 0.0120586 0.0105414 0.00917838 0.00797226 0.00690541 0.0059813 0.00517742 0.00446644 0.00383897 0.00330156 0.00285716 0.00249437 0.00217633 0.00188929 0.00160586 0.00133275 0.0011593 0.00102241 0.000809268 0.000604538 0.00038652 0.000144733 -0.000170039 -0.000524113 -0.00101671 -0.00154139 -0.00216002 -0.00282873 -0.00361048 -0.00447722 -0.00542016 -0.00649456 -0.00764235 -0.00879688 -0.0100215 -0.011234 -0.0124753 -0.0137056 -0.0150624 -0.016088 -0.0169203 -0.017679 -0.0185286 -0.0190272 -0.0195073 -0.0197744 -0.0193183 -0.0182951 -0.0161713 -0.0135683 -0.0107904 -0.00829938 -0.00659995 -0.00590622 -0.0056405 -0.00554126 -0.00545855 -0.00509881 -0.00445035 -0.00358868 -0.00273323 -0.00177676 -0.000855983 0.000101137 0.000896504 0.00153663 0.00193971 0.00220662 0.00231717 0.00233408 0.00230157 0.00223621 0.0021784 0.00212496 0.0020512 0.00198062 0.00191862 0.00184229 0.00174094 0.00162766 0.00151585 0.00141712 0.00133281 0.00126292 0.00120439 0.00115417 0.0011131 0.00108609 0.00107942 0.00104519 0.00101585 0.000983603 0.000942533 0.000890776 0.000819715 0.000726018 0.00060066 0.000432002 0.00021355 -8.17789e-05 -0.000456496 -0.000923592 -0.00146417 -0.00209875 -0.00289569 -0.00380297 -0.00486456 -0.0060094 -0.00732373 -0.00870625 -0.0101705 -0.0116604 -0.0131138 -0.0144433 -0.015641 -0.0163922 -0.0170968 -0.017474 -0.01767 -0.0171688 -0.0163034 -0.0147982 -0.0129254 -0.0108201 -0.00870527 -0.0069835 -0.00576319 -0.00532907 -0.00525722 -0.00520389 -0.00508086 -0.00477907 -0.00434095 -0.00376116 -0.00306898 -0.00232697 -0.0014552 -0.000591252 0.000190819 0.000855432 0.00136672 0.00181166 0.00214531 0.00239032 0.00251187 0.00255699 0.00257845 0.00253647 0.00244307 0.00232941 0.00220569 0.00205628 0.00189285 0.00172878 0.00157235 0.00142789 0.00129837 0.00118379 0.00108381 0.000998019 0.000925383 0.000871246 0.000829109 0.000776305 0.000736801 0.000704029 0.000676282 0.000652731 0.000626324 0.000593861 0.00054251 0.00046257 0.000342964 0.000170913 -6.4163e-05 -0.000359941 -0.000692236 -0.00100146 -0.00143111 -0.00203175 -0.00283504 -0.0038278 -0.00501354 -0.00641214 -0.0080313 -0.00979604 -0.0117378 -0.0136914 -0.0157592 -0.0177036 -0.0196994 -0.0212083 -0.0223777 -0.022614 -0.0220152 -0.0202644 -0.0178907 -0.0148616 -0.0118249 -0.0091143 -0.00711752 -0.00627631 -0.00603061 -0.00581662 -0.00554572 -0.00519787 -0.00461516 -0.0036953 -0.00256125 -0.00144946 -0.000502771 0.000273501 0.000880803 0.00130421 0.00158211 0.00179518 0.00196337 0.00206099 0.00209903 0.00205541 0.00198932 0.00194579 0.00190584 0.00183873 0.0017711 0.00171825 0.00166193 0.00158378 0.00149413 0.00140821 0.00133406 0.00127639 0.00123377 0.00120118 0.00117238 0.00114597 0.00112678 0.00114111 0.00113073 0.00108452 0.00103135 0.000960021 0.000856189 0.000714259 0.000523944 0.000280939 -2.33011e-05 -0.000398374 -0.00084081 -0.0013571 -0.00196943 -0.00266769 -0.0034849 -0.00440999 -0.00541973 -0.00651659 -0.00769968 -0.00896234 -0.010317 -0.0116376 -0.0130668 -0.0144492 -0.0157899 -0.0170727 -0.0180891 -0.0189676 -0.01951 -0.0196466 -0.0192997 -0.0183724 -0.0169323 -0.0149193 -0.0126108 -0.0102731 -0.00786933 -0.00571138 -0.00455863 -0.00246617 0.000318215 0.00344677 0.00642925 0.00922553 0.0119185 0.014574 0.0170828 0.0191214 0.0208099 0.0221945 0.0229519 0.0230589 0.0232025 0.0235061 0.0231279 0.0225547 0.0218459 0.0209283 0.0198763 0.0187532 0.0175518 0.0163088 0.0150366 0.0137515 0.0124192 0.0110864 0.00980577 0.00856203 0.00728785 0.00592437 0.00443877 0.00288763 0.00142514 -7.91676e-05 -0.00190339 -0.00415359 -0.00656256 -0.00888689 -0.011107 -0.0131635 -0.0149425 -0.0162825 -0.0169961 -0.0169268 ) ; boundaryField { inlet { type zeroGradient; } bottom { type zeroGradient; } outlet { type zeroGradient; } atmosphere { type totalPressure; rho none; psi none; gamma 1; p0 uniform 0; value nonuniform List<scalar> 357 ( -0.0105688 -0.0119026 -0.0130192 -0.0136192 -0.0132461 -0.0123144 -0.0111176 -0.00975057 -0.0080464 -0.00584427 -0.00357685 -0.0017882 -0.000594935 -3.38452e-05 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.61167e-06 -2.86498e-05 -9.5214e-05 -0.00020522 -0.000376683 -0.000611748 -0.000935626 -0.00133955 -0.00184208 -0.00245823 -0.0031698 -0.00399242 -0.00493648 -0.0059588 -0.00710162 -0.0082861 -0.00951242 -0.0107903 -0.0120363 -0.0132781 -0.0144647 -0.0156146 -0.0164629 -0.0171571 -0.0176517 -0.018028 -0.0180056 -0.017646 -0.0168129 -0.0151148 -0.0128674 -0.00975608 -0.00665866 -0.00374705 -0.0014729 -0.000223281 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.79597e-06 -2.07776e-05 -6.14402e-05 -0.00012539 -0.000215733 -0.000338811 -0.000494145 -0.000690933 -0.000939088 -0.00124867 -0.00164888 -0.00214303 -0.00273797 -0.00340409 -0.00416902 -0.00509555 -0.00610764 -0.0072569 -0.00846429 -0.009821 -0.0111776 -0.0125572 -0.0138815 -0.0150597 -0.0159783 -0.016637 -0.0167949 -0.0167686 -0.0162558 -0.0155111 -0.0140097 -0.0122462 -0.00991202 -0.00745901 -0.00502254 -0.00281587 -0.00120112 -0.000232409 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -5.93105e-06 -2.30755e-05 -4.93405e-05 -8.66084e-05 -0.000137241 -0.000209183 -0.000308637 -0.000448158 -0.000635905 -0.000882984 -0.00120285 -0.00160209 -0.00206641 -0.00255333 -0.0030092 -0.00361652 -0.00440432 -0.00539265 -0.00655713 -0.00789964 -0.00942923 -0.0111231 -0.0128774 -0.0147166 -0.0164181 -0.0181036 -0.0194544 -0.020717 -0.0212579 -0.0211794 -0.0198826 -0.0178104 -0.0147304 -0.0113576 -0.0077309 -0.00452312 -0.00198196 -0.000422954 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.12279e-06 -2.68554e-05 -7.81578e-05 -0.000159209 -0.000276513 -0.000432149 -0.000633153 -0.000882621 -0.00118864 -0.00155426 -0.00197873 -0.00246729 -0.00303053 -0.00365196 -0.00436166 -0.00512665 -0.00592034 -0.00678265 -0.0076464 -0.00853179 -0.00942526 -0.0102135 -0.0110585 -0.0117927 -0.0123378 -0.0127888 -0.0129295 -0.0129028 -0.0125582 -0.0117986 -0.0107058 -0.00923844 -0.0075074 -0.00559379 -0.00370436 -0.0021213 -0.000889745 -0.000169073 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.73939e-07 -1.46276e-05 -5.42365e-05 -0.000116036 -0.000187689 -0.000261787 -0.000331729 -0.000389716 -0.0004266 -0.000433667 -0.000406372 ) ; } frontBack { type empty; } } // ************************************************************************* //
[ "abenaz15@etudiant.mines-nantes.fr" ]
abenaz15@etudiant.mines-nantes.fr
9fa460409a75c87fa87c8036b91fbcde35e3f3ad
b88c209d772784f220a866c8fba308936f7c6c6c
/src/predictor.cpp
3e80f4f1a3835d9d4706e4ce554d56a72a6e9d01
[]
no_license
rudi77/CarND-Path-Planning-Project
10c1b3fb2c8b0c6a27d24b1c3310c77327417050
5a7e98a243a4a51f92479efdc33758c5696927d1
refs/heads/master
2021-08-26T06:38:04.440550
2017-11-21T21:09:16
2017-11-21T21:09:16
105,687,624
0
0
null
2017-10-03T18:26:33
2017-10-03T18:26:33
null
UTF-8
C++
false
false
610
cpp
#include <map> #include "map.h" #include "predictor.h" #include "trajectory_generator.h" using namespace std; map<int, vector<CarState>> Predictor::predict_trajectories(const vector<CarState>& other_cars, const Map& map) { TrajectoryGenerator trajectory_generator(map); std::map<int, vector<CarState>> trajectories; for (auto car : other_cars) { auto trajectory = trajectory_generator.compute_trajectory(car, car.speed, car.current_lane); assert(trajectory.size() == 50); trajectory.insert(trajectory.begin(), car); trajectories[car.id] = trajectory; } return trajectories; }
[ "rudi.dittrich77@gmail.com" ]
rudi.dittrich77@gmail.com
121104e12b3a46e2466ea7a1b4438470538c997b
be9123f1001fd2d220f9f54d0fc4b682c784ea45
/time.hpp
5146a4808fcf70172bbab03fe82736536ef041ed
[ "MIT" ]
permissive
komasaru/iss_sgp4_blh
751eb735cbfe9a30245b5bf80fe52628e82f53f3
cd8739824d1bf2979f7253269934e724ba856367
refs/heads/main
2023-06-10T21:20:27.978078
2021-06-29T14:28:14
2021-06-29T14:28:14
376,414,321
0
0
null
null
null
null
UTF-8
C++
false
false
1,459
hpp
#ifndef ISS_SGP4_BLH_TIME_HPP_ #define ISS_SGP4_BLH_TIME_HPP_ #include <cmath> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <sstream> #include <string> #include <vector> namespace iss_sgp4_blh { struct DateTime { unsigned int year; unsigned int month; unsigned int day; unsigned int hour; unsigned int minute; double second ; }; std::string gen_time_str(struct timespec ts); // 日時文字列生成 struct timespec ts_add(struct timespec, double); // 時刻 + 秒数 DateTime days2ymdhms(unsigned int, double); // 年+経過日数 => 年月日時分秒 double jday(DateTime); // 年月日時分秒 => ユリウス日 double gstime(double); // Greenwich sidereal time calculation double get_dut1(struct timespec); // DUT1 取得(EOP 読み込み) unsigned int get_dat(struct timespec); // DAT (= TAI - UTC)(うるう秒総和)取得 struct timespec jst2utc(struct timespec); // JST -> UTC struct timespec utc2ut1(struct timespec); // UTC -> UT1 struct timespec utc2tai(struct timespec); // UTC -> TAI struct timespec tai2tt(struct timespec); // TAI -> TT double gc2jd(struct timespec); // Gregorian Calendar -> Julian Day double jd2jcn(double); // Julian Day -> Julian Century Number } // namespace iss_sgp4_blh #endif
[ "masaru@mk-mode.com" ]
masaru@mk-mode.com
65ca9ba821fcbc92f48de62e60c1f28d5e54ac80
fcb93b835ce45a932e0c859d6a37ffaac4a71980
/project5/second.cpp
43d18b23e56b7a82a5ac8bccbcf8d973a76b00bf
[]
no_license
tcs76321/CS475
44c6d483522e0433dfb1b3538999d2c4baa7ed50
0b4779bf2dd172dd219bebe22364b7be558ade7a
refs/heads/master
2022-02-09T11:36:46.689518
2019-06-10T01:05:22
2019-06-10T01:05:22
180,644,805
1
0
null
null
null
null
UTF-8
C++
false
false
8,750
cpp
// 1. Program header #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #ifdef WIN32 #include <windows.h> #else #include <unistd.h> #endif #include <omp.h> #include "CL/cl.h" #include "CL/cl_platform.h" #ifndef NMB #define NMB 64 #endif #define NUM_ELEMENTS NMB*1024*1024 #ifndef LOCAL_SIZE #define LOCAL_SIZE 64 #endif #define NUM_WORK_GROUPS NUM_ELEMENTS/LOCAL_SIZE const char * CL_FILE_NAME = { "second.cl" }; const float TOL = 0.0001f; void Wait( cl_command_queue ); int LookAtTheBits( float ); int main( int argc, char *argv[ ] ) { // see if we can even open the opencl kernel program // (no point going on if we can't): FILE *fp; #ifdef WIN32 errno_t err = fopen_s( &fp, CL_FILE_NAME, "r" ); if( err != 0 ) #else fp = fopen( CL_FILE_NAME, "r" ); if( fp == NULL ) #endif { fprintf( stderr, "Cannot open OpenCL source file '%s'\n", CL_FILE_NAME ); return 1; } cl_int status; // returned status from opencl calls // test against CL_SUCCESS // get the platform id: cl_platform_id platform; status = clGetPlatformIDs( 1, &platform, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clGetPlatformIDs failed (2)\n" ); // get the device id: cl_device_id device; status = clGetDeviceIDs( platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clGetDeviceIDs failed (2)\n" ); // 2. allocate the host memory buffers: float *hA = new float[ NUM_ELEMENTS ]; float *hB = new float[ NUM_ELEMENTS ]; float *hC = new float[ NUM_ELEMENTS ]; float *hD = new float[ NUM_ELEMENTS ]; // fill the host memory buffers: for( int i = 0; i < NUM_ELEMENTS; i++ ) { hA[i] = hB[i] = hC[i] = (float) sqrt( (double)i ); } size_t dataSize = NUM_ELEMENTS * sizeof(float); // 3. create an opencl context: cl_context context = clCreateContext( NULL, 1, &device, NULL, NULL, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateContext failed\n" ); // 4. create an opencl command queue: cl_command_queue cmdQueue = clCreateCommandQueue( context, device, 0, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateCommandQueue failed\n" ); // 5. allocate the device memory buffers: cl_mem dA = clCreateBuffer( context, CL_MEM_READ_ONLY, dataSize, NULL, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateBuffer failed (1)\n" ); cl_mem dB = clCreateBuffer( context, CL_MEM_READ_ONLY, dataSize, NULL, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateBuffer failed (2)\n" ); cl_mem dC = clCreateBuffer( context, CL_MEM_READ_ONLY, dataSize, NULL, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateBuffer failed (3)\n" ); cl_mem dD = clCreateBuffer( context, CL_MEM_WRITE_ONLY, dataSize, NULL, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateBuffer failed (4)\n" ); // 6. enqueue the 2 commands to write the data from the host buffers to the device buffers: status = clEnqueueWriteBuffer( cmdQueue, dA, CL_FALSE, 0, dataSize, hA, 0, NULL, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clEnqueueWriteBuffer failed (1)\n" ); status = clEnqueueWriteBuffer( cmdQueue, dB, CL_FALSE, 0, dataSize, hB, 0, NULL, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clEnqueueWriteBuffer failed (2)\n" ); status = clEnqueueWriteBuffer( cmdQueue, dC, CL_FALSE, 0, dataSize, hC, 0, NULL, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clEnqueueWriteBuffer failed (3)\n" ); Wait( cmdQueue ); // 7. read the kernel code from a file: fseek( fp, 0, SEEK_END ); size_t fileSize = ftell( fp ); fseek( fp, 0, SEEK_SET ); char *clProgramText = new char[ fileSize+1 ]; // leave room for '\0' size_t n = fread( clProgramText, 1, fileSize, fp ); clProgramText[fileSize] = '\0'; fclose( fp ); if( n != fileSize ) fprintf( stderr, "Expected to read %d bytes read from '%s' -- actually read %d.\n", fileSize, CL_FILE_NAME, n ); // create the text for the kernel program: char *strings[1]; strings[0] = clProgramText; cl_program program = clCreateProgramWithSource( context, 1, (const char **)strings, NULL, &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateProgramWithSource failed\n" ); delete [ ] clProgramText; // 8. compile and link the kernel code: char *options = { "" }; status = clBuildProgram( program, 1, &device, options, NULL, NULL ); if( status != CL_SUCCESS ) { size_t size; clGetProgramBuildInfo( program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &size ); cl_char *log = new cl_char[ size ]; clGetProgramBuildInfo( program, device, CL_PROGRAM_BUILD_LOG, size, log, NULL ); fprintf( stderr, "clBuildProgram failed:\n%s\n", log ); delete [ ] log; } // 9. create the kernel object: cl_kernel kernel = clCreateKernel( program, "ArrayMult", &status ); if( status != CL_SUCCESS ) fprintf( stderr, "clCreateKernel failed\n" ); // 10. setup the arguments to the kernel object: status = clSetKernelArg( kernel, 0, sizeof(cl_mem), &dA ); if( status != CL_SUCCESS ) fprintf( stderr, "clSetKernelArg failed (1)\n" ); status = clSetKernelArg( kernel, 1, sizeof(cl_mem), &dB ); if( status != CL_SUCCESS ) fprintf( stderr, "clSetKernelArg failed (2)\n" ); status = clSetKernelArg( kernel, 2, sizeof(cl_mem), &dC ); if( status != CL_SUCCESS ) fprintf( stderr, "clSetKernelArg failed (3)\n" ); status = clSetKernelArg( kernel, 3, sizeof(cl_mem), &dD ); if( status != CL_SUCCESS ) fprintf( stderr, "clSetKernelArg failed (4)\n" ); // 11. enqueue the kernel object for execution: size_t globalWorkSize[3] = { NUM_ELEMENTS, 1, 1 }; size_t localWorkSize[3] = { LOCAL_SIZE, 1, 1 }; Wait( cmdQueue ); double time0 = omp_get_wtime( ); time0 = omp_get_wtime( ); status = clEnqueueNDRangeKernel( cmdQueue, kernel, 1, NULL, globalWorkSize, localWorkSize, 0, NULL, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clEnqueueNDRangeKernel failed: %d\n", status ); Wait( cmdQueue ); double time1 = omp_get_wtime( ); // 12. read the results buffer back from the device to the host: status = clEnqueueReadBuffer( cmdQueue, dD, CL_TRUE, 0, dataSize, hD, 0, NULL, NULL ); if( status != CL_SUCCESS ) fprintf( stderr, "clEnqueueReadBuffer failed\n" ); // did it work? for( int i = 0; i < NUM_ELEMENTS; i++ ) { float expected = (hA[i] * hB[i]) + hC[i]; if( fabs( hD[i] - expected ) > TOL ) { //fprintf( stderr, "%4d: %13.6f * %13.6f wrongly produced %13.6f instead of %13.6f (%13.8f)\n", //i, hA[i], hB[i], hC[i], expected, fabs(hC[i]-expected) ); //fprintf( stderr, "%4d: 0x%08x * 0x%08x wrongly produced 0x%08x instead of 0x%08x\n", //i, LookAtTheBits(hA[i]), LookAtTheBits(hB[i]), LookAtTheBits(hC[i]), LookAtTheBits(expected) ); } } fprintf( stderr, "%8d\t%4d\t%10d\t%10.3lf GigaMultsPerSecond\n", NMB, LOCAL_SIZE, NUM_WORK_GROUPS, (double)NUM_ELEMENTS/(time1-time0)/1000000000. ); #ifdef WIN32 Sleep( 2000 ); #endif // 13. clean everything up: clReleaseKernel( kernel ); clReleaseProgram( program ); clReleaseCommandQueue( cmdQueue ); clReleaseMemObject( dA ); clReleaseMemObject( dB ); clReleaseMemObject( dC ); clReleaseMemObject( dD ); delete [ ] hA; delete [ ] hB; delete [ ] hC; delete [ ] hD; return 0; } int LookAtTheBits( float fp ) { int *ip = (int *)&fp; return *ip; } // wait until all queued tasks have taken place: void Wait( cl_command_queue queue ) { cl_event wait; cl_int status; status = clEnqueueMarker( queue, &wait ); if( status != CL_SUCCESS ) fprintf( stderr, "Wait: clEnqueueMarker failed\n" ); status = clWaitForEvents( 1, &wait ); if( status != CL_SUCCESS ) fprintf( stderr, "Wait: clWaitForEvents failed\n" ); }
[ "trevor@trevorstahl.com" ]
trevor@trevorstahl.com
1a99a7fe380bb193a43ac6856b43cd9e9df7d229
10ecd7454a082e341eb60817341efa91d0c7fd0b
/SDK/BP_PromptActor_EmissaryEncounteredSkellyFort_RB_classes.h
05e59c458f24332563c510d22b7b3313cc210222
[]
no_license
Blackstate/Sot-SDK
1dba56354524572894f09ed27d653ae5f367d95b
cd73724ce9b46e3eb5b075c468427aa5040daf45
refs/heads/main
2023-04-10T07:26:10.255489
2021-04-23T01:39:08
2021-04-23T01:39:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,146
h
#pragma once // Name: SoT, Version: 2.1.0.1 /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass BP_PromptActor_EmissaryEncounteredSkellyFort_RB.BP_PromptActor_EmissaryEncounteredSkellyFort_RB_C // 0x0030 (FullSize[0x0490] - InheritedSize[0x0460]) class ABP_PromptActor_EmissaryEncounteredSkellyFort_RB_C : public ABP_PromptActorBase_C { public: struct FPointerToUberGraphFrame UberGraphFrame; // 0x0460(0x0008) (ZeroConstructor, Transient, DuplicateTransient) class UBP_Prompt_EmissaryEncounteredSkellyFort_C* PromptCoordinator; // 0x0468(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) class UClass* PromptCounterAccessKey; // 0x0470(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) class UClass* Company; // 0x0478(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) TArray<struct FPrioritisedPromptWithHandle> Prompts; // 0x0480(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance) static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_PromptActor_EmissaryEncounteredSkellyFort_RB.BP_PromptActor_EmissaryEncounteredSkellyFort_RB_C"); return ptr; } void UserConstructionScript(); void ReceiveBeginPlay(); void ReceiveEndPlay(TEnumAsByte<Engine_EEndPlayReason> EndPlayReason); void ExecuteUbergraph_BP_PromptActor_EmissaryEncounteredSkellyFort_RB(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "ploszjanos9844@gmail.com" ]
ploszjanos9844@gmail.com
f5c7dce5389fb76f22a9600e541868e7bf394f3b
cc0f632f56c572bd4f50c141f048b0bc7fad4055
/UVA/10780.cpp
2da90b26c24ac939640282394a0a68593b4506f0
[]
no_license
AbuHorairaTarif/UvaProject
78517e585c668a83b99866be19b84a0a120bc617
b0688f97a7226bdd692c9ceb29e7b0c406b8a15a
refs/heads/master
2021-05-04T08:19:46.607485
2016-11-11T14:26:23
2016-11-11T14:26:23
70,333,668
0
0
null
null
null
null
UTF-8
C++
false
false
796
cpp
#include <iostream> #include <cstring> using namespace std; int getsum(int n,int x) { int ans=0; while(n) { ans+=n/x; n/=x; } return ans; } int main(int argc,char *argv[]) { int n,m,i,j,t,c=1,temp,ans,a; cin>>t; while(t--) { cin>>m>>n; i=2; ans=1000000; while(m>1) { a=0; while(m%i==0) { a++; m/=i; } if(a) { temp=getsum(n,i)/a; if(ans>temp) ans=temp; } i++; } cout<<"Case "<<c++<<":"<<endl; if(ans) cout<<ans<<endl; else cout<<"Impossible to divide"<<endl; } return 0; }
[ "horaira_cse13@yahoo.com" ]
horaira_cse13@yahoo.com
13e723e32c51c3eec2a1dba10d15f53c958b3c4b
cc36bf3a46b06af454e42f88865aa2b16caefc2c
/UI_DirGraph/ObjViewDG.cpp
47961d972702aec316d5e7462e9bdec7d00998c6
[]
no_license
artcampo/2012_3D_Procedural_Object_Editor
058548468514da39d1434b024bcf42e17f1e0af4
ddb75c727bfb12f1d39786dd72928dc35539c860
refs/heads/master
2021-01-12T04:27:28.204089
2016-12-29T13:57:45
2016-12-29T13:57:45
77,615,572
1
0
null
null
null
null
UTF-8
C++
false
false
6,593
cpp
#include "ObjViewDG.h" ObjViewDG::ObjViewDG( std::wstring& aTitle, int aTypeView, bool aAllowOrbitation, D3DXVECTOR2& aCamPan, float aCamScale, D3DXVECTOR2& aCamOrbit ) { mTypeView = aTypeView; mTitle = aTitle; mAllowOrbitation = aAllowOrbitation; mCamPan = aCamPan; mCamScale = aCamScale; mCamOrbit = aCamOrbit; mUnitTangentU = D3DXVECTOR3(1,0,0); mUnitTangentV = D3DXVECTOR3(0,0,1); mRenderUpVector = D3DXVECTOR3(0,1,0); // Configuration mScaleMinimum = 0.01f; mScaleMultiplier = 0.01f; mGridScaleMult = 1.0f; } ObjViewDG* ObjViewDG::ViewFree() { std::wstring title(L"Free"); return new ObjViewDG( title , eTypeFree, true, D3DXVECTOR2( 0,0 ), 9.0f, //D3DXVECTOR2( Math::PI,Math::PI*1.25f ) ); //D3DXVECTOR2( 1.2f,0.7f ) ); D3DXVECTOR2( 0.9f,0.6f ) ); } D3DXVECTOR3 ObjViewDG::projectPoint( float aX, float aY ) { D3DXVECTOR3 ret; switch (mTypeView) { case eTypeX: //ret = D3DXVECTOR3( 0.0f, -aY*sqrt(mCamScale*mCamScale), aX*sqrt(mCamScale*mCamScale) ); ret = D3DXVECTOR3( 0.0f, aY*mCamScale, aX*mCamScale ); ret += projectPoint( mCamPan ); break; case eTypeY: ret = D3DXVECTOR3( -aY*mCamScale, 0.0f, aX*mCamScale ); ret += projectPoint( mCamPan ); break; case eTypeZ: ret = D3DXVECTOR3( -aX*mCamScale, aY*mCamScale, 0.0f ); ret += projectPoint( mCamPan ); break; case eTypeFree: ret = D3DXVECTOR3( -aX*mCamScale, aY*mCamScale, 0.0f ); ret += projectPoint( mCamPan ); break; }; return ret; } D3DXVECTOR3 ObjViewDG::projectPoint( D3DXVECTOR2& aP ) { D3DXVECTOR3 ret; switch (mTypeView) { case eTypeX: ret = D3DXVECTOR3( 0.0f, aP.y, -aP.x ); break; case eTypeY: ret = D3DXVECTOR3( aP.y, 0.0f, aP.x ); break; case eTypeZ: ret = D3DXVECTOR3( -aP.x, -aP.y, 0.0f ); break; case eTypeFree: float r = mCamScale; float t = mCamOrbit.x; float p = mCamOrbit.y; D3DXVECTOR3 u = +(cos(t)*cos(p))* D3DXVECTOR3(1,0,0) +(cos(t)*sin(p))* D3DXVECTOR3(0,0,1) -(sin(t))* D3DXVECTOR3(0,1,0); D3DXVECTOR3 v = -(sin(p))* D3DXVECTOR3(1,0,0) +(cos(p))* D3DXVECTOR3(0,0,1); ret = aP.x*v + -aP.y*u; break; }; return ret; } D3DXVECTOR3 ObjViewDG::getCamAt() { return projectPoint( mCamPan ); } D3DXVECTOR3 ObjViewDG::getCamPos() { D3DXVECTOR3 ret; ret = unitVector(); ret *= mCamScale; ret += projectPoint( mCamPan ); return ret; } void ObjViewDG::panUpdate(float aX, float aY) { mCamPan += D3DXVECTOR2( -aX*15.0f, aY*15.0f ); D3DXVECTOR3 ret; float r = mCamScale; float t = mCamOrbit.x; float p = mCamOrbit.y; D3DXVECTOR3 u = +(r*cos(t)*cos(p))* D3DXVECTOR3(1,0,0) +(r*cos(t)*sin(p))* D3DXVECTOR3(0,0,1) -(r*sin(t))* D3DXVECTOR3(0,1,0); D3DXVECTOR3 v = -(r*sin(p))* D3DXVECTOR3(1,0,0) +(r*cos(p))* D3DXVECTOR3(0,0,1); } float ObjViewDG::scaleUpdate (float aScale ) { mCamScale += mScaleMultiplier*aScale; if (mCamScale <= mScaleMinimum) mCamScale = mScaleMinimum; return mCamScale; } void ObjViewDG::orbitUpdate(float aX, float aY) { float multiplier = 0.005f; mCamOrbit += D3DXVECTOR2( aX*multiplier, aY*multiplier ); if ( mCamOrbit.x < 0.5 ) mCamOrbit.x = 0.5; if ( mCamOrbit.x > 2.4 ) mCamOrbit.x = 2.4; } bool ObjViewDG::allowsOrbitation() { return mAllowOrbitation; } D3DXVECTOR3 ObjViewDG::getTangentVectorU() { return mUnitTangentU; } D3DXVECTOR3 ObjViewDG::getTangentVectorV() { return mUnitTangentV; } float ObjViewDG::getScale() { return mCamScale; } D3DXVECTOR3 ObjViewDG::getUpVector() { return mRenderUpVector; } bool ObjViewDG::isFreeView() { return (mTypeView == 3); } std::wstring ObjViewDG::getTitle() { return mTitle; } float ObjViewDG::getGridScale() { //float scale = floor( 10.0f / (mCamScale * 1.0f) ) ; float m = 10.0f; float scale = floor( (m*mCamScale/100.0f))/m ; scale *= 0.1f*mCamScale; mGridMod = scale * mGridScaleMult; if (mGridMod < 0.5f) mGridMod = 0.5f; return mGridMod; } void ObjViewDG::setGridScaleMultiplier(float aMult ) { mGridScaleMult = aMult; } D3DXVECTOR3 ObjViewDG::adjustPointToGrid( const D3DXVECTOR3& aPoint ) { D3DXVECTOR3 ret; ret.x = adjustCoordinate( aPoint.x, mGridMod ); ret.y = adjustCoordinate( aPoint.y, mGridMod ); ret.z = adjustCoordinate( aPoint.z, mGridMod ); return ret; } float ObjViewDG::adjustCoordinate (const float aCoord, float aMod ) { float div = floor(aCoord/aMod) * aMod; ; float mod = aCoord-div; if (mod >= (0.5f*aMod)) return (div + aMod); else if (mod <= (0.5f*aMod)) return div; else return (div + aMod) ; } /* unit vector from target to camera position */ D3DXVECTOR3 ObjViewDG::unitVector() { D3DXVECTOR3 ret; if (mTypeView != 3) ret = mUnitVector; else { float thita = mCamOrbit.y; float rho = mCamOrbit.x; ret = D3DXVECTOR3( sin(rho)*cos(thita), cos(rho), sin(rho)*sin(thita) ); } return ret; } D3DXVECTOR3 ObjViewDG::cameraTangetU() { float r = mCamScale; float t = mCamOrbit.x; float p = mCamOrbit.y; D3DXVECTOR3 u = +(cos(t)*cos(p))* D3DXVECTOR3(1,0,0) +(cos(t)*sin(p))* D3DXVECTOR3(0,0,1) -(sin(t))* D3DXVECTOR3(0,1,0); return u; } D3DXVECTOR3 ObjViewDG::cameraTangetV() { float r = mCamScale; float t = mCamOrbit.x; float p = mCamOrbit.y; D3DXVECTOR3 v = -(sin(p))* D3DXVECTOR3(1,0,0) +(cos(p))* D3DXVECTOR3(0,0,1); return v; } D3DXVECTOR3 ObjViewDG::getCamTangentU() { float thita = mCamOrbit.y; float rho = mCamOrbit.x; D3DXVECTOR3 ret = D3DXVECTOR3( -sin(thita), 0, cos(thita) ); return ret; } D3DXVECTOR3 ObjViewDG::getCamTangentV() { float thita = mCamOrbit.y; float rho = mCamOrbit.x; D3DXVECTOR3 ret = D3DXVECTOR3( cos(rho)*cos(thita), -sin(rho), cos(rho)*sin(thita) ); return ret; }
[ "arturocampos82@gmail.com" ]
arturocampos82@gmail.com
209b34ab5a0823a44f2d3765a45b3ad035a27a22
fa4258ef4de2e5414abe4bbf3fb3ad15dc773c7d
/1401C.cpp
d2df3976dd394046c8c8eb3adcd9c60fc0d43a0c
[]
no_license
nihithreddy/Codeforces
48a1adc78731bd3fce600614458f140be66653cb
b1b7f2fc2bc0d7d9e7b19153833d266986257746
refs/heads/master
2022-12-18T01:19:25.451339
2020-09-01T02:29:29
2020-09-01T02:29:29
286,294,639
0
0
null
null
null
null
UTF-8
C++
false
false
839
cpp
#include<bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=(0);i<(n);i++) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define all(c) (c).begin(),(c).end() #define sz(c) (int)(c).size() #define pb push_back #define ff first #define ss second typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<double> vd; typedef vector<string> vs; void solve(){ int n,mi=(int)1e9; cin>>n; int a[n],b[n]; forn(i,n){ cin>>a[i]; b[i]=a[i]; mi=min(mi,a[i]); } sort(b,b+n); bool ok = 1; forn(i,n){ if(a[i]!=b[i]&& a[i]%mi){ ok = 0; break; } } string ans=(ok)?"YES":"NO"; cout<<ans<<"\n"; } int main(){ int t; cin>>t; while(t--){ solve(); } return 0; }
[ "sainihith9618@gmail.com" ]
sainihith9618@gmail.com
bd8cc94ccd6aa8f1402f2abe59af1b7d26748186
50249f2c0d924c87cd196fc0f815e7df198228f8
/PubSubClient.ino
ea0b361d8f87f1334a1d712fc77ba66d9f592a3b
[]
no_license
hipotenusa/PubSubClient
fee4e4d4bb43650856582cef11bd8ab55feaf26d
462b2a887f187921fcd7f85c6513bdca93959c88
refs/heads/master
2021-08-30T09:13:37.733314
2017-12-17T06:16:30
2017-12-17T06:16:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,667
ino
#include <ESP8266WiFi.h> #include <PubSubClient.h> const char *ssid = ""; // nama ssid dari wi-fi, jangan lebih dari 32 karakter const char *pass = ""; // password dari wi-fi //------------------------------ Konfigurasi server pada <a href="https://www.cloudmqtt.com/">https://www.cloudmqtt.com/</a> // perhatikan akun CloudMQTT yang telah dibuat, kemudian pastikan konfigurasi yang diperlukan ini, sama dengan akun yang anda miliki. const char *mqtt_server = "m14.cloudmqtt.com"; const int mqtt_port = 18622; const char *mqtt_user = "jztmmefb"; const char *mqtt_pass = "3Hm_ftWsUQwE"; //------------------------------ End Konfigurasi server pada <a href="https://www.cloudmqtt.com/">https://www.cloudmqtt.com/</a> //deklarasi variabel untuk led int led = 16; int led2 = 4; //deklarasi konfigurasi server WiFiClient wclient; PubSubClient client(wclient, mqtt_server, mqtt_port); //------------------------------ fungsi untuk menerima nilai balik (subcribe) void callback(const MQTT::Publish& pub) { if(pub.payload_string() == "1") { digitalWrite(led, HIGH); client.publish("/led/state", "Lampu Hidup"); } else if(pub.payload_string() == "0") { digitalWrite(led, LOW); client.publish("/led/state", "Lampu Mati"); } Serial.println(pub.payload_string()); } //------------------------------ End fungsi untuk menerima nilai balik (subcribe) void setup() { // Setup console Serial.begin(115200); delay(10); Serial.println(); Serial.println(); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); } void loop() { //----------------------------- cek apakah wi-fi sudah tersambung if (WiFi.status() != WL_CONNECTED) { Serial.print("Connecting to "); Serial.print(ssid); Serial.println("..."); WiFi.begin(ssid, pass); if (WiFi.waitForConnectResult() != WL_CONNECTED) return; Serial.println("WiFi connected"); } //----------------------------- End cek apakah wi-fi sudah tersambung //----------------------------- cek apakah ESP sudah tersambung dengan server if (WiFi.status() == WL_CONNECTED) { if (!client.connected()) { Serial.println("Connecting to MQTT server"); if (client.connect(MQTT::Connect("arduinoClient2").set_auth(mqtt_user, mqtt_pass))) { Serial.println("Connected to MQTT server"); client.set_callback(callback); client.subscribe("/led"); client.publish("/led/state", "0"); } else { Serial.println("Could not connect to MQTT server"); } } //----------------------------- cek apakah ESP sudah tersambung dengan server if (client.connected()) client.loop(); } }
[ "simatupang.ega@gmail.com" ]
simatupang.ega@gmail.com
76c618cd0db4f1d053f3e398f65f5566769b49aa
e23b730868329011477751c841dc188ff9662938
/Code/glwidget.h
41aec03dc1fc49461279cad449aca91883177c23
[]
no_license
NaifAlhar6i/Chapter7
d18e597621f90cce1fc10f69134214338d19ce6a
607f6da7c9949ebf0386397c1b42e5c8964266ae
refs/heads/master
2022-04-27T05:19:48.007179
2020-04-26T10:38:17
2020-04-26T10:38:17
259,003,927
0
0
null
null
null
null
UTF-8
C++
false
false
2,909
h
#ifndef GLWIDGET_H #define GLWIDGET_H #include <QPoint> #include <QMouseEvent> #include <QVector3D> #include <QOpenGLWidget> #include <QOpenGLFunctions> #include "Helper/transformation.h" #include "GL/glmanager.h" #include <QTimer> #include "Helper/framerate.h" class MainWindow; /** * @brief The GLWidget class the rendering canvas */ class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions, public Transformation, public GLManager { Q_OBJECT public: /** * @brief GLWidget class constructor * @param parent specifies the parent */ explicit GLWidget( QWidget *parent=0); ~GLWidget(); /** * @brief UpdateParticles updates particles data * @param particle specifies the particle data * @param color specifies the vertices color data * @param map specifies the method to be used to update the OpenGL buffer * @return true if data updated otherwise return false */ int UpdateParticles(void *particle, void *color, bool map = false); /** * @brief UpdateParticles updates particles data * @param particle specifies the particle data * @param map specifies the method to be used to update the OpenGL buffer * @return true if data updated otherwise return false */ int UpdateParticles(void *particle, bool map = false); protected: /** * @brief initializeGL initilizes OpenGL objects */ void initializeGL() Q_DECL_OVERRIDE; /** * @brief resizeGL resizes viewport * @param w specifies the viewport widght * @param h specifies the viewport hight */ void resizeGL(int w, int h) Q_DECL_OVERRIDE; /** * @brief paintGL paints the OpenGL */ void paintGL() Q_DECL_OVERRIDE; public slots: protected slots: /** * @brief zoom zoom in and out * @param value zooming value */ void zoom( int value ); /** * @brief mousePressEvent */ virtual void mousePressEvent(QMouseEvent*); /** * @brief mouseMoveEvent */ virtual void mouseMoveEvent(QMouseEvent*); signals: /** * @brief FrameRateUpdated signals to be fired on frame is done */ void FrameRateUpdated( int ); /** * @brief GLinitialized signals to be fired on OpenGL objects initilized */ void GLinitialized(); private: /** * @brief m_FrameRate */ FrameRate m_FrameRate; /** * @brief m_RefereshTimer */ QTimer m_RefereshTimer; /** * @brief getFrameRate gets a reference of the frame rate object FrameRate * @return a reference to FrameRate */ inline FrameRate &getFrameRate() { return m_FrameRate; } /** * @brief getRefereshTimer gets a reference to the Widget referesing timer * @return a reference to a QTimer object */ inline QTimer &getRefereshTimer() { return m_RefereshTimer; } }; #endif // GLWIDGET_H
[ "668696@swansea.ac.uk" ]
668696@swansea.ac.uk
e5b7fa6407fce22770bd191b300aee76d94b4aa3
78918391a7809832dc486f68b90455c72e95cdda
/boost_lib/boost/metaparse/v1/fwd/get_message.hpp
bf870e1da1e114abb89dd2148c89f5edba22b6cc
[ "MIT" ]
permissive
kyx0r/FA_Patcher
50681e3e8bb04745bba44a71b5fd04e1004c3845
3f539686955249004b4483001a9e49e63c4856ff
refs/heads/master
2022-03-28T10:03:28.419352
2020-01-02T09:16:30
2020-01-02T09:16:30
141,066,396
2
0
null
null
null
null
UTF-8
C++
false
false
471
hpp
#ifndef BOOST_METAPARSE_V1_FWD_GET_MESSAGE_HPP #define BOOST_METAPARSE_V1_FWD_GET_MESSAGE_HPP // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) namespace boost { namespace metaparse { namespace v1 { template <class> struct get_message_impl; template <class> struct get_message; } } } #endif
[ "k.melekhin@gmail.com" ]
k.melekhin@gmail.com
2dc8d1663f4e6a5a79aba2518e736e8552e875db
4247edf4ecdd626c8d3160e08a8758781ff9b30d
/gazebo_ros_pkgs/gazebo_ros_control/include/gazebo_ros_control/internal/joint_state.h
4fcf0716e482d72729ff122f533da8f2174e6c83
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
ignaciotb/robi_final_project
4a32588d8153800d4c8f545ed0f2f1965dc70b77
dfb73d2d1c2c3eab15b0dec4d0a3f19f202d155e
refs/heads/master
2022-06-18T04:14:24.812872
2022-06-10T11:53:15
2022-06-10T11:53:15
210,183,722
4
19
null
2019-10-04T12:45:36
2019-09-22T17:03:42
C++
UTF-8
C++
false
false
3,815
h
/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2015, PAL Robotics S.L. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of PAL Robotics S.L. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. ////////////////////////////////////////////////////////////////////////////// #ifndef _GAZEBO_ROS_CONTROL__INTERNAL__JOINT_STATE_H_ #define _GAZEBO_ROS_CONTROL__INTERNAL__JOINT_STATE_H_ #include <algorithm> #include <string> #include <vector> #include <boost/shared_ptr.hpp> #include <gazebo/physics/Joint.hh> #include <gazebo_ros_control/internal/read_write_resource.h> #include <urdf/model.h> namespace hardware_interface { class RobotHW; } namespace gazebo_ros_control { namespace internal { // TODO: Create an abstract base class?, separate read from write? class JointState : public ReadWriteResource { public: JointState(); // TODO doc requisite: RobotHW must contain interface virtual void init(const std::string& resource_name, const ros::NodeHandle& nh, boost::shared_ptr<gazebo::physics::Model> gazebo_model, const urdf::Model* const urdf_model, hardware_interface::RobotHW* robot_hw); virtual void read(const ros::Time& time, const ros::Duration& period, bool in_estop); virtual std::vector<std::string> getHardwareInterfaceTypes(); virtual std::string getName() const {return name_;} protected: std::string name_; double pos_; double vel_; double eff_; std::shared_ptr<const urdf::Joint> urdf_joint_; gazebo::physics::JointPtr sim_joint_; }; // Code copied almost verbatim from transmission_interface::JointStateInterfaceProvider // TODO: Refactor to avoid duplication template <class Interface> bool hasResource(const std::string& name, const Interface& iface) { using hardware_interface::internal::demangledTypeName; // Do nothing if resource already exists on the interface const std::vector<std::string>& existing_res = iface.getNames(); return existing_res.end() != std::find(existing_res.begin(), existing_res.end(), name); } template <class T> T clamp(const T& val, const T& min_val, const T& max_val) { return std::min(std::max(val, min_val), max_val); } } // namespace } // namespace #endif
[ "torroba@kth.se" ]
torroba@kth.se
1066acb9fc28e63f52b3adc8725addd1f30a89f3
a018eac0dd956c963a772b1b5f3c02e6947ec425
/file_sig/Processor.h
dd9975eb525cfc608dcf8d07170967106440bc12
[]
no_license
alexacz/filesig-crc32
41a4797257dd9ec53bc61f7bdb168111e6d5edcb
b59687c0f297deb0ee7e3544518703a748ffadc7
refs/heads/master
2020-03-30T08:52:50.626988
2018-10-01T10:16:02
2018-10-01T10:16:02
151,046,713
0
0
null
null
null
null
UTF-8
C++
false
false
1,413
h
// // Processor.h // veeam_sig // // Created by Alex Nik on 30/09/2018. // #ifndef Processor_h #define Processor_h #include "Buffer.h" extern "C" { uint32_t crc32(uint32_t, const void*, size_t); } /** * Calculates CRC32 of block and puts the CRC32 to ouput stream. */ class Processor { Buffer& _buffer; Writer& _writer; public: /** * Constructor. * \param buffer Reference to Buffer. * \param writer Reference to Writer. */ Processor(Buffer& buffer, Writer& writer):_buffer(buffer),_writer(writer){;} /** * Main loop */ void run() { while (true) { std::shared_ptr<Buffer::Block> block; if ( _buffer.get(block) ) { try { uint32_t crc = crc32(0, reinterpret_cast<const void*>( block->_data.get() ), block->_len); _writer.add(block->_num,crc); } catch (const std::exception& e) { std::cout << "Processor is occurred exception: " << e.what() << std::endl; break; } } else // Last block was processed, exit from while { break; } } // while (true) } }; #endif /* Processor_h */
[ "" ]
d23ecd631edcfbf8cc972bdc9f161a43d43f150b
30603b5a0e6fc12da18e9da0f8b87ebad9b9f1a3
/lop_faction_racs/lop_faction_racs/CfgBackpacks.hpp
25ed14922ff1a19dde715e16ec085c688c414e46
[]
no_license
ElectroEsper/LOP-Esper-s-Edit
60c40cada55bb50203bb20b4bbaf0b5e691adbb9
adf477e8fc04e68e4f5a2fcd7aadd35e269051a4
refs/heads/master
2020-06-02T22:01:49.834102
2015-08-08T21:11:05
2015-08-08T21:11:05
40,339,611
0
0
null
null
null
null
UTF-8
C++
false
false
1,475
hpp
class B_Kitbag_rgr; class rhsusf_falconii; class rhs_rpg_empty; class B_FieldPack_khk; class LOP_AA_Kitbag_Med : B_Kitbag_rgr { _generalMacro = "LOP_AA_Kitbag_Med"; author = $STR_LOP_FULL_NAME; scope = 1; class TransportItems { class _xx_FirstAidKit { count = 15; name = "FirstAidKit"; }; class _xx_Medikit { count = 1; name = "Medikit"; }; }; }; class LOP_AA_FalconII_SVD : rhsusf_falconii { _generalMacro = "LOP_AA_FalconII_SVD"; author = $STR_LOP_FULL_NAME; scope = 1; class TransportMagazines { class _xx_rhs_10Rnd_762x54mmR_7N1 { count = 5; magazine = "rhs_10Rnd_762x54mmR_7N1"; }; class _xx_rhs_mag_rgd5 { count = 2; magazine = "HandGrenade"; }; class _xx_rhs_mag_rdg2_white { count = 1; magazine = "rhs_mag_rdg2_white"; }; }; }; class LOP_AA_RPG_Pack : rhs_rpg_empty { _generalMacro = "LOP_AA_RPG_Pack"; author = $STR_LOP_FULL_NAME; scope = 1; class TransportMagazines { class _xx_rhs_rpg7_PG7VR_mag { count = 2; magazine = "rhs_rpg7_PG7VR_mag"; }; class _xx_rhs_rpg7_PG7VL_mag { count = 1; magazine = "rhs_rpg7_PG7VL_mag"; }; }; }; class LOP_AA_Fieldpack_PKM : B_FieldPack_khk { _generalMacro = "LOP_AA_Fieldpack_PKM"; author = $STR_LOP_FULL_NAME; scope = 1; class TransportMagazines { class _xx_rhs_100Rnd_762x54mmR { count = 4; magazine = "rhs_100Rnd_762x54mmR"; }; }; };
[ "tawesper@gmail.com" ]
tawesper@gmail.com
6718b1b317956ead3279e09a1613d4112b9a1e49
bb91762cc7683345d63a653db6c12cea65d5802e
/repetytorium12_12/Kalkulator/KalkulatorMain.cpp
8f4b75a4fdbc7e539a19e1961891dea57999f37a
[]
no_license
svv1viktoria1soverda1mail1ru/Cplusplus
f705e2c3000b0bea39cd6d528737f094ffed1340
3f1c4945fb7f7bbbe0b35b324c092e3a657de0e4
refs/heads/master
2020-12-24T12:12:47.961412
2017-01-05T14:02:58
2017-01-05T14:02:58
73,069,123
0
0
null
null
null
null
UTF-8
C++
false
false
12,646
cpp
/*************************************************************** * Name: KalkulatorMain.cpp * Purpose: Code for Application Frame * Author: () * Created: 2016-12-05 * Copyright: () * License: **************************************************************/ #include "KalkulatorMain.h" #include <wx/msgdlg.h> //(*InternalHeaders(KalkulatorFrame) #include <wx/string.h> #include <wx/intl.h> //*) //helper functions enum wxbuildinfoformat { short_f, long_f }; wxString wxbuildinfo(wxbuildinfoformat format) { wxString wxbuild(wxVERSION_STRING); if (format == long_f ) { #if defined(__WXMSW__) wxbuild << _T("-Windows"); #elif defined(__UNIX__) wxbuild << _T("-Linux"); #endif #if wxUSE_UNICODE wxbuild << _T("-Unicode build"); #else wxbuild << _T("-ANSI build"); #endif // wxUSE_UNICODE } return wxbuild; } //(*IdInit(KalkulatorFrame) const long KalkulatorFrame::ID_TEXTCTRL1 = wxNewId(); const long KalkulatorFrame::ID_BUTTON1 = wxNewId(); const long KalkulatorFrame::ID_BUTTON2 = wxNewId(); const long KalkulatorFrame::ID_BUTTON3 = wxNewId(); const long KalkulatorFrame::ID_BUTTON4 = wxNewId(); const long KalkulatorFrame::ID_BUTTON5 = wxNewId(); const long KalkulatorFrame::ID_BUTTON6 = wxNewId(); const long KalkulatorFrame::ID_BUTTON7 = wxNewId(); const long KalkulatorFrame::ID_BUTTON8 = wxNewId(); const long KalkulatorFrame::ID_BUTTON9 = wxNewId(); const long KalkulatorFrame::ID_BUTTON10 = wxNewId(); const long KalkulatorFrame::ID_BUTTON11 = wxNewId(); const long KalkulatorFrame::ID_BUTTON12 = wxNewId(); const long KalkulatorFrame::ID_BUTTON13 = wxNewId(); const long KalkulatorFrame::ID_BUTTON14 = wxNewId(); const long KalkulatorFrame::ID_BUTTON15 = wxNewId(); const long KalkulatorFrame::ID_BUTTON16 = wxNewId(); const long KalkulatorFrame::ID_BUTTON17 = wxNewId(); const long KalkulatorFrame::ID_BUTTON18 = wxNewId(); const long KalkulatorFrame::ID_BUTTON19 = wxNewId(); const long KalkulatorFrame::ID_BUTTON20 = wxNewId(); const long KalkulatorFrame::ID_MENUITEM1 = wxNewId(); const long KalkulatorFrame::idMenuAbout = wxNewId(); const long KalkulatorFrame::ID_STATUSBAR1 = wxNewId(); //*) BEGIN_EVENT_TABLE(KalkulatorFrame,wxFrame) //(*EventTable(KalkulatorFrame) //*) END_EVENT_TABLE() KalkulatorFrame::KalkulatorFrame(wxWindow* parent,wxWindowID id) { //(*Initialize(KalkulatorFrame) wxMenuItem* MenuItem2; wxMenuItem* MenuItem1; wxGridSizer* GridSizer1; wxMenu* Menu1; wxBoxSizer* BoxSizer1; wxMenuBar* MenuBar1; wxMenu* Menu2; Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY")); SetClientSize(wxSize(471,450)); BoxSizer1 = new wxBoxSizer(wxVERTICAL); pole = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(437,40), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); BoxSizer1->Add(pole, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); GridSizer1 = new wxGridSizer(5, 5, 0, 0); Button1 = new wxButton(this, ID_BUTTON1, _("1"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); GridSizer1->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button2 = new wxButton(this, ID_BUTTON2, _("2"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); GridSizer1->Add(Button2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button3 = new wxButton(this, ID_BUTTON3, _("3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); GridSizer1->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button4 = new wxButton(this, ID_BUTTON4, _("%"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); GridSizer1->Add(Button4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button5 = new wxButton(this, ID_BUTTON5, _("C"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); GridSizer1->Add(Button5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button6 = new wxButton(this, ID_BUTTON6, _("4"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON6")); GridSizer1->Add(Button6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button7 = new wxButton(this, ID_BUTTON7, _("5"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON7")); GridSizer1->Add(Button7, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button8 = new wxButton(this, ID_BUTTON8, _("6"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON8")); GridSizer1->Add(Button8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button9 = new wxButton(this, ID_BUTTON9, _("*"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON9")); GridSizer1->Add(Button9, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button10 = new wxButton(this, ID_BUTTON10, _("/"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON10")); GridSizer1->Add(Button10, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button11 = new wxButton(this, ID_BUTTON11, _("7"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON11")); GridSizer1->Add(Button11, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button12 = new wxButton(this, ID_BUTTON12, _("8"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON12")); GridSizer1->Add(Button12, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button13 = new wxButton(this, ID_BUTTON13, _("9"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON13")); GridSizer1->Add(Button13, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button14 = new wxButton(this, ID_BUTTON14, _("x^2"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON14")); GridSizer1->Add(Button14, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button15 = new wxButton(this, ID_BUTTON15, _("sqrt(x)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON15")); GridSizer1->Add(Button15, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button16 = new wxButton(this, ID_BUTTON16, _("."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON16")); GridSizer1->Add(Button16, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button17 = new wxButton(this, ID_BUTTON17, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON17")); GridSizer1->Add(Button17, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button18 = new wxButton(this, ID_BUTTON18, _("="), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON18")); GridSizer1->Add(Button18, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button19 = new wxButton(this, ID_BUTTON19, _("-"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON19")); GridSizer1->Add(Button19, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Button20 = new wxButton(this, ID_BUTTON20, _("+"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON20")); GridSizer1->Add(Button20, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(GridSizer1, 5, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(BoxSizer1); MenuBar1 = new wxMenuBar(); Menu1 = new wxMenu(); MenuItem1 = new wxMenuItem(Menu1, ID_MENUITEM1, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL); Menu1->Append(MenuItem1); MenuBar1->Append(Menu1, _("&File")); Menu2 = new wxMenu(); MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL); Menu2->Append(MenuItem2); MenuBar1->Append(Menu2, _("Help")); SetMenuBar(MenuBar1); StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1")); int __wxStatusBarWidths_1[1] = { -1 }; int __wxStatusBarStyles_1[1] = { wxSB_NORMAL }; StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1); StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1); SetStatusBar(StatusBar1); SetSizer(BoxSizer1); Layout(); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton1Click); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton2Click); Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton3Click); Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton4Click); Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton5Click); Connect(ID_BUTTON6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton6Click); Connect(ID_BUTTON7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton7Click); Connect(ID_BUTTON8,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton8Click); Connect(ID_BUTTON9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton9Click); Connect(ID_BUTTON11,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton11Click); Connect(ID_BUTTON12,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton12Click); Connect(ID_BUTTON13,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton13Click); Connect(ID_BUTTON14,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&KalkulatorFrame::OnButton14Click); Connect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&KalkulatorFrame::OnQuit); Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&KalkulatorFrame::OnAbout); //*) } KalkulatorFrame::~KalkulatorFrame() { //(*Destroy(KalkulatorFrame) //*) } void KalkulatorFrame::OnQuit(wxCommandEvent& event) { exit(0); } void KalkulatorFrame::OnAbout(wxCommandEvent& event) { wxString msg = wxbuildinfo(long_f); wxMessageBox(msg, _("Welcome to...")); } void KalkulatorFrame::OnButton1Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<1; pole->SetValue(napis+liczba); // Layout(); } void KalkulatorFrame::OnButton2Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<2; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton3Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<3; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton5Click(wxCommandEvent& event) { pole->Clear(); } void KalkulatorFrame::OnButton6Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<4; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton7Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<5; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton8Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<6; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton11Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<7; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton12Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<8; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton13Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<9; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton4Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<66; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton9Click(wxCommandEvent& event) { wxString liczba; wxString napis; napis=pole->GetValue(); liczba<<44; pole->SetValue(napis+liczba); } void KalkulatorFrame::OnButton14Click(wxCommandEvent& event) { }
[ "svv.viktoria.soverda@mail.ru" ]
svv.viktoria.soverda@mail.ru
2809c2722f51b63455f6f079fa5c1cc4ac1e649a
8dd73f14bc0b9792925d2596868e7f2e5fe1ff96
/src/tvheadend/utilities/LifetimeMapper.h
d678669d10a402134512d84422d90dcde11c71b8
[]
no_license
MovistarTV/pvr.hts
2fd5a7d3dd00682b57a15a35b7064d4e655d697f
0b796fee78fd1f18967a727109a9d55e1adb680c
refs/heads/master
2020-03-28T09:45:55.767202
2018-09-09T21:22:14
2018-09-09T21:22:14
148,058,307
1
2
null
null
null
null
UTF-8
C++
false
false
1,650
h
#pragma once /* * Copyright (C) 2017 Team Kodi * http://kodi.tv * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #include "../HTSPTypes.h" namespace tvheadend { namespace utilities { /** * Maps "lifetime" values from Kodi to Tvheadend and vica versa */ class LifetimeMapper { public: static int TvhToKodi(uint32_t tvhLifetime) { // pvr addon api: addon defined special values must be less than zero if (tvhLifetime == DVR_RET_SPACE) return -2; else if (tvhLifetime == DVR_RET_FOREVER) return -1; else return tvhLifetime; // lifetime in days } static uint32_t KodiToTvh(int kodiLifetime) { if (kodiLifetime == -2) return DVR_RET_SPACE; else if (kodiLifetime == -1) return DVR_RET_FOREVER; else return kodiLifetime; // lifetime in days } }; } }
[ "kai.sommerfeld@gmx.com" ]
kai.sommerfeld@gmx.com
49724ce04e67d5a01d8589b604134668ad77ce1c
767a49334113d375f96049f99e940123b4a712fd
/DevSkill_CP/Intermediate/Batch 2/Class 30/code3.cpp
ce248a18b3927b3c66cb9f9a9086feb36fd8b5d8
[]
no_license
Sadman007/DevSkill-Programming-Course---Basic---Public-CodeBank
9f4effbbea048f4a6919b699bc0fb1b9a0d5fef7
d831620c44f826c3c89ca18ff95fb81ea2a2cc40
refs/heads/master
2023-09-01T03:44:37.609267
2023-08-18T19:45:41
2023-08-18T19:45:41
173,104,184
83
64
null
null
null
null
UTF-8
C++
false
false
302
cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define MAX (ll)1e18 vector<ll>store, store2; int main() { for(ll i = 1; i<=1000000 ;i++) /// i ^ 3 { ll v = i*i*i; store.push_back(v); } for(int i=0;i<10;i++) cout << store[i] << endl; return 0; }
[ "sakib.csedu21@gmail.com" ]
sakib.csedu21@gmail.com
687b11e09016a5a12ba8ee3d435e1264769720db
005cb1c69358d301f72c6a6890ffeb430573c1a1
/Pods/Headers/Private/GeoFeatures/boost/type_traits/detail/size_t_trait_undef.hpp
fa11a63f036eeaa6897ee05da2f23cda5f66ae60
[ "Apache-2.0" ]
permissive
TheClimateCorporation/DemoCLUs
05588dcca687cc5854755fad72f07759f81fe673
f343da9b41807694055151a721b497cf6267f829
refs/heads/master
2021-01-10T15:10:06.021498
2016-04-19T20:31:34
2016-04-19T20:31:34
51,960,444
0
0
null
null
null
null
UTF-8
C++
false
false
89
hpp
../../../../../../GeoFeatures/GeoFeatures/boost/type_traits/detail/size_t_trait_undef.hpp
[ "tommy.rogers@climate.com" ]
tommy.rogers@climate.com
83222be5be996a3387395f8c80581c4a3700ff32
21a221c20313339ac7380f8d92f8006e5435ef1d
/src/arcscripts/src/SpellHandlers/HunterSpells.cpp
279d7f831a0cd1c3ebe35611f46193ebff72f668
[]
no_license
AwkwardDev/Descent-core-scripts-3.3.5
a947a98d0fdedae36a488c542642fcf61472c3d7
d773b1a41ed3f9f970d81962235e858d0848103f
refs/heads/master
2021-01-18T10:16:03.750112
2014-08-12T16:28:15
2014-08-12T16:28:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,347
cpp
/* * ArcScript Scripts for Arcemu MMORPG Server * Copyright (C) 2008-2009 Arcemu Team * Copyright (C) 2007 Moon++ <http://www.moonplusplus.com/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "Setup.h" bool Refocus(uint32 i, Spell * pSpell) { Player * playerTarget = pSpell->GetPlayerTarget(); if(playerTarget == 0) return true; SpellSet::const_iterator itr = playerTarget->mSpells.begin(); for(; itr != playerTarget->mSpells.end(); ++itr) { if((*itr) == 24531) // skip calling spell.. otherwise spammies! :D continue; if((*itr) == 19434 || (*itr) == 20900 || (*itr) == 20901 || (*itr) == 20902 || (*itr) == 20903 || (*itr) == 20904 || (*itr) == 27632 || (*itr) == 2643 || (*itr) == 14288|| (*itr) == 14289|| (*itr) == 14290 || (*itr) == 25294 || (*itr) == 14443 || (*itr) == 18651 || (*itr) == 20735 || (*itr) == 21390 || (*itr) == 1510 || (*itr) == 14294 || (*itr) == 14295 || (*itr) == 1540 || (*itr) == 22908 || (*itr) == 3044 || (*itr) == 14281 || (*itr) == 14282 || (*itr) == 14283 || (*itr) == 14284 || (*itr) == 14285 || (*itr) == 14286 || (*itr) == 14287) playerTarget->ClearCooldownForSpell((*itr)); } return true; } bool Readiness(uint32 i, Spell * pSpell) { if(!pSpell->p_caster) return true; pSpell->p_caster->ClearCooldownsOnLine(50 , pSpell->GetProto()->Id);//Beast Mastery pSpell->p_caster->ClearCooldownsOnLine(163, pSpell->GetProto()->Id);//Marksmanship pSpell->p_caster->ClearCooldownsOnLine(51 , pSpell->GetProto()->Id);//Survival return true; } void SetupHunterSpells(ScriptMgr * mgr) { mgr->register_dummy_spell(24531, &Refocus); mgr->register_dummy_spell(23989, &Readiness); }
[ "jozsab1@gmail.com" ]
jozsab1@gmail.com
69c05ea92ebecc2b84616dce137403c447cf463b
05b166f163992e1aa67f089c0c86d27a9c3af786
/~2022/Greedy/1339.cpp
f22285beb44e39ed4c1609d0a70bcd8eacc30740
[]
no_license
gyeolse/algorithm_study
52417554c9ab7ffc761c3b78e143683a9c18abaa
bdfd3f0ae0661a0163f5575f40a6984a6f453104
refs/heads/master
2022-08-31T11:32:27.502032
2022-08-06T12:18:50
2022-08-06T12:18:50
246,004,136
0
0
null
null
null
null
UTF-8
C++
false
false
1,303
cpp
#include <bits/stdc++.h> using namespace std; int alpha[30]; //알파벳 value 저장 vector<string> words; int n; //단어의 갯수 int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin>>n; for(int i=0;i<n;i++) { string t; cin>>t; words.push_back(t); } //1. word : words[i][j] -'0' - 17 (A가 17) (alpha에 넣어줄 때) //알파벳이 어느 자릿수에, 얼마나 등장하는지 alpha 배열에 넣어줌 for(int i=0;i<n;i++) { for(int j=0;j<words[i].size();j++) { int cur = words[i][j]-'0'-17; //1234일떄 1은 1000 (10^3) int curValue = pow(10,words[i].size()-(j+1)); alpha[cur] += curValue; } } //2. alpha 배열의 idx, 빈도수를 같이 저장 vector<pair<int,int>> alphaPair; for(int i=0;i<30;i++) { if(alpha[i] == 0) continue; alphaPair.push_back({alpha[i],i}); //value, idx } sort(alphaPair.begin(),alphaPair.end(),greater<>()); //3. 숫자 부여 int cur = 9; int res = 0; for(int i=0;i<alphaPair.size();i++) { int t = alphaPair[i].first * cur; res += t; cur--; // cout<<alphaPair[i].first<<" "<<alphaPair[i].second<<endl; } cout<<res<<endl; return 0; }
[ "threewave@kakao.com" ]
threewave@kakao.com
47478921634a52ca8ababb38302284a3c47cdf0e
e55f92f42d5fb994a6e6fc306478e73839d81c46
/EdFc/zEdUser/SetGrp.h
ff2d505f67fd52c429fb245e65c0567fb78bac1d
[]
no_license
zphseu/cuiyan
115f854e54ea35f18f44f26c2c865c4f8f98169e
ec121ddb16d9fe60b3edcc6c891f11318a12d32d
refs/heads/master
2021-01-18T15:08:20.290861
2014-01-23T07:47:09
2014-01-23T07:47:09
53,846,163
1
1
null
null
null
null
UTF-8
C++
false
false
1,254
h
#if !defined(AFX_SETGRP_H__71AC8DFA_9B1A_498F_BC3E_13635DCA1BCB__INCLUDED_) #define AFX_SETGRP_H__71AC8DFA_9B1A_498F_BC3E_13635DCA1BCB__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // SetGrp.h : header file // ///////////////////////////////////////////////////////////////////////////// // CSetGrp recordset struct tagGrp { CString m_csName; CString m_csCmt; }; class CSetGrp : public CRecordset, public tagGrp { public: CSetGrp(CDatabase* pDatabase); DECLARE_DYNAMIC(CSetGrp) // Field/Param Data //{{AFX_FIELD(CSetGrp, CRecordset) //}}AFX_FIELD // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSetGrp) public: virtual CString GetDefaultSQL(); // Default SQL for Recordset virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support virtual CString GetDefaultConnect(); //}}AFX_VIRTUAL // Implementation #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SETGRP_H__71AC8DFA_9B1A_498F_BC3E_13635DCA1BCB__INCLUDED_)
[ "cui.cuiyan@8bba5440-9dad-11dd-b92e-bd4787f9249a" ]
cui.cuiyan@8bba5440-9dad-11dd-b92e-bd4787f9249a
f111e7e3452c9dfdd94254a506e33bb73399f7b0
0a085d72288de171756e24d5484992aebcb67277
/hzd_test/HRZ/Core/CameraEntity.h
0209a0ff0a1560864697f62b0e72d37a2f28b8c0
[]
no_license
spammydavis/HZDCoreEditor
3bb44ae1b582a1e41e075b6a22e0734ebefe0271
bb4507b40eee906563e0c51e21eb404388aff35a
refs/heads/master
2023-08-20T21:23:29.556634
2021-10-30T09:31:02
2021-10-30T09:31:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,339
h
#pragma once #include "../PCore/Common.h" #include "Entity.h" namespace HRZ { DECL_RTTI(CameraEntity); DECL_RTTI(CameraEntityRep); DECL_RTTI(CameraEntityResource); class CameraEntityResource : public EntityResource { public: TYPE_RTTI(CameraEntityResource); char _pad130[0xA8]; virtual const RTTI *GetRTTI() const override; // 0 virtual ~CameraEntityResource() override; // 1 virtual const RTTI *GetInstanceRTTI() const override; // 18 virtual const RTTI *GetRepRTTI() const override; // 19 virtual const RTTI *GetNetRTTI() const override; // 20 virtual Entity *CreateInstance(const WorldTransform& Transform) override; // 21 virtual void CameraEntityResourceUnknown28(); // 28 virtual void CameraEntityResourceUnknown29(); // 29 }; assert_size(CameraEntityResource, 0x1D8); class CameraEntityRep : public EntityRep { TYPE_RTTI(CameraEntityRep); }; class CameraEntity : public Entity { public: TYPE_RTTI(CameraEntity); char _pad2C0[0x84]; float m_FOV; // 0x344 char _pad34C[0x28]; float m_NearFuzzy; // 0x370 float m_NearSharp; // 0x374 float m_FarFuzzy; // 0x378 float m_FarSharp; // 0x37C float m_MaxFuzzyNear; // 0x380 float m_MaxFuzzyFar; // 0x384 char _pad388[0x2C]; float m_NearPlane; // 0x3B4 float m_FarPlane; // 0x3B8 float m_StereoDepth; // 0x3BC char _pad3C0[0xB0]; virtual const RTTI *GetRTTI() const override; // 0 virtual ~CameraEntity() override; // 1 virtual void SetResource(EntityResource *Resource) override; // 19 virtual void EntityUnknown29() override; // 29 virtual void EntityUnknown30() override; // 30 virtual class Player *IsPlayer() override; // 31 virtual void CameraEntityUnknown39(); // 39 virtual void CameraEntityUnknown40(); // 40 virtual void CameraEntityUnknown41(); // 41 virtual void CameraEntityUnknown42(); // 42 virtual void CameraEntityUnknown43(); // 43 virtual void CameraEntityUnknown44(); // 44 virtual void CameraEntityUnknown45(); // 45 virtual void CameraEntityUnknown46(); // 46 virtual void CameraEntityUnknown47(); // 47 }; assert_offset(CameraEntity, m_FOV, 0x344); assert_offset(CameraEntity, m_NearFuzzy, 0x370); assert_offset(CameraEntity, m_NearPlane, 0x3B4); assert_size(CameraEntity, 0x470); }
[ "Nukem@outlook.com" ]
Nukem@outlook.com
4c8dd2f4c19f4de0b197d1194d3727ce0aeb84d6
6538e4aaab6c90e35d5472caaf9649295b0b485b
/codeforces/div228/card game.cpp
9b3052fab554361f7aab6fceca0c5b76c19b7c56
[]
no_license
Garvit/code-backup
28899e22bf3ac7050ae6bfed737fecfe6e66451e
a7cbccdf817f564f664cb0b50515ed4030acac0c
refs/heads/master
2019-01-02T00:42:56.653043
2015-03-04T19:24:12
2015-03-04T19:24:12
13,009,994
0
0
null
null
null
null
UTF-8
C++
false
false
734
cpp
#include<iostream> #include<stdio.h> #include<algorithm> #include<vector> using namespace std; vector<int> mid; int main() { int n,s,num,csum=0,jsum=0; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&s); for(int j=1;j<=s/2;j++) { scanf("%d",&num); csum+=num; } if(s%2) { scanf("%d",&num); mid.push_back(num); } for(int j=(s+1)/2+1;j<=s;j++) { scanf("%d",&num); jsum+=num; } } sort(mid.begin(),mid.end()); for(int i=mid.size()-1,c=1;i>=0;i--,c++) { if(c%2) csum+=mid[i]; else jsum+=mid[i]; } printf("%d %d",csum,jsum); }
[ "iitgarvit@gmail.com" ]
iitgarvit@gmail.com
a1c4b1afeeea5256ad4a8f4dc108bf9fa590094d
3bd90c6b89901eb563617191ccd34d2064e016d7
/foundation/tekEventsLinux.cpp
c20441a258f1d1c508e92676c2417d81c7769567
[]
no_license
tomerweller/teknic-example-single-threaded
5132d4a52939b3037ec61fa2fac7fb939d468bd9
000273cbc1bc5c9b544a645a3bc36a82a54019ea
refs/heads/master
2021-01-23T22:05:19.683522
2017-02-25T07:58:35
2017-02-25T07:58:35
83,116,362
0
0
null
null
null
null
UTF-8
C++
false
false
5,559
cpp
//***************************************************************************** // $Archive: /ClearPath SC/LinuxPrjEclipse/sFoundation20/linux/src/tekEventsLinux.cpp $ // $Revision: 4 $ $Date: 9/19/16 12:11 $ // $Workfile: tekEventsLinux.cpp $ // // DESCRIPTION: /** \file \brief Implementation module for a portable event based library for the Linux platform. **/ // PRINCIPLE AUTHORS: // Dave Sewhuk // // CREATION DATE: // 2012-03-27 13:38:27 // // COPYRIGHT NOTICE: // (C)Copyright 2012 Teknic, Inc. All rights reserved. // // This copyright notice must be reproduced in any copy, modification, // or portion thereof merged into another program. A copy of the // copyright notice must be included in the object library of a user // program. // * //***************************************************************************** //***************************************************************************** // NAME * // tekEventsLinux.cpp headers // #include "tekEventsLinux.h" #include <assert.h> // * //***************************************************************************** //***************************************************************************** // NAME * // tekEventsLinux.cpp function prototypes // // // * //***************************************************************************** //***************************************************************************** // NAME * // tekEventsLinux.cpp constants // // const size_t MAXIMUM_WAIT_OBJECTS = 64; // * //***************************************************************************** //***************************************************************************** // NAME * // tekEventsLinux.cpp static variables // // // * //***************************************************************************** //***************************************************************************** // NAME * // CCMTMultiLock::CCMTMultiLock // // AUTHOR: // Dave Sewhuk - created on 2012-03-27 13:42:31 // // DESCRIPTION: /** Wait until all the events in the list signal when unlocking. This version can only work with CCEvents and provides a subset of the Windows functionality of the WaitForMultipleObjects API function. \param[in,out] xxx description \return description **/ // SYNOPSIS: CCMTMultiLock::CCMTMultiLock(CCEvent *pObjects[],Uint32 dwCount, Uint32 UnlockCount, bool bWaitForAll, Uint32 dwTimeout, Uint32 dwWakeMask) { //dwWakeMask=dwWakeMask; // Suppress compiler warning //dwTimeout=dwTimeout; // Suppress compiler warning m_dwUnlockCount = UnlockCount; assert(dwCount > 0 && dwCount <= MAXIMUM_WAIT_OBJECTS); assert(pObjects != NULL); // Linux can't really do this assert(bWaitForAll); m_ppObjectArray = pObjects; m_dwCount = dwCount; // as an optimization, skip allocating array if // we can use a small, pre-eallocated bunch of handles if (m_dwCount > (sizeof(m_hPreallocated)/sizeof(m_hPreallocated[0]))) { m_pHandleArray = new CCEvent *[m_dwCount]; m_bLockedArray = new bool[m_dwCount]; } else { m_pHandleArray = m_hPreallocated; m_bLockedArray = m_bPreallocated; } // get list of handles from array of objects passed for (Uint32 i = 0; i <m_dwCount; i++) { assert(pObjects[i]); m_pHandleArray[i] = pObjects[i]; m_bLockedArray[i] = false; } ////Lock(dwTimeout,bWaitForAll,dwWakeMask); } // * //***************************************************************************** //***************************************************************************** // NAME * // CCMTMultiLock::~CCMTMultiLock // // AUTHOR: // Dave Sewhuk - created on 2012-03-27 13:43:39 // // DESCRIPTION: /** \param[in,out] xxx description \return description **/ // SYNOPSIS: CCMTMultiLock::~CCMTMultiLock() { for (Uint32 i=0; i < m_dwCount; i++) if (m_bLockedArray[i]) m_ppObjectArray[i]->SetEvent(); if (m_pHandleArray != m_hPreallocated) { delete[] m_bLockedArray; delete[] m_pHandleArray; } } // * //***************************************************************************** //***************************************************************************** // NAME * // CCMTMultiLock::Lock // // AUTHOR: // Dave Sewhuk - created on 2012-03-27 13:47:05 // // DESCRIPTION: /** \param[in,out] xxx description \return description **/ // SYNOPSIS: Uint32 CCMTMultiLock::Lock(Uint32 dwTimeOut, bool bWaitForAll,Uint32 dwWakeMask) { Uint32 dwResult = 0; //dwWakeMask=dwWakeMask; // Suppress Compiler Warnings if (bWaitForAll){ // Wait for all of our events to signal for (Uint32 i = 0; i < m_dwCount; i++) { m_bLockedArray[i] = m_pHandleArray[i]->WaitFor(dwTimeOut); dwResult |= m_bLockedArray[i]<<i; } } else { assert(0); } return dwResult; } // * //***************************************************************************** //============================================================================= // END OF FILE tekEventsLinux.cpp //=============================================================================
[ "tomer.weller@gmail.com" ]
tomer.weller@gmail.com
43226a97d36dd9cd8eaaa372b389aa6aefaef353
e52a624b75449dd21dd11be4f966b760d377e9ed
/RateLimitSvc.cpp
bd899f9c8e0f958ae2ffad094d5f47be6fd48f1b
[ "MIT" ]
permissive
jgaa/ratelimit-poc
942e7b6a676ded3c9d296c108f20aa57f230b42b
de7b56e7e86f1c240f75a943a7773cf9a1a672e5
refs/heads/master
2022-12-25T19:16:50.945972
2020-09-23T15:25:30
2020-09-23T15:25:30
298,008,959
0
0
null
null
null
null
UTF-8
C++
false
false
46
cpp
#include "RateLimitSvc.h" namespace rl { }
[ "jarle@jgaa.com" ]
jarle@jgaa.com
8231b9f1b2012116eb1473f0e903a2db4d7fdaef
9040c3a2dd3a32ba98c51ce3a1fc4a0e92c735af
/Tree/BiTree.h
07bd4f7bcc220a231ff742256bf8f5346871c6fe
[]
no_license
liubiyongge/DataStructExperimentCode
1f5e5c24b99ac1ccca5c806c84593dfeb1274f55
48de90faab80f3db09f4d92dc23ca45d2aa6074b
refs/heads/master
2021-06-25T18:37:27.028092
2020-10-25T08:48:52
2020-10-25T08:48:52
155,540,289
0
0
null
null
null
null
UTF-8
C++
false
false
8,811
h
#ifndef MYTREE_H #define MYTREE_H #include "mytree.h" #endif #include<stack> #include<cassert> #include<queue> #include<cstring> #define LH 1 //左高 #define EH 0 //等高 #define RH -1 //右高 template<typename T> class BiTree { public: class node { public: node() :lchild(NULL), rchild(NULL) {}; //!!!!!!???????? T data; class node *lchild, *rchild; }; typedef node*nodepointer; void clear(); int countleaf(); //求叶子数 int countnode(); //求节点数 int depth(); //递归求深度 void displayseqtree(); //显示顺序存储 void exchangelrchild(); //交换所有左右子树 nodepointer getroot(); //取根指针 void inordertraverse(); //中序递归遍历 bool isempty(); void layordertraverse(); //层次顺序遍历 void linktosequential(); //二叉链表转换顺序存储 void norecursioninordertraverse(); //非递归中序遍历 void postordertraverse(); //后序递归遍历 void preordertraverse(); //前序递归遍历 void randomcreate(int n=-1); //随机生成一颗二叉树 void sequentialtolink(myseqtree<T> t); //顺序转换二叉树链式存储 void bitree_aux(nodepointer &p, nodepointer otherp); //拷贝初始化辅助函数 int countleaf_aux(nodepointer p); //求叶子辅助 int countnode_aux(nodepointer p); //求结点数辅助 void deletenode_aux(nodepointer p); //回收结点空间辅助 int depth_aux(nodepointer p); //递归求深度辅助 void exchangelrchild_aux(nodepointer p); //交换左右子树辅助 void inordertraverse_aux(nodepointer p); //中序递归遍历辅助 void linktosequential_aux(myseqtree<T>&tempt, nodepointer p, int i); //二叉链表转顺序存储辅助 void preordertraverse_aux(nodepointer p); //前序递归辅助 void postordertraverse_aux(nodepointer p); //后序递归辅助 void sequentialtolink_aux(int i, nodepointer& subroot); //顺序转二叉链表存储辅助 BiTree(); ~BiTree(); BiTree(const BiTree<T>&othert); void read(istream& in); void display(ostream& ot); protected: nodepointer root; myseqtree<T>seqt; //二叉树对应的顺序存储数 }; template<typename T> void BiTree<T>::clear() { seqt.clear(); deletenode_aux(root); root = NULL; } template<typename T> int BiTree<T>::countleaf() { return countleaf_aux(root); } template<typename T> int BiTree<T>::countleaf_aux(nodepointer p) { int num = 0; static int i = 0; if (p) { if (!p->lchild&&!p->rchild) i++; countleaf_aux(p->lchild); countleaf_aux(p->rchild); } if (p == root) { num = i; i = 0; } return num; } template<typename T> int BiTree<T>::countnode() { return countnode_aux(root); } template<typename T> int BiTree<T>::countnode_aux(nodepointer p) { int num = 0; static int i = 0; if (p) { i++; countnode_aux(p->lchild); countnode_aux(p->rchild); } if (p == root) { num = i; i = 0; } return num; } template<typename T> void BiTree<T>::deletenode_aux(nodepointer p) { if (p) { deletenode_aux(p->lchild); deletenode_aux(p->rchild); delete p; } } template<typename T> int BiTree<T>::depth() { return depth_aux(root); } template<typename T> int BiTree<T>::depth_aux(nodepointer p) { int ldep = 0, rdep = 0; if (!p) return 0; else { ldep = depth_aux(p->lchild); rdep = depth_aux(p->rchild); return (ldep > rdep ? ldep : rdep) + 1; } } template<typename T> void BiTree<T>::displayseqtree() { seqt.display(); } template<typename T> void BiTree<T>::exchangelrchild() { exchangelrchild_aux(root); linktosequential(); } template<typename T> void BiTree<T>::exchangelrchild_aux(nodepointer p) { nodepointer s; if (p) { exchangelrchild_aux(p->lchild); exchangelrchild_aux(p->rchild); s = p->lchild; p->lchild = p->rchild; p->rchild = s; } } //!!!! template<typename T> typename BiTree<T>::nodepointer BiTree<T>::getroot() //!!!!! { return root; } template<typename T> void BiTree<T>::inordertraverse() { inordertraverse_aux(root); } template<typename T> void BiTree<T>::inordertraverse_aux(nodepointer p) { if (p) { inordertraverse_aux(p->lchild); cout << p->data; inordertraverse_aux(p->rchild); } } template<typename T> bool BiTree<T>::isempty() { return root ? false : true; } template <typename T> void BiTree<T>::layordertraverse() { nodepointer p; queue<nodepointer> q; if (root != NULL) q.push(root); while (!q.empty()) { p = q.front(); q.pop(); cout << p->data; if (p->lchild) q.push(p->lchild); if (p->rchild) q.push(p->rchild); } } template <typename T> void BiTree<T>::linktosequential() { int max_total = 0; myseqtree<T> tempt; if (!root) { seqt.clear(); return; } max_total = 1; for (int d = 1; d <= depth(); d++) max_total *= 2; max_total -= 1; tempt.setfinalindex(max_total - 1); //!!!!!!!!!!!!!! linktosequential_aux(tempt, root, 0); seqt = tempt; } template<typename T> void BiTree<T>::linktosequential_aux(myseqtree<T>&tempt, nodepointer p, int i) { if (!p || i > tempt.getfinalindex()) return; tempt.setnode(i, p->data); if (p->lchild != NULL) linktosequential_aux(tempt, p->lchild, 2 * i + 1); if (p->rchild != NULL) linktosequential_aux(tempt, p->rchild, 2 * i + 2); } template<typename T> void BiTree<T>::norecursioninordertraverse() { nodepointer p = root; stack<nodepointer> s; while (p || !s.empty()) { if (p) { s.push(p); p = p->lchild; } else { p=s.top(); s.pop(); cout << p->data; p = p->rchild; } } } template<typename T> void BiTree<T>::postordertraverse() { postordertraverse_aux(root); } template<typename T> void BiTree<T>::postordertraverse_aux(nodepointer p) { if (p) { postordertraverse_aux(p->lchild); postordertraverse_aux(p->rchild); cout << p->data; } } template<typename T> void BiTree<T>::preordertraverse() { preordertraverse_aux(root); } template<typename T> void BiTree<T>::preordertraverse_aux(nodepointer p) { if (p) { cout << p->data; preordertraverse_aux(p->lchild); preordertraverse_aux(p->rchild); } } template <typename T> void BiTree<T>::randomcreate(int n) { seqt.randsqt(n); sequentialtolink_aux(0, root); } template<typename T> void BiTree<T>::sequentialtolink(myseqtree<T> t) { seqt = t; sequentialtolink_aux(0, root); } template<typename T> void BiTree<T> ::sequentialtolink_aux(int i, nodepointer&p) { int n = seqt.getfinalindex(); if (n == -1) { p = NULL; return; } p = new BiTree<T>::node; assert(p != 0); p->data = seqt.getnode(i); if (2 * i + 1 > n || seqt.getnode(2 * i + 1) == ' ') p->lchild = NULL; else sequentialtolink_aux(2 * i + 1, p->lchild); if (2 * i + 2 > n || seqt.getnode(2 * i + 2) == ' ') p->rchild = NULL; else sequentialtolink_aux(2 * i + 2, p->rchild); } template <typename T> BiTree<T>::BiTree() { root = NULL; seqt.clear(); } template<typename T> BiTree<T>::BiTree(const BiTree<T>& othert) { if (!othert.root) { root = NULL; seqt.clear(); } else { bitree_aux(root, othert.root); linktosequential(); } } template<typename T> void BiTree<T>::bitree_aux(nodepointer& p, nodepointer otherp) { if (!otherp) { p = NULL; return; } p = new node; assert(p != 0); p->data = otherp->data; if (!otherp->lchild) p->lchild = NULL; else bitree_aux(p->lchild, otherp->lchild); if (!otherp->rchild) p->rchild = NULL; else bitree_aux(p->rchild, otherp->rchild); } template<typename T> BiTree<T>::~BiTree() { clear(); } template<typename T> void BiTree<T>::read(istream& in) { cout << "采用顺序存储方式创建一棵二叉树" << endl << endl; in >> seqt; sequentialtolink_aux(0, root); } template<typename T> istream& operator >> (istream&in, BiTree<T>&bt) { bt.read(in); return in; } template<typename T> void BiTree<T>::display(ostream& out) { out << seqt << endl; } template<typename T> ostream& operator<<(ostream&out, BiTree<T>& bt) { bt.display(out); return out; }
[ "liubiyongge@163.com" ]
liubiyongge@163.com
1dbc638ff90929aca169f8f9de26d24f362cfecc
1d4bd0305958b7cd17f7bc428dd5b6a76e6bd09f
/栈/stack/main.cpp
3d0c337f1362439b2d834422774ef2c6468b240a
[]
no_license
oycd/data-struct
3dfec233b79f9bc97eb5fe0c6afb0b504d27cc33
e78b0724e603c5b4c679a66753978112e58ea39c
refs/heads/main
2023-08-14T04:18:40.382391
2021-10-17T02:32:49
2021-10-17T02:32:49
409,266,710
0
0
null
null
null
null
GB18030
C++
false
false
2,113
cpp
#include<stdio.h> #include<malloc.h> #include<stdlib.h> //栈结构 typedef struct Node{ int data; struct Node * Pnext; }Node,* Pnode; typedef struct Stack{ Pnode pbottom; Pnode ptop; }Stack,*Pstack; //栈操作函数 void inint(Pstack);//初始化栈 void push(Pstack,int);//入栈 void show(Pstack);//输出栈元素 bool out(Pstack);//出栈 //主函数 int main(void) { Stack stack; //printf("%d \n",stack.ptop); //printf("%d \n",stack.pbottom); inint(&stack); //printf("%d \n",stack.ptop); //printf("%d \n",stack.pbottom); /*if(stack.ptop==stack.pbottom) { printf("函数外相等\n"); } else { printf("函数外不等\n"); }*/ push(&stack,1); push(&stack,2); push(&stack,3); push(&stack,4); push(&stack,5); push(&stack,6); show(&stack); out(&stack); show(&stack); return 0; } //栈操作函数具体实现 void inint(Pstack s) { s->ptop=(Pnode)malloc(sizeof(Node)); if(s->ptop==NULL) { printf("创建栈失败!"); exit(-1); } else { s->pbottom=s->ptop; s->ptop->Pnext=NULL; } } void push(Pstack stack,int e) { Pnode pnew; pnew=(Pnode)malloc(sizeof(Node)); pnew->data=e; pnew->Pnext=stack->ptop; stack->ptop=pnew; } void show(Pstack stack) { Pnode p; //p=(Pnode)malloc(sizeof(Node)); p=stack->ptop; if(p==stack->pbottom) { printf("该栈为空!"); } else { while(p!=stack->pbottom) { printf("%d ",p->data); p=p->Pnext; } } printf("\n"); } bool out(Pstack stack) { Pnode r;//为什么要用malloc不能直接使用? r=stack->ptop; if(r==stack->pbottom) { printf("该栈为空无法删除!\n"); return false; } else { //r->Pnext=stack->ptop;有误,如果按这句话来的话ptop并未移动,然后后面释放了r因此会出现错误! stack->ptop=r->Pnext; free(r); r=NULL; return true; } }
[ "66401986+oycd@users.noreply.github.com" ]
66401986+oycd@users.noreply.github.com
5a16d792a4a788b9853aeccfc07aa888287cbf4e
5de093a42b3d6c62d8ec6b217f44957e3ba4f8ce
/problems/112-path-sum/solution.cpp
b7e24a00711b4b72e068b3a8b972186b42f1e3da
[]
no_license
numbaa/lc
2d311983f9e6536940d14aa57b90f7fbef5de545
4a7d0432ab4fa02e3e29bd82602dfd073e86bd8f
refs/heads/master
2022-11-16T16:19:48.112387
2020-06-23T17:15:39
2020-06-23T17:15:39
262,825,471
0
0
null
null
null
null
UTF-8
C++
false
false
1,020
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 hasPathSum(TreeNode* root, int sum) { if (root == nullptr) return false; if (root->val == sum && root->left == nullptr && root->right == nullptr) return true; return hasPathSum(root->left, root->val, sum) || hasPathSum(root->right, root->val, sum); } bool hasPathSum(TreeNode* node, int prevSum, int target) { if (node == nullptr) return false; if (node->val + prevSum == target && node->left == nullptr && node->right == nullptr) return true; return hasPathSum(node->left, node->val + prevSum, target) || hasPathSum(node->right, node->val + prevSum, target); } };
[ "zhennan.tu@gmail.com" ]
zhennan.tu@gmail.com
1cea91f1d689892853860373850fad7d3e133857
d85b1f3ce9a3c24ba158ca4a51ea902d152ef7b9
/testcases/CWE122_Heap_Based_Buffer_Overflow/s05/CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_72a.cpp
155a06b025d8135918d3bde9be20447a3e83576b
[]
no_license
arichardson/juliet-test-suite-c
cb71a729716c6aa8f4b987752272b66b1916fdaa
e2e8cf80cd7d52f824e9a938bbb3aa658d23d6c9
refs/heads/master
2022-12-10T12:05:51.179384
2022-11-17T15:41:30
2022-12-01T15:25:16
179,281,349
34
34
null
2022-12-01T15:25:18
2019-04-03T12:03:21
null
UTF-8
C++
false
false
2,763
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_72a.cpp Label Definition File: CWE122_Heap_Based_Buffer_Overflow__CWE131.label.xml Template File: sources-sink-72a.tmpl.cpp */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate memory without using sizeof(int) * GoodSource: Allocate memory using sizeof(int) * Sinks: memcpy * BadSink : Copy array to data using memcpy() * Flow Variant: 72 Data flow: data passed in a vector from one function to another in different source files * * */ #include "std_testcase.h" #include <vector> using namespace std; namespace CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_72 { #ifndef OMITBAD /* bad function declaration */ void badSink(vector<int *> dataVector); void bad() { int * data; vector<int *> dataVector; data = NULL; /* FLAW: Allocate memory without using sizeof(int) */ data = (int *)malloc(10); if (data == NULL) {exit(-1);} /* Put data in a vector */ dataVector.insert(dataVector.end(), 1, data); dataVector.insert(dataVector.end(), 1, data); dataVector.insert(dataVector.end(), 1, data); badSink(dataVector); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declarations */ /* goodG2B uses the GoodSource with the BadSink */ void goodG2BSink(vector<int *> dataVector); static void goodG2B() { int * data; vector<int *> dataVector; data = NULL; /* FIX: Allocate memory using sizeof(int) */ data = (int *)malloc(10*sizeof(int)); if (data == NULL) {exit(-1);} /* Put data in a vector */ dataVector.insert(dataVector.end(), 1, data); dataVector.insert(dataVector.end(), 1, data); dataVector.insert(dataVector.end(), 1, data); goodG2BSink(dataVector); } void good() { goodG2B(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_72; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
[ "Alexander.Richardson@cl.cam.ac.uk" ]
Alexander.Richardson@cl.cam.ac.uk
e3110a3bf1314f25dfbccb80d0310b149f8e9896
806d887dcf79775f594ee547cffe26690c737d41
/Iterative-Algorithms/1/Problema1ContarMaximos.cpp
5ba5496df962685bf646807535e89135c52420cc
[]
no_license
YusefBM/Algorithms-and-Data-Structures
e58f9c9dd7e0991003d032568a86fdd7db1ac600
a45c49b2467caf6005b8882eaaac6366ae11346d
refs/heads/master
2022-04-15T22:57:17.851150
2020-04-12T21:56:09
2020-04-12T21:56:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,071
cpp
// Nombre del alumno : Eduardo Martínez Martín // Usuario del Juez : E31 #include <iostream> #include <fstream> using namespace std; // Resuelve un caso de prueba, leyendo de la entrada la // configuración, y escribiendo la respuesta void resuelveCaso() { // leer los datos de la entrada int numero, maximo, tam, cont = 1; cin >> tam; cin >> maximo; for (int i = 1; i < tam; i++) { cin >> numero; if (numero > maximo) { maximo = numero; cont = 1; } else if(numero == maximo) cont++; } cout << maximo << " " << cont << endl; } int main() { // Para la entrada por fichero. // Comentar para acepta el reto #ifndef DOMJUDGE std::ifstream in("datos.txt"); auto cinbuf = std::cin.rdbuf(in.rdbuf()); //save old buf and redirect std::cin to casos.txt #endif int numCasos; std::cin >> numCasos; for (int i = 0; i < numCasos; ++i) resuelveCaso(); // Para restablecer entrada. Comentar para acepta el reto #ifndef DOMJUDGE // para dejar todo como estaba al principio std::cin.rdbuf(cinbuf); system("PAUSE"); #endif return 0; }
[ "edumar03@ucm.es" ]
edumar03@ucm.es
bfa7b5a0a259a559a8e830af0be05e70f45939fc
dc147e412416807d1f6a73742152d48a00fde69c
/1A - Shopping App/Utils.cpp
f21fa91f0dce3cff3182ee4081fdc6a60daad697
[]
no_license
MohitSheladiya/ObjectOrientedProgramming
7a4b606098736c561c15c52cf9860cc1503cb178
04ccb2ea15bf1f0d31a6741c968d631e6c556c40
refs/heads/master
2023-07-06T18:02:32.455880
2021-08-15T06:59:57
2021-08-15T06:59:57
396,161,231
0
0
null
null
null
null
UTF-8
C++
false
false
1,446
cpp
/* Name: Mohit Kishorbhai Sheladiya Student ID: 117979203 Student Email: mksheladiya@myseneca.ca Date: 20/1/21 */ #include <iostream> #include "Utils.h" using namespace std; namespace sdds { void flushkeys() { while (cin.get() != '\n'); } bool ValidYesResponse(char ch) { return ch == 'Y' || ch == 'y' || ch == 'N' || ch == 'n'; } bool yes() { char ch = 0; do { cin >> ch; flushkeys(); } while (!ValidYesResponse(ch) && cout << "Only (Y/y) or (N/n) is acceptable: "); return ch == 'y' || ch == 'Y'; } void readCstr(char cstr[], int len) { char buf[1024] = {}; int i; cin.getline(buf, 1024); for (i = 0; i < len && buf[i]; i++) { cstr[i] = buf[i]; } cstr[i] = 0; } int readInt(int min, int max) { int value = 0; bool done = false; while (!done) { cin >> value; if (!cin) { cin.clear(); cout << "Bad integer, try agian: "; } else { if (value >= min && value <= max) { done = true; } else { cout << "Value out of range (" << min << "<=value<=" << max << "): "; } } flushkeys(); } return value; } }
[ "sheladiyamohit@gmail.com" ]
sheladiyamohit@gmail.com
d4b585ede187f1ecadfc9410bcedecb7f6357fe3
a34fe1a599b010d5e3f75a6f7838c8ecbf998a74
/boost/xpressive/traits/cpp_regex_traits.hpp
72da4f0aa6c591951abb4fd3e5197264fbfe0694
[]
no_license
flmello/4thArticleIntel
78652a9957c507beb4b7be6d8560076211134c0c
2c204799553a0ca85b6baf1a1ff9876254fd4800
refs/heads/master
2021-08-23T03:45:51.554811
2017-12-03T01:32:27
2017-12-03T01:32:27
112,890,564
0
0
null
null
null
null
UTF-8
C++
false
false
26,230
hpp
/////////////////////////////////////////////////////////////////////////////// /// \file cpp_regex_traits.hpp /// Contains the definition of the cpp_regex_traits\<\> template, which is a /// wrapper for std::locale that can be used to customize the behavior of /// static and dynamic regexes. // // Copyright 2008 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_XPRESSIVE_TRAITS_CPP_REGEX_TRAITS_HPP_EAN_10_04_2005 #define BOOST_XPRESSIVE_TRAITS_CPP_REGEX_TRAITS_HPP_EAN_10_04_2005 // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include <ios> #include <string> #include <locale> #include <sstream> #include <boost/config.hpp> #include <boost/assert.hpp> #include <boost/integer.hpp> #include <boost/mpl/assert.hpp> #include <boost/detail/workaround.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/xpressive/detail/detail_fwd.hpp> #include <boost/xpressive/detail/utility/literals.hpp> // From John Maddock: // Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow masks to be combined, for example: // std::use_facet<std::ctype<wchar_t> >(locale()).is(std::ctype_base::lower|std::ctype_base::upper, L'a'); // incorrectly returns false. // NOTE: later version of the gcc define __GLIBCXX__, not __GLIBCPP__ #if BOOST_WORKAROUND(__GLIBCPP__, != 0) # define BOOST_XPRESSIVE_BUGGY_CTYPE_FACET #endif namespace boost { namespace xpressive { namespace detail { // define an unsigned integral typedef of the same size as std::ctype_base::mask typedef boost::uint_t<sizeof(std::ctype_base::mask) * CHAR_BIT>::least umask_t; BOOST_MPL_ASSERT_RELATION(sizeof(std::ctype_base::mask), ==, sizeof(umask_t)); // Calculate what the size of the umaskex_t type should be to fix the 3 extra bitmasks // 11 char categories in ctype_base // + 3 extra categories for xpressive // = 14 total bits needed int const umaskex_bits = (14 > (sizeof(umask_t) * CHAR_BIT)) ? 14 : sizeof(umask_t) * CHAR_BIT; // define an unsigned integral type with at least umaskex_bits typedef boost::uint_t<umaskex_bits>::fast umaskex_t; BOOST_MPL_ASSERT_RELATION(sizeof(umask_t), <=, sizeof(umaskex_t)); // cast a ctype mask to a umaskex_t template<std::ctype_base::mask Mask> struct mask_cast { BOOST_STATIC_CONSTANT(umaskex_t, value = static_cast<umask_t>(Mask)); }; #ifdef __CYGWIN__ // Work around a gcc warning on cygwin template<> struct mask_cast<std::ctype_base::print> { BOOST_MPL_ASSERT_RELATION('\227', ==, std::ctype_base::print); BOOST_STATIC_CONSTANT(umaskex_t, value = 0227); }; #endif #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION template<std::ctype_base::mask Mask> umaskex_t const mask_cast<Mask>::value; #endif #ifndef BOOST_XPRESSIVE_BUGGY_CTYPE_FACET // an unsigned integer with the highest bit set umaskex_t const highest_bit = 1 << (sizeof(umaskex_t) * CHAR_BIT - 1); /////////////////////////////////////////////////////////////////////////////// // unused_mask // find a bit in an int that isn't set template<umaskex_t In, umaskex_t Out = highest_bit, bool Done = (0 == (Out & In))> struct unused_mask { BOOST_MPL_ASSERT_RELATION(1, !=, Out); BOOST_STATIC_CONSTANT(umaskex_t, value = (unused_mask<In, (Out >> 1)>::value)); }; template<umaskex_t In, umaskex_t Out> struct unused_mask<In, Out, true> { BOOST_STATIC_CONSTANT(umaskex_t, value = Out); }; #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION template<umaskex_t In, umaskex_t Out, bool Done> umaskex_t const unused_mask<In, Out, Done>::value; #endif umaskex_t const std_ctype_alnum = mask_cast<std::ctype_base::alnum>::value; umaskex_t const std_ctype_alpha = mask_cast<std::ctype_base::alpha>::value; umaskex_t const std_ctype_cntrl = mask_cast<std::ctype_base::cntrl>::value; umaskex_t const std_ctype_digit = mask_cast<std::ctype_base::digit>::value; umaskex_t const std_ctype_graph = mask_cast<std::ctype_base::graph>::value; umaskex_t const std_ctype_lower = mask_cast<std::ctype_base::lower>::value; umaskex_t const std_ctype_print = mask_cast<std::ctype_base::print>::value; umaskex_t const std_ctype_punct = mask_cast<std::ctype_base::punct>::value; umaskex_t const std_ctype_space = mask_cast<std::ctype_base::space>::value; umaskex_t const std_ctype_upper = mask_cast<std::ctype_base::upper>::value; umaskex_t const std_ctype_xdigit = mask_cast<std::ctype_base::xdigit>::value; // Reserve some bits for the implementation #if defined(__GLIBCXX__) umaskex_t const std_ctype_reserved = 0x8000; #elif defined(_CPPLIB_VER) && defined(BOOST_WINDOWS) umaskex_t const std_ctype_reserved = 0x8200; #else umaskex_t const std_ctype_reserved = 0; #endif // Bitwise-or all the ctype masks together umaskex_t const all_ctype_masks = std_ctype_reserved | std_ctype_alnum | std_ctype_alpha | std_ctype_cntrl | std_ctype_digit | std_ctype_graph | std_ctype_lower | std_ctype_print | std_ctype_punct | std_ctype_space | std_ctype_upper | std_ctype_xdigit; // define a new mask for "underscore" ("word" == alnum | underscore) umaskex_t const non_std_ctype_underscore = unused_mask<all_ctype_masks>::value; // define a new mask for "blank" umaskex_t const non_std_ctype_blank = unused_mask<all_ctype_masks | non_std_ctype_underscore>::value; // define a new mask for "newline" umaskex_t const non_std_ctype_newline = unused_mask<all_ctype_masks | non_std_ctype_underscore | non_std_ctype_blank>::value; #else /////////////////////////////////////////////////////////////////////////////// // Ugly work-around for buggy ctype facets. umaskex_t const std_ctype_alnum = 1 << 0; umaskex_t const std_ctype_alpha = 1 << 1; umaskex_t const std_ctype_cntrl = 1 << 2; umaskex_t const std_ctype_digit = 1 << 3; umaskex_t const std_ctype_graph = 1 << 4; umaskex_t const std_ctype_lower = 1 << 5; umaskex_t const std_ctype_print = 1 << 6; umaskex_t const std_ctype_punct = 1 << 7; umaskex_t const std_ctype_space = 1 << 8; umaskex_t const std_ctype_upper = 1 << 9; umaskex_t const std_ctype_xdigit = 1 << 10; umaskex_t const non_std_ctype_underscore = 1 << 11; umaskex_t const non_std_ctype_blank = 1 << 12; umaskex_t const non_std_ctype_newline = 1 << 13; static umaskex_t const std_masks[] = { mask_cast<std::ctype_base::alnum>::value , mask_cast<std::ctype_base::alpha>::value , mask_cast<std::ctype_base::cntrl>::value , mask_cast<std::ctype_base::digit>::value , mask_cast<std::ctype_base::graph>::value , mask_cast<std::ctype_base::lower>::value , mask_cast<std::ctype_base::print>::value , mask_cast<std::ctype_base::punct>::value , mask_cast<std::ctype_base::space>::value , mask_cast<std::ctype_base::upper>::value , mask_cast<std::ctype_base::xdigit>::value }; inline int mylog2(umaskex_t i) { return "\0\0\1\0\2\0\0\0\3"[i & 0xf] + "\0\4\5\0\6\0\0\0\7"[(i & 0xf0) >> 04] + "\0\10\11\0\12\0\0\0\13"[(i & 0xf00) >> 010]; } #endif // convenient constant for the extra masks umaskex_t const non_std_ctype_masks = non_std_ctype_underscore | non_std_ctype_blank | non_std_ctype_newline; /////////////////////////////////////////////////////////////////////////////// // cpp_regex_traits_base // BUGBUG this should be replaced with a regex facet that lets you query for // an array of underscore characters and an array of line separator characters. template<typename Char, std::size_t SizeOfChar = sizeof(Char)> struct cpp_regex_traits_base { protected: void imbue(std::locale const &) { } static bool is(std::ctype<Char> const &ct, Char ch, umaskex_t mask) { #ifndef BOOST_XPRESSIVE_BUGGY_CTYPE_FACET if(ct.is((std::ctype_base::mask)(umask_t)mask, ch)) { return true; } #else umaskex_t tmp = mask & ~non_std_ctype_masks; for(umaskex_t i; 0 != (i = (tmp & (~tmp+1))); tmp &= ~i) { std::ctype_base::mask m = (std::ctype_base::mask)(umask_t)std_masks[mylog2(i)]; if(ct.is(m, ch)) { return true; } } #endif return ((mask & non_std_ctype_blank) && cpp_regex_traits_base::is_blank(ch)) || ((mask & non_std_ctype_underscore) && cpp_regex_traits_base::is_underscore(ch)) || ((mask & non_std_ctype_newline) && cpp_regex_traits_base::is_newline(ch)); } private: static bool is_blank(Char ch) { BOOST_MPL_ASSERT_RELATION('\t', ==, L'\t'); BOOST_MPL_ASSERT_RELATION(' ', ==, L' '); return L' ' == ch || L'\t' == ch; } static bool is_underscore(Char ch) { BOOST_MPL_ASSERT_RELATION('_', ==, L'_'); return L'_' == ch; } static bool is_newline(Char ch) { BOOST_MPL_ASSERT_RELATION('\r', ==, L'\r'); BOOST_MPL_ASSERT_RELATION('\n', ==, L'\n'); BOOST_MPL_ASSERT_RELATION('\f', ==, L'\f'); return L'\r' == ch || L'\n' == ch || L'\f' == ch || (1 < SizeOfChar && (0x2028u == ch || 0x2029u == ch || 0x85u == ch)); } }; #ifndef BOOST_XPRESSIVE_BUGGY_CTYPE_FACET template<typename Char> struct cpp_regex_traits_base<Char, 1> { protected: void imbue(std::locale const &loc) { int i = 0; Char allchars[UCHAR_MAX + 1]; for(i = 0; i <= UCHAR_MAX; ++i) { allchars[i] = static_cast<Char>(i); } std::ctype<Char> const &ct = BOOST_USE_FACET(std::ctype<Char>, loc); std::ctype_base::mask tmp[UCHAR_MAX + 1]; ct.is(allchars, allchars + UCHAR_MAX + 1, tmp); for(i = 0; i <= UCHAR_MAX; ++i) { this->masks_[i] = static_cast<umask_t>(tmp[i]); BOOST_ASSERT(0 == (this->masks_[i] & non_std_ctype_masks)); } this->masks_[static_cast<unsigned char>('_')] |= non_std_ctype_underscore; this->masks_[static_cast<unsigned char>(' ')] |= non_std_ctype_blank; this->masks_[static_cast<unsigned char>('\t')] |= non_std_ctype_blank; this->masks_[static_cast<unsigned char>('\n')] |= non_std_ctype_newline; this->masks_[static_cast<unsigned char>('\r')] |= non_std_ctype_newline; this->masks_[static_cast<unsigned char>('\f')] |= non_std_ctype_newline; } bool is(std::ctype<Char> const &, Char ch, umaskex_t mask) const { return 0 != (this->masks_[static_cast<unsigned char>(ch)] & mask); } private: umaskex_t masks_[UCHAR_MAX + 1]; }; #endif } // namespace detail /////////////////////////////////////////////////////////////////////////////// // cpp_regex_traits // /// \brief Encapsaulates a std::locale for use by the /// basic_regex\<\> class template. template<typename Char> struct cpp_regex_traits : detail::cpp_regex_traits_base<Char> { typedef Char char_type; typedef std::basic_string<char_type> string_type; typedef std::locale locale_type; typedef detail::umaskex_t char_class_type; typedef regex_traits_version_2_tag version_tag; typedef detail::cpp_regex_traits_base<Char> base_type; /// Initialize a cpp_regex_traits object to use the specified std::locale, /// or the global std::locale if none is specified. /// cpp_regex_traits(locale_type const &loc = locale_type()) : base_type() , loc_() { this->imbue(loc); } /// Checks two cpp_regex_traits objects for equality /// /// \return this->getloc() == that.getloc(). bool operator ==(cpp_regex_traits<char_type> const &that) const { return this->loc_ == that.loc_; } /// Checks two cpp_regex_traits objects for inequality /// /// \return this->getloc() != that.getloc(). bool operator !=(cpp_regex_traits<char_type> const &that) const { return this->loc_ != that.loc_; } /// Convert a char to a Char /// /// \param ch The source character. /// \return std::use_facet\<std::ctype\<char_type\> \>(this->getloc()).widen(ch). char_type widen(char ch) const { return this->ctype_->widen(ch); } /// Returns a hash value for a Char in the range [0, UCHAR_MAX] /// /// \param ch The source character. /// \return a value between 0 and UCHAR_MAX, inclusive. static unsigned char hash(char_type ch) { return static_cast<unsigned char>(std::char_traits<Char>::to_int_type(ch)); } /// No-op /// /// \param ch The source character. /// \return ch static char_type translate(char_type ch) { return ch; } /// Converts a character to lower-case using the internally-stored std::locale. /// /// \param ch The source character. /// \return std::tolower(ch, this->getloc()). char_type translate_nocase(char_type ch) const { return this->ctype_->tolower(ch); } /// Converts a character to lower-case using the internally-stored std::locale. /// /// \param ch The source character. /// \return std::tolower(ch, this->getloc()). char_type tolower(char_type ch) const { return this->ctype_->tolower(ch); } /// Converts a character to upper-case using the internally-stored std::locale. /// /// \param ch The source character. /// \return std::toupper(ch, this->getloc()). char_type toupper(char_type ch) const { return this->ctype_->toupper(ch); } /// Returns a string_type containing all the characters that compare equal /// disregrarding case to the one passed in. This function can only be called /// if has_fold_case\<cpp_regex_traits\<Char\> \>::value is true. /// /// \param ch The source character. /// \return string_type containing all chars which are equal to ch when disregarding /// case string_type fold_case(char_type ch) const { BOOST_MPL_ASSERT((is_same<char_type, char>)); char_type ntcs[] = { this->ctype_->tolower(ch) , this->ctype_->toupper(ch) , 0 }; if(ntcs[1] == ntcs[0]) ntcs[1] = 0; return string_type(ntcs); } /// Checks to see if a character is within a character range. /// /// \param first The bottom of the range, inclusive. /// \param last The top of the range, inclusive. /// \param ch The source character. /// \return first <= ch && ch <= last. static bool in_range(char_type first, char_type last, char_type ch) { return first <= ch && ch <= last; } /// Checks to see if a character is within a character range, irregardless of case. /// /// \param first The bottom of the range, inclusive. /// \param last The top of the range, inclusive. /// \param ch The source character. /// \return in_range(first, last, ch) || in_range(first, last, tolower(ch, this->getloc())) || /// in_range(first, last, toupper(ch, this->getloc())) /// \attention The default implementation doesn't do proper Unicode /// case folding, but this is the best we can do with the standard /// ctype facet. bool in_range_nocase(char_type first, char_type last, char_type ch) const { // NOTE: this default implementation doesn't do proper Unicode // case folding, but this is the best we can do with the standard // std::ctype facet. return this->in_range(first, last, ch) || this->in_range(first, last, this->ctype_->toupper(ch)) || this->in_range(first, last, this->ctype_->tolower(ch)); } /// INTERNAL ONLY //string_type transform(char_type const *begin, char_type const *end) const //{ // return this->collate_->transform(begin, end); //} /// Returns a sort key for the character sequence designated by the iterator range [F1, F2) /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2) /// then v.transform(G1, G2) \< v.transform(H1, H2). /// /// \attention Not currently used template<typename FwdIter> string_type transform(FwdIter begin, FwdIter end) const { //string_type str(begin, end); //return this->transform(str.data(), str.data() + str.size()); BOOST_ASSERT(false); return string_type(); } /// Returns a sort key for the character sequence designated by the iterator range [F1, F2) /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2) /// when character case is not considered then /// v.transform_primary(G1, G2) \< v.transform_primary(H1, H2). /// /// \attention Not currently used template<typename FwdIter> string_type transform_primary(FwdIter begin, FwdIter end) const { BOOST_ASSERT(false); // TODO implement me return string_type(); } /// Returns a sequence of characters that represents the collating element /// consisting of the character sequence designated by the iterator range [F1, F2). /// Returns an empty string if the character sequence is not a valid collating element. /// /// \attention Not currently used template<typename FwdIter> string_type lookup_collatename(FwdIter begin, FwdIter end) const { BOOST_ASSERT(false); // TODO implement me return string_type(); } /// For the character class name represented by the specified character sequence, /// return the corresponding bitmask representation. /// /// \param begin A forward iterator to the start of the character sequence representing /// the name of the character class. /// \param end The end of the character sequence. /// \param icase Specifies whether the returned bitmask should represent the case-insensitive /// version of the character class. /// \return A bitmask representing the character class. template<typename FwdIter> char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase) const { static detail::umaskex_t const icase_masks = detail::std_ctype_lower | detail::std_ctype_upper; BOOST_ASSERT(begin != end); char_class_type char_class = this->lookup_classname_impl_(begin, end); if(0 == char_class) { // convert the string to lowercase string_type classname(begin, end); for(typename string_type::size_type i = 0, len = classname.size(); i < len; ++i) { classname[i] = this->translate_nocase(classname[i]); } char_class = this->lookup_classname_impl_(classname.begin(), classname.end()); } // erase case-sensitivity if icase==true if(icase && 0 != (char_class & icase_masks)) { char_class |= icase_masks; } return char_class; } /// Tests a character against a character class bitmask. /// /// \param ch The character to test. /// \param mask The character class bitmask against which to test. /// \pre mask is a bitmask returned by lookup_classname, or is several such masks bit-or'ed /// together. /// \return true if the character is a member of any of the specified character classes, false /// otherwise. bool isctype(char_type ch, char_class_type mask) const { return this->base_type::is(*this->ctype_, ch, mask); } /// Convert a digit character into the integer it represents. /// /// \param ch The digit character. /// \param radix The radix to use for the conversion. /// \pre radix is one of 8, 10, or 16. /// \return -1 if ch is not a digit character, the integer value of the character otherwise. /// The conversion is performed by imbueing a std::stringstream with this-\>getloc(); /// setting the radix to one of oct, hex or dec; inserting ch into the stream; and /// extracting an int. int value(char_type ch, int radix) const { BOOST_ASSERT(8 == radix || 10 == radix || 16 == radix); int val = -1; std::basic_stringstream<char_type> str; str.imbue(this->getloc()); str << (8 == radix ? std::oct : (16 == radix ? std::hex : std::dec)); str.put(ch); str >> val; return str.fail() ? -1 : val; } /// Imbues *this with loc /// /// \param loc A std::locale. /// \return the previous std::locale used by *this. locale_type imbue(locale_type loc) { locale_type old_loc = this->loc_; this->loc_ = loc; this->ctype_ = &BOOST_USE_FACET(std::ctype<char_type>, this->loc_); //this->collate_ = &BOOST_USE_FACET(std::collate<char_type>, this->loc_); this->base_type::imbue(this->loc_); return old_loc; } /// Returns the current std::locale used by *this. /// locale_type getloc() const { return this->loc_; } private: /////////////////////////////////////////////////////////////////////////////// // char_class_pair /// INTERNAL ONLY struct char_class_pair { char_type const *class_name_; char_class_type class_type_; }; /////////////////////////////////////////////////////////////////////////////// // char_class /// INTERNAL ONLY static char_class_pair const &char_class(std::size_t j) { static char_class_pair const s_char_class_map[] = { { BOOST_XPR_CSTR_(char_type, "alnum"), detail::std_ctype_alnum } , { BOOST_XPR_CSTR_(char_type, "alpha"), detail::std_ctype_alpha } , { BOOST_XPR_CSTR_(char_type, "blank"), detail::non_std_ctype_blank } , { BOOST_XPR_CSTR_(char_type, "cntrl"), detail::std_ctype_cntrl } , { BOOST_XPR_CSTR_(char_type, "d"), detail::std_ctype_digit } , { BOOST_XPR_CSTR_(char_type, "digit"), detail::std_ctype_digit } , { BOOST_XPR_CSTR_(char_type, "graph"), detail::std_ctype_graph } , { BOOST_XPR_CSTR_(char_type, "lower"), detail::std_ctype_lower } , { BOOST_XPR_CSTR_(char_type, "newline"),detail::non_std_ctype_newline } , { BOOST_XPR_CSTR_(char_type, "print"), detail::std_ctype_print } , { BOOST_XPR_CSTR_(char_type, "punct"), detail::std_ctype_punct } , { BOOST_XPR_CSTR_(char_type, "s"), detail::std_ctype_space } , { BOOST_XPR_CSTR_(char_type, "space"), detail::std_ctype_space } , { BOOST_XPR_CSTR_(char_type, "upper"), detail::std_ctype_upper } , { BOOST_XPR_CSTR_(char_type, "w"), detail::std_ctype_alnum | detail::non_std_ctype_underscore } , { BOOST_XPR_CSTR_(char_type, "xdigit"), detail::std_ctype_xdigit } , { 0, 0 } }; return s_char_class_map[j]; } /////////////////////////////////////////////////////////////////////////////// // lookup_classname_impl /// INTERNAL ONLY template<typename FwdIter> static char_class_type lookup_classname_impl_(FwdIter begin, FwdIter end) { // find the classname typedef cpp_regex_traits<Char> this_t; for(std::size_t j = 0; 0 != this_t::char_class(j).class_name_; ++j) { if(this_t::compare_(this_t::char_class(j).class_name_, begin, end)) { return this_t::char_class(j).class_type_; } } return 0; } /// INTERNAL ONLY template<typename FwdIter> static bool compare_(char_type const *name, FwdIter begin, FwdIter end) { for(; *name && begin != end; ++name, ++begin) { if(*name != *begin) { return false; } } return !*name && begin == end; } locale_type loc_; std::ctype<char_type> const *ctype_; //std::collate<char_type> const *collate_; }; /////////////////////////////////////////////////////////////////////////////// // cpp_regex_traits<>::hash specializations template<> inline unsigned char cpp_regex_traits<unsigned char>::hash(unsigned char ch) { return ch; } template<> inline unsigned char cpp_regex_traits<char>::hash(char ch) { return static_cast<unsigned char>(ch); } template<> inline unsigned char cpp_regex_traits<signed char>::hash(signed char ch) { return static_cast<unsigned char>(ch); } #ifndef BOOST_XPRESSIVE_NO_WREGEX template<> inline unsigned char cpp_regex_traits<wchar_t>::hash(wchar_t ch) { return static_cast<unsigned char>(ch); } #endif // Narrow C++ traits has fold_case() member function. template<> struct has_fold_case<cpp_regex_traits<char> > : mpl::true_ { }; }} #endif
[ "flavioluis.mello@gmail.com" ]
flavioluis.mello@gmail.com
befe8e0d5eba478814dd4cdd8179b23230d9b40c
869662062115ec5aeecf4f8164409cdcd661da1f
/src/main.cpp
c639fb35dab185db6d12a46f70af1aa317245349
[]
no_license
kaloyanpenev/opengl-pbr
80c641f85bf365c5bd4a29eb46870c3f0120992e
ddaca6347892049b5d560b71c8fbc1783bf0a538
refs/heads/master
2023-05-30T03:42:03.182552
2021-06-10T14:59:23
2021-06-10T14:59:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,554
cpp
#include <SDL2/SDL.h> #include <GL/glew.h> #include <glm/glm.hpp> #include <glm/ext.hpp> #include <iostream> #include <exception> #include <vector> #include <windows.h> #include "Shader.h" #include "Camera.h" #include "Time.h" #include "Texture.h" #include "Model.h" #include "Framebuffer.h" #include "Skybox.h" int main(int argc, char *argv[]) { // Global SDL state // ------------------------------- if (SDL_Init(SDL_INIT_VIDEO) < 0) { throw std::exception(); } SDL_GL_SetSwapInterval(0); //disable vsync evil SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16); SDL_Window *window = SDL_CreateWindow("OpenGL PBR. FPS: ", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); // Lock in mouse //SDL_SetRelativeMouseMode(SDL_TRUE); if (!SDL_GL_CreateContext(window)) { throw std::exception(); } // Global OpenGL state // --------------------------------- if (glewInit() != GLEW_OK) { throw std::exception(); } glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); // for skybox rendering glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); //// for lower mip levels in the pre-filter map. // turn on multisample anti-aliasing glEnable(GL_MULTISAMPLE); //ensure multisampling is nicest quality glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); std::unique_ptr<Shader> lampShader = std::make_unique<Shader>("../src/shaders/pure-white.vert", "../src/shaders/pure-white.frag"); std::unique_ptr<Shader> skyboxShader = std::make_unique<Shader>("../src/shaders/skybox.vert", "../src/shaders/skybox.frag"); std::unique_ptr<Shader> pbrShader = std::make_unique<Shader>("../src/shaders/pbr.vert", "../src/shaders/pbr.frag"); //Max number of texture units that can be used concurrently from a model file is currently 9. unsigned int skyboxSamplerID = 10; //skybox - this also constructs maps for irradiance, prefilter and brdfLUT std::shared_ptr<Skybox> skybox = std::make_shared<Skybox>("../assets/hdr/map.hdr", 2048); //OTHER SKYBOXES //std::shared_ptr<Skybox> skybox = std::make_shared<Skybox>("../assets/hdr/Road_to_MonumentValley_Ref.hdr", 2048); //std::shared_ptr<Skybox> skybox = std::make_shared<Skybox>("../assets/hdr/Factory_Catwalk_2k.hdr", 2048); //tv pbr std::shared_ptr<Model> tv = std::make_shared<Model>("../assets/tv/tv.fbx"); tv->m_modelMatrix = glm::scale(tv->m_modelMatrix, glm::vec3(0.3f)); tv->m_modelMatrix = glm::rotate(tv->m_modelMatrix, glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)); tv->m_modelMatrix = glm::translate(tv->m_modelMatrix, glm::vec3(-40.0f, 0.0f, -10.0f)); glm::vec3 lightPos[] { glm::vec3{ 0.0f, 1.0f, 15.0f}, glm::vec3{ 25.0f, 3.0f, 10.0f}, glm::vec3{-25.0f, 3.0f, 10.0f}, }; glm::vec3 lightColors[] { glm::vec3{300.0f, 300.0f, 300.0f}, glm::vec3{100.0f, 100.0f, 100.0f}, glm::vec3{100.0f, 100.0f, 100.0f}, }; //lamp 0 std::shared_ptr<Model> lamp0 = std::make_shared<Model>("../../assets/cube/cube.obj"); //lamp 1 - static std::shared_ptr<Model> lamp1 = std::make_shared<Model>("../../assets/cube/cube.obj"); lamp1->m_modelMatrix = glm::translate(glm::mat4{ 1.0f }, lightPos[1]); lamp1->m_modelMatrix = glm::scale(lamp1->m_modelMatrix, glm::vec3(0.2f, 0.2f, 0.2f)); //lamp 2 - static std::shared_ptr<Model> lamp2 = std::make_shared<Model>("../../assets/cube/cube.obj"); lamp2->m_modelMatrix = glm::translate(glm::mat4{ 1.0f }, lightPos[2]); lamp2->m_modelMatrix = glm::scale(lamp2->m_modelMatrix, glm::vec3{0.2f, 0.2f, 0.2f}); //camera std::shared_ptr<Camera> cam1 = std::make_shared<Camera>(glm::vec3{ 0.0f, 0.0f, 15.0 }); bool quit = false; float translation{ 0.0f }; pbrShader->Use(); //set irradiance map to higher texture units, to prevent pbrShader->setInt("u_irradianceMap", skyboxSamplerID + 1); pbrShader->setInt("u_prefilterMap", skyboxSamplerID + 2); pbrShader->setInt("u_brdfLUT", skyboxSamplerID + 3); for (unsigned int i = 0; i < sizeof(lightPos) / sizeof(lightPos[0]); i++) { pbrShader->setVec3("u_lightPos[" + std::to_string(i) + "]", lightPos[i]); pbrShader->setVec3("u_lightColors[" + std::to_string(i) + "]", lightColors[i]); } pbrShader->StopUsing(); //SKYBOX//////////////////////////////////////////////// skyboxShader->Use(); skyboxShader->setInt("u_environmentCubemap", skyboxSamplerID); skyboxShader->StopUsing(); //wireframe mode //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); Time::Update(); while (!quit) { SDL_Event e = { 0 }; while (SDL_PollEvent(&e)) { if (e.type == SDL_QUIT) { quit = true; } else if (e.type == SDL_KEYDOWN) { //locking the cursor on F click if (e.key.keysym.sym == SDLK_f) { if ((bool)SDL_GetRelativeMouseMode()) SDL_SetRelativeMouseMode(SDL_FALSE); else SDL_SetRelativeMouseMode(SDL_TRUE); } } else if (e.type == SDL_MOUSEBUTTONDOWN) { //locking the cursor on mouse click if ((bool)SDL_GetRelativeMouseMode()) SDL_SetRelativeMouseMode(SDL_FALSE); else SDL_SetRelativeMouseMode(SDL_TRUE); } else if (e.type == SDL_MOUSEMOTION) { //process mouse input float deltaX = static_cast<float>(e.motion.xrel); float deltaY = static_cast<float>(-e.motion.yrel); cam1->ProcessMouseInput(deltaX, deltaY); } } //time calculations Time::Update(); Time::DisplayFPSinWindowTitle(window); //window resizing calculation int width = 0; int height = 0; SDL_GetWindowSize(window, &width, &height); glViewport(0, 0, width, height); //camera updates cam1->ProcessKeyboardInput(); cam1->ProcessZoom(); cam1->ProcessWindowResizing(width, height); //glBindFramebuffer(GL_FRAMEBUFFER, framebuf1->GetID()); glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); pbrShader->Use(); pbrShader->setVec3("u_viewPos", cam1->getPosition()); pbrShader->setVec3("u_lightPos[0]", lightPos[0]); pbrShader->setViewAndProjectionMatrix(*cam1, true); // bind pre-computed IBL data glActiveTexture(GL_TEXTURE0 + skyboxSamplerID + 1); glBindTexture(GL_TEXTURE_CUBE_MAP, skybox->GetIrradianceMap().lock()->m_id); glActiveTexture(GL_TEXTURE0 + skyboxSamplerID + 2); glBindTexture(GL_TEXTURE_CUBE_MAP, skybox->GetPrefilterMap().lock()->m_id); glActiveTexture(GL_TEXTURE0 + skyboxSamplerID + 3); glBindTexture(GL_TEXTURE_2D, skybox->GetBrdfLUT().lock()->m_id); tv->RenderMeshes(*pbrShader); pbrShader->StopUsing(); lampShader->Use(); //main lamp translation float speed = 0.001f; float range = 10.0f; translation = glm::sin(SDL_GetTicks()*speed)*range; //oscillate lightPos[0].x = translation; lampShader->setViewAndProjectionMatrix(*cam1, true); lamp0->m_modelMatrix = glm::translate(glm::mat4{ 1.0f }, lightPos[0]); lamp0->m_modelMatrix = glm::scale(lamp0->m_modelMatrix, glm::vec3{ 0.4f }); lamp0->RenderMeshes(*lampShader); lamp1->RenderMeshes(*lampShader); lamp2->RenderMeshes(*lampShader); lampShader->StopUsing(); ///////////////////////SKYBOX////////////////////// skyboxShader->Use(); skyboxShader->setViewAndProjectionMatrix(*cam1, true); glActiveTexture(GL_TEXTURE0 + skyboxSamplerID); glBindTexture(GL_TEXTURE_CUBE_MAP, skybox->GetSkyboxMap().lock()->m_id); skybox->RenderCube(); skyboxShader->StopUsing(); glBindVertexArray(0); SDL_GL_SwapWindow(window); Time::Reset(); } SDL_DestroyWindow(window); SDL_Quit(); return 0; }
[ "kaloyan42x@gmail.com" ]
kaloyan42x@gmail.com
455b819f4b1fcf29e82c29b73b3e70254b4db447
46bf8aa86e7724629b269a0ac473b385dfe18c4b
/test/demosupport.h
2910f915274fe27fe2940ef515c3455ffdc8e10b
[ "MIT" ]
permissive
equilibr/osgQt
16938bd564010042972674bf8537ff229f318a54
c59c973dcff1c12c649f8bb83e6736dccff13f8d
refs/heads/master
2020-07-24T15:21:26.584542
2020-04-10T13:51:01
2020-04-10T13:51:01
207,967,538
5
1
null
null
null
null
UTF-8
C++
false
false
275
h
#ifndef DEMOSUPPORT_H #define DEMOSUPPORT_H #include <osg/Geode> #include "../src/osgQtWidget.h" namespace osgQtDemo { osg::Geode * createScene(); void setupCameraManipulator(osgQt::Widget * widget); void setupCamera(osgQt::Widget * widget); } #endif // DEMOSUPPORT_H
[ "47003432+equilibr@users.noreply.github.com" ]
47003432+equilibr@users.noreply.github.com
951c754f8d7d7ffaf2c6afaa27e3d2ca2fe8e8d6
9fdb7597205151b7020c8dae34309ce461480ade
/Dijstra.cpp
ae1e2ae8ac28a9b7220e924fda609b7bdf37cca5
[]
no_license
SownBanana/Applied-Algorithms
853996f3d4f95f97dee339641659dc55aa83d730
7e6041447e821c5eb6ab0e55d5686ce3c0a1e7d4
refs/heads/master
2021-01-05T15:37:35.358243
2020-02-17T09:11:49
2020-02-17T09:11:49
241,063,836
1
1
null
null
null
null
UTF-8
C++
false
false
2,840
cpp
#include <iostream> #include <vector> #include <list> #define MAX 100001 //using namespace std; typedef struct a{ int u; int w; } pairWu; int N,M; int s,t; //start - target std::vector<pairWu> A[MAX]; //tree int p[MAX]; bool fixed[MAX]; //heap int d[MAX]; //d[v] is the upper bound of the length of the shortest path from s to v; int node[MAX]; //node[i] is the ith element(vertex -u and weight -w) in th HEAP int idx[MAX]; //idx[v] is the index of v in the HEAP (idx[node[i].u] = i) int sH; //size of HEAP void input(){ std::cin>>N>>M; for(int i = 0; i < M; i++){ int u; pairWu v; std::cin>>u>>v.u>>v.w; A[u].push_back(v); } std::cin>>s>>t; } void swap(int i, int j){ //swap ith and jth elements of the HEAP int tmp = node[i]; node[i] = node[j]; node[j] = tmp; idx[node[i]] = i; idx[node[j]] = j; } void upHeap(int i){ // printf("sH = %d", sH); if(i == 0) return; while(i>0){ int pi = (i-1)/2; // printf("pi = %d\n", pi); if(d[node[i]] < d[node[pi]]){ swap(i, pi); }else{ break; } i = pi; } } void downHeap(int i){ int L = 2*i + 1; int R = 2*i +2; int maxIdx = i; if(L < sH && d[node[L]] < d[node[maxIdx]]) maxIdx = L; if(R < sH && d[node[R]] < d[node[maxIdx]]) maxIdx = R; if(maxIdx != i){ swap(i, maxIdx); downHeap(maxIdx); } } void insert(int v, int k){ //add element key = k, value = v into HEAP (v,d[v]) // printf("insert/n"); d[v] = k; node[sH] = v; idx[node[sH]] = sH; upHeap(sH); sH++; } int inHeap(int v){ // printf("%d o %d cua heap\n", v, idx[v]); return idx[v]; } void updateKey(int v, int k){ if(d[v] > k){ d[v] = k; upHeap(v); } else{ downHeap(v); } } int deleteMin(){ int sel_node = node[0]; swap(0, sH - 1); sH--; downHeap(0); return sel_node; } void init(){ sH = 0; for(int i = 1; i <= N; i++){ d[i] = 99999; fixed[i] = false; p[i] = 0; idx[i] = -1; } for(int i = 0; i < A[s].size(); i++){ pairWu v = A[s][i]; // std::cout<<node[0]<<std::endl; insert(v.u, v.w); // std::cout<<node[0]<<std::endl; } fixed[s] = true; } void LOOP(){ while(sH>0){ int u = deleteMin(); fixed[u] = true; // std::cout<<"d["<<u<<"] = "<<d[u]<<std::endl; for(int i = 0; i < A[u].size(); i++){ pairWu v = A[u][i]; // std::cout<<"d["<<v.u<<"] = "<<d[v.u]<<std::endl; // std::cout<<u<<"=>"<<v.u<<" = "; // std::cout<<d[u] + v.w<<std::endl; if(fixed[v.u]) continue; if(inHeap(v.u) == -1){ //v.u <=> w(u,v) // printf("%d vao heap\n", v.u); int w = d[u] + v.w; insert(v.u, w); } else{ if(d[v.u] > d[u] + v.w){ // printf("upadate %d\n", v.u); updateKey(v.u, d[u] + v.w); } } } } } void solve(){ init(); LOOP(); int rs = d[t]; // if(!fixed[t]) rs = -1; std::cout<<rs; } int main(){ input(); solve(); } /* 5 7 2 5 87 1 2 97 4 5 78 3 1 72 1 4 19 2 3 63 5 1 18 1 5 */
[ "s.v.o.a.26@gmail.com" ]
s.v.o.a.26@gmail.com
b4844f7ba9b5c77354f46f17b06ba5dfb1fd421b
753f9b8f260e7cb57a4c9091737a8bfb203c09b4
/Plugins/VaRestPlugin/Source/VaRest/Public/VaRestSubsystem.h
3fae927edbde90d15b79704140fc9253b48bdd36
[ "MIT" ]
permissive
cheburashkalev/Yandex.Music.UE4
784a4abe262bf0dded1cb8a21345634c43224a4a
58ccc6d0145eca4627bdf3a1daed5df4f0261dc3
refs/heads/main
2023-08-15T04:00:41.004801
2021-10-09T09:46:30
2021-10-09T09:46:30
412,085,960
4
0
null
null
null
null
UTF-8
C++
false
false
4,616
h
// Copyright 2014-2020 Vladimir Alyamkin. All Rights Reserved. #pragma once #include "VaRestJsonObject.h" #include "VaRestJsonValue.h" #include "VaRestRequestJSON.h" #include "Subsystems/EngineSubsystem.h" #include "VaRestSubsystem.generated.h" DECLARE_DYNAMIC_DELEGATE_OneParam(FVaRestCallDelegate, UVaRestRequestJSON*, Request); USTRUCT() struct FVaRestCallResponse { GENERATED_USTRUCT_BODY() UPROPERTY() UVaRestRequestJSON* Request; UPROPERTY() FVaRestCallDelegate Callback; FDelegateHandle CompleteDelegateHandle; FDelegateHandle FailDelegateHandle; FVaRestCallResponse() : Request(nullptr) { } }; UCLASS() class VAREST_API UVaRestSubsystem : public UEngineSubsystem { GENERATED_BODY() public: UVaRestSubsystem(); // Begin USubsystem virtual void Initialize(FSubsystemCollectionBase& Collection) override; virtual void Deinitialize() override; // End USubsystem ////////////////////////////////////////////////////////////////////////// // Easy URL processing public: /** Easy way to process http requests */ UFUNCTION(BlueprintCallable, Category = "VaRest|Utility") void CallURL(const FString& URL, EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback); /** Called when URL is processed (one for both success/unsuccess events)*/ void OnCallComplete(UVaRestRequestJSON* Request); protected: UPROPERTY() TMap<UVaRestRequestJSON*, FVaRestCallResponse> RequestMap; ////////////////////////////////////////////////////////////////////////// // Construction helpers public: /** Creates new request (totally empty) */ UFUNCTION(BlueprintCallable, meta = (DisplayName = "Construct Json Request (Empty)"), Category = "VaRest|Subsystem") UVaRestRequestJSON* ConstructVaRestRequest(); /** Creates new request with defined verb and content type */ UFUNCTION(BlueprintCallable, meta = (DisplayName = "Construct Json Request"), Category = "VaRest|Subsystem") UVaRestRequestJSON* ConstructVaRestRequestExt(EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType); /** Create new Json object */ UFUNCTION(BlueprintCallable, meta = (DisplayName = "Construct Json Object"), Category = "VaRest|Subsystem") UVaRestJsonObject* ConstructVaRestJsonObject(); /** Create new Json object (static one for MakeJson node, hack for #293) */ UFUNCTION() static UVaRestJsonObject* StaticConstructVaRestJsonObject(); /** Create new Json Number value * Attn.!! float used instead of double to make the function blueprintable! */ UFUNCTION(BlueprintPure, meta = (DisplayName = "Construct Json Number Value"), Category = "VaRest|Subsystem") UVaRestJsonValue* ConstructJsonValueNumber(float Number); /** Create new Json String value */ UFUNCTION(BlueprintPure, meta = (DisplayName = "Construct Json String Value"), Category = "VaRest|Subsystem") UVaRestJsonValue* ConstructJsonValueString(const FString& StringValue); /** Create new Json Bool value */ UFUNCTION(BlueprintPure, meta = (DisplayName = "Construct Json Bool Value"), Category = "VaRest|Subsystem") UVaRestJsonValue* ConstructJsonValueBool(bool InValue); /** Create new Json Array value */ UFUNCTION(BlueprintPure, meta = (DisplayName = "Construct Json Array Value"), Category = "VaRest|Subsystem") UVaRestJsonValue* ConstructJsonValueArray(const TArray<UVaRestJsonValue*>& InArray); /** Create new Json Object value */ UFUNCTION(BlueprintPure, meta = (DisplayName = "Construct Json Object Value"), Category = "VaRest|Subsystem") UVaRestJsonValue* ConstructJsonValueObject(UVaRestJsonObject* JsonObject); /** Create new Json value from FJsonValue (to be used from VaRestJsonObject) */ UVaRestJsonValue* ConstructJsonValue(const TSharedPtr<FJsonValue>& InValue); ////////////////////////////////////////////////////////////////////////// // Serialization public: /** Construct Json value from string */ UFUNCTION(BlueprintCallable, Category = "VaRest|Subsystem") UVaRestJsonValue* DecodeJsonValue(const FString& JsonString); /** Construct Json object from string */ UFUNCTION(BlueprintCallable, Category = "VaRest|Subsystem") UVaRestJsonObject* DecodeJsonObject(const FString& JsonString); ////////////////////////////////////////////////////////////////////////// // File system integration public: /** * Load JSON from formatted text file * @param bIsRelativeToContentDir if set to 'false' path is treated as absolute */ UFUNCTION(BlueprintCallable, Category = "VaRest|Utility") UVaRestJsonObject* LoadJsonFromFile(const FString& Path, const bool bIsRelativeToContentDir = true); };
[ "47310777+cheburashkalev@users.noreply.github.com" ]
47310777+cheburashkalev@users.noreply.github.com
e6bcf4008b03b9c13274740b77841b24522a50be
6e41458b8ec6ccf30d314a0cd0a3fdd94317925f
/Fuzzy/Codigo1/includes/RegrasVel.hpp
58756e090607c2db41ce763a64cad30671dc30a9
[]
no_license
UnbDroid/Festo2016
108577b4468513f609e921841e5365be6fc09274
8f22bcf9b68803a91ac20dfb282910db55415b98
refs/heads/master
2021-01-23T14:04:08.587503
2017-09-04T19:48:26
2017-09-04T19:48:26
58,758,496
1
0
null
null
null
null
UTF-8
C++
false
false
774
hpp
#ifndef REGRAS_VEL_HPP #define REGRAS_VEL_HPP #include "Regras.hpp" #include <vector> using namespace std; template <class Owner> class TurboBackward: public Regras<Owner>{ public: TurboBackward(Owner* o):Regras<Owner>(o){}; virtual void executar(); }; template <class Owner> class VeryFastBackward: public Regras<Owner>{ public: VeryFastBackward(Owner* o):Regras<Owner>(o){}; virtual void executar(); }; template <class Owner> class FastBackward: public Regras<Owner>{ public: FastBackward(Owner* o):Regras<Owner>(o){}; virtual void executar(); }; template <class Owner> class Backward: public Regras<Owner>{ public: Backward(Owner* o):Regras<Owner>(o){}; virtual void executar(); }; #include "RegrasVel.tpp" #endif // REGRAS_VEL_HPP
[ "rodrigowerberich@hotmail.com" ]
rodrigowerberich@hotmail.com
8ecbe36c8482cf6b44676b9439f59ccc4992ac1d
139dfd1c0af642a3bc48e88f1ac740589b0590ea
/src/AS_02_PHDR.h
e9084042bccc79612f71440e5718122872548252
[ "BSD-3-Clause" ]
permissive
DSRCorporation/asdcplib-as02
355c5fc76288e671d72e77a049e270ad6f9ca2e0
018002ccc5d62716514921a14782446e8edc4f3a
refs/heads/master
2020-05-02T13:44:35.517720
2016-08-08T12:36:59
2016-08-08T12:36:59
65,993,564
8
0
null
null
null
null
UTF-8
C++
false
false
8,201
h
/* Copyright (c) 2011-2015, John Hurst 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. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /*! \file AS_02_PHDR.h \version $Id: AS_02_PHDR.h,v 1.4 2015/01/22 21:05:58 jhurst Exp $ \brief AS-02 library, JPEG 2000 P-HDR essence reader and writer implementation */ #ifndef _AS_02_PHDR_H_ #define _AS_02_PHDR_H_ #include "AS_02.h" namespace AS_02 { namespace PHDR { // class FrameBuffer : public ASDCP::JP2K::FrameBuffer { public: std::string OpaqueMetadata; FrameBuffer() {} FrameBuffer(ui32_t size) { Capacity(size); } virtual ~FrameBuffer() {} // Print debugging information to stream (stderr default) void Dump(FILE* = 0, ui32_t dump_bytes = 0) const; }; // An object which reads a sequence of files containing // JPEG 2000 P-HDR pictures and metadata. class SequenceParser { class h__SequenceParser; Kumu::mem_ptr<h__SequenceParser> m_Parser; ASDCP_NO_COPY_CONSTRUCT(SequenceParser); public: SequenceParser(); virtual ~SequenceParser(); // Opens a directory for reading. The directory is expected to contain one or // more pairs of files, each containing the codestream for exactly one picture (.j2c) // and the corresponding P-HDR metadata (.xml). The files must be named such that the // frames are in temporal order when sorted alphabetically by filename. The parser // will automatically parse enough data from the first file to provide a complete set // of stream metadata for the MXFWriter below. The contents of the metadata files will // not be analyzed (i.e., the raw bytes will be passed in without scrutiny.) If the // "pedantic" parameter is given and is true, the J2C parser will check the JPEG 2000 // metadata for each codestream and fail if a mismatch is detected. Result_t OpenRead(const std::string& filename, bool pedantic = false) const; // Opens a file sequence for reading. The sequence is expected to contain one or // more pairs of filenames, each naming a file containing the codestream (.j2c) and the // corresponding P-HDR metadata (.xml) for exactly one picture. The parser will // automatically parse enough data from the first file to provide a complete set of // stream metadata for the MXFWriter below. If the "pedantic" parameter is given and // is true, the parser will check the metadata for each codestream and fail if a // mismatch is detected. Result_t OpenRead(const std::list<std::string>& file_list, bool pedantic = false) const; // Fill a PictureDescriptor struct with the values from the first file's codestream. // Returns RESULT_INIT if the directory is not open. Result_t FillPictureDescriptor(ASDCP::JP2K::PictureDescriptor&) const; // Rewind the directory to the beginning. Result_t Reset() const; // Reads the next sequential frame in the directory and places it in the frame buffer. // Fails if the buffer is too small or the direcdtory contains no more files. The frame // buffer's PlaintextOffset parameter will be set to the first byte of the data segment. // Set this value to zero if you want encrypted headers. Result_t ReadFrame(AS_02::PHDR::FrameBuffer&) const; }; // class MXFWriter { class h__Writer; ASDCP::mem_ptr<h__Writer> m_Writer; ASDCP_NO_COPY_CONSTRUCT(MXFWriter); public: MXFWriter(); virtual ~MXFWriter(); // Warning: direct manipulation of MXF structures can interfere // with the normal operation of the wrapper. Caveat emptor! virtual ASDCP::MXF::OP1aHeader& OP1aHeader(); virtual ASDCP::MXF::RIP& RIP(); // Open the file for writing. The file must not exist. Returns error if // the operation cannot be completed or if nonsensical data is discovered // in the essence descriptor. Result_t OpenWrite(const std::string& filename, const ASDCP::WriterInfo&, ASDCP::MXF::FileDescriptor* essence_descriptor, ASDCP::MXF::InterchangeObject_list_t& essence_sub_descriptor_list, const ASDCP::Rational& edit_rate, const ui32_t& header_size = 16384, const IndexStrategy_t& strategy = IS_FOLLOW, const ui32_t& partition_space = 10); // Writes a frame of essence to the MXF file. If the optional AESEncContext // argument is present, the essence is encrypted prior to writing. // Fails if the file is not open, is finalized, or an operating system // error occurs. Result_t WriteFrame(const AS_02::PHDR::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0); // Closes the MXF file, writing the final index, the PHDR master metadata and the revised header. Result_t Finalize(const std::string& PHDR_master_metadata); }; // class MXFReader { class h__Reader; ASDCP::mem_ptr<h__Reader> m_Reader; ASDCP_NO_COPY_CONSTRUCT(MXFReader); public: MXFReader(); virtual ~MXFReader(); // Warning: direct manipulation of MXF structures can interfere // with the normal operation of the wrapper. Caveat emptor! virtual ASDCP::MXF::OP1aHeader& OP1aHeader(); virtual AS_02::MXF::AS02IndexReader& AS02IndexReader(); virtual ASDCP::MXF::RIP& RIP(); // Open the file for reading. The file must exist. Returns error if the // operation cannot be completed. If master metadata is available it will // be placed into the string object passed as the second argument. Result_t OpenRead(const std::string& filename, std::string& PHDR_master_metadata) const; // Returns RESULT_INIT if the file is not open. Result_t Close() const; // Fill a WriterInfo struct with the values from the file's header. // Returns RESULT_INIT if the file is not open. Result_t FillWriterInfo(ASDCP::WriterInfo&) const; // Reads a frame of essence from the MXF file. If the optional AESEncContext // argument is present, the essence is decrypted after reading. If the MXF // file is encrypted and the AESDecContext argument is NULL, the frame buffer // will contain the ciphertext frame data. If the HMACContext argument is // not NULL, the HMAC will be calculated (if the file supports it). // Returns RESULT_INIT if the file is not open, failure if the frame number is // out of range, or if optional decrypt or HAMC operations fail. Result_t ReadFrame(ui32_t frame_number, AS_02::PHDR::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const; // Print debugging information to stream void DumpHeaderMetadata(FILE* = 0) const; void DumpIndex(FILE* = 0) const; }; } // end namespace PHDR } // end namespace AS_02 #endif // _AS_02_PHDR_H_ // // end AS_02_PHDR.h //
[ "Alexandr" ]
Alexandr
fd4be234176529442776cece8e1e590ab3e346b1
5d0ab3b290b0b997a8b2184037b01331af14fcfe
/practical5/src/dynamics/SpringForceField.cpp
d09c102d21be3af6d755dd4ed6e9c101d01b83f2
[]
no_license
pie3636/3D-Kart
e58ff18fb9e5701431ea0c495ee43de6d9b6c4ac
91310abe27d225b1d152b3722cafb9425a80c823
refs/heads/master
2023-06-09T08:34:03.739633
2016-04-26T10:20:01
2016-04-26T10:20:01
55,910,402
0
0
null
null
null
null
UTF-8
C++
false
false
903
cpp
#include "./../../include/dynamics/SpringForceField.hpp" SpringForceField::SpringForceField(const ParticlePtr p1, const ParticlePtr p2, float stiffness, float equilibriumLength, float damping) : m_p1(p1), m_p2(p2), m_stiffness(stiffness), m_equilibriumLength(equilibriumLength), m_damping(damping) {} void SpringForceField::do_addForce() { glm::vec3 u = m_p2->getPosition() - m_p1->getPosition(); if (glm::length(u) < std::numeric_limits<float>::epsilon()) { return; } glm::vec3 nu = glm::normalize(u); glm::vec3 force = -m_stiffness * (glm::length(u) - m_equilibriumLength) * u / glm::length(u) - m_damping * glm::dot(m_p2->getVelocity() - m_p1->getVelocity(), nu) * nu; m_p2->incrForce(force); m_p1->incrForce(-force); } ParticlePtr SpringForceField::getParticle1() const { return m_p1; } ParticlePtr SpringForceField::getParticle2() const { return m_p2; }
[ "maxime.meloux@ensimag.grenoble-inp.fr" ]
maxime.meloux@ensimag.grenoble-inp.fr
328bc10ee6ef7f1fe14ff8b99bad36b3b80e8ef6
fa939a703563ca6a5af3b79df3c4241757f3f059
/Source/Laboratoare/Tema3/Transform2D.h
ea7517f6cb8277a9df056b354670e71c09f9c21e
[]
no_license
alexbiolete/opengl-skylised-runner
47c13cc603cb8c0209bfbf2a13a4b570d6db3d42
abc3f167b5fad10ed8daefd05cddb6c405279c36
refs/heads/main
2023-07-17T23:38:32.158513
2021-08-31T21:01:51
2021-08-31T21:01:51
401,839,595
0
0
null
null
null
null
UTF-8
C++
false
false
686
h
#pragma once #include <include/glm.h> namespace Transform2D { // Translate matrix inline glm::mat3 Translate(float translateX, float translateY) { // TODO implement translate matrix return glm::transpose(glm::mat3(1, 0, translateX, 0, 1, translateY, 0, 0, 1)); } // Scale matrix inline glm::mat3 Scale(float scaleX, float scaleY) { // TODO implement scale matrix return glm::transpose(glm::mat3(scaleX, 0, 0, 0, scaleY, 0, 0, 0, 1)); } // Rotate matrix inline glm::mat3 Rotate(float radians) { // TODO implement rotate matrix return glm::transpose(glm::mat3(cos(radians), -sin(radians), 0, sin(radians), cos(radians), 0, 0, 0, 1)); } }
[ "alexbiolete@pm.me" ]
alexbiolete@pm.me
4ee80f2d5f4025385d95c50a9992276921042387
6a19bec1f6c02d8defe37e8a7179149821ab5a93
/src/wallet/rpcwallet.cpp
1f053ac2ae025e83f1a6bd5f92e5730e36d9e947
[ "MIT" ]
permissive
glpcoin/GodLikeProductsSource
4800d486f0f6c1cee2f76131b750346bcd1948d9
74059e30f802343e1812b7c40f0b4621ae0980d9
refs/heads/master
2020-06-12T01:16:46.672122
2019-06-27T19:11:34
2019-06-27T19:11:34
194,148,521
0
0
null
null
null
null
UTF-8
C++
false
false
142,216
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers // Copyright (c) 2019 The GodLikeProducts Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "amount.h" #include "base58.h" #include "chain.h" #include "consensus/validation.h" #include "core_io.h" #include "init.h" #include "instantx.h" #include "net.h" #include "policy/rbf.h" #include "rpc/server.h" #include "timedata.h" #include "util.h" #include "utilmoneystr.h" #include "validation.h" #include "wallet.h" #include "walletdb.h" #include "keepass.h" #include <stdint.h> #include <boost/assign/list_of.hpp> #include <univalue.h> int64_t nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime; std::string HelpRequiringPassphrase() { return pwalletMain && pwalletMain->IsCrypted() ? "\nRequires wallet passphrase to be set with walletpassphrase call." : ""; } bool EnsureWalletIsAvailable(bool avoidException) { if (!pwalletMain) { if (!avoidException) throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)"); else return false; } return true; } void EnsureWalletIsUnlocked() { if (pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); } void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) { int confirms = wtx.GetDepthInMainChain(false); bool fLocked = instantsend.IsLockedInstantSendTransaction(wtx.GetHash()); entry.push_back(Pair("confirmations", confirms)); entry.push_back(Pair("instantlock", fLocked)); if (wtx.IsCoinBase()) entry.push_back(Pair("generated", true)); if (confirms > 0) { entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); entry.push_back(Pair("blockindex", wtx.nIndex)); entry.push_back(Pair("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime())); } else { entry.push_back(Pair("trusted", wtx.IsTrusted())); } uint256 hash = wtx.GetHash(); entry.push_back(Pair("txid", hash.GetHex())); UniValue conflicts(UniValue::VARR); BOOST_FOREACH(const uint256& conflict, wtx.GetConflicts()) conflicts.push_back(conflict.GetHex()); entry.push_back(Pair("walletconflicts", conflicts)); entry.push_back(Pair("time", wtx.GetTxTime())); entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived)); // Add opt-in RBF status std::string rbfStatus = "no"; if (confirms <= 0) { LOCK(mempool.cs); RBFTransactionState rbfState = IsRBFOptIn(wtx, mempool); if (rbfState == RBF_TRANSACTIONSTATE_UNKNOWN) rbfStatus = "unknown"; else if (rbfState == RBF_TRANSACTIONSTATE_REPLACEABLE_BIP125) rbfStatus = "yes"; } entry.push_back(Pair("bip125-replaceable", rbfStatus)); BOOST_FOREACH(const PAIRTYPE(std::string, std::string)& item, wtx.mapValue) entry.push_back(Pair(item.first, item.second)); } std::string AccountFromValue(const UniValue& value) { std::string strAccount = value.get_str(); if (strAccount == "*") throw JSONRPCError(RPC_WALLET_INVALID_ACCOUNT_NAME, "Invalid account name"); return strAccount; } UniValue getnewaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 1) throw std::runtime_error( "getnewaddress ( \"account\" )\n" "\nReturns a new GodLikeProducts address for receiving payments.\n" "If 'account' is specified (DEPRECATED), it is added to the address book \n" "so payments received with the address will be credited to 'account'.\n" "\nArguments:\n" "1. \"account\" (string, optional) DEPRECATED. The account name for the address to be linked to. If not provided, the default account \"\" is used. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name.\n" "\nResult:\n" "\"address\" (string) The new godlikeproducts address\n" "\nExamples:\n" + HelpExampleCli("getnewaddress", "") + HelpExampleRpc("getnewaddress", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); // Parse the account first so we don't generate a key if there's an error std::string strAccount; if (request.params.size() > 0) strAccount = AccountFromValue(request.params[0]); if (!pwalletMain->IsLocked(true)) pwalletMain->TopUpKeyPool(); // Generate a new key that is added to wallet CPubKey newKey; if (!pwalletMain->GetKeyFromPool(newKey, false)) throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); CKeyID keyID = newKey.GetID(); pwalletMain->SetAddressBook(keyID, strAccount, "receive"); return CBitcoinAddress(keyID).ToString(); } CBitcoinAddress GetAccountAddress(std::string strAccount, bool bForceNew=false) { CPubKey pubKey; if (!pwalletMain->GetAccountPubkey(pubKey, strAccount, bForceNew)) { throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); } return CBitcoinAddress(pubKey.GetID()); } UniValue getaccountaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "getaccountaddress \"account\"\n" "\nDEPRECATED. Returns the current GodLikeProducts address for receiving payments to this account.\n" "\nArguments:\n" "1. \"account\" (string, required) The account name for the address. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created and a new address created if there is no account by the given name.\n" "\nResult:\n" "\"address\" (string) The account godlikeproducts address\n" "\nExamples:\n" + HelpExampleCli("getaccountaddress", "") + HelpExampleCli("getaccountaddress", "\"\"") + HelpExampleCli("getaccountaddress", "\"myaccount\"") + HelpExampleRpc("getaccountaddress", "\"myaccount\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); // Parse the account first so we don't generate a key if there's an error std::string strAccount = AccountFromValue(request.params[0]); UniValue ret(UniValue::VSTR); ret = GetAccountAddress(strAccount).ToString(); return ret; } UniValue getrawchangeaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 1) throw std::runtime_error( "getrawchangeaddress\n" "\nReturns a new GodLikeProducts address, for receiving change.\n" "This is for use with raw transactions, NOT normal use.\n" "\nResult:\n" "\"address\" (string) The address\n" "\nExamples:\n" + HelpExampleCli("getrawchangeaddress", "") + HelpExampleRpc("getrawchangeaddress", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (!pwalletMain->IsLocked(true)) pwalletMain->TopUpKeyPool(); CReserveKey reservekey(pwalletMain); CPubKey vchPubKey; if (!reservekey.GetReservedKey(vchPubKey, true)) throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); reservekey.KeepKey(); CKeyID keyID = vchPubKey.GetID(); return CBitcoinAddress(keyID).ToString(); } UniValue setaccount(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "setaccount \"address\" \"account\"\n" "\nDEPRECATED. Sets the account associated with the given address.\n" "\nArguments:\n" "1. \"address\" (string, required) The godlikeproducts address to be associated with an account.\n" "2. \"account\" (string, required) The account to assign the address to.\n" "\nExamples:\n" + HelpExampleCli("setaccount", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" \"tabby\"") + HelpExampleRpc("setaccount", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", \"tabby\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(request.params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid GodLikeProducts address"); std::string strAccount; if (request.params.size() > 1) strAccount = AccountFromValue(request.params[1]); // Only add the account if the address is yours. if (IsMine(*pwalletMain, address.Get())) { // Detect when changing the account of an address that is the 'unused current key' of another account: if (pwalletMain->mapAddressBook.count(address.Get())) { std::string strOldAccount = pwalletMain->mapAddressBook[address.Get()].name; if (address == GetAccountAddress(strOldAccount)) GetAccountAddress(strOldAccount, true); } pwalletMain->SetAddressBook(address.Get(), strAccount, "receive"); } else throw JSONRPCError(RPC_MISC_ERROR, "setaccount can only be used with own address"); return NullUniValue; } UniValue getaccount(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "getaccount \"address\"\n" "\nDEPRECATED. Returns the account associated with the given address.\n" "\nArguments:\n" "1. \"address\" (string, required) The godlikeproducts address for account lookup.\n" "\nResult:\n" "\"accountname\" (string) the account address\n" "\nExamples:\n" + HelpExampleCli("getaccount", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\"") + HelpExampleRpc("getaccount", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(request.params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid GodLikeProducts address"); std::string strAccount; std::map<CTxDestination, CAddressBookData>::iterator mi = pwalletMain->mapAddressBook.find(address.Get()); if (mi != pwalletMain->mapAddressBook.end() && !(*mi).second.name.empty()) strAccount = (*mi).second.name; return strAccount; } UniValue getaddressesbyaccount(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "getaddressesbyaccount \"account\"\n" "\nDEPRECATED. Returns the list of addresses for the given account.\n" "\nArguments:\n" "1. \"account\" (string, required) The account name.\n" "\nResult:\n" "[ (json array of string)\n" " \"address\" (string) a godlikeproducts address associated with the given account\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("getaddressesbyaccount", "\"tabby\"") + HelpExampleRpc("getaddressesbyaccount", "\"tabby\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); std::string strAccount = AccountFromValue(request.params[0]); // Find all addresses that have the given account UniValue ret(UniValue::VARR); BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, CAddressBookData)& item, pwalletMain->mapAddressBook) { const CBitcoinAddress& address = item.first; const std::string& strName = item.second.name; if (strName == strAccount) ret.push_back(address.ToString()); } return ret; } static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, bool fUseInstantSend=false, bool fUsePrivateSend=false) { CAmount curBalance = pwalletMain->GetBalance(); // Check amount if (nValue <= 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount"); if (nValue > curBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds"); if (pwalletMain->GetBroadcastTransactions() && !g_connman) throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); // Parse GodLikeProducts address CScript scriptPubKey = GetScriptForDestination(address); // Create and send the transaction CReserveKey reservekey(pwalletMain); CAmount nFeeRequired; std::string strError; std::vector<CRecipient> vecSend; int nChangePosRet = -1; CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount}; vecSend.push_back(recipient); if (!pwalletMain->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet, strError, NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstantSend)) { if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance) strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired)); throw JSONRPCError(RPC_WALLET_ERROR, strError); } CValidationState state; if (!pwalletMain->CommitTransaction(wtxNew, reservekey, g_connman.get(), state, fUseInstantSend ? NetMsgType::TXLOCKREQUEST : NetMsgType::TX)) { strError = strprintf("Error: The transaction was rejected! Reason given: %s", state.GetRejectReason()); throw JSONRPCError(RPC_WALLET_ERROR, strError); } } UniValue sendtoaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 2 || request.params.size() > 7) throw std::runtime_error( "sendtoaddress \"address\" amount ( \"comment\" \"comment_to\" subtractfeefromamount use_is use_ps )\n" "\nSend an amount to a given address.\n" + HelpRequiringPassphrase() + "\nArguments:\n" "1. \"address\" (string, required) The godlikeproducts address to send to.\n" "2. \"amount\" (numeric or string, required) The amount in " + CURRENCY_UNIT + " to send. eg 0.1\n" "3. \"comment\" (string, optional) A comment used to store what the transaction is for. \n" " This is not part of the transaction, just kept in your wallet.\n" "4. \"comment_to\" (string, optional) A comment to store the name of the person or organization \n" " to which you're sending the transaction. This is not part of the \n" " transaction, just kept in your wallet.\n" "5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n" " The recipient will receive less amount of GodLikeProducts than you enter in the amount field.\n" "6. \"use_is\" (bool, optional, default=false) Send this transaction as InstantSend\n" "7. \"use_ps\" (bool, optional, default=false) Use anonymized funds only\n" "\nResult:\n" "\"txid\" (string) The transaction id.\n" "\nExamples:\n" + HelpExampleCli("sendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1") + HelpExampleCli("sendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 \"donation\" \"seans outpost\"") + HelpExampleCli("sendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 \"\" \"\" true") + HelpExampleRpc("sendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", 0.1, \"donation\", \"seans outpost\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(request.params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid GodLikeProducts address"); // Amount CAmount nAmount = AmountFromValue(request.params[1]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); // Wallet comments CWalletTx wtx; if (request.params.size() > 2 && !request.params[2].isNull() && !request.params[2].get_str().empty()) wtx.mapValue["comment"] = request.params[2].get_str(); if (request.params.size() > 3 && !request.params[3].isNull() && !request.params[3].get_str().empty()) wtx.mapValue["to"] = request.params[3].get_str(); bool fSubtractFeeFromAmount = false; if (request.params.size() > 4) fSubtractFeeFromAmount = request.params[4].get_bool(); bool fUseInstantSend = false; bool fUsePrivateSend = false; if (request.params.size() > 5) fUseInstantSend = request.params[5].get_bool(); if (request.params.size() > 6) fUsePrivateSend = request.params[6].get_bool(); EnsureWalletIsUnlocked(); SendMoney(address.Get(), nAmount, fSubtractFeeFromAmount, wtx, fUseInstantSend, fUsePrivateSend); return wtx.GetHash().GetHex(); } UniValue instantsendtoaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 2 || request.params.size() > 5) throw std::runtime_error( "instantsendtoaddress \"address\" amount ( \"comment\" \"comment-to\" subtractfeefromamount )\n" "\nSend an amount to a given address. The amount is a real and is rounded to the nearest 0.00000001\n" + HelpRequiringPassphrase() + "\nArguments:\n" "1. \"address\" (string, required) The godlikeproducts address to send to.\n" "2. \"amount\" (numeric, required) The amount in " + CURRENCY_UNIT + " to send. eg 0.1\n" "3. \"comment\" (string, optional) A comment used to store what the transaction is for. \n" " This is not part of the transaction, just kept in your wallet.\n" "4. \"comment_to\" (string, optional) A comment to store the name of the person or organization \n" " to which you're sending the transaction. This is not part of the \n" " transaction, just kept in your wallet.\n" "5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n" " The recipient will receive less amount of GodLikeProducts than you enter in the amount field.\n" "\nResult:\n" "\"transactionid\" (string) The transaction id.\n" "\nExamples:\n" + HelpExampleCli("instantsendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1") + HelpExampleCli("instantsendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 \"donation\" \"seans outpost\"") + HelpExampleCli("instantsendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 \"\" \"\" true") + HelpExampleRpc("instantsendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", 0.1, \"donation\", \"seans outpost\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(request.params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid GodLikeProducts address"); // Amount CAmount nAmount = AmountFromValue(request.params[1]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); // Wallet comments CWalletTx wtx; if (request.params.size() > 2 && !request.params[2].isNull() && !request.params[2].get_str().empty()) wtx.mapValue["comment"] = request.params[2].get_str(); if (request.params.size() > 3 && !request.params[3].isNull() && !request.params[3].get_str().empty()) wtx.mapValue["to"] = request.params[3].get_str(); bool fSubtractFeeFromAmount = false; if (request.params.size() > 4) fSubtractFeeFromAmount = request.params[4].get_bool(); EnsureWalletIsUnlocked(); SendMoney(address.Get(), nAmount, fSubtractFeeFromAmount, wtx, true); return wtx.GetHash().GetHex(); } UniValue listaddressgroupings(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp) throw std::runtime_error( "listaddressgroupings\n" "\nLists groups of addresses which have had their common ownership\n" "made public by common use as inputs or as the resulting change\n" "in past transactions\n" "\nResult:\n" "[\n" " [\n" " [\n" " \"address\", (string) The godlikeproducts address\n" " amount, (numeric) The amount in " + CURRENCY_UNIT + "\n" " \"account\" (string, optional) DEPRECATED. The account\n" " ]\n" " ,...\n" " ]\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("listaddressgroupings", "") + HelpExampleRpc("listaddressgroupings", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); UniValue jsonGroupings(UniValue::VARR); std::map<CTxDestination, CAmount> balances = pwalletMain->GetAddressBalances(); BOOST_FOREACH(std::set<CTxDestination> grouping, pwalletMain->GetAddressGroupings()) { UniValue jsonGrouping(UniValue::VARR); BOOST_FOREACH(CTxDestination address, grouping) { UniValue addressInfo(UniValue::VARR); addressInfo.push_back(CBitcoinAddress(address).ToString()); addressInfo.push_back(ValueFromAmount(balances[address])); { if (pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get()) != pwalletMain->mapAddressBook.end()) addressInfo.push_back(pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get())->second.name); } jsonGrouping.push_back(addressInfo); } jsonGroupings.push_back(jsonGrouping); } return jsonGroupings; } UniValue listaddressbalances(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 1) throw std::runtime_error( "listaddressbalances ( minamount )\n" "\nLists addresses of this wallet and their balances\n" "\nArguments:\n" "1. minamount (numeric, optional, default=0) Minimum balance in " + CURRENCY_UNIT + " an address should have to be shown in the list\n" "\nResult:\n" "{\n" " \"address\": amount, (string) The godlikeproducts address and the amount in " + CURRENCY_UNIT + "\n" " ,...\n" "}\n" "\nExamples:\n" + HelpExampleCli("listaddressbalances", "") + HelpExampleCli("listaddressbalances", "10") + HelpExampleRpc("listaddressbalances", "") + HelpExampleRpc("listaddressbalances", "10") ); LOCK2(cs_main, pwalletMain->cs_wallet); CAmount nMinAmount = 0; if (request.params.size() > 0) nMinAmount = AmountFromValue(request.params[0]); if (nMinAmount < 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); UniValue jsonBalances(UniValue::VOBJ); std::map<CTxDestination, CAmount> balances = pwalletMain->GetAddressBalances(); for (auto& balance : balances) if (balance.second >= nMinAmount) jsonBalances.push_back(Pair(CBitcoinAddress(balance.first).ToString(), ValueFromAmount(balance.second))); return jsonBalances; } UniValue signmessage(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 2) throw std::runtime_error( "signmessage \"address\" \"message\"\n" "\nSign a message with the private key of an address" + HelpRequiringPassphrase() + "\n" "\nArguments:\n" "1. \"address\" (string, required) The godlikeproducts address to use for the private key.\n" "2. \"message\" (string, required) The message to create a signature of.\n" "\nResult:\n" "\"signature\" (string) The signature of the message encoded in base 64\n" "\nExamples:\n" "\nUnlock the wallet for 30 seconds\n" + HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") + "\nCreate the signature\n" + HelpExampleCli("signmessage", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" \"my message\"") + "\nVerify the signature\n" + HelpExampleCli("verifymessage", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" \"signature\" \"my message\"") + "\nAs json rpc\n" + HelpExampleRpc("signmessage", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", \"my message\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); std::string strAddress = request.params[0].get_str(); std::string strMessage = request.params[1].get_str(); CBitcoinAddress addr(strAddress); if (!addr.IsValid()) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); CKeyID keyID; if (!addr.GetKeyID(keyID)) throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key"); CKey key; if (!pwalletMain->GetKey(keyID, key)) throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available"); CHashWriter ss(SER_GETHASH, 0); ss << strMessageMagic; ss << strMessage; std::vector<unsigned char> vchSig; if (!key.SignCompact(ss.GetHash(), vchSig)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed"); return EncodeBase64(&vchSig[0], vchSig.size()); } UniValue getreceivedbyaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) throw std::runtime_error( "getreceivedbyaddress \"address\" ( minconf addlockconf )\n" "\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n" "\nArguments:\n" "1. \"address\" (string, required) The godlikeproducts address for transactions.\n" "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n" "3. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "\nResult:\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received at this address.\n" "\nExamples:\n" "\nThe amount from transactions with at least 1 confirmation\n" + HelpExampleCli("getreceivedbyaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\"") + "\nThe amount including unconfirmed transactions, zero confirmations\n" + HelpExampleCli("getreceivedbyaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0") + "\nThe amount with at least 6 confirmation, very safe\n" + HelpExampleCli("getreceivedbyaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 6") + "\nAs a json rpc call\n" + HelpExampleRpc("getreceivedbyaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", 6") ); LOCK2(cs_main, pwalletMain->cs_wallet); // GodLikeProducts address CBitcoinAddress address = CBitcoinAddress(request.params[0].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid GodLikeProducts address"); CScript scriptPubKey = GetScriptForDestination(address.Get()); if (!IsMine(*pwalletMain, scriptPubKey)) return ValueFromAmount(0); // Minimum confirmations int nMinDepth = 1; if (request.params.size() > 1) nMinDepth = request.params[1].get_int(); bool fAddLockConf = (request.params.size() > 2 && request.params[2].get_bool()); // Tally CAmount nAmount = 0; for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx)) continue; BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout) if (txout.scriptPubKey == scriptPubKey) if (wtx.GetDepthInMainChain(fAddLockConf) >= nMinDepth) nAmount += txout.nValue; } return ValueFromAmount(nAmount); } UniValue getreceivedbyaccount(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) throw std::runtime_error( "getreceivedbyaccount \"account\" ( minconf addlockconf )\n" "\nDEPRECATED. Returns the total amount received by addresses with <account> in transactions with specified minimum number of confirmations.\n" "\nArguments:\n" "1. \"account\" (string, required) The selected account, may be the default account using \"\".\n" "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n" "3. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "\nResult:\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this account.\n" "\nExamples:\n" "\nAmount received by the default account with at least 1 confirmation\n" + HelpExampleCli("getreceivedbyaccount", "\"\"") + "\nAmount received at the tabby account including unconfirmed amounts with zero confirmations\n" + HelpExampleCli("getreceivedbyaccount", "\"tabby\" 0") + "\nThe amount with at least 6 confirmation, very safe\n" + HelpExampleCli("getreceivedbyaccount", "\"tabby\" 6") + "\nAs a json rpc call\n" + HelpExampleRpc("getreceivedbyaccount", "\"tabby\", 6") ); LOCK2(cs_main, pwalletMain->cs_wallet); // Minimum confirmations int nMinDepth = 1; if (request.params.size() > 1) nMinDepth = request.params[1].get_int(); bool fAddLockConf = (request.params.size() > 2 && request.params[2].get_bool()); // Get the set of pub keys assigned to account std::string strAccount = AccountFromValue(request.params[0]); std::set<CTxDestination> setAddress = pwalletMain->GetAccountAddresses(strAccount); // Tally CAmount nAmount = 0; for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx)) continue; BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout) { CTxDestination address; if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*pwalletMain, address) && setAddress.count(address)) if (wtx.GetDepthInMainChain(fAddLockConf) >= nMinDepth) nAmount += txout.nValue; } } return ValueFromAmount(nAmount); } UniValue getbalance(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 4) throw std::runtime_error( "getbalance ( \"account\" minconf addlockconf include_watchonly )\n" "\nIf account is not specified, returns the server's total available balance.\n" "If account is specified (DEPRECATED), returns the balance in the account.\n" "Note that the account \"\" is not the same as leaving the parameter out.\n" "The server total may be different to the balance in the default \"\" account.\n" "\nArguments:\n" "1. \"account\" (string, optional) DEPRECATED. The selected account, or \"*\" for entire wallet. It may be the default account using \"\".\n" "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n" "3. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "4. include_watchonly (bool, optional, default=false) Also include balance in watch-only addresses (see 'importaddress')\n" "\nResult:\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this account.\n" "\nExamples:\n" "\nThe total amount in the wallet\n" + HelpExampleCli("getbalance", "") + "\nThe total amount in the wallet at least 5 blocks confirmed\n" + HelpExampleCli("getbalance", "\"*\" 6") + "\nAs a json rpc call\n" + HelpExampleRpc("getbalance", "\"*\", 6") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (request.params.size() == 0) return ValueFromAmount(pwalletMain->GetBalance()); int nMinDepth = 1; if (request.params.size() > 1) nMinDepth = request.params[1].get_int(); bool fAddLockConf = (request.params.size() > 2 && request.params[2].get_bool()); isminefilter filter = ISMINE_SPENDABLE; if(request.params.size() > 3) if(request.params[3].get_bool()) filter = filter | ISMINE_WATCH_ONLY; if (request.params[0].get_str() == "*") { // Calculate total balance a different way from GetBalance() // (GetBalance() sums up all unspent TxOuts) // getbalance and "getbalance * 1 true" should return the same number CAmount nBalance = 0; for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 0) continue; CAmount allFee; std::string strSentAccount; std::list<COutputEntry> listReceived; std::list<COutputEntry> listSent; wtx.GetAmounts(listReceived, listSent, allFee, strSentAccount, filter); if (wtx.GetDepthInMainChain(fAddLockConf) >= nMinDepth) { BOOST_FOREACH(const COutputEntry& r, listReceived) nBalance += r.amount; } BOOST_FOREACH(const COutputEntry& s, listSent) nBalance -= s.amount; nBalance -= allFee; } return ValueFromAmount(nBalance); } std::string strAccount = AccountFromValue(request.params[0]); CAmount nBalance = pwalletMain->GetAccountBalance(strAccount, nMinDepth, filter, fAddLockConf); return ValueFromAmount(nBalance); } UniValue getunconfirmedbalance(const JSONRPCRequest &request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 0) throw std::runtime_error( "getunconfirmedbalance\n" "Returns the server's total unconfirmed balance\n"); LOCK2(cs_main, pwalletMain->cs_wallet); return ValueFromAmount(pwalletMain->GetUnconfirmedBalance()); } UniValue movecmd(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 3 || request.params.size() > 5) throw std::runtime_error( "move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" )\n" "\nDEPRECATED. Move a specified amount from one account in your wallet to another.\n" "\nArguments:\n" "1. \"fromaccount\" (string, required) The name of the account to move funds from. May be the default account using \"\".\n" "2. \"toaccount\" (string, required) The name of the account to move funds to. May be the default account using \"\".\n" "3. amount (numeric) Quantity of " + CURRENCY_UNIT + " to move between accounts.\n" "4. (dummy) (numeric, optional) Ignored. Remains for backward compatibility.\n" "5. \"comment\" (string, optional) An optional comment, stored in the wallet only.\n" "\nResult:\n" "true|false (boolean) true if successful.\n" "\nExamples:\n" "\nMove 0.01 " + CURRENCY_UNIT + " from the default account to the account named tabby\n" + HelpExampleCli("move", "\"\" \"tabby\" 0.01") + "\nMove 0.01 " + CURRENCY_UNIT + " timotei to akiko with a comment and funds have 6 confirmations\n" + HelpExampleCli("move", "\"timotei\" \"akiko\" 0.01 6 \"happy birthday!\"") + "\nAs a json rpc call\n" + HelpExampleRpc("move", "\"timotei\", \"akiko\", 0.01, 6, \"happy birthday!\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); std::string strFrom = AccountFromValue(request.params[0]); std::string strTo = AccountFromValue(request.params[1]); CAmount nAmount = AmountFromValue(request.params[2]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); if (request.params.size() > 3) // unused parameter, used to be nMinDepth, keep type-checking it though (void)request.params[3].get_int(); std::string strComment; if (request.params.size() > 4) strComment = request.params[4].get_str(); if (!pwalletMain->AccountMove(strFrom, strTo, nAmount, strComment)) throw JSONRPCError(RPC_DATABASE_ERROR, "database error"); return true; } UniValue sendfrom(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 3 || request.params.size() > 7) throw std::runtime_error( "sendfrom \"fromaccount\" \"toaddress\" amount ( minconf addlockconf \"comment\" \"comment_to\" )\n" "\nDEPRECATED (use sendtoaddress). Sent an amount from an account to a godlikeproducts address." + HelpRequiringPassphrase() + "\n" "\nArguments:\n" "1. \"fromaccount\" (string, required) The name of the account to send funds from. May be the default account using \"\".\n" " Specifying an account does not influence coin selection, but it does associate the newly created\n" " transaction with the account, so the account's balance computation and transaction history can reflect\n" " the spend.\n" "2. \"toaddress\" (string, required) The godlikeproducts address to send funds to.\n" "3. amount (numeric or string, required) The amount in " + CURRENCY_UNIT + " (transaction fee is added on top).\n" "4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n" "5. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "6. \"comment\" (string, optional) A comment used to store what the transaction is for. \n" " This is not part of the transaction, just kept in your wallet.\n" "7. \"comment_to\" (string, optional) An optional comment to store the name of the person or organization \n" " to which you're sending the transaction. This is not part of the transaction, \n" " it is just kept in your wallet.\n" "\nResult:\n" "\"txid\" (string) The transaction id.\n" "\nExamples:\n" "\nSend 0.01 " + CURRENCY_UNIT + " from the default account to the address, must have at least 1 confirmation\n" + HelpExampleCli("sendfrom", "\"\" \"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.01") + "\nSend 0.01 from the tabby account to the given address, funds must have at least 6 confirmations\n" + HelpExampleCli("sendfrom", "\"tabby\" \"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.01 6 false \"donation\" \"seans outpost\"") + "\nAs a json rpc call\n" + HelpExampleRpc("sendfrom", "\"tabby\", \"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", 0.01, 6, false, \"donation\", \"seans outpost\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); std::string strAccount = AccountFromValue(request.params[0]); CBitcoinAddress address(request.params[1].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid GodLikeProducts address"); CAmount nAmount = AmountFromValue(request.params[2]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); int nMinDepth = 1; if (request.params.size() > 3) nMinDepth = request.params[3].get_int(); bool fAddLockConf = (request.params.size() > 4 && request.params[4].get_bool()); CWalletTx wtx; wtx.strFromAccount = strAccount; if (request.params.size() > 5 && !request.params[5].isNull() && !request.params[5].get_str().empty()) wtx.mapValue["comment"] = request.params[5].get_str(); if (request.params.size() > 6 && !request.params[6].isNull() && !request.params[6].get_str().empty()) wtx.mapValue["to"] = request.params[6].get_str(); EnsureWalletIsUnlocked(); // Check funds CAmount nBalance = pwalletMain->GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE, fAddLockConf); if (nAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); SendMoney(address.Get(), nAmount, false, wtx); return wtx.GetHash().GetHex(); } UniValue sendmany(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 2 || request.params.size() > 8) throw std::runtime_error( "sendmany \"fromaccount\" {\"address\":amount,...} ( minconf addlockconf \"comment\" [\"address\",...] subtractfeefromamount use_is use_ps )\n" "\nSend multiple times. Amounts are double-precision floating point numbers." + HelpRequiringPassphrase() + "\n" "\nArguments:\n" "1. \"fromaccount\" (string, required) DEPRECATED. The account to send the funds from. Should be \"\" for the default account\n" "2. \"amounts\" (string, required) A json object with addresses and amounts\n" " {\n" " \"address\":amount (numeric or string) The godlikeproducts address is the key, the numeric amount (can be string) in " + CURRENCY_UNIT + " is the value\n" " ,...\n" " }\n" "3. minconf (numeric, optional, default=1) Only use the balance confirmed at least this many times.\n" "4. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "5. \"comment\" (string, optional) A comment\n" "6. subtractfeefromamount (array, optional) A json array with addresses.\n" " The fee will be equally deducted from the amount of each selected address.\n" " Those recipients will receive less godlikeproductss than you enter in their corresponding amount field.\n" " If no addresses are specified here, the sender pays the fee.\n" " [\n" " \"address\" (string) Subtract fee from this address\n" " ,...\n" " ]\n" "7. \"use_is\" (bool, optional, default=false) Send this transaction as InstantSend\n" "8. \"use_ps\" (bool, optional, default=false) Use anonymized funds only\n" "\nResult:\n" "\"txid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n" " the number of addresses.\n" "\nExamples:\n" "\nSend two amounts to two different addresses:\n" + HelpExampleCli("sendmany", "\"tabby\" \"{\\\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\\\":0.01,\\\"XuQQkwA4FYkq2XERzMY2CiAZhJTEDAbtcG\\\":0.02}\"") + "\nSend two amounts to two different addresses setting the confirmation and comment:\n" + HelpExampleCli("sendmany", "\"tabby\" \"{\\\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\\\":0.01,\\\"XuQQkwA4FYkq2XERzMY2CiAZhJTEDAbtcG\\\":0.02}\" 6 false \"testing\"") + "\nAs a json rpc call\n" + HelpExampleRpc("sendmany", "\"tabby\", \"{\\\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\\\":0.01,\\\"XuQQkwA4FYkq2XERzMY2CiAZhJTEDAbtcG\\\":0.02}\", 6, false, \"testing\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (pwalletMain->GetBroadcastTransactions() && !g_connman) throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); std::string strAccount = AccountFromValue(request.params[0]); UniValue sendTo = request.params[1].get_obj(); int nMinDepth = 1; if (request.params.size() > 2) nMinDepth = request.params[2].get_int(); bool fAddLockConf = (request.params.size() > 3 && request.params[3].get_bool()); CWalletTx wtx; wtx.strFromAccount = strAccount; if (request.params.size() > 4 && !request.params[4].isNull() && !request.params[4].get_str().empty()) wtx.mapValue["comment"] = request.params[4].get_str(); UniValue subtractFeeFromAmount(UniValue::VARR); if (request.params.size() > 5) subtractFeeFromAmount = request.params[5].get_array(); std::set<CBitcoinAddress> setAddress; std::vector<CRecipient> vecSend; CAmount totalAmount = 0; std::vector<std::string> keys = sendTo.getKeys(); BOOST_FOREACH(const std::string& name_, keys) { CBitcoinAddress address(name_); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid GodLikeProducts address: ")+name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ")+name_); setAddress.insert(address); CScript scriptPubKey = GetScriptForDestination(address.Get()); CAmount nAmount = AmountFromValue(sendTo[name_]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); totalAmount += nAmount; bool fSubtractFeeFromAmount = false; for (unsigned int idx = 0; idx < subtractFeeFromAmount.size(); idx++) { const UniValue& addr = subtractFeeFromAmount[idx]; if (addr.get_str() == name_) fSubtractFeeFromAmount = true; } CRecipient recipient = {scriptPubKey, nAmount, fSubtractFeeFromAmount}; vecSend.push_back(recipient); } EnsureWalletIsUnlocked(); // Check funds CAmount nBalance = pwalletMain->GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE, fAddLockConf); if (totalAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); // Send CReserveKey keyChange(pwalletMain); CAmount nFeeRequired = 0; int nChangePosRet = -1; std::string strFailReason; bool fUseInstantSend = false; bool fUsePrivateSend = false; if (request.params.size() > 6) fUseInstantSend = request.params[6].get_bool(); if (request.params.size() > 7) fUsePrivateSend = request.params[7].get_bool(); bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstantSend); if (!fCreated) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); CValidationState state; if (!pwalletMain->CommitTransaction(wtx, keyChange, g_connman.get(), state, fUseInstantSend ? NetMsgType::TXLOCKREQUEST : NetMsgType::TX)) { strFailReason = strprintf("Transaction commit failed:: %s", state.GetRejectReason()); throw JSONRPCError(RPC_WALLET_ERROR, strFailReason); } return wtx.GetHash().GetHex(); } // Defined in rpc/misc.cpp extern CScript _createmultisig_redeemScript(const UniValue& params); UniValue addmultisigaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) { std::string msg = "addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n" "\nAdd a nrequired-to-sign multisignature address to the wallet.\n" "Each key is a GodLikeProducts address or hex-encoded public key.\n" "If 'account' is specified (DEPRECATED), assign address to that account.\n" "\nArguments:\n" "1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n" "2. \"keys\" (string, required) A json array of godlikeproducts addresses or hex-encoded public keys\n" " [\n" " \"address\" (string) godlikeproducts address or hex-encoded public key\n" " ...,\n" " ]\n" "3. \"account\" (string, optional) DEPRECATED. An account to assign the addresses to.\n" "\nResult:\n" "\"address\" (string) A godlikeproducts address associated with the keys.\n" "\nExamples:\n" "\nAdd a multisig address from 2 addresses\n" + HelpExampleCli("addmultisigaddress", "2 \"[\\\"Xt4qk9uKvQYAonVGSZNXqxeDmtjaEWgfrS\\\",\\\"XoSoWQkpgLpppPoyyzbUFh1fq2RBvW6UK2\\\"]\"") + "\nAs json rpc call\n" + HelpExampleRpc("addmultisigaddress", "2, \"[\\\"Xt4qk9uKvQYAonVGSZNXqxeDmtjaEWgfrS\\\",\\\"XoSoWQkpgLpppPoyyzbUFh1fq2RBvW6UK2\\\"]\"") ; throw std::runtime_error(msg); } LOCK2(cs_main, pwalletMain->cs_wallet); std::string strAccount; if (request.params.size() > 2) strAccount = AccountFromValue(request.params[2]); // Construct using pay-to-script-hash: CScript inner = _createmultisig_redeemScript(request.params); CScriptID innerID(inner); pwalletMain->AddCScript(inner); pwalletMain->SetAddressBook(innerID, strAccount, "send"); return CBitcoinAddress(innerID).ToString(); } struct tallyitem { CAmount nAmount; int nConf; std::vector<uint256> txids; bool fIsWatchonly; tallyitem() { nAmount = 0; nConf = std::numeric_limits<int>::max(); fIsWatchonly = false; } }; UniValue ListReceived(const UniValue& params, bool fByAccounts) { // Minimum confirmations int nMinDepth = 1; if (params.size() > 0) nMinDepth = params[0].get_int(); bool fAddLockConf = (params.size() > 1 && params[1].get_bool()); // Whether to include empty accounts bool fIncludeEmpty = false; if (params.size() > 2) fIncludeEmpty = params[2].get_bool(); isminefilter filter = ISMINE_SPENDABLE; if(params.size() > 3) if(params[3].get_bool()) filter = filter | ISMINE_WATCH_ONLY; // Tally std::map<CBitcoinAddress, tallyitem> mapTally; for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx)) continue; int nDepth = wtx.GetDepthInMainChain(fAddLockConf); if (nDepth < nMinDepth) continue; BOOST_FOREACH(const CTxOut& txout, wtx.tx->vout) { CTxDestination address; if (!ExtractDestination(txout.scriptPubKey, address)) continue; isminefilter mine = IsMine(*pwalletMain, address); if(!(mine & filter)) continue; tallyitem& item = mapTally[address]; item.nAmount += txout.nValue; item.nConf = std::min(item.nConf, nDepth); item.txids.push_back(wtx.GetHash()); if (mine & ISMINE_WATCH_ONLY) item.fIsWatchonly = true; } } // Reply UniValue ret(UniValue::VARR); std::map<std::string, tallyitem> mapAccountTally; BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, CAddressBookData)& item, pwalletMain->mapAddressBook) { const CBitcoinAddress& address = item.first; const std::string& strAccount = item.second.name; std::map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address); if (it == mapTally.end() && !fIncludeEmpty) continue; isminefilter mine = IsMine(*pwalletMain, address.Get()); if(!(mine & filter)) continue; CAmount nAmount = 0; int nConf = std::numeric_limits<int>::max(); bool fIsWatchonly = false; if (it != mapTally.end()) { nAmount = (*it).second.nAmount; nConf = (*it).second.nConf; fIsWatchonly = (*it).second.fIsWatchonly; } if (fByAccounts) { tallyitem& _item = mapAccountTally[strAccount]; _item.nAmount += nAmount; _item.nConf = std::min(_item.nConf, nConf); _item.fIsWatchonly = fIsWatchonly; } else { UniValue obj(UniValue::VOBJ); if(fIsWatchonly) obj.push_back(Pair("involvesWatchonly", true)); obj.push_back(Pair("address", address.ToString())); obj.push_back(Pair("account", strAccount)); obj.push_back(Pair("amount", ValueFromAmount(nAmount))); obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); if (!fByAccounts) obj.push_back(Pair("label", strAccount)); UniValue transactions(UniValue::VARR); if (it != mapTally.end()) { BOOST_FOREACH(const uint256& _item, (*it).second.txids) { transactions.push_back(_item.GetHex()); } } obj.push_back(Pair("txids", transactions)); ret.push_back(obj); } } if (fByAccounts) { for (std::map<std::string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it) { CAmount nAmount = (*it).second.nAmount; int nConf = (*it).second.nConf; UniValue obj(UniValue::VOBJ); if((*it).second.fIsWatchonly) obj.push_back(Pair("involvesWatchonly", true)); obj.push_back(Pair("account", (*it).first)); obj.push_back(Pair("amount", ValueFromAmount(nAmount))); obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); ret.push_back(obj); } } return ret; } UniValue listreceivedbyaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 4) throw std::runtime_error( "listreceivedbyaddress ( minconf addlockconf include_empty include_watchonly)\n" "\nList incoming payments grouped by receiving address.\n" "\nArguments:\n" "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n" "2. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "3. include_empty (bool, optional, default=false) Whether to include addresses that haven't received any payments.\n" "4. include_watchonly (bool, optional, default=false) Whether to include watch-only addresses (see 'importaddress').\n" "\nResult:\n" "[\n" " {\n" " \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n" " \"address\" : \"receivingaddress\", (string) The receiving address\n" " \"account\" : \"accountname\", (string) DEPRECATED. The account of the receiving address. The default account is \"\".\n" " \"amount\" : x.xxx, (numeric) The total amount in " + CURRENCY_UNIT + " received by the address\n" " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included.\n" " If 'addlockconf' is true, the minimum number of confirmations is calculated\n" " including additional " + std::to_string(nInstantSendDepth) + " confirmations for transactions locked via InstantSend\n" " \"label\" : \"label\", (string) A comment for the address/transaction, if any\n" " \"txids\": [\n" " n, (numeric) The ids of transactions received with the address \n" " ...\n" " ]\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("listreceivedbyaddress", "") + HelpExampleCli("listreceivedbyaddress", "6 false true") + HelpExampleRpc("listreceivedbyaddress", "6, false, true, true") ); LOCK2(cs_main, pwalletMain->cs_wallet); return ListReceived(request.params, false); } UniValue listreceivedbyaccount(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 4) throw std::runtime_error( "listreceivedbyaccount ( minconf addlockconf include_empty include_watchonly)\n" "\nDEPRECATED. List incoming payments grouped by account.\n" "\nArguments:\n" "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n" "2. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "3. include_empty (bool, optional, default=false) Whether to include accounts that haven't received any payments.\n" "4. include_watchonly (bool, optional, default=false) Whether to include watch-only addresses (see 'importaddress').\n" "\nResult:\n" "[\n" " {\n" " \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n" " \"account\" : \"accountname\", (string) The account name of the receiving account\n" " \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n" " \"confirmations\" : n (numeric) The number of blockchain confirmations of the most recent transaction included\n" " \"label\" : \"label\" (string) A comment for the address/transaction, if any\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("listreceivedbyaccount", "") + HelpExampleCli("listreceivedbyaccount", "6 false true") + HelpExampleRpc("listreceivedbyaccount", "6, false, true, true") ); LOCK2(cs_main, pwalletMain->cs_wallet); return ListReceived(request.params, true); } static void MaybePushAddress(UniValue & entry, const CTxDestination &dest) { CBitcoinAddress addr; if (addr.Set(dest)) entry.push_back(Pair("address", addr.ToString())); } void ListTransactions(const CWalletTx& wtx, const std::string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter) { CAmount nFee; std::string strSentAccount; std::list<COutputEntry> listReceived; std::list<COutputEntry> listSent; wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount, filter); bool fAllAccounts = (strAccount == std::string("*")); bool involvesWatchonly = wtx.IsFromMe(ISMINE_WATCH_ONLY); // Sent if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount)) { BOOST_FOREACH(const COutputEntry& s, listSent) { UniValue entry(UniValue::VOBJ); if(involvesWatchonly || (::IsMine(*pwalletMain, s.destination) & ISMINE_WATCH_ONLY)) entry.push_back(Pair("involvesWatchonly", true)); entry.push_back(Pair("account", strSentAccount)); MaybePushAddress(entry, s.destination); std::map<std::string, std::string>::const_iterator it = wtx.mapValue.find("DS"); entry.push_back(Pair("category", (it != wtx.mapValue.end() && it->second == "1") ? "privatesend" : "send")); entry.push_back(Pair("amount", ValueFromAmount(-s.amount))); if (pwalletMain->mapAddressBook.count(s.destination)) entry.push_back(Pair("label", pwalletMain->mapAddressBook[s.destination].name)); entry.push_back(Pair("vout", s.vout)); entry.push_back(Pair("fee", ValueFromAmount(-nFee))); if (fLong) WalletTxToJSON(wtx, entry); entry.push_back(Pair("abandoned", wtx.isAbandoned())); ret.push_back(entry); } } // Received if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth) { BOOST_FOREACH(const COutputEntry& r, listReceived) { std::string account; if (pwalletMain->mapAddressBook.count(r.destination)) account = pwalletMain->mapAddressBook[r.destination].name; if (fAllAccounts || (account == strAccount)) { UniValue entry(UniValue::VOBJ); if(involvesWatchonly || (::IsMine(*pwalletMain, r.destination) & ISMINE_WATCH_ONLY)) entry.push_back(Pair("involvesWatchonly", true)); entry.push_back(Pair("account", account)); MaybePushAddress(entry, r.destination); if (wtx.IsCoinBase()) { if (wtx.GetDepthInMainChain() < 1) entry.push_back(Pair("category", "orphan")); else if (wtx.GetBlocksToMaturity() > 0) entry.push_back(Pair("category", "immature")); else entry.push_back(Pair("category", "generate")); } else { entry.push_back(Pair("category", "receive")); } entry.push_back(Pair("amount", ValueFromAmount(r.amount))); if (pwalletMain->mapAddressBook.count(r.destination)) entry.push_back(Pair("label", account)); entry.push_back(Pair("vout", r.vout)); if (fLong) WalletTxToJSON(wtx, entry); ret.push_back(entry); } } } } void AcentryToJSON(const CAccountingEntry& acentry, const std::string& strAccount, UniValue& ret) { bool fAllAccounts = (strAccount == std::string("*")); if (fAllAccounts || acentry.strAccount == strAccount) { UniValue entry(UniValue::VOBJ); entry.push_back(Pair("account", acentry.strAccount)); entry.push_back(Pair("category", "move")); entry.push_back(Pair("time", acentry.nTime)); entry.push_back(Pair("amount", ValueFromAmount(acentry.nCreditDebit))); entry.push_back(Pair("otheraccount", acentry.strOtherAccount)); entry.push_back(Pair("comment", acentry.strComment)); ret.push_back(entry); } } UniValue listtransactions(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 4) throw std::runtime_error( "listtransactions ( \"account\" count skip include_watchonly)\n" "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.\n" "\nArguments:\n" "1. \"account\" (string, optional) DEPRECATED. The account name. Should be \"*\".\n" "2. count (numeric, optional, default=10) The number of transactions to return\n" "3. skip (numeric, optional, default=0) The number of transactions to skip\n" "4. include_watchonly (bool, optional, default=false) Include transactions to watch-only addresses (see 'importaddress')\n" "\nResult:\n" "[\n" " {\n" " \"account\":\"accountname\", (string) DEPRECATED. The account name associated with the transaction. \n" " It will be \"\" for the default account.\n" " \"address\":\"address\", (string) The godlikeproducts address of the transaction. Not present for \n" " move transactions (category = move).\n" " \"category\":\"send|receive|move\", (string) The transaction category. 'move' is a local (off blockchain)\n" " transaction between accounts, and not associated with an address,\n" " transaction id or block. 'send' and 'receive' transactions are \n" " associated with an address, transaction id and block details\n" " \"amount\": x.xxx, (numeric) The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and for the\n" " 'move' category for moves outbound. It is positive for the 'receive' category,\n" " and for the 'move' category for inbound funds.\n" " \"label\": \"label\", (string) A comment for the address/transaction, if any\n" " \"vout\": n, (numeric) the vout value\n" " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n" " 'send' category of transactions.\n" " \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n" " \"confirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and \n" " 'receive' category of transactions. Negative confirmations indicate the\n" " transation conflicts with the block chain\n" " \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n" " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n" " category of transactions.\n" " \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive'\n" " category of transactions.\n" " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n" " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n" " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n" " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n" " for 'send' and 'receive' category of transactions.\n" " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n" " \"otheraccount\": \"accountname\", (string) DEPRECATED. For the 'move' category of transactions, the account the funds came \n" " from (for receiving funds, positive amounts), or went to (for sending funds,\n" " negative amounts).\n" " \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n" " may be unknown for unconfirmed transactions not in the mempool\n" " \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n" " 'send' category of transactions.\n" " }\n" "]\n" "\nExamples:\n" "\nList the most recent 10 transactions in the systems\n" + HelpExampleCli("listtransactions", "") + "\nList transactions 100 to 120\n" + HelpExampleCli("listtransactions", "\"*\" 20 100") + "\nAs a json rpc call\n" + HelpExampleRpc("listtransactions", "\"*\", 20, 100") ); LOCK2(cs_main, pwalletMain->cs_wallet); std::string strAccount = "*"; if (request.params.size() > 0) strAccount = request.params[0].get_str(); int nCount = 10; if (request.params.size() > 1) nCount = request.params[1].get_int(); int nFrom = 0; if (request.params.size() > 2) nFrom = request.params[2].get_int(); isminefilter filter = ISMINE_SPENDABLE; if(request.params.size() > 3) if(request.params[3].get_bool()) filter = filter | ISMINE_WATCH_ONLY; if (nCount < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative count"); if (nFrom < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative from"); UniValue ret(UniValue::VARR); const CWallet::TxItems & txOrdered = pwalletMain->wtxOrdered; // iterate backwards until we have nCount items to return: for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { CWalletTx *const pwtx = (*it).second.first; if (pwtx != 0) ListTransactions(*pwtx, strAccount, 0, true, ret, filter); CAccountingEntry *const pacentry = (*it).second.second; if (pacentry != 0) AcentryToJSON(*pacentry, strAccount, ret); if ((int)ret.size() >= (nCount+nFrom)) break; } // ret is newest to oldest if (nFrom > (int)ret.size()) nFrom = ret.size(); if ((nFrom + nCount) > (int)ret.size()) nCount = ret.size() - nFrom; std::vector<UniValue> arrTmp = ret.getValues(); std::vector<UniValue>::iterator first = arrTmp.begin(); std::advance(first, nFrom); std::vector<UniValue>::iterator last = arrTmp.begin(); std::advance(last, nFrom+nCount); if (last != arrTmp.end()) arrTmp.erase(last, arrTmp.end()); if (first != arrTmp.begin()) arrTmp.erase(arrTmp.begin(), first); std::reverse(arrTmp.begin(), arrTmp.end()); // Return oldest to newest ret.clear(); ret.setArray(); ret.push_backV(arrTmp); return ret; } UniValue listaccounts(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 3) throw std::runtime_error( "listaccounts ( minconf addlockconf include_watchonly)\n" "\nDEPRECATED. Returns Object that has account names as keys, account balances as values.\n" "\nArguments:\n" "1. minconf (numeric, optional, default=1) Only include transactions with at least this many confirmations\n" "2. addlockconf (bool, optional, default=false) Whether to add " + std::to_string(nInstantSendDepth) + " confirmations to transactions locked via InstantSend.\n" "3. include_watchonly (bool, optional, default=false) Include balances in watch-only addresses (see 'importaddress')\n" "\nResult:\n" "{ (json object where keys are account names, and values are numeric balances\n" " \"account\": x.xxx, (numeric) The property name is the account name, and the value is the total balance for the account.\n" " ...\n" "}\n" "\nExamples:\n" "\nList account balances where there at least 1 confirmation\n" + HelpExampleCli("listaccounts", "") + "\nList account balances including zero confirmation transactions\n" + HelpExampleCli("listaccounts", "0") + "\nList account balances for 6 or more confirmations\n" + HelpExampleCli("listaccounts", "6") + "\nAs json rpc call\n" + HelpExampleRpc("listaccounts", "6") ); LOCK2(cs_main, pwalletMain->cs_wallet); int nMinDepth = 1; if (request.params.size() > 0) nMinDepth = request.params[0].get_int(); bool fAddLockConf = (request.params.size() > 1 && request.params[1].get_bool()); isminefilter includeWatchonly = ISMINE_SPENDABLE; if(request.params.size() > 2) if(request.params[2].get_bool()) includeWatchonly = includeWatchonly | ISMINE_WATCH_ONLY; std::map<std::string, CAmount> mapAccountBalances; BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& entry, pwalletMain->mapAddressBook) { if (IsMine(*pwalletMain, entry.first) & includeWatchonly) // This address belongs to me mapAccountBalances[entry.second.name] = 0; } for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; CAmount nFee; std::string strSentAccount; std::list<COutputEntry> listReceived; std::list<COutputEntry> listSent; int nDepth = wtx.GetDepthInMainChain(fAddLockConf); if (wtx.GetBlocksToMaturity() > 0 || nDepth < 0) continue; wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount, includeWatchonly); mapAccountBalances[strSentAccount] -= nFee; BOOST_FOREACH(const COutputEntry& s, listSent) mapAccountBalances[strSentAccount] -= s.amount; if (nDepth >= nMinDepth) { BOOST_FOREACH(const COutputEntry& r, listReceived) if (pwalletMain->mapAddressBook.count(r.destination)) mapAccountBalances[pwalletMain->mapAddressBook[r.destination].name] += r.amount; else mapAccountBalances[""] += r.amount; } } const std::list<CAccountingEntry> & acentries = pwalletMain->laccentries; BOOST_FOREACH(const CAccountingEntry& entry, acentries) mapAccountBalances[entry.strAccount] += entry.nCreditDebit; UniValue ret(UniValue::VOBJ); BOOST_FOREACH(const PAIRTYPE(std::string, CAmount)& accountBalance, mapAccountBalances) { ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); } return ret; } UniValue listsinceblock(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp) throw std::runtime_error( "listsinceblock ( \"blockhash\" target_confirmations include_watchonly)\n" "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted\n" "\nArguments:\n" "1. \"blockhash\" (string, optional) The block hash to list transactions since\n" "2. target_confirmations: (numeric, optional) The confirmations required, must be 1 or more\n" "3. include_watchonly: (bool, optional, default=false) Include transactions to watch-only addresses (see 'importaddress')" "\nResult:\n" "{\n" " \"transactions\": [\n" " \"account\":\"accountname\", (string) DEPRECATED. The account name associated with the transaction. Will be \"\" for the default account.\n" " \"address\":\"address\", (string) The godlikeproducts address of the transaction. Not present for move transactions (category = move).\n" " \"category\":\"send|receive\", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.\n" " \"amount\": x.xxx, (numeric) The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and for the 'move' category for moves \n" " outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.\n" " \"vout\" : n, (numeric) the vout value\n" " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the 'send' category of transactions.\n" " \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n" " \"confirmations\" : n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n" " When it's < 0, it means the transaction conflicted that many blocks ago.\n" " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n" " \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive' category of transactions.\n" " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n" " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n" " \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n" " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT). Available for 'send' and 'receive' category of transactions.\n" " \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n" " may be unknown for unconfirmed transactions not in the mempool\n" " \"abandoned\": xxx, (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions.\n" " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n" " \"label\" : \"label\" (string) A comment for the address/transaction, if any\n" " \"to\": \"...\", (string) If a comment to is associated with the transaction.\n" " ],\n" " \"lastblock\": \"lastblockhash\" (string) The hash of the last block\n" "}\n" "\nExamples:\n" + HelpExampleCli("listsinceblock", "") + HelpExampleCli("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6") + HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6") ); LOCK2(cs_main, pwalletMain->cs_wallet); const CBlockIndex *pindex = NULL; int target_confirms = 1; isminefilter filter = ISMINE_SPENDABLE; if (request.params.size() > 0) { uint256 blockId; blockId.SetHex(request.params[0].get_str()); BlockMap::iterator it = mapBlockIndex.find(blockId); if (it != mapBlockIndex.end()) { pindex = it->second; if (chainActive[pindex->nHeight] != pindex) { // the block being asked for is a part of a deactivated chain; // we don't want to depend on its perceived height in the block // chain, we want to instead use the last common ancestor pindex = chainActive.FindFork(pindex); } } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid blockhash"); } if (request.params.size() > 1) { target_confirms = request.params[1].get_int(); if (target_confirms < 1) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter"); } if (request.params.size() > 2 && request.params[2].get_bool()) { filter = filter | ISMINE_WATCH_ONLY; } int depth = pindex ? (1 + chainActive.Height() - pindex->nHeight) : -1; UniValue transactions(UniValue::VARR); for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); it++) { CWalletTx tx = (*it).second; if (depth == -1 || tx.GetDepthInMainChain(false) < depth) ListTransactions(tx, "*", 0, true, transactions, filter); } CBlockIndex *pblockLast = chainActive[chainActive.Height() + 1 - target_confirms]; uint256 lastblock = pblockLast ? pblockLast->GetBlockHash() : uint256(); UniValue ret(UniValue::VOBJ); ret.push_back(Pair("transactions", transactions)); ret.push_back(Pair("lastblock", lastblock.GetHex())); return ret; } UniValue gettransaction(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "gettransaction \"txid\" ( include_watchonly )\n" "\nGet detailed information about in-wallet transaction <txid>\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "2. \"include_watchonly\" (bool, optional, default=false) Whether to include watch-only addresses in balance calculation and details[]\n" "\nResult:\n" "{\n" " \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n" " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n" " 'send' category of transactions.\n" " \"instantlock\" : true|false, (bool) Current transaction lock state\n" " \"confirmations\" : n, (numeric) The number of blockchain confirmations\n" " \"blockhash\" : \"hash\", (string) The block hash\n" " \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n" " \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n" " \"txid\" : \"transactionid\", (string) The transaction id.\n" " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n" " \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n" " \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n" " may be unknown for unconfirmed transactions not in the mempool\n" " \"details\" : [\n" " {\n" " \"account\" : \"accountname\", (string) DEPRECATED. The account name involved in the transaction, can be \"\" for the default account.\n" " \"address\" : \"address\", (string) The godlikeproducts address involved in the transaction\n" " \"category\" : \"send|receive\", (string) The category, either 'send' or 'receive'\n" " \"amount\" : x.xxx, (numeric) The amount in " + CURRENCY_UNIT + "\n" " \"label\" : \"label\", (string) A comment for the address/transaction, if any\n" " \"vout\" : n, (numeric) the vout value\n" " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n" " 'send' category of transactions.\n" " \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n" " 'send' category of transactions.\n" " }\n" " ,...\n" " ],\n" " \"hex\" : \"data\" (string) Raw data for transaction\n" "}\n" "\nExamples:\n" + HelpExampleCli("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + HelpExampleCli("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true") + HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); uint256 hash; hash.SetHex(request.params[0].get_str()); isminefilter filter = ISMINE_SPENDABLE; if(request.params.size() > 1) if(request.params[1].get_bool()) filter = filter | ISMINE_WATCH_ONLY; UniValue entry(UniValue::VOBJ); if (!pwalletMain->mapWallet.count(hash)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet transaction id"); const CWalletTx& wtx = pwalletMain->mapWallet[hash]; CAmount nCredit = wtx.GetCredit(filter); CAmount nDebit = wtx.GetDebit(filter); CAmount nNet = nCredit - nDebit; CAmount nFee = (wtx.IsFromMe(filter) ? wtx.tx->GetValueOut() - nDebit : 0); entry.push_back(Pair("amount", ValueFromAmount(nNet - nFee))); if (wtx.IsFromMe(filter)) entry.push_back(Pair("fee", ValueFromAmount(nFee))); WalletTxToJSON(wtx, entry); UniValue details(UniValue::VARR); ListTransactions(wtx, "*", 0, false, details, filter); entry.push_back(Pair("details", details)); std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx)); entry.push_back(Pair("hex", strHex)); return entry; } UniValue abandontransaction(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "abandontransaction \"txid\"\n" "\nMark in-wallet transaction <txid> as abandoned\n" "This will mark this transaction and all its in-wallet descendants as abandoned which will allow\n" "for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions.\n" "It only works on transactions which are not included in a block and are not currently in the mempool.\n" "It has no effect on transactions which are already conflicted or abandoned.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "\nResult:\n" "\nExamples:\n" + HelpExampleCli("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + HelpExampleRpc("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); uint256 hash; hash.SetHex(request.params[0].get_str()); if (!pwalletMain->mapWallet.count(hash)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet transaction id"); if (!pwalletMain->AbandonTransaction(hash)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not eligible for abandonment"); return NullUniValue; } UniValue backupwallet(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "backupwallet \"destination\"\n" "\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n" "\nArguments:\n" "1. \"destination\" (string) The destination directory or file\n" "\nExamples:\n" + HelpExampleCli("backupwallet", "\"backup.dat\"") + HelpExampleRpc("backupwallet", "\"backup.dat\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); std::string strDest = request.params[0].get_str(); if (!pwalletMain->BackupWallet(strDest)) throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!"); return NullUniValue; } UniValue keypoolrefill(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 1) throw std::runtime_error( "keypoolrefill ( newsize )\n" "\nFills the keypool." + HelpRequiringPassphrase() + "\n" "\nArguments:\n" "1. newsize (numeric, optional, default=" + itostr(DEFAULT_KEYPOOL_SIZE) + ") The new keypool size\n" "\nExamples:\n" + HelpExampleCli("keypoolrefill", "") + HelpExampleRpc("keypoolrefill", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); // 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool unsigned int kpSize = 0; if (request.params.size() > 0) { if (request.params[0].get_int() < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size."); kpSize = (unsigned int)request.params[0].get_int(); } EnsureWalletIsUnlocked(); pwalletMain->TopUpKeyPool(kpSize); if (pwalletMain->GetKeyPoolSize() < (pwalletMain->IsHDEnabled() ? kpSize * 2 : kpSize)) throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool."); return NullUniValue; } static void LockWallet(CWallet* pWallet) { LOCK(cs_nWalletUnlockTime); nWalletUnlockTime = 0; pWallet->Lock(); } UniValue walletpassphrase(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (pwalletMain->IsCrypted() && (request.fHelp || request.params.size() < 2 || request.params.size() > 3)) throw std::runtime_error( "walletpassphrase \"passphrase\" timeout ( mixingonly )\n" "\nStores the wallet decryption key in memory for 'timeout' seconds.\n" "This is needed prior to performing transactions related to private keys such as sending godlikeproductss\n" "\nArguments:\n" "1. \"passphrase\" (string, required) The wallet passphrase\n" "2. timeout (numeric, required) The time to keep the decryption key in seconds.\n" "3. mixingonly (boolean, optional, default=false) If is true sending functions are disabled.\n" "\nNote:\n" "Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n" "time that overrides the old one.\n" "\nExamples:\n" "\nUnlock the wallet for 60 seconds\n" + HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") + "\nUnlock the wallet for 60 seconds but allow PrivateSend mixing only\n" + HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60 true") + "\nLock the wallet again (before 60 seconds)\n" + HelpExampleCli("walletlock", "") + "\nAs json rpc call\n" + HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (request.fHelp) return true; if (!pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrase was called."); // Note that the walletpassphrase is stored in request.params[0] which is not mlock()ed SecureString strWalletPass; strWalletPass.reserve(100); // TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string) // Alternately, find a way to make request.params[0] mlock()'d to begin with. strWalletPass = request.params[0].get_str().c_str(); int64_t nSleepTime = request.params[1].get_int64(); bool fForMixingOnly = false; if (request.params.size() >= 3) fForMixingOnly = request.params[2].get_bool(); if (fForMixingOnly && !pwalletMain->IsLocked(true) && pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_ALREADY_UNLOCKED, "Error: Wallet is already unlocked for mixing only."); if (!pwalletMain->IsLocked()) throw JSONRPCError(RPC_WALLET_ALREADY_UNLOCKED, "Error: Wallet is already fully unlocked."); if (!pwalletMain->Unlock(strWalletPass, fForMixingOnly)) throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect."); pwalletMain->TopUpKeyPool(); LOCK(cs_nWalletUnlockTime); nWalletUnlockTime = GetTime() + nSleepTime; RPCRunLater("lockwallet", boost::bind(LockWallet, pwalletMain), nSleepTime); return NullUniValue; } UniValue walletpassphrasechange(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (pwalletMain->IsCrypted() && (request.fHelp || request.params.size() != 2)) throw std::runtime_error( "walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n" "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n" "\nArguments:\n" "1. \"oldpassphrase\" (string) The current passphrase\n" "2. \"newpassphrase\" (string) The new passphrase\n" "\nExamples:\n" + HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") + HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (request.fHelp) return true; if (!pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrasechange was called."); // TODO: get rid of these .c_str() calls by implementing SecureString::operator=(std::string) // Alternately, find a way to make request.params[0] mlock()'d to begin with. SecureString strOldWalletPass; strOldWalletPass.reserve(100); strOldWalletPass = request.params[0].get_str().c_str(); SecureString strNewWalletPass; strNewWalletPass.reserve(100); strNewWalletPass = request.params[1].get_str().c_str(); if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1) throw std::runtime_error( "walletpassphrasechange <oldpassphrase> <newpassphrase>\n" "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>."); if (!pwalletMain->ChangeWalletPassphrase(strOldWalletPass, strNewWalletPass)) throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect."); return NullUniValue; } UniValue walletlock(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (pwalletMain->IsCrypted() && (request.fHelp || request.params.size() != 0)) throw std::runtime_error( "walletlock\n" "\nRemoves the wallet encryption key from memory, locking the wallet.\n" "After calling this method, you will need to call walletpassphrase again\n" "before being able to call any methods which require the wallet to be unlocked.\n" "\nExamples:\n" "\nSet the passphrase for 2 minutes to perform a transaction\n" + HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") + "\nPerform a send (requires passphrase set)\n" + HelpExampleCli("sendtoaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 1.0") + "\nClear the passphrase since we are done before 2 minutes is up\n" + HelpExampleCli("walletlock", "") + "\nAs json rpc call\n" + HelpExampleRpc("walletlock", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (request.fHelp) return true; if (!pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletlock was called."); { LOCK(cs_nWalletUnlockTime); pwalletMain->Lock(); nWalletUnlockTime = 0; } return NullUniValue; } UniValue encryptwallet(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (!pwalletMain->IsCrypted() && (request.fHelp || request.params.size() != 1)) throw std::runtime_error( "encryptwallet \"passphrase\"\n" "\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n" "After this, any calls that interact with private keys such as sending or signing \n" "will require the passphrase to be set prior the making these calls.\n" "Use the walletpassphrase call for this, and then walletlock call.\n" "If the wallet is already encrypted, use the walletpassphrasechange call.\n" "Note that this will shutdown the server.\n" "\nArguments:\n" "1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n" "\nExamples:\n" "\nEncrypt you wallet\n" + HelpExampleCli("encryptwallet", "\"my pass phrase\"") + "\nNow set the passphrase to use the wallet, such as for signing or sending godlikeproducts\n" + HelpExampleCli("walletpassphrase", "\"my pass phrase\"") + "\nNow we can so something like sign\n" + HelpExampleCli("signmessage", "\"address\" \"test message\"") + "\nNow lock the wallet again by removing the passphrase\n" + HelpExampleCli("walletlock", "") + "\nAs a json rpc call\n" + HelpExampleRpc("encryptwallet", "\"my pass phrase\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (request.fHelp) return true; if (pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called."); // TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string) // Alternately, find a way to make request.params[0] mlock()'d to begin with. SecureString strWalletPass; strWalletPass.reserve(100); strWalletPass = request.params[0].get_str().c_str(); if (strWalletPass.length() < 1) throw std::runtime_error( "encryptwallet <passphrase>\n" "Encrypts the wallet with <passphrase>."); if (!pwalletMain->EncryptWallet(strWalletPass)) throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet."); // BDB seems to have a bad habit of writing old data into // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: StartShutdown(); return "Wallet encrypted; GodLikeProducts Core server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup."; } UniValue lockunspent(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "lockunspent unlock ([{\"txid\":\"txid\",\"vout\":n},...])\n" "\nUpdates list of temporarily unspendable outputs.\n" "Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n" "If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.\n" "A locked transaction output will not be chosen by automatic coin selection, when spending godlikeproductss.\n" "Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n" "is always cleared (by virtue of process exit) when a node stops or fails.\n" "Also see the listunspent call\n" "\nArguments:\n" "1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n" "2. \"transactions\" (string, optional) A json array of objects. Each object the txid (string) vout (numeric)\n" " [ (json array of json objects)\n" " {\n" " \"txid\":\"id\", (string) The transaction id\n" " \"vout\": n (numeric) The output number\n" " }\n" " ,...\n" " ]\n" "\nResult:\n" "true|false (boolean) Whether the command was successful or not\n" "\nExamples:\n" "\nList the unspent transactions\n" + HelpExampleCli("listunspent", "") + "\nLock an unspent transaction\n" + HelpExampleCli("lockunspent", "false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") + "\nList the locked transactions\n" + HelpExampleCli("listlockunspent", "") + "\nUnlock the transaction again\n" + HelpExampleCli("lockunspent", "true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") + "\nAs a json rpc call\n" + HelpExampleRpc("lockunspent", "false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); if (request.params.size() == 1) RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VBOOL)); else RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VBOOL)(UniValue::VARR)); bool fUnlock = request.params[0].get_bool(); if (request.params.size() == 1) { if (fUnlock) pwalletMain->UnlockAllCoins(); return true; } UniValue outputs = request.params[1].get_array(); for (unsigned int idx = 0; idx < outputs.size(); idx++) { const UniValue& output = outputs[idx]; if (!output.isObject()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object"); const UniValue& o = output.get_obj(); RPCTypeCheckObj(o, { {"txid", UniValueType(UniValue::VSTR)}, {"vout", UniValueType(UniValue::VNUM)}, }); std::string txid = find_value(o, "txid").get_str(); if (!IsHex(txid)) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected hex txid"); int nOutput = find_value(o, "vout").get_int(); if (nOutput < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); COutPoint outpt(uint256S(txid), nOutput); if (fUnlock) pwalletMain->UnlockCoin(outpt); else pwalletMain->LockCoin(outpt); } return true; } UniValue listlockunspent(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 0) throw std::runtime_error( "listlockunspent\n" "\nReturns list of temporarily unspendable outputs.\n" "See the lockunspent call to lock and unlock transactions for spending.\n" "\nResult:\n" "[\n" " {\n" " \"txid\" : \"transactionid\", (string) The transaction id locked\n" " \"vout\" : n (numeric) The vout value\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" "\nList the unspent transactions\n" + HelpExampleCli("listunspent", "") + "\nLock an unspent transaction\n" + HelpExampleCli("lockunspent", "false \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") + "\nList the locked transactions\n" + HelpExampleCli("listlockunspent", "") + "\nUnlock the transaction again\n" + HelpExampleCli("lockunspent", "true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") + "\nAs a json rpc call\n" + HelpExampleRpc("listlockunspent", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); std::vector<COutPoint> vOutpts; pwalletMain->ListLockedCoins(vOutpts); UniValue ret(UniValue::VARR); BOOST_FOREACH(COutPoint &outpt, vOutpts) { UniValue o(UniValue::VOBJ); o.push_back(Pair("txid", outpt.hash.GetHex())); o.push_back(Pair("vout", (int)outpt.n)); ret.push_back(o); } return ret; } UniValue settxfee(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 1) throw std::runtime_error( "settxfee amount\n" "\nSet the transaction fee per kB. Overwrites the paytxfee parameter.\n" "\nArguments:\n" "1. amount (numeric or string, required) The transaction fee in " + CURRENCY_UNIT + "/kB\n" "\nResult:\n" "true|false (boolean) Returns true if successful\n" "\nExamples:\n" + HelpExampleCli("settxfee", "0.00001") + HelpExampleRpc("settxfee", "0.00001") ); LOCK2(cs_main, pwalletMain->cs_wallet); // Amount CAmount nAmount = AmountFromValue(request.params[0]); payTxFee = CFeeRate(nAmount, 1000); return true; } UniValue getwalletinfo(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getwalletinfo\n" "Returns an object containing various wallet state info.\n" "\nResult:\n" "{\n" " \"walletversion\": xxxxx, (numeric) the wallet version\n" " \"balance\": xxxxxxx, (numeric) the total confirmed balance of the wallet in " + CURRENCY_UNIT + "\n" + (!fLiteMode ? " \"privatesend_balance\": xxxxxx, (numeric) the anonymized godlikeproducts balance of the wallet in " + CURRENCY_UNIT + "\n" : "") + " \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed balance of the wallet in " + CURRENCY_UNIT + "\n" " \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in " + CURRENCY_UNIT + "\n" " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n" " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool\n" " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated (only counts external keys)\n" " \"keypoolsize_hd_internal\": xxxx, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)\n" " \"keys_left\": xxxx, (numeric) how many new keys are left since last automatic backup\n" " \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n" " \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in " + CURRENCY_UNIT + "/kB\n" " \"hdchainid\": \"<hash>\", (string) the ID of the HD chain\n" " \"hdaccountcount\": xxx, (numeric) how many accounts of the HD chain are in this wallet\n" " [\n" " {\n" " \"hdaccountindex\": xxx, (numeric) the index of the account\n" " \"hdexternalkeyindex\": xxxx, (numeric) current external childkey index\n" " \"hdinternalkeyindex\": xxxx, (numeric) current internal childkey index\n" " }\n" " ,...\n" " ]\n" "}\n" "\nExamples:\n" + HelpExampleCli("getwalletinfo", "") + HelpExampleRpc("getwalletinfo", "") ); LOCK2(cs_main, pwalletMain->cs_wallet); CHDChain hdChainCurrent; bool fHDEnabled = pwalletMain->GetHDChain(hdChainCurrent); UniValue obj(UniValue::VOBJ); obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); if(!fLiteMode) obj.push_back(Pair("privatesend_balance", ValueFromAmount(pwalletMain->GetAnonymizedBalance()))); obj.push_back(Pair("unconfirmed_balance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance()))); obj.push_back(Pair("immature_balance", ValueFromAmount(pwalletMain->GetImmatureBalance()))); obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size())); obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoolsize", (int64_t)pwalletMain->KeypoolCountExternalKeys())); if (fHDEnabled) { obj.push_back(Pair("keypoolsize_hd_internal", (int64_t)(pwalletMain->KeypoolCountInternalKeys()))); } obj.push_back(Pair("keys_left", pwalletMain->nKeysLeftSinceAutoBackup)); if (pwalletMain->IsCrypted()) obj.push_back(Pair("unlocked_until", nWalletUnlockTime)); obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK()))); if (fHDEnabled) { obj.push_back(Pair("hdchainid", hdChainCurrent.GetID().GetHex())); obj.push_back(Pair("hdaccountcount", (int64_t)hdChainCurrent.CountAccounts())); UniValue accounts(UniValue::VARR); for (size_t i = 0; i < hdChainCurrent.CountAccounts(); ++i) { CHDAccount acc; UniValue account(UniValue::VOBJ); account.push_back(Pair("hdaccountindex", (int64_t)i)); if(hdChainCurrent.GetAccount(i, acc)) { account.push_back(Pair("hdexternalkeyindex", (int64_t)acc.nExternalChainCounter)); account.push_back(Pair("hdinternalkeyindex", (int64_t)acc.nInternalChainCounter)); } else { account.push_back(Pair("error", strprintf("account %d is missing", i))); } accounts.push_back(account); } obj.push_back(Pair("hdaccounts", accounts)); } return obj; } UniValue keepass(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; std::string strCommand; if (request.params.size() >= 1) strCommand = request.params[0].get_str(); if (request.fHelp || (strCommand != "genkey" && strCommand != "init" && strCommand != "setpassphrase")) throw std::runtime_error( "keepass <genkey|init|setpassphrase>\n"); if (strCommand == "genkey") { SecureString sResult; // Generate RSA key SecureString sKey = CKeePassIntegrator::generateKeePassKey(); sResult = "Generated Key: "; sResult += sKey; return sResult.c_str(); } else if(strCommand == "init") { // Generate base64 encoded 256 bit RSA key and associate with KeePassHttp SecureString sResult; SecureString sKey; std::string strId; keePassInt.rpcAssociate(strId, sKey); sResult = "Association successful. Id: "; sResult += strId.c_str(); sResult += " - Key: "; sResult += sKey.c_str(); return sResult.c_str(); } else if(strCommand == "setpassphrase") { if(request.params.size() != 2) { return "setlogin: invalid number of parameters. Requires a passphrase"; } SecureString sPassphrase = SecureString(request.params[1].get_str().c_str()); keePassInt.updatePassphrase(sPassphrase); return "setlogin: Updated credentials."; } return "Invalid command"; } UniValue resendwallettransactions(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "resendwallettransactions\n" "Immediately re-broadcast unconfirmed wallet transactions to all peers.\n" "Intended only for testing; the wallet code periodically re-broadcasts\n" "automatically.\n" "Returns array of transaction ids that were re-broadcast.\n" ); if (!g_connman) throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); LOCK2(cs_main, pwalletMain->cs_wallet); std::vector<uint256> txids = pwalletMain->ResendWalletTransactionsBefore(GetTime(), g_connman.get()); UniValue result(UniValue::VARR); BOOST_FOREACH(const uint256& txid, txids) { result.push_back(txid.ToString()); } return result; } UniValue listunspent(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() > 4) throw std::runtime_error( "listunspent ( minconf maxconf [\"addresses\",...] [include_unsafe] )\n" "\nReturns array of unspent transaction outputs\n" "with between minconf and maxconf (inclusive) confirmations.\n" "Optionally filter to only include txouts paid to specified addresses.\n" "\nArguments:\n" "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n" "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n" "3. \"addresses\" (string) A json array of godlikeproducts addresses to filter\n" " [\n" " \"address\" (string) godlikeproducts address\n" " ,...\n" " ]\n" "4. include_unsafe (bool, optional, default=true) Include outputs that are not safe to spend\n" " because they come from unconfirmed untrusted transactions or unconfirmed\n" " replacement transactions (cases where we are less sure that a conflicting\n" " transaction won't be mined).\n" "\nResult:\n" "[ (array of json object)\n" " {\n" " \"txid\" : \"txid\", (string) the transaction id \n" " \"vout\" : n, (numeric) the vout value\n" " \"address\" : \"address\", (string) the godlikeproducts address\n" " \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n" " \"scriptPubKey\" : \"key\", (string) the script key\n" " \"amount\" : x.xxx, (numeric) the transaction output amount in " + CURRENCY_UNIT + "\n" " \"confirmations\" : n, (numeric) The number of confirmations\n" " \"redeemScript\" : n (string) The redeemScript if scriptPubKey is P2SH\n" " \"spendable\" : xxx, (bool) Whether we have the private keys to spend this output\n" " \"solvable\" : xxx, (bool) Whether we know how to spend this output, ignoring the lack of keys\n" " \"ps_rounds\" : n (numeric) The number of PS rounds\n" " }\n" " ,...\n" "]\n" "\nExamples:\n" + HelpExampleCli("listunspent", "") + HelpExampleCli("listunspent", "6 9999999 \"[\\\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\\\",\\\"XuQQkwA4FYkq2XERzMY2CiAZhJTEDAbtcg\\\"]\"") + HelpExampleRpc("listunspent", "6, 9999999 \"[\\\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\\\",\\\"XuQQkwA4FYkq2XERzMY2CiAZhJTEDAbtcg\\\"]\"") ); int nMinDepth = 1; if (request.params.size() > 0 && !request.params[0].isNull()) { RPCTypeCheckArgument(request.params[0], UniValue::VNUM); nMinDepth = request.params[0].get_int(); } int nMaxDepth = 9999999; if (request.params.size() > 1 && !request.params[1].isNull()) { RPCTypeCheckArgument(request.params[1], UniValue::VNUM); nMaxDepth = request.params[1].get_int(); } std::set<CBitcoinAddress> setAddress; if (request.params.size() > 2 && !request.params[2].isNull()) { RPCTypeCheckArgument(request.params[2], UniValue::VARR); UniValue inputs = request.params[2].get_array(); for (unsigned int idx = 0; idx < inputs.size(); idx++) { const UniValue& input = inputs[idx]; CBitcoinAddress address(input.get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid GodLikeProducts address: ")+input.get_str()); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ")+input.get_str()); setAddress.insert(address); } } bool include_unsafe = true; if (request.params.size() > 3 && !request.params[3].isNull()) { RPCTypeCheckArgument(request.params[3], UniValue::VBOOL); include_unsafe = request.params[3].get_bool(); } UniValue results(UniValue::VARR); std::vector<COutput> vecOutputs; assert(pwalletMain != NULL); LOCK2(cs_main, pwalletMain->cs_wallet); pwalletMain->AvailableCoins(vecOutputs, !include_unsafe, NULL, true); BOOST_FOREACH(const COutput& out, vecOutputs) { if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth) continue; CTxDestination address; const CScript& scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey; bool fValidAddress = ExtractDestination(scriptPubKey, address); if (setAddress.size() && (!fValidAddress || !setAddress.count(address))) continue; UniValue entry(UniValue::VOBJ); entry.push_back(Pair("txid", out.tx->GetHash().GetHex())); entry.push_back(Pair("vout", out.i)); if (fValidAddress) { entry.push_back(Pair("address", CBitcoinAddress(address).ToString())); if (pwalletMain->mapAddressBook.count(address)) entry.push_back(Pair("account", pwalletMain->mapAddressBook[address].name)); if (scriptPubKey.IsPayToScriptHash()) { const CScriptID& hash = boost::get<CScriptID>(address); CScript redeemScript; if (pwalletMain->GetCScript(hash, redeemScript)) entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end()))); } } entry.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); entry.push_back(Pair("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue))); entry.push_back(Pair("confirmations", out.nDepth)); entry.push_back(Pair("spendable", out.fSpendable)); entry.push_back(Pair("solvable", out.fSolvable)); entry.push_back(Pair("ps_rounds", pwalletMain->GetOutpointPrivateSendRounds(COutPoint(out.tx->GetHash(), out.i)))); results.push_back(entry); } return results; } UniValue fundrawtransaction(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "fundrawtransaction \"hexstring\" ( options )\n" "\nAdd inputs to a transaction until it has enough in value to meet its out value.\n" "This will not modify existing inputs, and will add at most one change output to the outputs.\n" "No existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified.\n" "Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n" "The inputs added will not be signed, use signrawtransaction for that.\n" "Note that all existing inputs must have their previous output transaction be in the wallet.\n" "Note that all inputs selected must be of standard form and P2SH scripts must be\n" "in the wallet using importaddress or addmultisigaddress (to calculate fees).\n" "You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n" "Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n" "\nArguments:\n" "1. \"hexstring\" (string, required) The hex string of the raw transaction\n" "2. options (object, optional)\n" " {\n" " \"changeAddress\" (string, optional, default pool address) The godlikeproducts address to receive the change\n" " \"changePosition\" (numeric, optional, default random) The index of the change output\n" " \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n" " \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n" " \"reserveChangeKey\" (boolean, optional, default true) Reserves the change output key from the keypool\n" " \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (" + CURRENCY_UNIT + " per KB)\n" " \"subtractFeeFromOutputs\" (array, optional) A json array of integers.\n" " The fee will be equally deducted from the amount of each specified output.\n" " The outputs are specified by their zero-based index, before any change output is added.\n" " Those recipients will receive less godlikeproducts than you enter in their corresponding amount field.\n" " If no outputs are specified here, the sender pays the fee.\n" " [vout_index,...]\n" " }\n" " for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}\n" "\nResult:\n" "{\n" " \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n" " \"fee\": n, (numeric) Fee in " + CURRENCY_UNIT + " the resulting transaction pays\n" " \"changepos\": n (numeric) The position of the added change output, or -1\n" "}\n" "\nExamples:\n" "\nCreate a transaction with no inputs\n" + HelpExampleCli("createrawtransaction", "\"[]\" \"{\\\"myaddress\\\":0.01}\"") + "\nAdd sufficient unsigned inputs to meet the output value\n" + HelpExampleCli("fundrawtransaction", "\"rawtransactionhex\"") + "\nSign the transaction\n" + HelpExampleCli("signrawtransaction", "\"fundedtransactionhex\"") + "\nSend the transaction\n" + HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"") ); RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)); CTxDestination changeAddress = CNoDestination(); int changePosition = -1; bool includeWatching = false; bool lockUnspents = false; bool reserveChangeKey = true; CFeeRate feeRate = CFeeRate(0); bool overrideEstimatedFeerate = false; UniValue subtractFeeFromOutputs; std::set<int> setSubtractFeeFromOutputs; if (request.params.size() > 1) { if (request.params[1].type() == UniValue::VBOOL) { // backward compatibility bool only fallback includeWatching = request.params[1].get_bool(); } else { RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VOBJ)); UniValue options = request.params[1]; RPCTypeCheckObj(options, { {"changeAddress", UniValueType(UniValue::VSTR)}, {"changePosition", UniValueType(UniValue::VNUM)}, {"includeWatching", UniValueType(UniValue::VBOOL)}, {"lockUnspents", UniValueType(UniValue::VBOOL)}, {"reserveChangeKey", UniValueType(UniValue::VBOOL)}, {"feeRate", UniValueType()}, // will be checked below {"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, }, true, true); if (options.exists("changeAddress")) { CBitcoinAddress address(options["changeAddress"].get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_PARAMETER, "changeAddress must be a valid godlikeproducts address"); changeAddress = address.Get(); } if (options.exists("changePosition")) changePosition = options["changePosition"].get_int(); if (options.exists("includeWatching")) includeWatching = options["includeWatching"].get_bool(); if (options.exists("lockUnspents")) lockUnspents = options["lockUnspents"].get_bool(); if (options.exists("reserveChangeKey")) reserveChangeKey = options["reserveChangeKey"].get_bool(); if (options.exists("feeRate")) { feeRate = CFeeRate(AmountFromValue(options["feeRate"])); overrideEstimatedFeerate = true; } if (options.exists("subtractFeeFromOutputs")) subtractFeeFromOutputs = options["subtractFeeFromOutputs"].get_array(); } } // parse hex string from parameter CMutableTransaction tx; if (!DecodeHexTx(tx, request.params[0].get_str())) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); if (tx.vout.size() == 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "TX must have at least one output"); if (changePosition != -1 && (changePosition < 0 || (unsigned int)changePosition > tx.vout.size())) throw JSONRPCError(RPC_INVALID_PARAMETER, "changePosition out of bounds"); for (unsigned int idx = 0; idx < subtractFeeFromOutputs.size(); idx++) { int pos = subtractFeeFromOutputs[idx].get_int(); if (setSubtractFeeFromOutputs.count(pos)) throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, duplicated position: %d", pos)); if (pos < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, negative position: %d", pos)); if (pos >= int(tx.vout.size())) throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, position too large: %d", pos)); setSubtractFeeFromOutputs.insert(pos); } CAmount nFeeOut; std::string strFailReason; if(!pwalletMain->FundTransaction(tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, setSubtractFeeFromOutputs, reserveChangeKey, changeAddress)) throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason); UniValue result(UniValue::VOBJ); result.push_back(Pair("hex", EncodeHexTx(tx))); result.push_back(Pair("changepos", changePosition)); result.push_back(Pair("fee", ValueFromAmount(nFeeOut))); return result; } UniValue setbip69enabled(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "setbip69enabled enable\n" "\nEnable/Disable BIP69 input/output sorting (-regtest only)\n" "\nArguments:\n" "1. enable (bool, required) true or false" ); if (Params().NetworkIDString() != CBaseChainParams::REGTEST) throw std::runtime_error("setbip69enabled for regression testing (-regtest mode) only"); bBIP69Enabled = request.params[0].get_bool(); return NullUniValue; } extern UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp extern UniValue importprivkey(const JSONRPCRequest& request); extern UniValue importaddress(const JSONRPCRequest& request); extern UniValue importpubkey(const JSONRPCRequest& request); extern UniValue dumpwallet(const JSONRPCRequest& request); extern UniValue importwallet(const JSONRPCRequest& request); extern UniValue importprunedfunds(const JSONRPCRequest& request); extern UniValue removeprunedfunds(const JSONRPCRequest& request); extern UniValue importmulti(const JSONRPCRequest& request); extern UniValue dumphdinfo(const JSONRPCRequest& request); extern UniValue importelectrumwallet(const JSONRPCRequest& request); static const CRPCCommand commands[] = { // category name actor (function) okSafeMode // --------------------- ------------------------ ----------------------- ---------- { "rawtransactions", "fundrawtransaction", &fundrawtransaction, false, {"hexstring","options"} }, { "hidden", "resendwallettransactions", &resendwallettransactions, true, {} }, { "wallet", "abandontransaction", &abandontransaction, false, {"txid"} }, { "wallet", "addmultisigaddress", &addmultisigaddress, true, {"nrequired","keys","account"} }, { "wallet", "backupwallet", &backupwallet, true, {"destination"} }, { "wallet", "dumpprivkey", &dumpprivkey, true, {"address"} }, { "wallet", "dumpwallet", &dumpwallet, true, {"filename"} }, { "wallet", "encryptwallet", &encryptwallet, true, {"passphrase"} }, { "wallet", "getaccountaddress", &getaccountaddress, true, {"account"} }, { "wallet", "getaccount", &getaccount, true, {"address"} }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true, {"account"} }, { "wallet", "getbalance", &getbalance, false, {"account","minconf","addlockconf","include_watchonly"} }, { "wallet", "getnewaddress", &getnewaddress, true, {"account"} }, { "wallet", "getrawchangeaddress", &getrawchangeaddress, true, {} }, { "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false, {"account","minconf","addlockconf"} }, { "wallet", "getreceivedbyaddress", &getreceivedbyaddress, false, {"address","minconf","addlockconf"} }, { "wallet", "gettransaction", &gettransaction, false, {"txid","include_watchonly"} }, { "wallet", "getunconfirmedbalance", &getunconfirmedbalance, false, {} }, { "wallet", "getwalletinfo", &getwalletinfo, false, {} }, { "wallet", "importmulti", &importmulti, true, {"requests","options"} }, { "wallet", "importprivkey", &importprivkey, true, {"privkey","label","rescan"} }, { "wallet", "importwallet", &importwallet, true, {"filename"} }, { "wallet", "importaddress", &importaddress, true, {"address","label","rescan","p2sh"} }, { "wallet", "importprunedfunds", &importprunedfunds, true, {"rawtransaction","txoutproof"} }, { "wallet", "importpubkey", &importpubkey, true, {"pubkey","label","rescan"} }, { "wallet", "keypoolrefill", &keypoolrefill, true, {"newsize"} }, { "wallet", "listaccounts", &listaccounts, false, {"minconf","addlockconf","include_watchonly"} }, { "wallet", "listaddressgroupings", &listaddressgroupings, false, {} }, { "wallet", "listaddressbalances", &listaddressbalances, false, {"minamount"} }, { "wallet", "listlockunspent", &listlockunspent, false, {} }, { "wallet", "listreceivedbyaccount", &listreceivedbyaccount, false, {"minconf","addlockconf","include_empty","include_watchonly"} }, { "wallet", "listreceivedbyaddress", &listreceivedbyaddress, false, {"minconf","addlockconf","include_empty","include_watchonly"} }, { "wallet", "listsinceblock", &listsinceblock, false, {"blockhash","target_confirmations","include_watchonly"} }, { "wallet", "listtransactions", &listtransactions, false, {"account","count","skip","include_watchonly"} }, { "wallet", "listunspent", &listunspent, false, {"minconf","maxconf","addresses","include_unsafe"} }, { "wallet", "lockunspent", &lockunspent, true, {"unlock","transactions"} }, { "wallet", "move", &movecmd, false, {"fromaccount","toaccount","amount","minconf","comment"} }, { "wallet", "sendfrom", &sendfrom, false, {"fromaccount","toaddress","amount","minconf","addlockconf","comment","comment_to"} }, { "wallet", "sendmany", &sendmany, false, {"fromaccount","amounts","minconf","addlockconf","comment","subtractfeefrom"} }, { "wallet", "sendtoaddress", &sendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount"} }, { "wallet", "setaccount", &setaccount, true, {"address","account"} }, { "wallet", "settxfee", &settxfee, true, {"amount"} }, { "wallet", "signmessage", &signmessage, true, {"address","message"} }, { "wallet", "walletlock", &walletlock, true, {} }, { "wallet", "walletpassphrasechange", &walletpassphrasechange, true, {"oldpassphrase","newpassphrase"} }, { "wallet", "walletpassphrase", &walletpassphrase, true, {"passphrase","timeout","mixingonly"} }, { "wallet", "removeprunedfunds", &removeprunedfunds, true, {"txid"} }, { "wallet", "keepass", &keepass, true, {} }, { "wallet", "instantsendtoaddress", &instantsendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount"} }, { "wallet", "dumphdinfo", &dumphdinfo, true, {} }, { "wallet", "importelectrumwallet", &importelectrumwallet, true, {"filename", "index"} }, { "hidden", "setbip69enabled", &setbip69enabled, true, {} }, }; void RegisterWalletRPCCommands(CRPCTable &t) { if (GetBoolArg("-disablewallet", false)) return; for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); }
[ "damalisullivan@yahoo.com" ]
damalisullivan@yahoo.com
a11ad2b7827c668fe0c324ee4d14c58eed05c952
0641d87fac176bab11c613e64050330246569e5c
/tags/release-2-6-d01/source/test/intltest/calregts.h
74243601aeac75dedb4dcef58bfd6f50ba883ab1
[ "ICU" ]
permissive
svn2github/libicu_full
ecf883cedfe024efa5aeda4c8527f227a9dbf100
f1246dcb7fec5a23ebd6d36ff3515ff0395aeb29
refs/heads/master
2021-01-01T17:00:58.555108
2015-01-27T16:59:40
2015-01-27T16:59:40
9,308,333
0
2
null
null
null
null
UTF-8
C++
false
false
2,571
h
/******************************************************************** * COPYRIGHT: * Copyright (c) 1997-2001, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ #ifndef _CALENDARREGRESSIONTEST_ #define _CALENDARREGRESSIONTEST_ #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #include "unicode/calendar.h" #include "unicode/gregocal.h" #include "intltest.h" /** * Performs regression test for Calendar **/ class CalendarRegressionTest: public IntlTest { // IntlTest override void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ); public: void test4100311(void); void test4074758(void); void test4028518(void); void test4031502(void) ; void test4035301(void) ; void test4040996(void) ; void test4051765(void) ; void test4059654(void) ; void test4061476(void) ; void test4070502(void) ; void test4071197(void) ; void test4071385(void) ; void test4073929(void) ; void test4083167(void) ; void test4086724(void) ; void test4092362(void) ; void test4095407(void) ; void test4096231(void) ; void test4096539(void) ; void test41003112(void) ; void test4103271(void) ; void test4106136(void) ; void test4108764(void) ; void test4114578(void) ; void test4118384(void) ; void test4125881(void) ; void test4125892(void) ; void test4141665(void) ; void test4142933(void) ; void test4145158(void) ; void test4145983(void) ; void test4147269(void) ; void Test4149677(void) ; void Test4162587(void) ; void Test4165343(void) ; void Test4166109(void) ; void Test4167060(void) ; void Test4197699(void); void TestJ81(void); void TestJ438(void); void TestLeapFieldDifference(void); void TestMalaysianInstance(void); void TestWeekShift(void); void TestTimeZoneTransitionAdd(void); void printdate(GregorianCalendar *cal, const char *string); void dowTest(UBool lenient) ; static UDate getAssociatedDate(UDate d, UErrorCode& status); static UDate makeDate(int32_t y, int32_t m = 0, int32_t d = 0, int32_t hr = 0, int32_t min = 0, int32_t sec = 0); static const UDate EARLIEST_SUPPORTED_MILLIS; static const UDate LATEST_SUPPORTED_MILLIS; static const char* FIELD_NAME[]; protected: UBool failure(UErrorCode status, const char* msg); }; #endif /* #if !UCONFIG_NO_FORMATTING */ #endif // _CALENDARREGRESSIONTEST_ //eof
[ "(no author)@251d0590-4201-4cf1-90de-194747b24ca1" ]
(no author)@251d0590-4201-4cf1-90de-194747b24ca1
a97e4a45eebc97eb2353beb620a85f27b492dac7
df56c3d9f44132d636c0cef1b70e40034ff09022
/networksecurity/tlsprovider/source/swtlstokentypeplugin/swtlstokenprovider.cpp
bb22bedeeee43f4d17af4fcce5495f8c1d88c624
[]
no_license
SymbianSource/oss.FCL.sf.os.networkingsrv
e6317d7ee0ebae163572127269c6cf40b98e3e1c
b283ce17f27f4a95f37cdb38c6ce79d38ae6ebf9
refs/heads/master
2021-01-12T11:29:50.765762
2010-10-14T06:50:50
2010-10-14T06:50:50
72,938,071
4
1
null
null
null
null
UTF-8
C++
false
false
3,709
cpp
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" // which accompanies this distribution, and is available // at the URL "http://www.eclipse.org/legal/epl-v10.html". // // Initial Contributors: // Nokia Corporation - initial contribution. // // Contributors: // // Description: // #include "swtlstokentypeplugin.h" // // CSwTLSTokenProvider MCTToken& CSwTLSTokenProvider::Token() { return iToken; } const TDesC& CSwTLSTokenProvider::Label() { return iLabel; } void CSwTLSTokenProvider::GetSession( const TTLSServerAddr& aServerName, RArray<TTLSProtocolVersion>& aAcceptableProtVersions, TTLSSessionData& aOutputSessionData, TRequestStatus& aStatus) { SWTLSTOKEN_LOG( _L("CSwTLSTokenProvider::GetSession") ) iToken.GetCacheData(aServerName, aAcceptableProtVersions, aOutputSessionData); TRequestStatus* status = &aStatus; User::RequestComplete( status, KErrNone); return; } void CSwTLSTokenProvider::ClearSessionCache( const TTLSServerAddr& aServerName, TTLSSessionId& aSession, TBool& aResult, TRequestStatus& aStatus) { SWTLSTOKEN_LOG( _L("CSwTLSTokenProvider::ClearSessionCache") ) aResult = iToken.RemoveFromCache( aServerName, aSession ); TRequestStatus* status = &aStatus; if( EFalse == aResult ) User::RequestComplete( status, KTLSErrCacheEntryInUse); else User::RequestComplete( status, KErrNone); return; } void CSwTLSTokenProvider::CryptoCapabilities( RArray<TTLSProtocolVersion>& aProtocols, RArray<TTLSKeyExchangeAlgorithm>& aKeyExchAlgs, RArray<TTLSSignatureAlgorithm>& aSigAlgs, TRequestStatus& aStatus) { SWTLSTOKEN_LOG( _L("CSwTLSTokenProvider::CryptoCapabilities") ) TRequestStatus* status = &aStatus; aProtocols.Reset(); aKeyExchAlgs.Reset(); TInt i; TInt err = KErrNone; err = aProtocols.Append( KTLS1_0 ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aProtocols.Append( KSSL3_0 ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aKeyExchAlgs.Append( ERsa ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aKeyExchAlgs.Append( EDHE ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aKeyExchAlgs.Append( EPsk ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aSigAlgs.Append( ERsaSigAlg ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aSigAlgs.Append( EDsa ); if ( err != KErrNone ) User::RequestComplete( status, err ); err = aSigAlgs.Append( EPskSigAlg); if ( err != KErrNone ) User::RequestComplete( status, err ); TInt max; max = aProtocols.Count(); for(i=0; i<max; i++) SWTLSTOKEN_LOG2( _L(" protocol version: 3.%d inserted into list"), aProtocols[i].iMinor ); max = aKeyExchAlgs.Count(); for(i=0; i<max; i++) SWTLSTOKEN_LOG2( _L(" key exch alg: %d inserted into list"), aKeyExchAlgs[i] ); max = aSigAlgs.Count(); for(i=0; i<max; i++) SWTLSTOKEN_LOG2( _L(" sign alg: %d inserted into list"), aSigAlgs[i] ); if ( status ) { User::RequestComplete( status, KErrNone); } return; } void CSwTLSTokenProvider::CancelGetSession() { SWTLSTOKEN_LOG( _L("CSwTLSTokenProvider::CancelGetSession") ) return; } void CSwTLSTokenProvider::CancelCryptoCapabilities() { SWTLSTOKEN_LOG( _L("CSwTLSTokenProvider::CancelCryptoCapabilities") ) return; } void CSwTLSTokenProvider::CancelClearSessionCache() { SWTLSTOKEN_LOG( _L("CSwTLSTokenProvider::CancelClearSessionCache") ) return; }
[ "kirill.dremov@nokia.com" ]
kirill.dremov@nokia.com
41f6ecd3bfaef72f42112035587219a8b689dd62
7b379862f58f587d9327db829ae4c6493b745bb1
/JuceLibraryCode/modules/juce_graphics/fonts/juce_TextLayout.cpp
be3a8ac66be9d6a05e9f52ad505853fbc05b11d6
[]
no_license
owenvallis/Nomestate
75e844e8ab68933d481640c12019f0d734c62065
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
refs/heads/master
2021-01-19T07:35:14.301832
2011-12-28T07:42:50
2011-12-28T07:42:50
2,950,072
2
0
null
null
null
null
UTF-8
C++
false
false
20,576
cpp
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ BEGIN_JUCE_NAMESPACE TextLayout::Glyph::Glyph (const int glyphCode_, const Point<float>& anchor_, float width_) noexcept : glyphCode (glyphCode_), anchor (anchor_), width (width_) { } TextLayout::Glyph::Glyph (const Glyph& other) noexcept : glyphCode (other.glyphCode), anchor (other.anchor), width (other.width) { } TextLayout::Glyph& TextLayout::Glyph::operator= (const Glyph& other) noexcept { glyphCode = other.glyphCode; anchor = other.anchor; width = other.width; return *this; } TextLayout::Glyph::~Glyph() noexcept {} //============================================================================== TextLayout::Run::Run() noexcept : colour (0xff000000) { } TextLayout::Run::Run (const Range<int>& range, const int numGlyphsToPreallocate) : colour (0xff000000), stringRange (range) { glyphs.ensureStorageAllocated (numGlyphsToPreallocate); } TextLayout::Run::Run (const Run& other) : font (other.font), colour (other.colour), glyphs (other.glyphs), stringRange (other.stringRange) { } TextLayout::Run::~Run() noexcept {} //============================================================================== TextLayout::Line::Line() noexcept : ascent (0.0f), descent (0.0f), leading (0.0f) { } TextLayout::Line::Line (const Range<int>& stringRange_, const Point<float>& lineOrigin_, const float ascent_, const float descent_, const float leading_, const int numRunsToPreallocate) : stringRange (stringRange_), lineOrigin (lineOrigin_), ascent (ascent_), descent (descent_), leading (leading_) { runs.ensureStorageAllocated (numRunsToPreallocate); } TextLayout::Line::Line (const Line& other) : stringRange (other.stringRange), lineOrigin (other.lineOrigin), ascent (other.ascent), descent (other.descent), leading (other.leading) { runs.addCopiesOf (other.runs); } TextLayout::Line::~Line() noexcept { } Range<float> TextLayout::Line::getLineBoundsX() const noexcept { Range<float> range; bool isFirst = true; for (int i = runs.size(); --i >= 0;) { const Run* run = runs.getUnchecked(i); jassert (run != nullptr); if (run->glyphs.size() > 0) { float minX = run->glyphs.getReference(0).anchor.x; float maxX = minX; for (int j = run->glyphs.size(); --j > 0;) { const Glyph& glyph = run->glyphs.getReference (j); const float x = glyph.anchor.x; minX = jmin (minX, x); maxX = jmax (maxX, x + glyph.width); } if (isFirst) { isFirst = false; range = Range<float> (minX, maxX); } else { range = range.getUnionWith (Range<float> (minX, maxX)); } } } return range + lineOrigin.x; } //============================================================================== TextLayout::TextLayout() : width (0), justification (Justification::topLeft) { } TextLayout::TextLayout (const TextLayout& other) : width (other.width), justification (other.justification) { lines.addCopiesOf (other.lines); } #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS TextLayout::TextLayout (TextLayout&& other) noexcept : lines (static_cast <OwnedArray<Line>&&> (other.lines)), width (other.width), justification (other.justification) { } TextLayout& TextLayout::operator= (TextLayout&& other) noexcept { lines = static_cast <OwnedArray<Line>&&> (other.lines); width = other.width; justification = other.justification; return *this; } #endif TextLayout& TextLayout::operator= (const TextLayout& other) { width = other.width; justification = other.justification; lines.clear(); lines.addCopiesOf (other.lines); return *this; } TextLayout::~TextLayout() { } float TextLayout::getHeight() const noexcept { const Line* const lastLine = lines.getLast(); return lastLine != nullptr ? lastLine->lineOrigin.y + lastLine->descent : 0; } TextLayout::Line& TextLayout::getLine (const int index) const { return *lines[index]; } void TextLayout::ensureStorageAllocated (int numLinesNeeded) { lines.ensureStorageAllocated (numLinesNeeded); } void TextLayout::addLine (Line* line) { lines.add (line); } void TextLayout::draw (Graphics& g, const Rectangle<float>& area) const { const Point<float> origin (justification.appliedToRectangle (Rectangle<float> (0, 0, width, getHeight()), area).getPosition()); LowLevelGraphicsContext& context = *g.getInternalContext(); for (int i = 0; i < getNumLines(); ++i) { const Line& line = getLine (i); const Point<float> lineOrigin (origin + line.lineOrigin); for (int j = 0; j < line.runs.size(); ++j) { const Run* const run = line.runs.getUnchecked (j); jassert (run != nullptr); context.setFont (run->font); context.setFill (run->colour); for (int k = 0; k < run->glyphs.size(); ++k) { const Glyph& glyph = run->glyphs.getReference (k); context.drawGlyph (glyph.glyphCode, AffineTransform::translation (lineOrigin.x + glyph.anchor.x, lineOrigin.y + glyph.anchor.y)); } } } } void TextLayout::createLayout (const AttributedString& text, float maxWidth) { lines.clear(); width = maxWidth; justification = text.getJustification(); if (! createNativeLayout (text)) createStandardLayout (text); recalculateWidth(); } //============================================================================== namespace TextLayoutHelpers { struct FontAndColour { FontAndColour (const Font* font_) noexcept : font (font_), colour (0xff000000) {} const Font* font; Colour colour; bool operator!= (const FontAndColour& other) const noexcept { return (font != other.font && *font != *other.font) || colour != other.colour; } }; struct RunAttribute { RunAttribute (const FontAndColour& fontAndColour_, const Range<int>& range_) noexcept : fontAndColour (fontAndColour_), range (range_) {} FontAndColour fontAndColour; Range<int> range; }; struct Token { Token (const String& t, const Font& f, const Colour& c, const bool isWhitespace_) : text (t), font (f), colour (c), area (font.getStringWidth (t), roundToInt (f.getHeight())), isWhitespace (isWhitespace_), isNewLine (t.containsChar ('\n') || t.containsChar ('\r')) {} const String text; const Font font; const Colour colour; Rectangle<int> area; int line, lineHeight; const bool isWhitespace, isNewLine; private: Token& operator= (const Token&); }; class TokenList { public: TokenList() noexcept : totalLines (0) {} void createLayout (const AttributedString& text, TextLayout& layout) { tokens.ensureStorageAllocated (64); layout.ensureStorageAllocated (totalLines); addTextRuns (text); layoutRuns ((int) layout.getWidth()); int charPosition = 0; int lineStartPosition = 0; int runStartPosition = 0; TextLayout::Line* glyphLine = new TextLayout::Line(); TextLayout::Run* glyphRun = new TextLayout::Run(); for (int i = 0; i < tokens.size(); ++i) { const Token* const t = tokens.getUnchecked (i); const Point<float> tokenPos (t->area.getPosition().toFloat()); Array <int> newGlyphs; Array <float> xOffsets; t->font.getGlyphPositions (t->text.trimEnd(), newGlyphs, xOffsets); glyphRun->glyphs.ensureStorageAllocated (glyphRun->glyphs.size() + newGlyphs.size()); for (int j = 0; j < newGlyphs.size(); ++j) { if (charPosition == lineStartPosition) glyphLine->lineOrigin = tokenPos.translated (0, t->font.getAscent()); const float x = xOffsets.getUnchecked (j); glyphRun->glyphs.add (TextLayout::Glyph (newGlyphs.getUnchecked(j), Point<float> (tokenPos.getX() + x, 0), xOffsets.getUnchecked (j + 1) - x)); ++charPosition; } if (t->isWhitespace || t->isNewLine) ++charPosition; const Token* const nextToken = tokens [i + 1]; if (nextToken == nullptr) // this is the last token { addRun (glyphLine, glyphRun, t, runStartPosition, charPosition); glyphLine->stringRange = Range<int> (lineStartPosition, charPosition); layout.addLine (glyphLine); } else { if (t->font != nextToken->font || t->colour != nextToken->colour) { addRun (glyphLine, glyphRun, t, runStartPosition, charPosition); runStartPosition = charPosition; glyphRun = new TextLayout::Run(); } if (t->line != nextToken->line) { addRun (glyphLine, glyphRun, t, runStartPosition, charPosition); glyphLine->stringRange = Range<int> (lineStartPosition, charPosition); layout.addLine (glyphLine); runStartPosition = charPosition; lineStartPosition = charPosition; glyphLine = new TextLayout::Line(); glyphRun = new TextLayout::Run(); } } } if ((text.getJustification().getFlags() & (Justification::right | Justification::horizontallyCentred)) != 0) { const int totalW = (int) layout.getWidth(); for (int i = 0; i < layout.getNumLines(); ++i) { const int lineW = getLineWidth (i); float dx = 0; if ((text.getJustification().getFlags() & Justification::right) != 0) dx = (float) (totalW - lineW); else dx = (totalW - lineW) / 2.0f; TextLayout::Line& glyphLine = layout.getLine (i); glyphLine.lineOrigin.x += dx; } } } private: static void addRun (TextLayout::Line* glyphLine, TextLayout::Run* glyphRun, const Token* const t, const int start, const int end) { glyphRun->stringRange = Range<int> (start, end); glyphRun->font = t->font; glyphRun->colour = t->colour; glyphLine->ascent = jmax (glyphLine->ascent, t->font.getAscent()); glyphLine->descent = jmax (glyphLine->descent, t->font.getDescent()); glyphLine->runs.add (glyphRun); } void appendText (const AttributedString& text, const Range<int>& stringRange, const Font& font, const Colour& colour) { String stringText (text.getText().substring (stringRange.getStart(), stringRange.getEnd())); String::CharPointerType t (stringText.getCharPointer()); String currentString; int lastCharType = 0; for (;;) { const juce_wchar c = t.getAndAdvance(); if (c == 0) break; int charType; if (c == '\r' || c == '\n') charType = 0; else if (CharacterFunctions::isWhitespace (c)) charType = 2; else charType = 1; if (charType == 0 || charType != lastCharType) { if (currentString.isNotEmpty()) tokens.add (new Token (currentString, font, colour, lastCharType == 2 || lastCharType == 0)); currentString = String::charToString (c); if (c == '\r' && *t == '\n') currentString += t.getAndAdvance(); } else { currentString += c; } lastCharType = charType; } if (currentString.isNotEmpty()) tokens.add (new Token (currentString, font, colour, lastCharType == 2)); } void layoutRuns (const int maxWidth) { int x = 0, y = 0, h = 0; int i; for (i = 0; i < tokens.size(); ++i) { Token* const t = tokens.getUnchecked(i); t->area.setPosition (x, y); t->line = totalLines; x += t->area.getWidth(); h = jmax (h, t->area.getHeight()); const Token* nextTok = tokens[i + 1]; if (nextTok == 0) break; if (t->isNewLine || ((! nextTok->isWhitespace) && x + nextTok->area.getWidth() > maxWidth)) { setLastLineHeight (i + 1, h); x = 0; y += h; h = 0; ++totalLines; } } setLastLineHeight (jmin (i + 1, tokens.size()), h); ++totalLines; } void setLastLineHeight (int i, const int height) noexcept { while (--i >= 0) { Token* const tok = tokens.getUnchecked (i); if (tok->line == totalLines) tok->lineHeight = height; else break; } } int getLineWidth (const int lineNumber) const noexcept { int maxW = 0; for (int i = tokens.size(); --i >= 0;) { const Token* const t = tokens.getUnchecked (i); if (t->line == lineNumber && ! t->isWhitespace) maxW = jmax (maxW, t->area.getRight()); } return maxW; } void addTextRuns (const AttributedString& text) { Font defaultFont; Array<RunAttribute> runAttributes; { const int stringLength = text.getText().length(); int rangeStart = 0; FontAndColour lastFontAndColour (nullptr); // Iterate through every character in the string for (int i = 0; i < stringLength; ++i) { FontAndColour newFontAndColour (&defaultFont); const int numCharacterAttributes = text.getNumAttributes(); for (int j = 0; j < numCharacterAttributes; ++j) { const AttributedString::Attribute* const attr = text.getAttribute (j); // Check if the current character falls within the range of a font attribute if (attr->getFont() != nullptr && (i >= attr->range.getStart()) && (i < attr->range.getEnd())) newFontAndColour.font = attr->getFont(); // Check if the current character falls within the range of a foreground colour attribute if (attr->getColour() != nullptr && (i >= attr->range.getStart()) && (i < attr->range.getEnd())) newFontAndColour.colour = *attr->getColour(); } if (i > 0 && (newFontAndColour != lastFontAndColour || i == stringLength - 1)) { runAttributes.add (RunAttribute (lastFontAndColour, Range<int> (rangeStart, (i < stringLength - 1) ? i : (i + 1)))); rangeStart = i; } lastFontAndColour = newFontAndColour; } } for (int i = 0; i < runAttributes.size(); ++i) { const RunAttribute& r = runAttributes.getReference(i); appendText (text, r.range, *(r.fontAndColour.font), r.fontAndColour.colour); } } OwnedArray<Token> tokens; int totalLines; JUCE_DECLARE_NON_COPYABLE (TokenList); }; } //============================================================================== void TextLayout::createLayoutWithBalancedLineLengths (const AttributedString& text, float maxWidth) { const float minimumWidth = maxWidth / 2.0f; float bestWidth = maxWidth; float bestLineProportion = 0.0f; while (maxWidth > minimumWidth) { createLayout (text, maxWidth); if (getNumLines() < 2) return; const float line1 = lines.getUnchecked (lines.size() - 1)->getLineBoundsX().getLength(); const float line2 = lines.getUnchecked (lines.size() - 2)->getLineBoundsX().getLength(); const float prop = jmax (line1, line2) / jmin (line1, line2); if (prop > 0.9f) return; if (prop > bestLineProportion) { bestLineProportion = prop; bestWidth = maxWidth; } maxWidth -= 10.0f; } if (bestWidth != maxWidth) createLayout (text, bestWidth); } //============================================================================== void TextLayout::createStandardLayout (const AttributedString& text) { TextLayoutHelpers::TokenList l; l.createLayout (text, *this); } void TextLayout::recalculateWidth() { if (lines.size() > 0) { Range<float> range (lines.getFirst()->getLineBoundsX()); int i; for (i = lines.size(); --i > 0;) range = range.getUnionWith (lines.getUnchecked(i)->getLineBoundsX()); for (i = lines.size(); --i >= 0;) lines.getUnchecked(i)->lineOrigin.x -= range.getStart(); width = range.getLength(); } } END_JUCE_NAMESPACE
[ "ow3nskip" ]
ow3nskip
47c584f0ffffa0fe9b556947cab467a3f524bb2e
9e44da9a999c2334f767eb1dd4ffb2ff9f5d6c84
/P1928外星密码.cpp
27b547baf454549d687854156eff71309c67fbda
[]
no_license
wanan429/LuoGu_Cpp
04839d9dc012fe8432db17bb917702181b3926aa
31ccd1128e49255151c7359f3d91eabe784c0f95
refs/heads/master
2023-06-10T15:01:12.129698
2021-06-28T15:06:25
2021-06-28T15:06:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
367
cpp
#include "bits/stdc++.h" #include "string" using namespace std; string node(){ int N; string s = "",qt; char c; while(cin >> c){ if(c=='['){ cin >> N; qt = node(); while(N--){ s+=qt; } }else{ if(c ==']'){ return s; }else{ s +=c; } } } } int main(){ cout << node(); return 0; }
[ "xuanrandev@qq.com" ]
xuanrandev@qq.com
c8700e3acd21217ad57bfc7b0bc74c156b15d2eb
7f4cc9d717fe4bbcb4616b331e0ec3766a76d395
/eventlogger.cpp
89336a82b91dd43db8bcbef4c9bef5f0fcc34bb1
[]
no_license
zzy7896321/FishTank
dacd1c3769407a41a05fbff0aab2c16581ab11ba
5186f0e21fad2fd68c4791394fcdb492e5f6872a
refs/heads/master
2016-09-06T16:06:51.823867
2014-05-23T12:50:05
2014-05-23T12:50:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,700
cpp
#include "eventlogger.h" #include "host.h" const char* pstrResultString[7] = {"Success.", //0 "Failure: invalid target coordinate.", //1 "Failure: target is already occupied.", //2 "Failure: target is out of range.", //3 "Failure: target is empty.", //4 "Failure: operation is allowed once each round." , //5 "Failure: it's not good to commit suicide." //6 }; EventLogger::EventLogger(const std::string& strId):strIdentifier(strId), host(RetrieveHost()){} EventLoggerHub::EventLoggerHub():elList(){} void EventLoggerHub::AddLogger(EventLogger* elLogger){ elList.push_back(elLogger); } unsigned EventLoggerHub::GetSize() const{ return elList.size(); } const std::string EventLoggerHub::GetIdentifier(unsigned iIndex) const{ return (iIndex>=0 && iIndex<elList.size()) ? elList[iIndex]->strIdentifier : "INVALID_INDEX"; } void EventLoggerHub::DeleteLogger(unsigned iIndex){ if (iIndex>=0 && iIndex<elList.size()){ EventLogger* elToDelete = elList[iIndex]; elList.erase(elList.begin() + iIndex); delete elToDelete; } } void EventLoggerHub::HostInitialized(time_t tmTime){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->HostInitialized(tmTime); } void EventLoggerHub::AISetup(time_t tmTime, int iCount){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->AISetup(tmTime, iCount); } void EventLoggerHub::GameStarted(time_t tmTime){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->GameStarted(tmTime); } void EventLoggerHub::GameEnded(time_t tmTime, const int* iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->GameEnded(tmTime, iId); } void EventLoggerHub::HostDestroyed(time_t tmTime){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->HostDestroyed(tmTime); } void EventLoggerHub::FishBorn(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishBorn(iId); } void EventLoggerHub::FoodRefreshed(const int* ipPosX, const int* ipPosY){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FoodRefreshed(ipPosX, ipPosY); } void EventLoggerHub::FishInitializing(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishInitializing(iId); } void EventLoggerHub::RoundStarted(int iRoundNumber){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->RoundStarted(iRoundNumber); } void EventLoggerHub::FishRevived(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishRevived(iId); } void EventLoggerHub::SequenceDecided(const int* iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->SequenceDecided(iId); } void EventLoggerHub::FishInAction(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishInAction(iId); } void EventLoggerHub::FishMove(int iId, int iFormerPosX, int iFormerPosY, int iTargetPosX, int iTargetPosY, int iResult){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishMove(iId, iFormerPosX, iFormerPosY, iTargetPosX, iTargetPosY, iResult); } void EventLoggerHub::FishAttack(int iId, int iTargetPosX, int iTargetPosY, int iTarget, int iResult){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishAttack(iId, iTargetPosX, iTargetPosY, iTarget, iResult); } void EventLoggerHub::FishDead(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishDead(iId); } void EventLoggerHub::FishExpIncreased(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishExpIncreased(iId); } void EventLoggerHub::FishLevelUp(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishLevelUp(iId); } void EventLoggerHub::FishHPModified(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishHPModified(iId); } void EventLoggerHub::FishActionFinished(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishActionFinished(iId); } void EventLoggerHub::FishTimeout(int iId, int iTimeUsage){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishTimeout(iId, iTimeUsage); } void EventLoggerHub::FishHealthIncreased(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishHealthIncreased(iId); } void EventLoggerHub::FishSpeedIncreased(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishSpeedIncreased(iId); } void EventLoggerHub::FishStrengthIncreased(int iId){ for (unsigned i=0; i<elList.size(); ++i) elList[i]->FishStrengthIncreased(iId); }
[ "zzy7896321@163.com" ]
zzy7896321@163.com
34c15df69b795bb03df42116934845aac12d1c07
9923a00a9afcd97c2fb02f6ed615adea3fc3fe1d
/Branch/Deprecated/SickLDMRS/datatypes/FieldDescription.cpp
e0ca5076659c74b465ffcd5d119c8dfdbbd95a34
[ "MIT" ]
permissive
Tsinghua-OpenICV/OpenICV
93df0e3dda406a5b8958f50ee763756a45182bf3
3bdb2ba744fabe934b31e36ba9c1e6ced2d5e6fc
refs/heads/master
2022-03-02T03:09:02.236509
2021-12-26T08:09:42
2021-12-26T08:09:42
225,785,128
13
9
null
2020-08-06T02:42:03
2019-12-04T05:17:57
C++
UTF-8
C++
false
false
634
cpp
/* * FieldDescription.cpp * * Created on: 30.08.2011 * Author: wahnfla */ #include "FieldDescription.hpp" #include "../tools/errorhandler.hpp" namespace datatypes { FieldDescription::FieldDescription() : m_fieldType(Undefined) { m_datatype = Datatype_FieldDescription; } // // // std::string FieldDescription::fieldTypeToString(FieldType type) { switch (type) { case Segmented: return "Segmented"; case Rectangle: return "Rectangle"; case Radial: return "Radial"; case Dynamic: return "Dynamic"; default: return "undefined"; } } } // namespace datatypes
[ "synsin0@outlook.com" ]
synsin0@outlook.com
fb617860d3220b89047d992f74dc74745b6172be
98d075fd10bd084fd0972adb1320b78090a09ad9
/testapp/stdafx.h
4dffc357d6fd3df4d14cdff3bf0cfe585ac12427
[]
no_license
mssmax/scratch
c4fe33567f0722b5b8b5de126f622a5b2b4dd107
5b3dc920ccc028a5a862a4f3f64187091a07608b
refs/heads/master
2020-09-25T12:15:02.890504
2017-04-29T17:58:05
2017-04-29T17:58:05
66,651,672
0
1
null
null
null
null
UTF-8
C++
false
false
448
h
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include <Windows.h> #include <Sddl.h> #include <AclAPI.h> #include <tchar.h> #include <strsafe.h> #include <stdio.h> #import <msxml6.dll> rename_namespace("MSXML") #include <string> #include <list> #include "OutputDebugStringEx.h"
[ "max@gfi.com" ]
max@gfi.com
2554aa7eed1cb0523aba1a97e0c1fddf2bcc9861
f416ab3adfb5c641dc84022f918df43985c19a09
/problems/kattis/nsum/sol.cpp
3d9289d3cadc156d604f9dcba385008a63ad50d5
[]
no_license
NicoKNL/coding-problems
a4656e8423e8c7f54be1b9015a9502864f0b13a5
4c8c8d5da3cdf74aefcfad4e82066c4a4beb8c06
refs/heads/master
2023-07-26T02:00:35.834440
2023-07-11T22:47:13
2023-07-11T22:47:13
160,269,601
1
0
null
null
null
null
UTF-8
C++
false
false
266
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> V(n, 0); for (int i = 0; i < n; ++i) { cin >> V[i]; } int sum = accumulate(V.begin(), V.end(), 0); cout << sum << endl; return 0; }
[ "klaassen.nico@gmail.com" ]
klaassen.nico@gmail.com
b46f7d60633844c2925ce026a44e40c96c46e60b
05b8ceb85880245663723fff23ffcf73c8e5c3e2
/gm/fp_sample_chaining.cpp
4ac66137ac166a0baa9d38ce476e9a3f066eca66
[ "BSD-3-Clause" ]
permissive
RainwayApp/skia
307e562bb197914f638e3d65b9ac1a62cbfc09dd
f5583b4936ad13c4efe170807fbaf9b2decd0618
refs/heads/master
2020-12-15T20:19:20.358046
2020-07-15T16:46:54
2020-07-15T16:46:54
235,236,299
2
0
NOASSERTION
2020-07-15T17:17:37
2020-01-21T02:02:45
C++
UTF-8
C++
false
false
16,746
cpp
/* * Copyright 2019 Google LLC. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "gm/gm.h" #include "include/core/SkFont.h" #include "include/effects/SkRuntimeEffect.h" #include "src/gpu/GrBitmapTextureMaker.h" #include "src/gpu/GrContextPriv.h" #include "src/gpu/GrRenderTargetContextPriv.h" #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h" #include "src/gpu/ops/GrFillRectOp.h" #include "tools/ToolUtils.h" // Samples child with a constant (literal) matrix // Scales along X class ConstantMatrixEffect : public GrFragmentProcessor { public: static constexpr GrProcessor::ClassID CLASS_ID = (GrProcessor::ClassID) 3; ConstantMatrixEffect(std::unique_ptr<GrFragmentProcessor> child) : GrFragmentProcessor(CLASS_ID, kNone_OptimizationFlags) { this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix( "float3x3(float3(0.5, 0.0, 0.0), " "float3(0.0, 1.0, 0.0), " "float3(0.0, 0.0, 1.0))")); } const char* name() const override { return "ConstantMatrixEffect"; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; } std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { class Impl : public GrGLSLFragmentProcessor { void emitCode(EmitArgs& args) override { SkString sample = this->invokeChildWithMatrix(0, args); args.fFragBuilder->codeAppendf("%s = %s;\n", args.fOutputColor, sample.c_str()); } }; return new Impl; } }; // Samples child with a uniform matrix (functionally identical to GrMatrixEffect) // Scales along Y class UniformMatrixEffect : public GrFragmentProcessor { public: static constexpr GrProcessor::ClassID CLASS_ID = (GrProcessor::ClassID) 4; UniformMatrixEffect(std::unique_ptr<GrFragmentProcessor> child) : GrFragmentProcessor(CLASS_ID, kNone_OptimizationFlags) { this->registerChild(std::move(child), SkSL::SampleUsage::UniformMatrix("matrix")); } const char* name() const override { return "UniformMatrixEffect"; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; } std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { class Impl : public GrGLSLFragmentProcessor { void emitCode(EmitArgs& args) override { fMatrixVar = args.fUniformHandler->addUniform(&args.fFp, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrix"); SkString sample = this->invokeChildWithMatrix(0, args); args.fFragBuilder->codeAppendf("%s = %s;\n", args.fOutputColor, sample.c_str()); } void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& proc) override { pdman.setSkMatrix(fMatrixVar, SkMatrix::Scale(1, 0.5f)); } UniformHandle fMatrixVar; }; return new Impl; } }; // Samples child with a variable matrix // Translates along X // Typically, kVariable would be due to multiple sample(matrix) invocations, but this artificially // uses kVariable with a single (constant) matrix. class VariableMatrixEffect : public GrFragmentProcessor { public: static constexpr GrProcessor::ClassID CLASS_ID = (GrProcessor::ClassID) 5; VariableMatrixEffect(std::unique_ptr<GrFragmentProcessor> child) : GrFragmentProcessor(CLASS_ID, kNone_OptimizationFlags) { this->registerChild(std::move(child), SkSL::SampleUsage::VariableMatrix()); } const char* name() const override { return "VariableMatrixEffect"; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; } std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { class Impl : public GrGLSLFragmentProcessor { void emitCode(EmitArgs& args) override { SkString sample = this->invokeChildWithMatrix( 0, args, "float3x3(1, 0, 0, 0, 1, 0, 8, 0, 1)"); args.fFragBuilder->codeAppendf("%s = %s;\n", args.fOutputColor, sample.c_str()); } }; return new Impl; } }; // Samples child with explicit coords // Translates along Y class ExplicitCoordEffect : public GrFragmentProcessor { public: static constexpr GrProcessor::ClassID CLASS_ID = (GrProcessor::ClassID) 6; ExplicitCoordEffect(std::unique_ptr<GrFragmentProcessor> child) : GrFragmentProcessor(CLASS_ID, kNone_OptimizationFlags) { this->registerChild(std::move(child), SkSL::SampleUsage::Explicit()); this->setUsesSampleCoordsDirectly(); } const char* name() const override { return "ExplicitCoordEffect"; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; } std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { class Impl : public GrGLSLFragmentProcessor { void emitCode(EmitArgs& args) override { args.fFragBuilder->codeAppendf("float2 coord = %s + float2(0, 8);", args.fSampleCoord); SkString sample = this->invokeChild(0, args, "coord"); args.fFragBuilder->codeAppendf("%s = %s;\n", args.fOutputColor, sample.c_str()); } }; return new Impl; } }; // Generates test pattern class TestPatternEffect : public GrFragmentProcessor { public: static constexpr GrProcessor::ClassID CLASS_ID = (GrProcessor::ClassID) 7; TestPatternEffect() : GrFragmentProcessor(CLASS_ID, kNone_OptimizationFlags) { this->setUsesSampleCoordsDirectly(); } const char* name() const override { return "TestPatternEffect"; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor& that) const override { return this == &that; } std::unique_ptr<GrFragmentProcessor> clone() const override { return nullptr; } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { class Impl : public GrGLSLFragmentProcessor { void emitCode(EmitArgs& args) override { auto fb = args.fFragBuilder; fb->codeAppendf("float2 coord = %s / 64.0;", args.fSampleCoord); fb->codeAppendf("coord = floor(coord * 4) / 3;"); fb->codeAppendf("%s = half4(half2(coord.rg), 0, 1);\n", args.fOutputColor); } }; return new Impl; } }; SkBitmap make_test_bitmap() { SkBitmap bitmap; bitmap.allocN32Pixels(64, 64); SkCanvas canvas(bitmap); SkFont font(ToolUtils::create_portable_typeface()); const char* alpha = "ABCDEFGHIJKLMNOP"; for (int i = 0; i < 16; ++i) { int tx = i % 4, ty = i / 4; int x = tx * 16, y = ty * 16; SkPaint paint; paint.setColor4f({ tx / 3.0f, ty / 3.0f, 0.0f, 1.0f }); canvas.drawRect(SkRect::MakeXYWH(x, y, 16, 16), paint); paint.setColor4f({ (3-tx) / 3.0f, (3-ty)/3.0f, 1.0f, 1.0f }); canvas.drawSimpleText(alpha + i, 1, SkTextEncoding::kUTF8, x + 3, y + 13, font, paint); } return bitmap; } enum EffectType { kConstant, kUniform, kVariable, kExplicit, }; static std::unique_ptr<GrFragmentProcessor> wrap(std::unique_ptr<GrFragmentProcessor> fp, EffectType effectType) { switch (effectType) { case kConstant: return std::unique_ptr<GrFragmentProcessor>(new ConstantMatrixEffect(std::move(fp))); case kUniform: return std::unique_ptr<GrFragmentProcessor>(new UniformMatrixEffect(std::move(fp))); case kVariable: return std::unique_ptr<GrFragmentProcessor>(new VariableMatrixEffect(std::move(fp))); case kExplicit: return std::unique_ptr<GrFragmentProcessor>(new ExplicitCoordEffect(std::move(fp))); } SkUNREACHABLE; } DEF_SIMPLE_GPU_GM(fp_sample_chaining, ctx, rtCtx, canvas, 380, 306) { SkBitmap bmp = make_test_bitmap(); GrBitmapTextureMaker maker(ctx, bmp, GrImageTexGenPolicy::kDraw); int x = 10, y = 10; auto nextCol = [&] { x += (64 + 10); }; auto nextRow = [&] { x = 10; y += (64 + 10); }; auto draw = [&](std::initializer_list<EffectType> effects) { // Enable TestPatternEffect to get a fully procedural inner effect. It's not quite as nice // visually (no text labels in each box), but it avoids the extra GrMatrixEffect. // Switching it on actually triggers *more* shader compilation failures. #if 0 auto fp = std::unique_ptr<GrFragmentProcessor>(new TestPatternEffect()); #else auto view = maker.view(GrMipMapped::kNo); auto fp = GrTextureEffect::Make(std::move(view), maker.alphaType()); #endif for (EffectType effectType : effects) { fp = wrap(std::move(fp), effectType); } GrPaint paint; paint.addColorFragmentProcessor(std::move(fp)); rtCtx->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::Translate(x, y), SkRect::MakeIWH(64, 64)); nextCol(); }; // Reminder, in every case, the chain is more complicated than it seems, because the // GrTextureEffect is wrapped in a GrMatrixEffect, which is subject to the same bugs that // we're testing (particularly the bug about owner/base in UniformMatrixEffect). // First row: no transform, then each one independently applied draw({}); // Identity (4 rows and columns) draw({ kConstant }); // Scale X axis by 2x (2 visible columns) draw({ kUniform }); // Scale Y axis by 2x (2 visible rows) draw({ kVariable }); // Translate left by 8px draw({ kExplicit }); // Translate up by 8px nextRow(); // Second row: transform duplicated draw({ kConstant, kUniform }); // Scale XY by 2x (2 rows and columns) draw({ kConstant, kConstant }); // Scale X axis by 4x (1 visible column) draw({ kUniform, kUniform }); // Scale Y axis by 4x (1 visible row) draw({ kVariable, kVariable }); // Translate left by 16px draw({ kExplicit, kExplicit }); // Translate up by 16px nextRow(); // Remember, these are applied inside out: draw({ kConstant, kExplicit }); // Scale X by 2x and translate up by 8px draw({ kConstant, kVariable }); // Scale X by 2x and translate left by 8px draw({ kUniform, kVariable }); // Scale Y by 2x and translate left by 8px draw({ kUniform, kExplicit }); // Scale Y by 2x and translate up by 8px draw({ kVariable, kExplicit }); // Translate left and up by 8px nextRow(); draw({ kExplicit, kExplicit, kConstant }); // Scale X by 2x and translate up by 16px draw({ kVariable, kConstant }); // Scale X by 2x and translate left by 16px draw({ kVariable, kVariable, kUniform }); // Scale Y by 2x and translate left by 16px draw({ kExplicit, kUniform }); // Scale Y by 2x and translate up by 16px draw({ kExplicit, kUniform, kVariable, kConstant }); // Scale XY by 2x and translate xy 16px } const char* gConstantMatrixSkSL = R"( in shader child; void main(float2 xy, inout half4 color) { color = sample(child, float3x3(0.5, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)); } )"; const char* gUniformMatrixSkSL = R"( in shader child; uniform float3x3 matrix; void main(float2 xy, inout half4 color) { color = sample(child, matrix); } )"; // This form (uniform * constant) is currently detected as variable, thanks to our limited analysis // when scanning for sample matrices. With that pulled into a separate local, it's highly unlikely // we'll ever treat this as anything else. const char* gVariableMatrixSkSL = R"( in shader child; uniform float3x3 matrix; void main(float2 xy, inout half4 color) { float3x3 varMatrix = matrix * 0.5; color = sample(child, varMatrix); } )"; const char* gExplicitCoordSkSL = R"( in shader child; void main(float2 xy, inout half4 color) { color = sample(child, xy + float2(0, 8)); } )"; // Version of fp_sample_chaining that uses SkRuntimeEffect DEF_SIMPLE_GM(sksl_sample_chaining, canvas, 380, 306) { SkBitmap bmp = make_test_bitmap(); sk_sp<SkRuntimeEffect> effects[4] = { std::get<0>(SkRuntimeEffect::Make(SkString(gConstantMatrixSkSL))), std::get<0>(SkRuntimeEffect::Make(SkString(gUniformMatrixSkSL))), std::get<0>(SkRuntimeEffect::Make(SkString(gVariableMatrixSkSL))), std::get<0>(SkRuntimeEffect::Make(SkString(gExplicitCoordSkSL))), }; canvas->translate(10, 10); canvas->save(); auto nextCol = [&] { canvas->translate(64 + 10, 0); }; auto nextRow = [&] { canvas->restore(); canvas->translate(0, 64 + 10); canvas->save(); }; auto draw = [&](std::initializer_list<EffectType> effectTypes) { auto shader = bmp.makeShader(); for (EffectType effectType : effectTypes) { SkRuntimeShaderBuilder builder(effects[effectType]); builder.child("child") = shader; switch (effectType) { case kUniform: builder.input("matrix") = SkMatrix::Scale(1.0f, 0.5f); break; case kVariable: builder.input("matrix") = SkMatrix::Translate(8, 0); break; default: break; } shader = builder.makeShader(nullptr, true); } SkPaint paint; paint.setShader(shader); canvas->drawRect(SkRect::MakeWH(64, 64), paint); nextCol(); }; // Reminder, in every case, the chain is more complicated than it seems, because the // GrTextureEffect is wrapped in a GrMatrixEffect, which is subject to the same bugs that // we're testing (particularly the bug about owner/base in UniformMatrixEffect). // First row: no transform, then each one independently applied draw({}); // Identity (4 rows and columns) draw({ kConstant }); // Scale X axis by 2x (2 visible columns) draw({ kUniform }); // Scale Y axis by 2x (2 visible rows) draw({ kVariable }); // Translate left by 8px draw({ kExplicit }); // Translate up by 8px nextRow(); // Second row: transform duplicated draw({ kConstant, kUniform }); // Scale XY by 2x (2 rows and columns) draw({ kConstant, kConstant }); // Scale X axis by 4x (1 visible column) draw({ kUniform, kUniform }); // Scale Y axis by 4x (1 visible row) draw({ kVariable, kVariable }); // Translate left by 16px draw({ kExplicit, kExplicit }); // Translate up by 16px nextRow(); // Remember, these are applied inside out: draw({ kConstant, kExplicit }); // Scale X by 2x and translate up by 8px draw({ kConstant, kVariable }); // Scale X by 2x and translate left by 8px draw({ kUniform, kVariable }); // Scale Y by 2x and translate left by 8px draw({ kUniform, kExplicit }); // Scale Y by 2x and translate up by 8px draw({ kVariable, kExplicit }); // Translate left and up by 8px nextRow(); draw({ kExplicit, kExplicit, kConstant }); // Scale X by 2x and translate up by 16px draw({ kVariable, kConstant }); // Scale X by 2x and translate left by 16px draw({ kVariable, kVariable, kUniform }); // Scale Y by 2x and translate left by 16px draw({ kExplicit, kUniform }); // Scale Y by 2x and translate up by 16px draw({ kExplicit, kUniform, kVariable, kConstant }); // Scale XY by 2x and translate xy 16px }
[ "skia-commit-bot@chromium.org" ]
skia-commit-bot@chromium.org
fabfff14529600da1b9673e9b6701ddaf4b9460f
8de76d892940f42673e3bac14046482f206dbb6f
/src/Difficulty.cpp
8f901e2fb78d9dc0e5243406a2dac30e9ecc4992
[ "MIT" ]
permissive
vcahlik/pa2-pacman
229c09cf1641dfc715bc432e6cb603d10f15625a
511b4585a136508ddfacceca08b887cb512517c1
refs/heads/master
2021-05-26T07:22:00.674091
2021-01-04T09:43:56
2021-01-04T09:43:56
127,897,736
1
0
null
null
null
null
UTF-8
C++
false
false
1,485
cpp
#include <stdexcept> #include "Difficulty.h" #include "Config.h" Difficulty::Difficulty(const Level level) { ghostBaseSpeed = Config::PLAYER_BASE_SPEED; ghostFrightenedDurationMsecs = Config::GHOST_FRIGHTENED_DEFAULT_DURATION_MSECS; switch (level) { case Level::Level1: ghostBaseSpeed *= 0.6; ghostFrightenedDurationMsecs *= 2; initialRemainingLives = 4; break; case Level::Level2: ghostBaseSpeed *= 0.7; ghostFrightenedDurationMsecs *= 1.5; initialRemainingLives = 3; break; case Level::Level3: ghostBaseSpeed *= 0.8; ghostFrightenedDurationMsecs *= 1; initialRemainingLives = 2; break; case Level::Level4: ghostBaseSpeed *= 0.9; ghostFrightenedDurationMsecs *= 0.8; initialRemainingLives = 1; break; case Level::Level5: ghostBaseSpeed *= 1; ghostFrightenedDurationMsecs *= 0.5; initialRemainingLives = 0; break; default: throw std::logic_error("level not handled"); } } const double Difficulty::getGhostBaseSpeed() const { return ghostBaseSpeed; } const uint32_t Difficulty::getGhostFrightenedDurationMsecs() const { return ghostFrightenedDurationMsecs; } const uint32_t Difficulty::getInitialRemainingLives() const { return initialRemainingLives; }
[ "vojtech.cahlik@gmail.com" ]
vojtech.cahlik@gmail.com
e1d46d5c07a1170e0ec13390c3deeb9f4c4e698c
e2d709a6005a8dcd1eb0de818260be0d7b8fa6a2
/include/okapi/api/chassis/controller/chassisControllerPid.hpp
0a23f47455c9dfb858c457b4def76be17b86cf39
[]
no_license
sealj553/VexV5NanoboyAdvance
ea33ceea18b84231a0e7ea581e05e7f639a1f2f1
d11f44fba95d16fcb0f8fe8cfae22318e6ce9cbb
refs/heads/master
2020-04-01T15:51:14.815109
2018-10-20T05:38:57
2018-10-20T05:38:57
153,354,793
11
0
null
null
null
null
UTF-8
C++
false
false
4,719
hpp
/** * @author Ryan Benasutti, WPI * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef _OKAPI_CHASSISCONTROLLERPID_HPP_ #define _OKAPI_CHASSISCONTROLLERPID_HPP_ #include "okapi/api/chassis/controller/chassisController.hpp" #include "okapi/api/control/iterative/iterativePosPidController.hpp" #include "okapi/api/util/abstractRate.hpp" #include "okapi/api/util/logging.hpp" #include "okapi/api/util/timeUtil.hpp" #include <atomic> #include <memory> namespace okapi { class ChassisControllerPID : public virtual ChassisController { public: /** * ChassisController using PID control. Puts the motors into encoder degree units. Throws a * std::invalid_argument exception if the gear ratio is zero. * * @param imodelArgs ChassisModelArgs * @param idistanceController distance PID controller * @param iangleController angle PID controller (keeps the robot straight) * @param igearset motor internal gearset and gear ratio * @param iscales see ChassisScales docs */ ChassisControllerPID(const TimeUtil &itimeUtil, std::shared_ptr<ChassisModel> imodel, std::unique_ptr<IterativePosPIDController> idistanceController, std::unique_ptr<IterativePosPIDController> iangleController, std::unique_ptr<IterativePosPIDController> iturnController, AbstractMotor::GearsetRatioPair igearset = AbstractMotor::gearset::red, const ChassisScales &iscales = ChassisScales({1, 1})); ChassisControllerPID(ChassisControllerPID &&other) noexcept; ~ChassisControllerPID() override; /** * Drives the robot straight for a distance (using closed-loop control). * * @param itarget distance to travel */ void moveDistance(QLength itarget) override; /** * Drives the robot straight for a distance (using closed-loop control). * * @param itarget distance to travel in motor degrees */ void moveDistance(double itarget) override; /** * Sets the target distance for the robot to drive straight (using closed-loop control). * * @param itarget distance to travel */ void moveDistanceAsync(QLength itarget) override; /** * Sets the target distance for the robot to drive straight (using closed-loop control). * * @param itarget distance to travel in motor degrees */ void moveDistanceAsync(double itarget) override; /** * Turns the robot clockwise in place (using closed-loop control). * * @param idegTarget angle to turn for */ void turnAngle(QAngle idegTarget) override; /** * Turns the robot clockwise in place (using closed-loop control). * * @param idegTarget angle to turn for in motor degrees */ void turnAngle(double idegTarget) override; /** * Sets the target angle for the robot to turn clockwise in place (using closed-loop control). * * @param idegTarget angle to turn for */ void turnAngleAsync(QAngle idegTarget) override; /** * Sets the target angle for the robot to turn clockwise in place (using closed-loop control). * * @param idegTarget angle to turn for in motor degrees */ void turnAngleAsync(double idegTarget) override; /** * Delays until the currently executing movement completes. */ void waitUntilSettled() override; /** * Stop the robot (set all the motors to 0). */ void stop() override; /** * Starts the internal thread. This should not be called by normal users. This method is called * by the ChassisControllerFactory when making a new instance of this class. */ void startThread(); /** * Get the ChassisScales. */ ChassisScales getChassisScales() const override; /** * Get the GearsetRatioPair. */ AbstractMotor::GearsetRatioPair getGearsetRatioPair() const override; protected: Logger *logger; std::unique_ptr<AbstractRate> rate; std::unique_ptr<IterativePosPIDController> distancePid; std::unique_ptr<IterativePosPIDController> anglePid; std::unique_ptr<IterativePosPIDController> turnPid; ChassisScales scales; AbstractMotor::GearsetRatioPair gearsetRatioPair; std::atomic_bool doneLooping{true}; std::atomic_bool newMovement{false}; std::atomic_bool dtorCalled{false}; static void trampoline(void *context); void loop(); bool waitForDistanceSettled(); bool waitForAngleSettled(); void stopAfterSettled(); typedef enum { distance, angle, none } modeType; modeType mode{none}; CrossplatformThread *task{nullptr}; }; } // namespace okapi #endif
[ "sealj553@gmail.com" ]
sealj553@gmail.com
658ba10a326f3f26dd7a402fb4da8a8a5e65c423
8afb5afd38548c631f6f9536846039ef6cb297b9
/_REPO/MICROSOFT/cocos2d-x/cocos/editor-support/cocostudio/CCActionManagerEx.h
772497bf15ce2315ad07696cec6e89be38c7b8e9
[ "MIT" ]
permissive
bgoonz/UsefulResourceRepo2.0
d87588ffd668bb498f7787b896cc7b20d83ce0ad
2cb4b45dd14a230aa0e800042e893f8dfb23beda
refs/heads/master
2023-03-17T01:22:05.254751
2022-08-11T03:18:22
2022-08-11T03:18:22
382,628,698
10
12
MIT
2022-10-10T14:13:54
2021-07-03T13:58:52
null
UTF-8
C++
false
false
3,794
h
/**************************************************************************** Copyright (c) 2013-2017 Chukong Technologies Inc. http://www.cocos2d-x.org 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 __ActionMANAGER_H__ #define __ActionMANAGER_H__ #include "editor-support/cocostudio/CCActionObject.h" #include "editor-support/cocostudio/DictionaryHelper.h" #include "editor-support/cocostudio/CocosStudioExport.h" namespace cocostudio { class CocoLoader; struct stExpCocoNode; class CC_STUDIO_DLL ActionManagerEx:public cocos2d::Ref { public: /** * Default constructor * @js ctor */ ActionManagerEx(); /** * Default destructor * @js NA * @lua NA */ virtual ~ActionManagerEx(); /** * Gets the static instance of ActionManager. * @js getInstance * @lua getInstance */ static ActionManagerEx* getInstance(); /** * Purges ActionManager point. * @js purge * @lua destroyActionManager */ static void destroyInstance(); /** * Gets an ActionObject with a name. * * @param jsonName UI file name * * @param actionName action name in the UI file. * * @return ActionObject which named as the param name */ ActionObject* getActionByName(const char* jsonName,const char* actionName); /** * Play an Action with a name. * * @param jsonName UI file name * * @param actionName action name in the UIfile. * * @return ActionObject which named as the param name */ ActionObject* playActionByName(const char* jsonName,const char* actionName); /** * Play an Action with a name. * * @param jsonName UI file name * * @param actionName action name in the UIfile. * * @param func ui action call back */ ActionObject* playActionByName(const char* jsonName,const char* actionName, cocos2d::CallFunc* func); /** * Stop an Action with a name. * * @param jsonName UI file name * * @param actionName action name in the UIfile. * * @return ActionObject which named as the param name */ ActionObject* stopActionByName(const char* jsonName,const char* actionName); /*init properties with json dictionary*/ void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Ref* root, int version = 1600); void initWithBinary(const char* file, Ref* root, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode); /** * Release all actions. * */ void releaseActions(); int getStudioVersionNumber() const; protected: std::unordered_map<std::string, cocos2d::Vector<ActionObject*>> _actionDic; int _studioVersionNumber; }; } #endif
[ "bryan.guner@gmail.com" ]
bryan.guner@gmail.com
4cdcd6b4237a5aa5527fba8435c344cec1fd23d1
03c7cf7a57a1a26bb21e0184642f0a5c8b0336ae
/Release/gen/webcore/bindings/V8SQLTransactionErrorCallback.cpp
32377624f8f2e3dd8b30ee17b96c8d32e3e82898
[]
no_license
sanyaade-embedded-systems/armhf-node-webkit
eb38a2a34e833310ee477592028905fd00a86e5a
5bc4509c0e19cce1a64b7cab4f92f91edfa17944
refs/heads/master
2020-12-30T19:11:15.189923
2013-03-16T14:29:23
2013-03-16T14:29:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,336
cpp
/* This file is part of the WebKit open source project. This file has been generated by generate-bindings.pl. DO NOT MODIFY! This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "V8SQLTransactionErrorCallback.h" #if ENABLE(SQL_DATABASE) #include "ScriptExecutionContext.h" #include "V8Binding.h" #include "V8Callback.h" #include "V8SQLError.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> #include <wtf/Assertions.h> namespace WebCore { V8SQLTransactionErrorCallback::V8SQLTransactionErrorCallback(v8::Handle<v8::Object> callback, ScriptExecutionContext* context) : ActiveDOMCallback(context) , m_callback(callback) , m_worldContext(UseCurrentWorld) { } V8SQLTransactionErrorCallback::~V8SQLTransactionErrorCallback() { } // Functions bool V8SQLTransactionErrorCallback::handleEvent(SQLError* error) { if (!canInvokeCallback()) return true; v8::HandleScope handleScope; v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext); if (v8Context.IsEmpty()) return true; v8::Context::Scope scope(v8Context); v8::Handle<v8::Value> errorHandle = toV8(error); if (errorHandle.IsEmpty()) { if (!isScriptControllerTerminating()) CRASH(); return true; } v8::Handle<v8::Value> argv[] = { errorHandle }; bool callbackReturnValue = false; return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext()); } } // namespace WebCore #endif // ENABLE(SQL_DATABASE)
[ "marian.such@ackee.cz" ]
marian.such@ackee.cz
b10f5717b21029b52c9508c48748355eff6845f9
04b1803adb6653ecb7cb827c4f4aa616afacf629
/third_party/blink/renderer/platform/audio/audio_io_callback.h
cb9e87dcaeca4757c590d639a866dd630daecb11
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft" ]
permissive
Samsung/Castanets
240d9338e097b75b3f669604315b06f7cf129d64
4896f732fc747dfdcfcbac3d442f2d2d42df264a
refs/heads/castanets_76_dev
2023-08-31T09:01:04.744346
2021-07-30T04:56:25
2021-08-11T05:45:21
125,484,161
58
49
BSD-3-Clause
2022-10-16T19:31:26
2018-03-16T08:07:37
null
UTF-8
C++
false
false
2,988
h
/* * Copyright (C) 2012 Google Inc. 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 Apple Computer, Inc. ("Apple") 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 APPLE 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 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. */ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_AUDIO_AUDIO_IO_CALLBACK_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_AUDIO_AUDIO_IO_CALLBACK_H_ #include "base/time/time.h" namespace blink { class AudioBus; // For the calculation of "render capacity". The render capacity can be // calculated by dividing |render_duration| by |callback_interval|. struct AudioIOCallbackMetric { // The time interval in seconds between the onset of previous callback // function and the current one. double callback_interval; // The time duration spent on rendering render quanta (i.e. batch pulling of // audio graph) per a device callback request. double render_duration; }; struct AudioIOPosition { // Audio stream position in seconds. double position; // System timestamp in seconds corresponding to the contained |position| // value. double timestamp; }; // Abstract base-class for isochronous audio I/O client. class AudioIOCallback { public: // Called periodically to get the next render quantum of audio into // |destination_bus|. virtual void Render(AudioBus* destination_bus, uint32_t frames_to_process, const AudioIOPosition& output_position, const AudioIOCallbackMetric& metric) = 0; virtual ~AudioIOCallback() = default; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_AUDIO_AUDIO_IO_CALLBACK_H_
[ "sunny.nam@samsung.com" ]
sunny.nam@samsung.com
ba449a9fe1b31be52650e846dc989051ce866e15
1fa6620e50dcc759e561904b0890c2f436b432fb
/OccFaceDetectFromSensor/main.cpp
51f6540f9cec635b9e9cc0b61037bd581b26d38f
[]
no_license
brycezou/GroceryProjects
ee3f31a2f3538d45370a964c14d9f33fa093af6a
acd8d390692d42a648e6493cf1f7d3ebee124089
refs/heads/master
2021-08-10T09:21:27.005941
2017-11-12T12:59:05
2017-11-12T12:59:05
110,268,793
0
0
null
null
null
null
GB18030
C++
false
false
9,010
cpp
#include <Windows.h> #include "obtainForegroundMask.h" #include "FourierTransform.h" #include "LocateHeadRegion.h" #include "registerColor2Depth.h" #include "FindContours.h" #include "GetHeadRegionRect.h" #include <fstream> #include "svm.h" #include "KinectConnector.h" using namespace std; //在深度图像depthIpl和配准后的彩色图像regColorIpl上 //标记出人脸区域headRect //说明:直接在原图上标记 void showHeadRectResult(IplImage *depthIpl, IplImage *regColorIpl, CvRect &headRect) { cvRectangle(depthIpl, cvPoint(2*headRect.x, 2*headRect.y), cvPoint(2*(headRect.x+headRect.width), 2*(headRect.y+headRect.height)), CV_RGB(0,0,128), 2); cvShowImage("深度人头定位结果", depthIpl); cvRectangle(regColorIpl, cvPoint(2*headRect.x, 2*headRect.y), cvPoint(2*(headRect.x+headRect.width), 2*(headRect.y+headRect.height)), CV_RGB(255,0,0), 2); cvShowImage("彩色人头定位结果", regColorIpl); } //缩放输入图像src至新的尺寸 //缩放后的宽度为newWidth //缩放后的高度为newHeight //说明:会返回新的图像 IplImage* resizeInputImage(IplImage *src, int newWidth, int newHeight) { IplImage *newSizeImg = cvCreateImage(cvSize(newWidth, newHeight), src->depth, src->nChannels); cvResize(src, newSizeImg, CV_INTER_LINEAR); return newSizeImg; } //在48x56的人脸区域上预定义的区域 CvRect EYES_RECT = cvRect(6, 16, 36, 16); //眼睛区域 CvRect NOSE_RECT = cvRect(6, 24, 36, 16); //鼻子区域 CvRect MOUTH_RECT = cvRect(6, 32, 36, 16); //嘴巴区域 CvRect CHIN_RECT = cvRect(6, 48, 36, 8); //下巴区域 //高级人脸分块的特征向量 //彩色图像的彩色直方图, 彩色图像的灰度直方图 //彩色图像的Haar特征, 深度图像的Haar特征 int f_vc[4172]; //得到图像color_img的彩色直方图(每个通道取16级灰度), 保存在f_vc数组的[0:4095]位 //和灰度直方图(64级灰度), 保存在f_vc数组的[4096:4159]位 void getColorAndGrayHistogram(IplImage *color_img) { memset(f_vc, 0, sizeof(int)*4172); for (int i = 0; i < color_img->height; i++) { for (int j = 0; j < color_img->width; j++) { int rr = ((uchar*)(color_img->imageData+i*color_img->widthStep))[j*color_img->nChannels+0]; int gg = ((uchar*)(color_img->imageData+i*color_img->widthStep))[j*color_img->nChannels+1]; int bb = ((uchar*)(color_img->imageData+i*color_img->widthStep))[j*color_img->nChannels+2]; f_vc[rr/16*256+gg/16*16+bb/16]++; //统计彩色直方图 [0:4095] f_vc[((int)(0.30*rr+0.59*gg+0.11*bb))/4+4096]++; //统计灰度直方图 [4096:4159] } } } struct svm_model* eyes_model; struct svm_model* nose_model; struct svm_model* mouth_model; int EYES_PREDICT; int NOSE_PREDICT; int MOUTH_PREDICT; int predictOcclusionByColor(IplImage *color_roi) { //预测眼睛区域 cvSetImageROI(color_roi, EYES_RECT); getColorAndGrayHistogram(color_roi); //svm节点(index:value) struct svm_node *eyes_node = (struct svm_node *) malloc(4173*sizeof(struct svm_node)); for (int i = 0; i < 4172; i++) { eyes_node[i].index = i+1; eyes_node[i].value = f_vc[i]; } eyes_node[4172].index = -1; int eyes_predict = (int)svm_predict(eyes_model, eyes_node); free(eyes_node); cvResetImageROI(color_roi); //预测鼻子区域 cvSetImageROI(color_roi, NOSE_RECT); getColorAndGrayHistogram(color_roi); struct svm_node *nose_node = (struct svm_node *) malloc(4173*sizeof(struct svm_node)); for (int i = 0; i < 4172; i++) { nose_node[i].index = i+1; nose_node[i].value = f_vc[i]; } nose_node[4172].index = -1; int nose_predict = (int)svm_predict(nose_model, nose_node); free(nose_node); cvResetImageROI(color_roi); //预测嘴巴区域 cvSetImageROI(color_roi, MOUTH_RECT); getColorAndGrayHistogram(color_roi); struct svm_node *mouth_node = (struct svm_node *) malloc(4173*sizeof(struct svm_node)); for (int i = 0; i < 4172; i++) { mouth_node[i].index = i+1; mouth_node[i].value = f_vc[i]; } mouth_node[4172].index = -1; int mouth_predict = (int)svm_predict(mouth_model, mouth_node); free(mouth_node); cvResetImageROI(color_roi); EYES_PREDICT = eyes_predict; NOSE_PREDICT = nose_predict; MOUTH_PREDICT = mouth_predict; cout<<eyes_predict<<", "<<nose_predict<<", "<<mouth_predict<<endl; return eyes_predict+nose_predict+mouth_predict; } int predictOcclution(IplImage *depthIpl, IplImage *regColorIpl, CvRect &headRect) { //获得人脸感兴趣区域 CvRect rect_roi = cvRect(2*headRect.x, 2*headRect.y, 2*headRect.width, 2*headRect.height); //将深度人脸图像缩放到48*56像素 cvSetImageROI(depthIpl, rect_roi); IplImage *depth_roi = resizeInputImage(depthIpl, 48, 56); cvResetImageROI(depthIpl); //将彩色人脸图像缩放到48*56像素 cvSetImageROI(regColorIpl, rect_roi); IplImage *color_roi = resizeInputImage(regColorIpl, 48, 56); cvResetImageROI(regColorIpl); int res = predictOcclusionByColor(color_roi); cvReleaseImage(&color_roi); cvReleaseImage(&depth_roi); return res; } bool gbExit = false; DWORD WINAPI handleThread(LPVOID lpParam) { gbExit = false; //定义和创建读取下一帧的信号事件句柄,控制KINECT是否可以开始读取下一帧深度数据 HANDLE depthEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); //定义和创建读取下一帧的信号事件句柄,控制KINECT是否可以开始读取下一帧彩色数据 HANDLE colorEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); //保存深度图像数据流的句柄,用以提取数据 HANDLE depthStreamHandle = NULL; //保存彩色图像数据流的句柄,用以提取数据 HANDLE colorStreamHandle = NULL; if(!InitializeKinect(depthEvent, depthStreamHandle, colorEvent, colorStreamHandle)) { gbExit = true; return -1; } //加载SVM模型文件 cout<<"loading svm model ..."<<endl; eyes_model = svm_load_model("eyes.model"); nose_model = svm_load_model("nose.model"); mouth_model = svm_load_model("mouth.model"); cout<<"svm model loaded"<<endl; //定义和初始化深度图像 Mat depthMat(480, 640, CV_8UC1); IplImage *depthIpl = cvCreateImage(cvSize(640, 480), 8, 1); //定义和初始化彩色图像 Mat colorMat(480, 640, CV_8UC3); IplImage *colorIpl = cvCreateImage(cvSize(640, 480), 8, 3); IplImage *depth2show = NULL; IplImage *color2show = NULL; char sResultTxtOut[10]; char sDetalResult[10]; CvRect headRect; //将结果保存到视频文件中 //CvVideoWriter *writer = cvCreateVideoWriter("test.avi",CV_FOURCC('M','J','P','G'), 20, cvGetSize(colorIpl)); while(true) { // 无限等待新的数据,等到后WaitForSingleObject为0,则返回 if(WAIT_OBJECT_0 == WaitForSingleObject(depthEvent, INFINITE)) { if (WAIT_OBJECT_0 == WaitForSingleObject(colorEvent, INFINITE)) { if(getDepthImage(depthEvent, depthStreamHandle, depthMat)) { if (getColorImage(colorEvent, colorStreamHandle, colorMat)) { depthIpl->imageData = (char *)depthMat.data; colorIpl->imageData = (char *)colorMat.data; depth2show = cvCloneImage(depthIpl); IplImage *regColorIpl = GetHeadRegionRect(depthIpl, colorIpl, headRect, false); if (regColorIpl != NULL) { color2show = cvCloneImage(regColorIpl); int res = predictOcclution(depthIpl, regColorIpl, headRect); if(res >= 1) { cout<<"!!!!!!!!!!!!!!!!!!!!Occluded"<<endl; sprintf(sResultTxtOut, "Occluded"); } else { cout<<"-----------------Safe"<<endl; sprintf(sResultTxtOut, "Safe"); } CvFont font; cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX|CV_FONT_ITALIC, 1,1,0,2); sprintf(sDetalResult, "%d, %d, %d", EYES_PREDICT, NOSE_PREDICT, MOUTH_PREDICT); cvPutText(color2show,sDetalResult,cvPoint(10,50),&font,CV_RGB(255,0,0)); cvPutText(color2show,sResultTxtOut,cvPoint(10,100),&font,CV_RGB(255,0,0)); showHeadRectResult(depth2show, color2show, headRect); //cvWriteFrame(writer, color2show); cvReleaseImage(&regColorIpl); cvReleaseImage(&color2show); } cvReleaseImage(&depth2show); if(cvWaitKey(1) == 27) break; } else { NuiShutdown(); if(!InitializeKinect(depthEvent, depthStreamHandle, colorEvent, colorStreamHandle)) { cvReleaseImage(&colorIpl); cvReleaseImage(&depthIpl); gbExit = true; return -1; } } } else { NuiShutdown(); if(!InitializeKinect(depthEvent, depthStreamHandle, colorEvent, colorStreamHandle)) { cvReleaseImage(&colorIpl); cvReleaseImage(&depthIpl); gbExit = true; return -1; } } } } //cvWaitKey(0); if(cvWaitKey(1) == 27) break; //cvReleaseVideoWriter(&writer); } NuiShutdown(); gbExit = true; return 0; } int main(int argc, char **argv) { HANDLE handle = CreateThread(NULL, 0, handleThread, NULL, 0, 0); if(!handle) cout<<"Creating handleThread failed!"<<endl; while (!gbExit) Sleep(100); return 0; }
[ "1574689068@qq.com" ]
1574689068@qq.com
81127547d3ab9b40b03ac350525546f3b0f9145c
6e57bdc0a6cd18f9f546559875256c4570256c45
/external/pdfium/xfa/fxfa/cxfa_ffpageview.cpp
fe1fbb517fb90fc7abceb24648da3d292926a235
[ "BSD-3-Clause" ]
permissive
dongdong331/test
969d6e945f7f21a5819cd1d5f536d12c552e825c
2ba7bcea4f9d9715cbb1c4e69271f7b185a0786e
refs/heads/master
2023-03-07T06:56:55.210503
2020-12-07T04:15:33
2020-12-07T04:15:33
134,398,935
2
1
null
2022-11-21T07:53:41
2018-05-22T10:26:42
null
UTF-8
C++
false
false
15,857
cpp
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "xfa/fxfa/cxfa_ffpageview.h" #include <algorithm> #include <memory> #include <vector> #include "fxjs/xfa/cjx_object.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffcheckbutton.h" #include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/cxfa_ffdocview.h" #include "xfa/fxfa/cxfa_fffield.h" #include "xfa/fxfa/cxfa_ffimageedit.h" #include "xfa/fxfa/cxfa_ffpushbutton.h" #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_traversal.h" #include "xfa/fxfa/parser/cxfa_traverse.h" namespace { CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect, const CFX_Rect& devicePageRect, int32_t iRotate, uint32_t dwCoordinatesType) { ASSERT(iRotate >= 0 && iRotate <= 3); bool bFlipX = (dwCoordinatesType & 0x01) != 0; bool bFlipY = (dwCoordinatesType & 0x02) != 0; CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0); if (iRotate == 0 || iRotate == 2) { m.a *= (float)devicePageRect.width / docPageRect.width; m.d *= (float)devicePageRect.height / docPageRect.height; } else { m.a *= (float)devicePageRect.height / docPageRect.width; m.d *= (float)devicePageRect.width / docPageRect.height; } m.Rotate(iRotate * 1.57079632675f); switch (iRotate) { case 0: m.e = bFlipX ? (float)devicePageRect.right() : (float)devicePageRect.left; m.f = bFlipY ? (float)devicePageRect.bottom() : (float)devicePageRect.top; break; case 1: m.e = bFlipY ? (float)devicePageRect.left : (float)devicePageRect.right(); m.f = bFlipX ? (float)devicePageRect.bottom() : (float)devicePageRect.top; break; case 2: m.e = bFlipX ? (float)devicePageRect.left : (float)devicePageRect.right(); m.f = bFlipY ? (float)devicePageRect.top : (float)devicePageRect.bottom(); break; case 3: m.e = bFlipY ? (float)devicePageRect.right() : (float)devicePageRect.left; m.f = bFlipX ? (float)devicePageRect.top : (float)devicePageRect.bottom(); break; default: break; } return m; } bool PageWidgetFilter(CXFA_FFWidget* pWidget, uint32_t dwFilter, bool bTraversal, bool bIgnorerelevant) { CXFA_Node* pNode = pWidget->GetNode(); if (!!(dwFilter & XFA_WidgetStatus_Focused) && (!pNode || pNode->GetElementType() != XFA_Element::Field)) { return false; } uint32_t dwStatus = pWidget->GetStatus(); if (bTraversal && (dwStatus & XFA_WidgetStatus_Disabled)) return false; if (bIgnorerelevant) return !!(dwStatus & XFA_WidgetStatus_Visible); dwFilter &= (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable); return (dwFilter & dwStatus) == dwFilter; } bool IsLayoutElement(XFA_Element eElement, bool bLayoutContainer) { switch (eElement) { case XFA_Element::Draw: case XFA_Element::Field: case XFA_Element::InstanceManager: return !bLayoutContainer; case XFA_Element::Area: case XFA_Element::Subform: case XFA_Element::ExclGroup: case XFA_Element::SubformSet: case XFA_Element::PageArea: case XFA_Element::Form: return true; default: return false; } } } // namespace CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {} CXFA_FFPageView::~CXFA_FFPageView() {} CXFA_FFDocView* CXFA_FFPageView::GetDocView() const { return m_pDocView.Get(); } CFX_RectF CXFA_FFPageView::GetPageViewRect() const { return CFX_RectF(0, 0, GetPageSize()); } CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const { return GetPageMatrix(CFX_RectF(0, 0, GetPageSize()), rtDisp, iRotate, 0); } std::unique_ptr<IXFA_WidgetIterator> CXFA_FFPageView::CreateWidgetIterator( uint32_t dwTraverseWay, uint32_t dwWidgetFilter) { switch (dwTraverseWay) { case XFA_TRAVERSEWAY_Tranvalse: return pdfium::MakeUnique<CXFA_FFTabOrderPageWidgetIterator>( this, dwWidgetFilter); case XFA_TRAVERSEWAY_Form: return pdfium::MakeUnique<CXFA_FFPageWidgetIterator>(this, dwWidgetFilter); } return nullptr; } CXFA_FFPageWidgetIterator::CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter) : m_pPageView(pPageView), m_dwFilter(dwFilter), m_sIterator(pPageView) { m_bIgnorerelevant = m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() < XFA_VERSION_205; } CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() {} void CXFA_FFPageWidgetIterator::Reset() { m_sIterator.Reset(); } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() { m_sIterator.Reset(); for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem; pLayoutItem = m_sIterator.MoveToNext()) { if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return nullptr; } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() { m_sIterator.SetCurrent(nullptr); return MoveToPrevious(); } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem; pLayoutItem = m_sIterator.MoveToNext()) { if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return nullptr; } CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() { for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem; pLayoutItem = m_sIterator.MoveToPrev()) { if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) { return hWidget; } } return nullptr; } CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() { CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : nullptr; } bool CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) { return hWidget && m_sIterator.SetCurrent(hWidget); } CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget( CXFA_LayoutItem* pLayoutItem) { CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem); if (!pWidget) return nullptr; if (!PageWidgetFilter(pWidget, m_dwFilter, false, m_bIgnorerelevant)) return nullptr; if (!pWidget->IsLoaded() && !!(pWidget->GetStatus() & XFA_WidgetStatus_Visible)) { if (!pWidget->LoadWidget()) return nullptr; } return pWidget; } void CXFA_TabParam::AppendTabParam(CXFA_TabParam* pParam) { m_Children.push_back(pParam->GetWidget()); m_Children.insert(m_Children.end(), pParam->GetChildren().begin(), pParam->GetChildren().end()); } void CXFA_TabParam::ClearChildren() { m_Children.clear(); } CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator( CXFA_FFPageView* pPageView, uint32_t dwFilter) : m_pPageView(pPageView), m_dwFilter(dwFilter), m_iCurWidget(-1) { m_bIgnorerelevant = m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() < XFA_VERSION_205; Reset(); } CXFA_FFTabOrderPageWidgetIterator::~CXFA_FFTabOrderPageWidgetIterator() {} void CXFA_FFTabOrderPageWidgetIterator::Reset() { CreateTabOrderWidgetArray(); m_iCurWidget = -1; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { for (int32_t i = 0; i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) { if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true, m_bIgnorerelevant)) { m_iCurWidget = i; return m_TabOrderWidgetArray[m_iCurWidget]; } } return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() { for (int32_t i = pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1; i >= 0; i--) { if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true, m_bIgnorerelevant)) { m_iCurWidget = i; return m_TabOrderWidgetArray[m_iCurWidget]; } } return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() { for (int32_t i = m_iCurWidget + 1; i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) { if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true, m_bIgnorerelevant)) { m_iCurWidget = i; return m_TabOrderWidgetArray[m_iCurWidget]; } } m_iCurWidget = -1; return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() { for (int32_t i = m_iCurWidget - 1; i >= 0; i--) { if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true, m_bIgnorerelevant)) { m_iCurWidget = i; return m_TabOrderWidgetArray[m_iCurWidget]; } } m_iCurWidget = -1; return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() { return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget] : nullptr; } bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget( CXFA_FFWidget* hWidget) { auto it = std::find(m_TabOrderWidgetArray.begin(), m_TabOrderWidgetArray.end(), hWidget); if (it == m_TabOrderWidgetArray.end()) return false; m_iCurWidget = it - m_TabOrderWidgetArray.begin(); return true; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( CXFA_FFWidget* pWidget) { CXFA_Traversal* pTraversal = pWidget->GetNode()->GetChild<CXFA_Traversal>( 0, XFA_Element::Traversal, false); if (pTraversal) { CXFA_Traverse* pTraverse = pTraversal->GetChild<CXFA_Traverse>(0, XFA_Element::Traverse, false); if (pTraverse) { Optional<WideString> traverseWidgetName = pTraverse->JSObject()->TryAttribute(XFA_Attribute::Ref, true); if (traverseWidgetName) return FindWidgetByName(*traverseWidgetName, pWidget); } } return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName( const WideString& wsWidgetName, CXFA_FFWidget* pRefWidget) { return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget); } void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() { m_TabOrderWidgetArray.clear(); std::vector<CXFA_FFWidget*> SpaceOrderWidgetArray; CreateSpaceOrderWidgetArray(&SpaceOrderWidgetArray); if (SpaceOrderWidgetArray.empty()) return; int32_t nWidgetCount = pdfium::CollectionSize<int32_t>(SpaceOrderWidgetArray); CXFA_FFWidget* hWidget = SpaceOrderWidgetArray[0]; while (pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) < nWidgetCount) { if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) { m_TabOrderWidgetArray.push_back(hWidget); CXFA_WidgetAcc* pWidgetAcc = hWidget->GetNode()->GetWidgetAcc(); if (pWidgetAcc->GetUIType() == XFA_Element::ExclGroup) { auto it = std::find(SpaceOrderWidgetArray.begin(), SpaceOrderWidgetArray.end(), hWidget); int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end() ? it - SpaceOrderWidgetArray.begin() + 1 : 0; while (true) { CXFA_FFWidget* radio = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount]; if (radio->GetNode()->GetExclGroupIfExists() != pWidgetAcc->GetNode()) break; if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) m_TabOrderWidgetArray.push_back(radio); iWidgetIndex++; } } if (CXFA_FFWidget* hTraverseWidget = GetTraverseWidget(hWidget)) { hWidget = hTraverseWidget; continue; } } auto it = std::find(SpaceOrderWidgetArray.begin(), SpaceOrderWidgetArray.end(), hWidget); int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end() ? it - SpaceOrderWidgetArray.begin() + 1 : 0; hWidget = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount]; } } void CXFA_FFTabOrderPageWidgetIterator::OrderContainer( CXFA_LayoutItemIterator* sIterator, CXFA_LayoutItem* pContainerItem, CXFA_TabParam* pContainer, bool& bCurrentItem, bool& bContentArea, bool bMarsterPage) { std::vector<std::unique_ptr<CXFA_TabParam>> tabParams; CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext(); while (pSearchItem) { if (!pSearchItem->IsContentLayoutItem()) { bContentArea = true; pSearchItem = sIterator->MoveToNext(); continue; } if (bMarsterPage && bContentArea) { break; } if (bMarsterPage || bContentArea) { CXFA_FFWidget* hWidget = GetWidget(pSearchItem); if (!hWidget) { pSearchItem = sIterator->MoveToNext(); continue; } if (pContainerItem && (pSearchItem->GetParent() != pContainerItem)) { bCurrentItem = true; break; } tabParams.push_back(pdfium::MakeUnique<CXFA_TabParam>(hWidget)); if (IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), true)) { OrderContainer(sIterator, pSearchItem, tabParams.back().get(), bCurrentItem, bContentArea, bMarsterPage); } } if (bCurrentItem) { pSearchItem = sIterator->GetCurrent(); bCurrentItem = false; } else { pSearchItem = sIterator->MoveToNext(); } } std::sort(tabParams.begin(), tabParams.end(), [](const std::unique_ptr<CXFA_TabParam>& arg1, const std::unique_ptr<CXFA_TabParam>& arg2) { const CFX_RectF& rt1 = arg1->GetWidget()->GetWidgetRect(); const CFX_RectF& rt2 = arg2->GetWidget()->GetWidgetRect(); if (rt1.top - rt2.top >= XFA_FLOAT_PERCISION) return rt1.top < rt2.top; return rt1.left < rt2.left; }); for (const auto& pParam : tabParams) pContainer->AppendTabParam(pParam.get()); } void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray( std::vector<CXFA_FFWidget*>* WidgetArray) { CXFA_LayoutItemIterator sIterator(m_pPageView); auto pParam = pdfium::MakeUnique<CXFA_TabParam>(nullptr); bool bCurrentItem = false; bool bContentArea = false; OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea); WidgetArray->insert(WidgetArray->end(), pParam->GetChildren().begin(), pParam->GetChildren().end()); sIterator.Reset(); bCurrentItem = false; bContentArea = false; pParam->ClearChildren(); OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea, true); WidgetArray->insert(WidgetArray->end(), pParam->GetChildren().begin(), pParam->GetChildren().end()); } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget( CXFA_LayoutItem* pLayoutItem) { if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { if (!pWidget->IsLoaded() && (pWidget->GetStatus() & XFA_WidgetStatus_Visible)) { pWidget->LoadWidget(); } return pWidget; } return nullptr; } CXFA_TabParam::CXFA_TabParam(CXFA_FFWidget* pWidget) : m_pWidget(pWidget) {} CXFA_TabParam::~CXFA_TabParam() {}
[ "dongdong331@163.com" ]
dongdong331@163.com
b6a8a0f7d42f867af210b2547d5ad96bc8c0919a
6b514ab0c3d714a60e65e42582e7cecf9366b4f4
/include/web-socketz.h
f6c54037d20c5af2f03e9628b60314247ca542b7
[]
no_license
zualex-zz/zRadio
5356fd500b06c9faabef70406b2d7a8850039de6
d1771c04ea8702c48516769d4e7fbf35f3fa6257
refs/heads/main
2023-03-20T20:46:30.224879
2021-03-09T14:06:16
2021-03-09T14:06:16
346,022,119
3
0
null
null
null
null
UTF-8
C++
false
false
840
h
#ifndef WEBSOCKETZ_H #define WEBSOCKETZ_H #include <WebSocketsServer.h> WebSocketsServer webSocket = WebSocketsServer(81); class WebSocketz { // WebSocketServerEvent webSocketServerEvent; public: WebSocketz() { Serial.print("WebSocketz constructor"); } void begin() { webSocket.begin(); // webSocket.onEvent(webSocketEvent); } // void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length){ // // Do something with the data from the client // if(type == WStype_TEXT){ // Serial.print("webSocketEvent: "); // Serial.println(payload); // } // } void static broadcastTXT(String json) { webSocket.broadcastTXT(json.c_str(), json.length()); } void loop() { webSocket.loop(); } }; #endif
[ "alex.zupan@gpi.it" ]
alex.zupan@gpi.it
374618ec44e22dd44ab5decd0cd8e99c29330904
bc163b3de90994860566a6ce2355c9d36b2b4604
/MyApplication_17/TouchGFX/generated/images/src/miniDOWN.cpp
b48bd11a8171de52cdfe39d3cd1e3ff0badf8e08
[]
no_license
mfkiwl/CoolSmif
6831a89c5470bd37907672f71927d8f0da618e63
0db24b78d9f55a53fd61007aa05246dee4ad14b5
refs/heads/master
2023-03-19T07:33:19.147816
2020-06-04T12:50:32
2020-06-04T12:50:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
99,002
cpp
// 4.13.0 dither_algorithm=2 alpha_dither=yes layout_rotation=0 opaque_image_format=RGB888 non_opaque_image_format=ARGB8888 section=ExtFlashSection extra_section=ExtFlashSection generate_png=no 0x90414c59 // Generated by imageconverter. Please, do not edit! #include <touchgfx/hal/Config.hpp> LOCATION_PRAGMA("ExtFlashSection") KEEP extern const unsigned char _minidown[] LOCATION_ATTRIBUTE("ExtFlashSection") = // 98x55 RGB888 pixels. { 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x04, 0x02, 0xfa, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x4e, 0x4e, 0xff, 0x6c, 0x6c, 0xff, 0x69, 0x69, 0xff, 0x69, 0x69, 0xff, 0x68, 0x68, 0xff, 0x51, 0x51, 0xff, 0x15, 0x15, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x5b, 0x5b, 0xff, 0x9a, 0x9a, 0xff, 0xac, 0xac, 0xff, 0x9f, 0x9f, 0xff, 0x6f, 0x6f, 0xff, 0x11, 0x11, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x14, 0x14, 0xff, 0x80, 0x80, 0xff, 0x80, 0x80, 0xff, 0x18, 0x18, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x4c, 0x4c, 0xff, 0x7f, 0x7f, 0xff, 0x6f, 0x6f, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x71, 0x71, 0xff, 0x83, 0x83, 0xff, 0x27, 0x27, 0xff, 0x00, 0x00, 0xff, 0x15, 0x15, 0xff, 0x71, 0x71, 0xff, 0x6f, 0x6f, 0xff, 0x38, 0x38, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x0b, 0x0b, 0xff, 0x7a, 0x7a, 0xff, 0x6d, 0x6d, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xea, 0xea, 0xff, 0x33, 0x33, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x4a, 0x4a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa2, 0xa2, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x34, 0x34, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x95, 0x95, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x28, 0x28, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x21, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5a, 0x5a, 0xff, 0x00, 0x00, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x41, 0x41, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x54, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xe1, 0xff, 0xa1, 0xa1, 0xff, 0xab, 0xab, 0xff, 0xe3, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x51, 0x51, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x39, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xad, 0xad, 0xff, 0x80, 0x80, 0xff, 0xa0, 0xa0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x95, 0x95, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x28, 0x28, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x7c, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x69, 0x69, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb9, 0xb9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xfb, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x4c, 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa0, 0xa0, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x3c, 0x3c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x04, 0xff, 0x00, 0x00, 0xff, 0xc5, 0xc5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x76, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xce, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb5, 0xb5, 0xff, 0xff, 0xff, 0xff, 0xe6, 0xe6, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xeb, 0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x60, 0x60, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x4c, 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xa8, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x6e, 0x6e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0x7b, 0xff, 0x00, 0x00, 0xff, 0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0x83, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x70, 0x70, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x65, 0x65, 0xff, 0x00, 0x00, 0xff, 0x6e, 0x6e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x34, 0x34, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xc6, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x90, 0x90, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0x96, 0x96, 0xff, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x4c, 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xa8, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0x89, 0x89, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x2c, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x22, 0x22, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9d, 0x9d, 0xff, 0x00, 0x00, 0xff, 0x16, 0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x75, 0x75, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x2c, 0xff, 0x00, 0x00, 0xff, 0x08, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x39, 0x39, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xae, 0xae, 0xff, 0x4d, 0x4d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x7c, 0xff, 0x00, 0x00, 0xff, 0x4c, 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xa8, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0xdc, 0xff, 0x00, 0x00, 0xff, 0xa5, 0xa5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x05, 0x05, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x0c, 0x0c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0, 0xb0, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcd, 0xcd, 0xff, 0x00, 0x00, 0xff, 0x24, 0x24, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x80, 0xff, 0x00, 0x00, 0xff, 0x52, 0x52, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x4a, 0x4a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xa8, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 0xd9, 0xff, 0x00, 0x00, 0xff, 0xae, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x05, 0x05, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x0b, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa9, 0xa9, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb0, 0xb0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x6f, 0x6f, 0xff, 0xff, 0xff, 0xff, 0xd9, 0xd9, 0xff, 0x00, 0x00, 0xff, 0xd7, 0xd7, 0xff, 0xff, 0xff, 0xff, 0xcd, 0xcd, 0xff, 0x00, 0x00, 0xff, 0xa2, 0xa2, 0xff, 0xff, 0xff, 0xff, 0xd2, 0xd2, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0x4c, 0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0x87, 0xff, 0x36, 0x36, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xa8, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xff, 0x00, 0x00, 0xff, 0x9c, 0x9c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x28, 0x28, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x2a, 0x2a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8e, 0x8e, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x5a, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x04, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0x8d, 0x8d, 0xff, 0x00, 0x00, 0xff, 0x86, 0x86, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0x79, 0x79, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xec, 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xa8, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x75, 0x75, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6c, 0x6c, 0xff, 0x00, 0x00, 0xff, 0x66, 0x66, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x73, 0x73, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x85, 0x85, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x40, 0x40, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x05, 0x05, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x53, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3a, 0x3a, 0xff, 0x00, 0x00, 0xff, 0x2f, 0x2f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x25, 0x25, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x24, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x31, 0x31, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0xca, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa0, 0xa0, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x38, 0x38, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x05, 0x05, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x0e, 0x0e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xf0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc5, 0xc5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xd2, 0xd2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xdf, 0xff, 0x9c, 0x9c, 0xff, 0xaf, 0xaf, 0xff, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x43, 0x43, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9d, 0x9d, 0xff, 0x79, 0x79, 0xff, 0xa7, 0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x42, 0x42, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x9b, 0x9b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xe3, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xcf, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xba, 0xba, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb8, 0xb8, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x1b, 0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff, 0x2d, 0x2d, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xab, 0xab, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x51, 0x51, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x49, 0x49, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9a, 0x9a, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x7a, 0x7a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x67, 0x67, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xc5, 0xc5, 0xff, 0xff, 0xff, 0xff, 0xcd, 0xcd, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xb3, 0xb3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x51, 0x51, 0xff, 0x6c, 0x6c, 0xff, 0x69, 0x69, 0xff, 0x69, 0x69, 0xff, 0x6a, 0x6a, 0xff, 0x4e, 0x4e, 0xff, 0x0e, 0x0e, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x14, 0x14, 0xff, 0x74, 0x74, 0xff, 0xa5, 0xa5, 0xff, 0xb3, 0xb3, 0xff, 0xa0, 0xa0, 0xff, 0x5f, 0x5f, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x71, 0x71, 0xff, 0x7d, 0x7d, 0xff, 0x7b, 0x7b, 0xff, 0x09, 0x09, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x02, 0x02, 0xff, 0x78, 0x78, 0xff, 0x7d, 0x7d, 0xff, 0x75, 0x75, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x3e, 0x3e, 0xff, 0x87, 0x87, 0xff, 0x40, 0x40, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x67, 0x67, 0xff, 0x74, 0x74, 0xff, 0x48, 0x48, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff };
[ "coolab.strousset@gmail.com" ]
coolab.strousset@gmail.com
d04fd11e07068b8473e3132ea507684373f16379
ec6ca197b7a6c6ec1fba5ad4365aa5f99d5ebf8f
/libgearman/aggregator.cc
e5b2727ef2fe098d80df23804075ef43e46486a5
[ "BSD-3-Clause" ]
permissive
gearman/gearmand
65e6ad6fbd06cf53f623bf1ea1174555e3b1210d
56761cd7c6119cbfde81033f3371a551055390a3
refs/heads/master
2023-09-03T20:30:00.118647
2023-08-18T15:22:06
2023-08-18T15:22:06
62,418,058
765
174
NOASSERTION
2023-08-18T15:22:08
2016-07-01T20:26:20
C++
UTF-8
C++
false
false
2,008
cc
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * * The names of its contributors may not be used to endorse or * promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "gear_config.h" #include <libgearman/common.h> #include "libgearman/assert.hpp" #include <cstdlib> #include <limits> #include <memory> #include <libgearman/aggregator.hpp> void *gearman_aggegator_context(gearman_aggregator_st *self) { if (not self) return NULL; return self->context; }
[ "brian@tangent.org" ]
brian@tangent.org
3e8440cbc8382b5d7bc58099b8fc99a6abe69e06
8975b519d7dc2930e787e65e9505774557dfe982
/IndoorGMLParser/Face.h
7d75362e6bfc1139e6eb8a4e4ddbb0e6fdf9bd29
[]
no_license
JungHam/IndoorGMLParser
36ae477b8da1a34775d9810dba2170f04ecca910
26a76578e1ea1d49db7d358657f651a48755db51
refs/heads/master
2020-06-03T08:22:50.005011
2019-08-19T11:50:51
2019-08-19T11:50:51
191,506,101
0
0
null
null
null
null
UTF-8
C++
false
false
765
h
#pragma once #include <iostream> #include <vector> #include "Vertex.h" #include "Point3d.h" #include "Polygon2D.h" #include "Triangle.h" using namespace std; namespace geometry { class Face { vector<Vertex>vertexArray; indoorgml::Point3D calculateNormal(); indoorgml::Point3D _normal; bool hasNormalValue; public : Face(); void addVertex(Vertex a); void setVertexArray(vector<Vertex> arr); vector<Vertex> getVertexArray(); indoorgml::Point3D getNormal(); void setNormal(); int getBestFacePlaneTypeToProject(); Polygon2D getProjectedPolygon(); void calculateVerticesNormals(); vector<Triangle> getTessellatedTriangles(); vector<Triangle> getTrianglesConvex(); //void convertFromPolygon(shared_ptr<indoorgml::Polygon> p); }; }
[ "hmjeong@gaia3d.com" ]
hmjeong@gaia3d.com
b803eb862f4ced5c63fa3cf8d17dd9a7d6b8e1d2
7b32a691b428b8b158825f5d9f9719c533d4fa3e
/NumberDifferentSubstrings.cpp
fa864abdfbe7c19a1f9e0947b2ecfbdf831fa958
[]
no_license
drexxcbba/ITMOCOURSE_CP
c378403e8de4382f13e925a92a6a30ecd2e209db
8f4311f22d6b39ceb905eb64bf4a812cac61ee1b
refs/heads/master
2022-12-07T21:01:09.611062
2020-09-03T05:25:22
2020-09-03T05:25:22
290,088,092
0
0
null
null
null
null
UTF-8
C++
false
false
1,990
cpp
#include <bits/stdc++.h> using namespace std; void countSort(vector<int> &p, vector<int> &c){ int n = p.size(); vector<int> count (n); for (auto x: c){ count[x]++; } vector<int> new_p (n); vector<int> pos (n); pos[0] = 0; for(int i = 1; i < n; i++) pos[i] = pos[i - 1] + count[i - 1]; for(auto x: p){ int i = c[x]; new_p[pos[i]] = x; pos[i]++; } p = new_p; } int main(){ string s; cin>>s; s += '$'; int n = s.size(); //This array will contain the ordering of the strings vector<int> p (n); //This array will contain their equivalences of the class string vector<int> c (n); { //k = 0; vector< pair<char, int> > a (n); for (int i = 0; i < n; i++) a[i] = { s[i], i }; sort(a.begin(), a.end()); for(int i = 0; i < n; i++) p[i] = a[i].second; c[p[0]] = 0; for(int i = 1; i < n; i++){ if(a[i].first == a[i - 1].first){ c[p[i]] = c[p[i - 1]]; }else{ c[p[i]] = c[p[i - 1]] + 1; } } } int k = 0; while((1 << k) < n){ //k -> k + 1 for(int i = 0; i < n; i++){ p[i] = (p[i] - (1 << k)+ n) % n; } //Radix countSort(p , c); vector<int> new_c (n); new_c[p[0]] = 0; for(int i = 1; i < n; i++){ pair<int, int> now = { c[p[i]], c[(p[i] + (1 << k)) % n] }; pair<int, int> prev = { c[p[i - 1]], c[(p[i - 1] + (1 << k)) % n] }; if(now == prev){ new_c[p[i]] = new_c[p[i - 1]]; }else{ new_c[p[i]] = new_c[p[i - 1]] + 1; } } c = new_c; k++; } vector<int> lcp (n); int common = 0; for (int i = 0; i < n - 1; i++){ int pi = c[i]; int j = p[pi - 1]; // Now find lcp[i] = lcp(s[i..], s[j..]) while(s[i + common] == s[j + common]) common++; lcp[pi] = common; common = max(common - 1, 0); } long long dif = 0; for(int i = 1; i < n; i++){ long long aux = ((s.substr(p[i], n - p[i]).size()) - 1 - lcp[i]); long long zero = 0; dif += max(aux, zero); } cout<<dif<<endl; return 0; }
[ "villarroel24kyle@gmail.com" ]
villarroel24kyle@gmail.com
103fe20f336afd3f64d3bc91262864ccbef27b9b
f38241a7b627c03a906a1a28b3ef9bc0f0b4cf24
/src/blend2d/pipegen/blpipecompiler_p.h
6442b6a6952060daddb02b75e4d5b89551715b02
[ "LicenseRef-scancode-warranty-disclaimer", "Zlib" ]
permissive
Sondro/blend2d
e2a0d9db5c60582490d233a38a2b880dbc8b3d3f
337e969181a1e6e655c55d8e1dc015262178cc79
refs/heads/master
2020-05-16T12:49:54.308155
2019-04-21T22:36:53
2019-04-21T22:36:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
80,432
h
// [Blend2D] // 2D Vector Graphics Powered by a JIT Compiler. // // [License] // ZLIB - See LICENSE.md file in the package. #ifndef BLEND2D_PIPEGEN_BLPIPECOMPILER_P_H #define BLEND2D_PIPEGEN_BLPIPECOMPILER_P_H #include "../pipegen/blpipegencore_p.h" #include "../pipegen/blpiperegusage_p.h" //! \cond INTERNAL //! \addtogroup blend2d_internal_pipegen //! \{ namespace BLPipeGen { // ============================================================================ // [BLPipeGen::PipeCompiler] // ============================================================================ //! Pipeline compiler. class PipeCompiler { public: BL_NONCOPYABLE(PipeCompiler) //! AsmJit compiler. x86::Compiler* cc; //! Target CPU features. x86::Features _features; //! Optimization level. uint32_t _optLevel; //! Number of registers available to the pipeline compiler. PipeRegUsage _availableRegs; //! Estimation of registers used by the pipeline temporarily. PipeRegUsage _temporaryRegs; //! Estimation of registers used by the pipeline permanently. PipeRegUsage _persistentRegs; //! Function node. asmjit::FuncNode* _funcNode; //! Function initialization hook. asmjit::BaseNode* _funcInit; //! Function end hook (to add 'unlikely' branches). asmjit::BaseNode* _funcEnd; //! Invalid GP register. x86::Gp _gpNone; //! Holds `BLPipeFillFunc::ctxData` argument. x86::Gp _ctxData; //! Holds `BLPipeFillFunc::fillData` argument. x86::Gp _fillData; //! Holds `BLPipeFillFunc::fetchData` argument. x86::Gp _fetchData; //! Temporary stack used to transfer SIMD regs to GP/MM. x86::Mem _tmpStack; //! Offset to get real ctx-data from the passed pointer. int _ctxDataOffset; //! Offset to get real fill-data from the passed pointer. int _fillDataOffset; //! Offset to get real fetch-data from the passed pointer. int _fetchDataOffset; //! Offset to the first constant to the `blCommonTable` global. int32_t _commonTableOff; //! Pointer to the `blCommonTable` constant pool (only used in 64-bit mode). x86::Gp _commonTablePtr; //! XMM constants. x86::Xmm _constantsXmm[4]; // -------------------------------------------------------------------------- // [PackedInst] // -------------------------------------------------------------------------- //! Packing generic instructions and SSE+AVX instructions into a single 32-bit //! integer. //! //! AsmJit has around 1400 instructions for X86|X64, which means that we need //! at least 11 bits to represent each. Typically we need just one instruction //! ID at a time, however, since SSE and AVX instructions use different IDs //! we need a way to pack both SSE and AVX instruction ID into one integer as //! it's much easier to use unified instruction set rather than using specific //! paths for SSE and AVX code. //! //! PackedInst allows to specify the following: //! //! - SSE instruction ID for up to SSE4.2 code generation. //! - AVX instruction ID for AVX+ code generation. //! - Maximum operation width aka 0 (XMM), 1 (YMM) and 2 (ZMM). //! - Special intrinsic used only by PipeCompiler. struct PackedInst { //! Limit width of operands of vector instructions to Xmm|Ymm|Zmm. enum WidthLimit { kWidthX = 0, kWidthY = 1, kWidthZ = 2 }; enum Bits { kSseIdShift = 0, kSseIdBits = 0xFFF, kAvxIdShift = 12, kAvxIdBits = 0xFFF, kWidthShift = 24, kWidthBits = 0x3, kIntrinShift = 31, kIntrinBits = 0x1 }; static inline uint32_t packIntrin(uint32_t intrinId, uint32_t width = kWidthZ) noexcept { return (intrinId << kSseIdShift ) | (width << kWidthShift ) | (1u << kIntrinShift) ; } static inline uint32_t packAvxSse(uint32_t avxId, uint32_t sseId, uint32_t width = kWidthZ) noexcept { return (avxId << kAvxIdShift) | (sseId << kSseIdShift) | (width << kWidthShift) ; } static inline uint32_t avxId(uint32_t packedId) noexcept { return (packedId >> kAvxIdShift) & kAvxIdBits; } static inline uint32_t sseId(uint32_t packedId) noexcept { return (packedId >> kSseIdShift) & kSseIdBits; } static inline uint32_t width(uint32_t packedId) noexcept { return (packedId >> kWidthShift) & kWidthBits; } static inline uint32_t isIntrin(uint32_t packedId) noexcept { return (packedId & (kIntrinBits << kIntrinShift)) != 0; } static inline uint32_t intrinId(uint32_t packedId) noexcept { return (packedId >> kSseIdShift) & kSseIdBits; } }; //! Intrinsic ID. //! //! Some operations are not available as a single instruction or are part //! of CPU extensions outside of the baseline instruction set. These are //! handled as intrinsics. enum IntrinId { kIntrin2Vloadi128uRO, kIntrin2Vmovu8u16, kIntrin2Vmovu8u32, kIntrin2Vmovu16u32, kIntrin2Vabsi8, kIntrin2Vabsi16, kIntrin2Vabsi32, kIntrin2Vabsi64, kIntrin2Vinv255u16, kIntrin2Vinv256u16, kIntrin2Vinv255u32, kIntrin2Vinv256u32, kIntrin2Vduplpd, kIntrin2Vduphpd, kIntrin2iVswizps, kIntrin2iVswizpd, kIntrin3Vcombhli64, kIntrin3Vcombhld64, kIntrin3Vminu16, kIntrin3Vmaxu16, kIntrin3Vmulu64x32, kIntrin3Vhaddpd, kIntrin4Vpblendvb }; enum { //! Number of reserved GP registers for general use. //! //! NOTE: In 32-bit mode constants are absolutely addressed, however, in //! 64-bit mode we can't address arbitrary 64-bit pointers, so one more //! register is reserved as a compensation. kReservedGpRegs = 1 + uint32_t(BL_TARGET_ARCH_BITS >= 64), //! Number of spare MM registers to always reserve. kReservedMmRegs = 1, //! Number of spare XMM|YMM|ZMM registers to always reserve. kReservedVecRegs = 1 }; // -------------------------------------------------------------------------- // [Construction / Destruction] // -------------------------------------------------------------------------- PipeCompiler(x86::Compiler* cc, const asmjit::x86::Features& features) noexcept; ~PipeCompiler() noexcept; // -------------------------------------------------------------------------- // [Reset] // -------------------------------------------------------------------------- void reset() noexcept; // -------------------------------------------------------------------------- // [Optimization Level] // -------------------------------------------------------------------------- void updateOptLevel() noexcept; //! Get the optimization level of the compiler. inline uint32_t optLevel() const noexcept { return _optLevel; } //! Set the optimization level of the compiler. inline void setOptLevel(uint32_t optLevel) noexcept { _optLevel = optLevel; } inline bool hasSSE2() const noexcept { return _optLevel >= kOptLevel_X86_SSE2; } inline bool hasSSE3() const noexcept { return _optLevel >= kOptLevel_X86_SSE3; } inline bool hasSSSE3() const noexcept { return _optLevel >= kOptLevel_X86_SSSE3; } inline bool hasSSE4_1() const noexcept { return _optLevel >= kOptLevel_X86_SSE4_1; } inline bool hasSSE4_2() const noexcept { return _optLevel >= kOptLevel_X86_SSE4_2; } inline bool hasAVX() const noexcept { return _optLevel >= kOptLevel_X86_AVX; } inline bool hasAVX2() const noexcept { return _optLevel >= kOptLevel_X86_AVX2; } inline bool hasADX() const noexcept { return _features.hasADX(); } inline bool hasBMI() const noexcept { return _features.hasBMI(); } inline bool hasBMI2() const noexcept { return _features.hasBMI2(); } inline bool hasLZCNT() const noexcept { return _features.hasLZCNT(); } inline bool hasPOPCNT() const noexcept { return _features.hasPOPCNT(); } //! Tell the compiler to emit EMMS at the end of the function. Only called //! if the pipeline compiler or some part of it uses MMX registers. inline void usingMmx() noexcept { _funcNode->frame().setMmxCleanup(); } // -------------------------------------------------------------------------- // [Data Offsets] // -------------------------------------------------------------------------- inline int ctxDataOffset() const noexcept { return _ctxDataOffset; } inline int fillDataOffset() const noexcept { return _fillDataOffset; } inline int fetchDataOffset() const noexcept { return _fetchDataOffset; } inline void setCtxDataOffset(int offset) noexcept { _ctxDataOffset = offset; } inline void setFillDataOffset(int offset) noexcept { _fillDataOffset = offset; } inline void setFetchDataOffset(int offset) noexcept { _fetchDataOffset = offset; } // -------------------------------------------------------------------------- // [Compilation] // -------------------------------------------------------------------------- void beginFunction() noexcept; void endFunction() noexcept; // -------------------------------------------------------------------------- // [Parts Management] // -------------------------------------------------------------------------- // TODO: [PIPEGEN] There should be a getter on asmjit side that will return // the `ZoneAllocator` object that can be used for these kind of purposes. // It doesn't make sense to create another ZoneAllocator. template<typename T> inline T* newPartT() noexcept { return new(cc->_codeZone.alloc(sizeof(T), 8)) T(this); } template<typename T, typename... Args> inline T* newPartT(Args&&... args) noexcept { return new(cc->_codeZone.alloc(sizeof(T), 8)) T(this, std::forward<Args>(args)...); } FillPart* newFillPart(uint32_t fillType, FetchPart* dstPart, CompOpPart* compOpPart) noexcept; FetchPart* newFetchPart(uint32_t fetchType, uint32_t fetchPayload, uint32_t format) noexcept; CompOpPart* newCompOpPart(uint32_t compOp, FetchPart* dstPart, FetchPart* srcPart) noexcept; // -------------------------------------------------------------------------- // [Init] // -------------------------------------------------------------------------- void initPipeline(PipePart* root) noexcept; void onPreInitPart(PipePart* part) noexcept; void onPostInitPart(PipePart* part) noexcept; //! Generate a function of the given `signature`. void compileFunc(uint32_t signature) noexcept; // -------------------------------------------------------------------------- // [Constants] // -------------------------------------------------------------------------- void _initCommonTablePtr() noexcept; x86::Mem constAsMem(const void* c) noexcept; x86::Xmm constAsXmm(const void* c) noexcept; // -------------------------------------------------------------------------- // [Registers / Memory] // -------------------------------------------------------------------------- BL_NOINLINE void newXmmArray(OpArray& dst, uint32_t n, const char* name) noexcept { BL_ASSERT(n <= OpArray::kMaxSize); // Set the counter here as we don't want to hit an assert in OpArray::operator[]. dst._size = n; for (uint32_t i = 0; i < n; i++) dst[i] = cc->newXmm("%s%u", name, i); } x86::Mem tmpStack(uint32_t size) noexcept; // -------------------------------------------------------------------------- // [Emit - Commons] // -------------------------------------------------------------------------- // Emit helpers used by GP and MMX intrinsics. void iemit2(uint32_t instId, const Operand_& op1, int imm) noexcept; void iemit2(uint32_t instId, const Operand_& op1, const Operand_& op2) noexcept; void iemit3(uint32_t instId, const Operand_& op1, const Operand_& op2, int imm) noexcept; // Emit helpers to emit MOVE from SrcT to DstT, used by pre-AVX instructions. // The `width` parameter is important as it describes how many bytes to read // in case that `src` is a memory location. It's important as some instructions // like PMOVZXBW read only 8 bytes, but to make the same operation in pre-SSE4.1 // code we need to read 8 bytes from memory and use PUNPCKLBW to interleave that // bytes with zero. PUNPCKLBW would read 16 bytes from memory and would require // them to be aligned to 16 bytes, if used with memory operand. void vemit_xmov(const Operand_& dst, const Operand_& src, uint32_t width) noexcept; void vemit_xmov(const OpArray& dst, const Operand_& src, uint32_t width) noexcept; void vemit_xmov(const OpArray& dst, const OpArray& src, uint32_t width) noexcept; // Emit helpers used by SSE|AVX intrinsics. void vemit_vv_vv(uint32_t packedId, const Operand_& dst_, const Operand_& src_) noexcept; void vemit_vv_vv(uint32_t packedId, const OpArray& dst_, const Operand_& src_) noexcept; void vemit_vv_vv(uint32_t packedId, const OpArray& dst_, const OpArray& src_) noexcept; void vemit_vvi_vi(uint32_t packedId, const Operand_& dst_, const Operand_& src_, int imm) noexcept; void vemit_vvi_vi(uint32_t packedId, const OpArray& dst_, const Operand_& src_, int imm) noexcept; void vemit_vvi_vi(uint32_t packedId, const OpArray& dst_, const OpArray& src_, int imm) noexcept; void vemit_vvi_vvi(uint32_t packedId, const Operand_& dst_, const Operand_& src_, int imm) noexcept; void vemit_vvi_vvi(uint32_t packedId, const OpArray& dst_, const Operand_& src_, int imm) noexcept; void vemit_vvi_vvi(uint32_t packedId, const OpArray& dst_, const OpArray& src_, int imm) noexcept; void vemit_vvv_vv(uint32_t packedId, const Operand_& dst_, const Operand_& src1_, const Operand_& src2_) noexcept; void vemit_vvv_vv(uint32_t packedId, const OpArray& dst_, const Operand_& src1_, const OpArray& src2_) noexcept; void vemit_vvv_vv(uint32_t packedId, const OpArray& dst_, const OpArray& src1_, const Operand_& src2_) noexcept; void vemit_vvv_vv(uint32_t packedId, const OpArray& dst_, const OpArray& src1_, const OpArray& src2_) noexcept; void vemit_vvvi_vvi(uint32_t packedId, const Operand_& dst_, const Operand_& src1_, const Operand_& src2_, int imm) noexcept; void vemit_vvvi_vvi(uint32_t packedId, const OpArray& dst_, const Operand_& src1_, const OpArray& src2_, int imm) noexcept; void vemit_vvvi_vvi(uint32_t packedId, const OpArray& dst_, const OpArray& src1_, const Operand_& src2_, int imm) noexcept; void vemit_vvvi_vvi(uint32_t packedId, const OpArray& dst_, const OpArray& src1_, const OpArray& src2_, int imm) noexcept; void vemit_vvvv_vvv(uint32_t packedId, const Operand_& dst_, const Operand_& src1_, const Operand_& src2_, const Operand_& src3_) noexcept; void vemit_vvvv_vvv(uint32_t packedId, const OpArray& dst_, const OpArray& src1_, const OpArray& src2_, const Operand_& src3_) noexcept; void vemit_vvvv_vvv(uint32_t packedId, const OpArray& dst_, const OpArray& src1_, const OpArray& src2_, const OpArray& src3_) noexcept; #define I_EMIT_2(NAME, INST_ID) \ template<typename Op1, typename Op2> \ inline void NAME(const Op1& o1, \ const Op2& o2) noexcept { \ iemit2(x86::Inst::kId##INST_ID, o1, o2); \ } #define I_EMIT_3(NAME, INST_ID) \ template<typename Op1, typename Op2, typename Op3> \ inline void NAME(const Op1& o1, \ const Op2& o2, \ const Op3& o3) noexcept { \ iemit3(x86::Inst::kId##INST_ID, o1, o2, o3); \ } #define V_EMIT_VV_VV(NAME, PACKED_ID) \ template<typename DstT, typename SrcT> \ inline void NAME(const DstT& dst, \ const SrcT& src) noexcept { \ vemit_vv_vv(PACKED_ID, dst, src); \ } #define V_EMIT_VVI_VI(NAME, PACKED_ID) \ template<typename DstT, typename SrcT> \ inline void NAME(const DstT& dst, \ const SrcT& src, \ int imm) noexcept { \ vemit_vvi_vi(PACKED_ID, dst, src, imm); \ } #define V_EMIT_VVI_VVI(NAME, PACKED_ID) \ template<typename DstT, typename SrcT> \ inline void NAME(const DstT& dst, \ const SrcT& src, \ int imm) noexcept { \ vemit_vvi_vvi(PACKED_ID, dst, src, imm); \ } #define V_EMIT_VVi_VVi(NAME, PACKED_ID, IMM_VALUE) \ template<typename DstT, typename SrcT> \ inline void NAME(const DstT& dst, \ const SrcT& src) noexcept { \ vemit_vvi_vvi(PACKED_ID, dst, src, IMM_VALUE); \ } #define V_EMIT_VVV_VV(NAME, PACKED_ID) \ template<typename DstT, typename Src1T, typename Src2T> \ inline void NAME(const DstT& dst, \ const Src1T& src1, \ const Src2T& src2) noexcept { \ vemit_vvv_vv(PACKED_ID, dst, src1, src2); \ } #define V_EMIT_VVVI_VVI(NAME, PACKED_ID) \ template<typename DstT, typename Src1T, typename Src2T> \ inline void NAME(const DstT& dst, \ const Src1T& src1, \ const Src2T& src2, \ int imm) noexcept { \ vemit_vvvi_vvi(PACKED_ID, dst, src1, src2, imm); \ } #define V_EMIT_VVVi_VVi(NAME, PACKED_ID, IMM_VALUE) \ template<typename DstT, typename Src1T, typename Src2T> \ inline void NAME(const DstT& dst, \ const Src1T& src1, \ const Src2T& src2) noexcept { \ vemit_vvvi_vvi(PACKED_ID, dst, src1, src2, IMM_VALUE); \ } #define V_EMIT_VVVV_VVV(NAME, PACKED_ID) \ template<typename DstT, typename Src1T, typename Src2T, typename Src3T> \ inline void NAME(const DstT& dst, \ const Src1T& src1, \ const Src2T& src2, \ const Src3T& src3) noexcept { \ vemit_vvvv_vvv(PACKED_ID, dst, src1, src2, src3); \ } #define PACK_AVX_SSE(AVX_ID, SSE_ID, W) \ PackedInst::packAvxSse(x86::Inst::kId##AVX_ID, x86::Inst::kId##SSE_ID, PackedInst::kWidth##W) // -------------------------------------------------------------------------- // [Emit - 'I' General Purpose Instructions] // -------------------------------------------------------------------------- template<typename A, typename B> BL_NOINLINE void uZeroIfEq(const A& a, const B& b) noexcept { Label L = cc->newLabel(); cc->cmp(a, b); cc->jne(L); cc->mov(a, 0); cc->bind(L); } // dst = abs(src) template<typename DstT, typename SrcT> BL_NOINLINE void uAbs(const DstT& dst, const SrcT& src) noexcept { if (dst.id() == src.id()) { x86::Gp tmp = cc->newSimilarReg(dst, "@tmp"); cc->mov(tmp, dst); cc->neg(dst); cc->cmovs(dst, tmp); } else { cc->mov(dst, src); cc->neg(dst); cc->cmovs(dst, src); } } template<typename DstT, typename ValueT, typename LimitT> BL_NOINLINE void uBound0ToN(const DstT& dst, const ValueT& value, const LimitT& limit) noexcept { if (dst.id() == value.id()) { x86::Gp zero = cc->newSimilarReg(dst, "@zero"); cc->xor_(zero, zero); cc->cmp(dst, limit); cc->cmova(dst, zero); cc->cmovg(dst, limit); } else { cc->xor_(dst, dst); cc->cmp(value, limit); cc->cmovbe(dst, value); cc->cmovg(dst, limit); } } template<typename DstT, typename SrcT> BL_NOINLINE void uReflect(const DstT& dst, const SrcT& src) noexcept { BL_ASSERT(dst.size() == src.size()); int nBits = int(dst.size()) * 8 - 1; if (dst.id() == src.id()) { DstT copy = cc->newSimilarReg(dst, "@copy"); cc->mov(copy, dst); cc->sar(copy, nBits); cc->xor_(dst, copy); } else { cc->mov(dst, src); cc->sar(dst, nBits); cc->xor_(dst, src); } } template<typename DstT, typename SrcT> BL_NOINLINE void uMod(const DstT& dst, const SrcT& src) noexcept { x86::Gp mod = cc->newSimilarReg(dst, "@mod"); cc->xor_(mod, mod); cc->div(mod, dst, src); cc->mov(dst, mod); } BL_NOINLINE void uAdvanceAndDecrement(const x86::Gp& p, int pAdd, const x86::Gp& i, int iDec) noexcept { cc->add(p, pAdd); cc->sub(i, iDec); } //! dst = a * b. BL_NOINLINE void uMulImm(const x86::Gp& dst, const x86::Gp& a, int b) noexcept { if (b > 0) { switch (b) { case 1: if (dst.id() != a.id()) cc->mov(dst, a); return; case 2: if (dst.id() == a.id()) cc->shl(dst, 1); else cc->lea(dst, x86::ptr(a, a, 0)); return; case 3: cc->lea(dst, x86::ptr(a, a, 1)); return; case 4: case 8: { int shift = 2 + (b == 8); if (dst.id() == a.id()) cc->shl(dst, shift); else break; // cc->lea(dst, x86::ptr(uint64_t(0), a, shift)); return; } } } if (dst.id() == a.id()) cc->imul(dst, b); else cc->imul(dst, a, b); } //! dst += a * b. BL_NOINLINE void uAddMulImm(const x86::Gp& dst, const x86::Gp& a, int b) noexcept { switch (b) { case 1: cc->add(dst, a); return; case 2: case 4: case 8: { int shift = b == 2 ? 1 : b == 4 ? 2 : 3; cc->lea(dst, x86::ptr(dst, a, shift)); return; } default: { x86::Gp tmp = cc->newSimilarReg(dst, "tmp"); cc->imul(tmp, a, b); cc->add(dst, tmp); return; } } } BL_NOINLINE void uLeaBpp(const x86::Gp& dst, const x86::Gp& src, const x86::Gp& idx, uint32_t scale, int32_t disp = 0) noexcept { switch (scale) { case 1: if (dst.id() == src.id() && disp == 0) cc->add(dst, idx); else cc->lea(dst, cc->intptr_ptr(src, idx, 0, disp)); break; case 2: cc->lea(dst, cc->intptr_ptr(src, idx, 1, disp)); break; case 3: cc->lea(dst, cc->intptr_ptr(src, idx, 1, disp)); cc->add(dst, idx); break; case 4: cc->lea(dst, cc->intptr_ptr(src, idx, 2, disp)); break; default: BL_NOT_REACHED(); } } inline void uShl(const x86::Gp& dst, const x86::Gp& src) noexcept { if (hasBMI2()) cc->shlx(dst, dst, src.cloneAs(dst)); else cc->shl(dst, src.r8()); } inline void uShr(const x86::Gp& dst, const x86::Gp& src) noexcept { if (hasBMI2()) cc->shrx(dst, dst, src.cloneAs(dst)); else cc->shr(dst, src.r8()); } inline void uCTZ(const Operand& dst, const Operand& src) noexcept { // INTEL - No difference, `bsf` and `tzcnt` both have latency ~2.5 cycles. // AMD - Big difference, `tzcnt` has only ~1.5 cycle latency while `bsf` has ~2.5 cycles. cc->emit(hasBMI() ? x86::Inst::kIdTzcnt : x86::Inst::kIdBsf, dst, src); } inline void uPrefetch(const x86::Mem& mem) noexcept { cc->prefetcht0(mem); } // -------------------------------------------------------------------------- // [Emit - 'Q' Vector Instructions (64-bit MMX)] // -------------------------------------------------------------------------- // MMX code should be considered legacy, however, CPUs don't penalize it. In // 32-bit mode MMX can help with its 8 64-bit registers and instructions that // allow pure 64-bit operations like addition and subtraction. To distinguish // between MMX and SSE|AVX code all MMX instructions use 'q' (quad) prefix. // // NOTE: There are no instructions that allow transfer between MMX and XMM // registers as that would conflict with AVX code, if used. Use MMX only if // you don't need such transfer. // // MMX instructions that require SSE3+ are suffixed with `_` to make it clear // that they are not part of the baseline instruction set. I_EMIT_2(qmov32 , Movd) // MMX I_EMIT_2(qmov64 , Movq) // MMX I_EMIT_2(qmovmsku8 , Pmovmskb) // MMX2 I_EMIT_2(qabsi8_ , Pabsb) // SSSE3 I_EMIT_2(qabsi16_ , Pabsw) // SSSE3 I_EMIT_2(qabsi32_ , Pabsd) // SSSE3 I_EMIT_2(qavgu8 , Pavgb) // MMX2 I_EMIT_2(qavgu16 , Pavgw) // MMX2 I_EMIT_2(qsigni8_ , Psignb) // SSSE3 I_EMIT_2(qsigni16_ , Psignw) // SSSE3 I_EMIT_2(qsigni32_ , Psignd) // SSSE3 I_EMIT_2(qaddi8 , Paddb) // MMX I_EMIT_2(qaddi16 , Paddw) // MMX I_EMIT_2(qaddi32 , Paddd) // MMX I_EMIT_2(qaddi64 , Paddq) // SSE2 I_EMIT_2(qaddsi8 , Paddsb) // MMX I_EMIT_2(qaddsi16 , Paddsw) // MMX I_EMIT_2(qaddsu8 , Paddusb) // MMX I_EMIT_2(qaddsu16 , Paddusw) // MMX I_EMIT_2(qsubi8 , Psubb) // MMX I_EMIT_2(qsubi16 , Psubw) // MMX I_EMIT_2(qsubi32 , Psubd) // MMX I_EMIT_2(qsubi64 , Psubq) // SSE2 I_EMIT_2(qsubsi8 , Psubsb) // MMX I_EMIT_2(qsubsi16 , Psubsw) // MMX I_EMIT_2(qsubsu8 , Psubusb) // MMX I_EMIT_2(qsubsu16 , Psubusw) // MMX I_EMIT_2(qmuli16 , Pmullw) // MMX I_EMIT_2(qmulu16 , Pmullw) // MMX I_EMIT_2(qmulhi16 , Pmulhw) // MMX I_EMIT_2(qmulhu16 , Pmulhuw) // MMX2 I_EMIT_2(qmulxllu32 , Pmuludq) // SSE2 I_EMIT_2(qand , Pand) // MMX I_EMIT_2(qnand , Pandn) // MMX I_EMIT_2(qor , Por) // MMX I_EMIT_2(qxor , Pxor) // MMX I_EMIT_2(qcmpeqi8 , Pcmpeqb) // MMX I_EMIT_2(qcmpeqi16 , Pcmpeqw) // MMX I_EMIT_2(qcmpeqi32 , Pcmpeqd) // MMX I_EMIT_2(qcmpgti8 , Pcmpgtb) // MMX I_EMIT_2(qcmpgti16 , Pcmpgtw) // MMX I_EMIT_2(qcmpgti32 , Pcmpgtd) // MMX I_EMIT_2(qminu8 , Pminub) // MMX2 I_EMIT_2(qmaxu8 , Pmaxub) // MMX2 I_EMIT_2(qmini16 , Pminsw) // MMX2 I_EMIT_2(qmaxi16 , Pmaxsw) // MMX2 I_EMIT_3(qinsertu16 , Pinsrw) // MMX2 I_EMIT_3(qextractu16, Pextrw) // MMX2 I_EMIT_2(qswizi8v_ , Pshufb) // SSSE3 I_EMIT_3(qswizi16 , Pshufw) // MMX2 I_EMIT_2(qslli16 , Psllw) // MMX I_EMIT_2(qsrli16 , Psrlw) // MMX I_EMIT_2(qsrai16 , Psraw) // MMX I_EMIT_2(qslli32 , Pslld) // MMX I_EMIT_2(qsrli32 , Psrld) // MMX I_EMIT_2(qsrai32 , Psrad) // MMX I_EMIT_2(qslli64 , Psllq) // MMX I_EMIT_2(qsrli64 , Psrlq) // MMX I_EMIT_2(qhaddi16_ , Phaddw) // SSSE3 I_EMIT_2(qhaddi32_ , Phaddd) // SSSE3 I_EMIT_2(qhsubi16_ , Phsubw) // SSSE3 I_EMIT_2(qhsubi32_ , Phsubd) // SSSE3 I_EMIT_2(qhaddsi16_ , Phaddsw) // SSSE3 I_EMIT_2(qhsubsi16_ , Phsubsw) // SSSE3 I_EMIT_3(qalignr8_ , Palignr) // SSE3 I_EMIT_2(qpacki32i16, Packssdw) // MMX I_EMIT_2(qpacki16i8 , Packsswb) // MMX I_EMIT_2(qpacki16u8 , Packuswb) // MMX I_EMIT_2(qunpackli8 , Punpcklbw) // MMX I_EMIT_2(qunpackhi8 , Punpckhbw) // MMX I_EMIT_2(qunpackli16, Punpcklwd) // MMX I_EMIT_2(qunpackhi16, Punpckhwd) // MMX I_EMIT_2(qunpackli32, Punpckldq) // MMX I_EMIT_2(qunpackhi32, Punpckhdq) // MMX I_EMIT_2(qsadu8 , Psadbw) // MMX2 I_EMIT_2(qmulrhi16_ , Pmulhrsw) // SSSE3 I_EMIT_2(qmaddi16 , Pmaddwd) // MMX I_EMIT_2(qmaddsu8i8_, Pmaddubsw) // SSSE3 inline void qzeropi(const Operand_& dst) noexcept { iemit2(x86::Inst::kIdPxor, dst, dst); } inline void qswapi32(const Operand_& dst, const Operand_& src) noexcept { qswizi16(dst, src, x86::Predicate::shuf(1, 0, 3, 2)); } inline void qdupli32(const Operand_& dst, const Operand_& src) noexcept { qswizi16(dst, src, x86::Predicate::shuf(1, 0, 1, 0)); } inline void qduphi32(const Operand_& dst, const Operand_& src) noexcept { qswizi16(dst, src, x86::Predicate::shuf(3, 2, 3, 2)); } // Multiplies 64-bit `a` (QWORD) with 32-bit `b` (low DWORD). void qmulu64u32(const x86::Mm& d, const x86::Mm& a, const x86::Mm& b) noexcept; // -------------------------------------------------------------------------- // [Emit - 'V' Vector Instructions (128..512-bit SSE|AVX)] // -------------------------------------------------------------------------- // To make the code generation easier and more parametrizable we support both // SSE|AVX through the same interface (always non-destructive source form) and // each intrinsic can accept either `Operand_` or `OpArray`, which can hold up // to 4 registers to form scalars, pairs and quads. Each 'V' instruction maps // directly to the ISA so check the optimization level before using them or use // instructions starting with 'x' that are generic and designed to map to the // best instruction(s) possible. // // Also, multiple overloads are provided for convenience, similarly to AsmJit // design, we don't want to inline expansion of `OpArray(op)` here so these // overloads are implemented in pipecompiler.cpp. // SSE instructions that require SSE3+ are suffixed with `_` to make it clear // that they are not part of the baseline instruction set. Some instructions // like that are always provided don't have such suffix, and will be emulated // Integer SIMD - Core. V_EMIT_VV_VV(vmov , PACK_AVX_SSE(Vmovaps , Movaps , Z)) // AVX | SSE2 V_EMIT_VV_VV(vmov64 , PACK_AVX_SSE(Vmovq , Movq , X)) // AVX | SSE2 V_EMIT_VV_VV(vmovi8i16_ , PACK_AVX_SSE(Vpmovsxbw , Pmovsxbw , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovu8u16_ , PACK_AVX_SSE(Vpmovzxbw , Pmovzxbw , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovi8i32_ , PACK_AVX_SSE(Vpmovsxbd , Pmovsxbd , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovu8u32_ , PACK_AVX_SSE(Vpmovzxbd , Pmovzxbd , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovi8i64_ , PACK_AVX_SSE(Vpmovsxbq , Pmovsxbq , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovu8u64_ , PACK_AVX_SSE(Vpmovzxbq , Pmovzxbq , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovi16i32_ , PACK_AVX_SSE(Vpmovsxwd , Pmovsxwd , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovu16u32_ , PACK_AVX_SSE(Vpmovzxwd , Pmovzxwd , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovi16i64_ , PACK_AVX_SSE(Vpmovsxwq , Pmovsxwq , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovu16u64_ , PACK_AVX_SSE(Vpmovzxwq , Pmovzxwq , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovi32i64_ , PACK_AVX_SSE(Vpmovsxdq , Pmovsxdq , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovu32u64_ , PACK_AVX_SSE(Vpmovzxdq , Pmovzxdq , Z)) // AVX2 | SSE4.1 V_EMIT_VV_VV(vmovmsku8 , PACK_AVX_SSE(Vpmovmskb , Pmovmskb , Z)) // AVX2 | SSE2 V_EMIT_VVVI_VVI(vinsertu8_ , PACK_AVX_SSE(Vpinsrb , Pinsrb , X)) // AVX2 | SSE4_1 V_EMIT_VVVI_VVI(vinsertu16 , PACK_AVX_SSE(Vpinsrw , Pinsrw , X)) // AVX2 | SSE2 V_EMIT_VVVI_VVI(vinsertu32_, PACK_AVX_SSE(Vpinsrd , Pinsrd , X)) // AVX2 | SSE4_1 V_EMIT_VVVI_VVI(vinsertu64_, PACK_AVX_SSE(Vpinsrq , Pinsrq , X)) // AVX2 | SSE4_1 V_EMIT_VVI_VVI(vextractu8_ , PACK_AVX_SSE(Vpextrb , Pextrb , X)) // AVX2 | SSE4_1 V_EMIT_VVI_VVI(vextractu16 , PACK_AVX_SSE(Vpextrw , Pextrw , X)) // AVX2 | SSE2 V_EMIT_VVI_VVI(vextractu32_, PACK_AVX_SSE(Vpextrd , Pextrd , X)) // AVX2 | SSE4_1 V_EMIT_VVI_VVI(vextractu64_, PACK_AVX_SSE(Vpextrq , Pextrq , X)) // AVX2 | SSE4_1 V_EMIT_VVV_VV(vunpackli8 , PACK_AVX_SSE(Vpunpcklbw , Punpcklbw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackhi8 , PACK_AVX_SSE(Vpunpckhbw , Punpckhbw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackli16 , PACK_AVX_SSE(Vpunpcklwd , Punpcklwd , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackhi16 , PACK_AVX_SSE(Vpunpckhwd , Punpckhwd , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackli32 , PACK_AVX_SSE(Vpunpckldq , Punpckldq , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackhi32 , PACK_AVX_SSE(Vpunpckhdq , Punpckhdq , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackli64 , PACK_AVX_SSE(Vpunpcklqdq, Punpcklqdq, Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vunpackhi64 , PACK_AVX_SSE(Vpunpckhqdq, Punpckhqdq, Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vpacki32i16 , PACK_AVX_SSE(Vpackssdw , Packssdw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vpacki32u16_ , PACK_AVX_SSE(Vpackusdw , Packusdw , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vpacki16i8 , PACK_AVX_SSE(Vpacksswb , Packsswb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vpacki16u8 , PACK_AVX_SSE(Vpackuswb , Packuswb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vswizi8v_ , PACK_AVX_SSE(Vpshufb , Pshufb , Z)) // AVX2 | SSSE3 V_EMIT_VVI_VVI(vswizli16 , PACK_AVX_SSE(Vpshuflw , Pshuflw , Z)) // AVX2 | SSE2 V_EMIT_VVI_VVI(vswizhi16 , PACK_AVX_SSE(Vpshufhw , Pshufhw , Z)) // AVX2 | SSE2 V_EMIT_VVI_VVI(vswizi32 , PACK_AVX_SSE(Vpshufd , Pshufd , Z)) // AVX2 | SSE2 V_EMIT_VVVI_VVI(vshufi32 , PACK_AVX_SSE(Vshufps , Shufps , Z)) // AVX | SSE V_EMIT_VVVI_VVI(vshufi64 , PACK_AVX_SSE(Vshufpd , Shufpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vand , PACK_AVX_SSE(Vpand , Pand , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vandnot_a , PACK_AVX_SSE(Vpandn , Pandn , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vor , PACK_AVX_SSE(Vpor , Por , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vxor , PACK_AVX_SSE(Vpxor , Pxor , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vavgu8 , PACK_AVX_SSE(Vpavgb , Pavgb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vavgu16 , PACK_AVX_SSE(Vpavgw , Pavgw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsigni8_ , PACK_AVX_SSE(Vpsignb , Psignb , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vsigni16_ , PACK_AVX_SSE(Vpsignw , Psignw , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vsigni32_ , PACK_AVX_SSE(Vpsignd , Psignd , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vaddi8 , PACK_AVX_SSE(Vpaddb , Paddb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddi16 , PACK_AVX_SSE(Vpaddw , Paddw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddi32 , PACK_AVX_SSE(Vpaddd , Paddd , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddi64 , PACK_AVX_SSE(Vpaddq , Paddq , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddsi8 , PACK_AVX_SSE(Vpaddsb , Paddsb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddsu8 , PACK_AVX_SSE(Vpaddusb , Paddusb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddsi16 , PACK_AVX_SSE(Vpaddsw , Paddsw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vaddsu16 , PACK_AVX_SSE(Vpaddusw , Paddusw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubi8 , PACK_AVX_SSE(Vpsubb , Psubb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubi16 , PACK_AVX_SSE(Vpsubw , Psubw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubi32 , PACK_AVX_SSE(Vpsubd , Psubd , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubi64 , PACK_AVX_SSE(Vpsubq , Psubq , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubsi8 , PACK_AVX_SSE(Vpsubsb , Psubsb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubsi16 , PACK_AVX_SSE(Vpsubsw , Psubsw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubsu8 , PACK_AVX_SSE(Vpsubusb , Psubusb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vsubsu16 , PACK_AVX_SSE(Vpsubusw , Psubusw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmuli16 , PACK_AVX_SSE(Vpmullw , Pmullw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmulu16 , PACK_AVX_SSE(Vpmullw , Pmullw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmulhi16 , PACK_AVX_SSE(Vpmulhw , Pmulhw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmulhu16 , PACK_AVX_SSE(Vpmulhuw , Pmulhuw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmuli32_ , PACK_AVX_SSE(Vpmulld , Pmulld , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vmulu32_ , PACK_AVX_SSE(Vpmulld , Pmulld , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vmulxlli32_ , PACK_AVX_SSE(Vpmuldq , Pmuldq , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vmulxllu32 , PACK_AVX_SSE(Vpmuludq , Pmuludq , Z)) // AVX2 | SSE2 V_EMIT_VVVi_VVi(vmulxllu64_, PACK_AVX_SSE(Vpclmulqdq , Pclmulqdq , Z), 0x00) // AVX2 | PCLMULQDQ V_EMIT_VVVi_VVi(vmulxhlu64_, PACK_AVX_SSE(Vpclmulqdq , Pclmulqdq , Z), 0x01) // AVX2 | PCLMULQDQ V_EMIT_VVVi_VVi(vmulxlhu64_, PACK_AVX_SSE(Vpclmulqdq , Pclmulqdq , Z), 0x10) // AVX2 | PCLMULQDQ V_EMIT_VVVi_VVi(vmulxhhu64_, PACK_AVX_SSE(Vpclmulqdq , Pclmulqdq , Z), 0x11) // AVX2 | PCLMULQDQ V_EMIT_VVV_VV(vmini8_ , PACK_AVX_SSE(Vpminsb , Pminsb , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vmaxi8_ , PACK_AVX_SSE(Vpmaxsb , Pmaxsb , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vminu8 , PACK_AVX_SSE(Vpminub , Pminub , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmaxu8 , PACK_AVX_SSE(Vpmaxub , Pmaxub , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmini16 , PACK_AVX_SSE(Vpminsw , Pminsw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmaxi16 , PACK_AVX_SSE(Vpmaxsw , Pmaxsw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vmini32_ , PACK_AVX_SSE(Vpminsd , Pminsd , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vmaxi32_ , PACK_AVX_SSE(Vpmaxsd , Pmaxsd , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vminu32_ , PACK_AVX_SSE(Vpminud , Pminud , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vmaxu32_ , PACK_AVX_SSE(Vpmaxud , Pmaxud , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vcmpeqi8 , PACK_AVX_SSE(Vpcmpeqb , Pcmpeqb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vcmpeqi16 , PACK_AVX_SSE(Vpcmpeqw , Pcmpeqw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vcmpeqi32 , PACK_AVX_SSE(Vpcmpeqd , Pcmpeqd , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vcmpeqi64_ , PACK_AVX_SSE(Vpcmpeqq , Pcmpeqq , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vcmpgti8 , PACK_AVX_SSE(Vpcmpgtb , Pcmpgtb , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vcmpgti16 , PACK_AVX_SSE(Vpcmpgtw , Pcmpgtw , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vcmpgti32 , PACK_AVX_SSE(Vpcmpgtd , Pcmpgtd , Z)) // AVX2 | SSE2 V_EMIT_VVV_VV(vcmpgti64_ , PACK_AVX_SSE(Vpcmpgtq , Pcmpgtq , Z)) // AVX2 | SSE4.2 V_EMIT_VVI_VI(vslli16 , PACK_AVX_SSE(Vpsllw , Psllw , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vsrli16 , PACK_AVX_SSE(Vpsrlw , Psrlw , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vsrai16 , PACK_AVX_SSE(Vpsraw , Psraw , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vslli32 , PACK_AVX_SSE(Vpslld , Pslld , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vsrli32 , PACK_AVX_SSE(Vpsrld , Psrld , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vsrai32 , PACK_AVX_SSE(Vpsrad , Psrad , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vslli64 , PACK_AVX_SSE(Vpsllq , Psllq , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vsrli64 , PACK_AVX_SSE(Vpsrlq , Psrlq , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vslli128b , PACK_AVX_SSE(Vpslldq , Pslldq , Z)) // AVX2 | SSE2 V_EMIT_VVI_VI(vsrli128b , PACK_AVX_SSE(Vpsrldq , Psrldq , Z)) // AVX2 | SSE2 V_EMIT_VVVV_VVV(vblendv8_ , PACK_AVX_SSE(Vpblendvb , Pblendvb , Z)) // AVX2 | SSE4.1 V_EMIT_VVVI_VVI(vblend16_ , PACK_AVX_SSE(Vpblendw , Pblendw , Z)) // AVX2 | SSE4.1 V_EMIT_VVV_VV(vhaddi16_ , PACK_AVX_SSE(Vphaddw , Phaddw , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vhaddi32_ , PACK_AVX_SSE(Vphaddd , Phaddd , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vhsubi16_ , PACK_AVX_SSE(Vphsubw , Phsubw , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vhsubi32_ , PACK_AVX_SSE(Vphsubd , Phsubd , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vhaddsi16_ , PACK_AVX_SSE(Vphaddsw , Phaddsw , Z)) // AVX2 | SSSE3 V_EMIT_VVV_VV(vhsubsi16_ , PACK_AVX_SSE(Vphsubsw , Phsubsw , Z)) // AVX2 | SSSE3 // Integer SIMD - Miscellaneous. V_EMIT_VV_VV(vtest_ , PACK_AVX_SSE(Vptest , Ptest , Z)) // AVX2 | SSE4_1 // Integer SIMD - Consult X86 manual before using these... V_EMIT_VVV_VV(vsadu8 , PACK_AVX_SSE(Vpsadbw , Psadbw , Z)) // AVX2 | SSE2 [dst.u64[0..X] = SUM{0.7}(ABS(src1.u8[N] - src2.u8[N]))))] V_EMIT_VVV_VV(vmulrhi16_ , PACK_AVX_SSE(Vpmulhrsw , Pmulhrsw , Z)) // AVX2 | SSSE3 [dst.i16[0..X] = ((((src1.i16[0] * src2.i16[0])) >> 14)) + 1)) >> 1))] V_EMIT_VVV_VV(vmaddsu8i8_ , PACK_AVX_SSE(Vpmaddubsw , Pmaddubsw , Z)) // AVX2 | SSSE3 [dst.i16[0..X] = SAT(src1.u8[0] * src2.i8[0] + src1.u8[1] * src2.i8[1])) V_EMIT_VVV_VV(vmaddi16 , PACK_AVX_SSE(Vpmaddwd , Pmaddwd , Z)) // AVX2 | SSE2 [dst.i32[0..X] = (src1.i16[0] * src2.i16[0] + src1.i16[1] * src2.i16[1])) V_EMIT_VVVI_VVI(vmpsadu8_ , PACK_AVX_SSE(Vmpsadbw , Mpsadbw , Z)) // AVX2 | SSE4.1 V_EMIT_VVVI_VVI(valignr8_ , PACK_AVX_SSE(Vpalignr , Palignr , Z)) // AVX2 | SSSE3 V_EMIT_VV_VV(vhminposu16_ , PACK_AVX_SSE(Vphminposuw, Phminposuw, Z)) // AVX2 | SSE4_1 // Floating Point - Core. V_EMIT_VV_VV(vmovaps , PACK_AVX_SSE(Vmovaps , Movaps , Z)) // AVX | SSE V_EMIT_VV_VV(vmovapd , PACK_AVX_SSE(Vmovapd , Movapd , Z)) // AVX | SSE2 V_EMIT_VV_VV(vmovups , PACK_AVX_SSE(Vmovups , Movups , Z)) // AVX | SSE V_EMIT_VV_VV(vmovupd , PACK_AVX_SSE(Vmovupd , Movupd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vmovlps2x , PACK_AVX_SSE(Vmovlps , Movlps , X)) // AVX | SSE V_EMIT_VVV_VV(vmovhps2x , PACK_AVX_SSE(Vmovhps , Movhps , X)) // AVX | SSE V_EMIT_VVV_VV(vmovlhps2x , PACK_AVX_SSE(Vmovlhps , Movlhps , X)) // AVX | SSE V_EMIT_VVV_VV(vmovhlps2x , PACK_AVX_SSE(Vmovhlps , Movhlps , X)) // AVX | SSE V_EMIT_VVV_VV(vmovlpd , PACK_AVX_SSE(Vmovlpd , Movlpd , X)) // AVX | SSE V_EMIT_VVV_VV(vmovhpd , PACK_AVX_SSE(Vmovhpd , Movhpd , X)) // AVX | SSE V_EMIT_VV_VV(vmovduplps_ , PACK_AVX_SSE(Vmovsldup , Movsldup , Z)) // AVX | SSE3 V_EMIT_VV_VV(vmovduphps_ , PACK_AVX_SSE(Vmovshdup , Movshdup , Z)) // AVX | SSE3 V_EMIT_VV_VV(vmovduplpd_ , PACK_AVX_SSE(Vmovddup , Movddup , Z)) // AVX | SSE3 V_EMIT_VV_VV(vmovmskps , PACK_AVX_SSE(Vmovmskps , Movmskps , Z)) // AVX | SSE V_EMIT_VV_VV(vmovmskpd , PACK_AVX_SSE(Vmovmskpd , Movmskpd , Z)) // AVX | SSE2 V_EMIT_VVI_VVI(vinsertss_ , PACK_AVX_SSE(Vinsertps , Insertps , X)) // AVX | SSE4_1 V_EMIT_VVI_VVI(vextractss_ , PACK_AVX_SSE(Vextractps , Extractps , X)) // AVX | SSE4_1 V_EMIT_VVV_VV(vunpacklps , PACK_AVX_SSE(Vunpcklps , Unpcklps , Z)) // AVX | SSE V_EMIT_VVV_VV(vunpacklpd , PACK_AVX_SSE(Vunpcklpd , Unpcklpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vunpackhps , PACK_AVX_SSE(Vunpckhps , Unpckhps , Z)) // AVX | SSE V_EMIT_VVV_VV(vunpackhpd , PACK_AVX_SSE(Vunpckhpd , Unpckhpd , Z)) // AVX | SSE2 V_EMIT_VVVI_VVI(vshufps , PACK_AVX_SSE(Vshufps , Shufps , Z)) // AVX | SSE V_EMIT_VVVI_VVI(vshufpd , PACK_AVX_SSE(Vshufpd , Shufpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vandps , PACK_AVX_SSE(Vandps , Andps , Z)) // AVX | SSE V_EMIT_VVV_VV(vandpd , PACK_AVX_SSE(Vandpd , Andpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vandnot_aps , PACK_AVX_SSE(Vandnps , Andnps , Z)) // AVX | SSE V_EMIT_VVV_VV(vandnot_apd , PACK_AVX_SSE(Vandnpd , Andnpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vorps , PACK_AVX_SSE(Vorps , Orps , Z)) // AVX | SSE V_EMIT_VVV_VV(vorpd , PACK_AVX_SSE(Vorpd , Orpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vxorps , PACK_AVX_SSE(Vxorps , Xorps , Z)) // AVX | SSE V_EMIT_VVV_VV(vxorpd , PACK_AVX_SSE(Vxorpd , Xorpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vaddss , PACK_AVX_SSE(Vaddss , Addss , X)) // AVX | SSE V_EMIT_VVV_VV(vaddsd , PACK_AVX_SSE(Vaddsd , Addsd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vaddps , PACK_AVX_SSE(Vaddps , Addps , Z)) // AVX | SSE V_EMIT_VVV_VV(vaddpd , PACK_AVX_SSE(Vaddpd , Addpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vsubss , PACK_AVX_SSE(Vsubss , Subss , X)) // AVX | SSE V_EMIT_VVV_VV(vsubsd , PACK_AVX_SSE(Vsubsd , Subsd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vsubps , PACK_AVX_SSE(Vsubps , Subps , Z)) // AVX | SSE V_EMIT_VVV_VV(vsubpd , PACK_AVX_SSE(Vsubpd , Subpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vaddsubps_ , PACK_AVX_SSE(Vaddsubps , Addsubps , Z)) // AVX | SSE3 V_EMIT_VVV_VV(vaddsubpd_ , PACK_AVX_SSE(Vaddsubpd , Addsubpd , Z)) // AVX | SSE3 V_EMIT_VVV_VV(vmulss , PACK_AVX_SSE(Vmulss , Mulss , X)) // AVX | SSE V_EMIT_VVV_VV(vmulsd , PACK_AVX_SSE(Vmulsd , Mulsd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vmulps , PACK_AVX_SSE(Vmulps , Mulps , Z)) // AVX | SSE V_EMIT_VVV_VV(vmulpd , PACK_AVX_SSE(Vmulpd , Mulpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vdivss , PACK_AVX_SSE(Vdivss , Divss , X)) // AVX | SSE V_EMIT_VVV_VV(vdivsd , PACK_AVX_SSE(Vdivsd , Divsd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vdivps , PACK_AVX_SSE(Vdivps , Divps , Z)) // AVX | SSE V_EMIT_VVV_VV(vdivpd , PACK_AVX_SSE(Vdivpd , Divpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vminss , PACK_AVX_SSE(Vminss , Minss , X)) // AVX | SSE V_EMIT_VVV_VV(vminsd , PACK_AVX_SSE(Vminsd , Minsd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vminps , PACK_AVX_SSE(Vminps , Minps , Z)) // AVX | SSE V_EMIT_VVV_VV(vminpd , PACK_AVX_SSE(Vminpd , Minpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vmaxss , PACK_AVX_SSE(Vmaxss , Maxss , X)) // AVX | SSE V_EMIT_VVV_VV(vmaxsd , PACK_AVX_SSE(Vmaxsd , Maxsd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vmaxps , PACK_AVX_SSE(Vmaxps , Maxps , Z)) // AVX | SSE V_EMIT_VVV_VV(vmaxpd , PACK_AVX_SSE(Vmaxpd , Maxpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vsqrtss , PACK_AVX_SSE(Vsqrtss , Sqrtss , X)) // AVX | SSE V_EMIT_VVV_VV(vsqrtsd , PACK_AVX_SSE(Vsqrtsd , Sqrtsd , X)) // AVX | SSE2 V_EMIT_VV_VV(vsqrtps , PACK_AVX_SSE(Vsqrtps , Sqrtps , Z)) // AVX | SSE V_EMIT_VV_VV(vsqrtpd , PACK_AVX_SSE(Vsqrtpd , Sqrtpd , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vrcpss , PACK_AVX_SSE(Vrcpss , Rcpss , X)) // AVX | SSE V_EMIT_VV_VV(vrcpps , PACK_AVX_SSE(Vrcpps , Rcpps , Z)) // AVX | SSE V_EMIT_VVV_VV(vrsqrtss , PACK_AVX_SSE(Vrsqrtss , Rsqrtss , X)) // AVX | SSE V_EMIT_VV_VV(vrsqrtps , PACK_AVX_SSE(Vrsqrtps , Rsqrtps , Z)) // AVX | SSE V_EMIT_VVVI_VVI(vdpps_ , PACK_AVX_SSE(Vdpps , Dpps , Z)) // AVX | SSE4.1 V_EMIT_VVVI_VVI(vdppd_ , PACK_AVX_SSE(Vdppd , Dppd , Z)) // AVX | SSE4.1 V_EMIT_VVVI_VVI(vroundss_ , PACK_AVX_SSE(Vroundss , Roundss , X)) // AVX | SSE4.1 V_EMIT_VVVI_VVI(vroundsd_ , PACK_AVX_SSE(Vroundsd , Roundsd , X)) // AVX | SSE4.1 V_EMIT_VVI_VVI(vroundps_ , PACK_AVX_SSE(Vroundps , Roundps , Z)) // AVX | SSE4.1 V_EMIT_VVI_VVI(vroundpd_ , PACK_AVX_SSE(Vroundpd , Roundpd , Z)) // AVX | SSE4.1 V_EMIT_VVVI_VVI(vcmpss , PACK_AVX_SSE(Vcmpss , Cmpss , X)) // AVX | SSE V_EMIT_VVVI_VVI(vcmpsd , PACK_AVX_SSE(Vcmpsd , Cmpsd , X)) // AVX | SSE2 V_EMIT_VVVI_VVI(vcmpps , PACK_AVX_SSE(Vcmpps , Cmpps , Z)) // AVX | SSE V_EMIT_VVVI_VVI(vcmppd , PACK_AVX_SSE(Vcmppd , Cmppd , Z)) // AVX | SSE2 V_EMIT_VVVV_VVV(vblendvps_ , PACK_AVX_SSE(Vblendvps , Blendvps , Z)) // AVX | SSE4.1 V_EMIT_VVVV_VVV(vblendvpd_ , PACK_AVX_SSE(Vblendvpd , Blendvpd , Z)) // AVX | SSE4.1 V_EMIT_VVVI_VVI(vblendps_ , PACK_AVX_SSE(Vblendps , Blendps , Z)) // AVX | SSE4.1 V_EMIT_VVVI_VVI(vblendpd_ , PACK_AVX_SSE(Vblendpd , Blendpd , Z)) // AVX | SSE4.1 V_EMIT_VV_VV(vcvti32ps , PACK_AVX_SSE(Vcvtdq2ps , Cvtdq2ps , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvtpdps , PACK_AVX_SSE(Vcvtpd2ps , Cvtpd2ps , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvti32pd , PACK_AVX_SSE(Vcvtdq2pd , Cvtdq2pd , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvtpspd , PACK_AVX_SSE(Vcvtps2pd , Cvtps2pd , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvtpsi32 , PACK_AVX_SSE(Vcvtps2dq , Cvtps2dq , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvtpdi32 , PACK_AVX_SSE(Vcvtpd2dq , Cvtpd2dq , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvttpsi32 , PACK_AVX_SSE(Vcvttps2dq , Cvttps2dq , Z)) // AVX | SSE2 V_EMIT_VV_VV(vcvttpdi32 , PACK_AVX_SSE(Vcvttpd2dq , Cvttpd2dq , Z)) // AVX | SSE2 V_EMIT_VVV_VV(vcvtsdss , PACK_AVX_SSE(Vcvtsd2ss , Cvtsd2ss , X)) // AVX | SSE2 V_EMIT_VVV_VV(vcvtsssd , PACK_AVX_SSE(Vcvtss2sd , Cvtss2sd , X)) // AVX | SSE2 V_EMIT_VVV_VV(vcvtsiss , PACK_AVX_SSE(Vcvtsi2ss , Cvtsi2ss , X)) // AVX | SSE V_EMIT_VVV_VV(vcvtsisd , PACK_AVX_SSE(Vcvtsi2sd , Cvtsi2sd , X)) // AVX | SSE2 V_EMIT_VV_VV(vcvtsssi , PACK_AVX_SSE(Vcvtss2si , Cvtss2si , X)) // AVX | SSE V_EMIT_VV_VV(vcvtsdsi , PACK_AVX_SSE(Vcvtsd2si , Cvtsd2si , X)) // AVX | SSE2 V_EMIT_VV_VV(vcvttsssi , PACK_AVX_SSE(Vcvttss2si , Cvttss2si , X)) // AVX | SSE V_EMIT_VV_VV(vcvttsdsi , PACK_AVX_SSE(Vcvttsd2si , Cvttsd2si , X)) // AVX | SSE2 V_EMIT_VVV_VV(vhaddps_ , PACK_AVX_SSE(Vhaddps , Haddps , Z)) // AVX | SSE3 V_EMIT_VVV_VV(vhaddpd_ , PACK_AVX_SSE(Vhaddpd , Haddpd , Z)) // AVX | SSE3 V_EMIT_VVV_VV(vhsubps_ , PACK_AVX_SSE(Vhsubps , Hsubps , Z)) // AVX | SSE3 V_EMIT_VVV_VV(vhsubpd_ , PACK_AVX_SSE(Vhsubpd , Hsubpd , Z)) // AVX | SSE3 // Floating Point - Miscellaneous. V_EMIT_VV_VV(vcomiss , PACK_AVX_SSE(Vcomiss , Comiss , X)) // AVX | SSE V_EMIT_VV_VV(vcomisd , PACK_AVX_SSE(Vcomisd , Comisd , X)) // AVX | SSE2 V_EMIT_VV_VV(vucomiss , PACK_AVX_SSE(Vucomiss , Ucomiss , X)) // AVX | SSE V_EMIT_VV_VV(vucomisd , PACK_AVX_SSE(Vucomisd , Ucomisd , X)) // AVX | SSE2 // Initialization. inline void vzeropi(const Operand_& dst) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vpxor , Pxor , Z), dst, dst, dst); } inline void vzerops(const Operand_& dst) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vxorps, Xorps, Z), dst, dst, dst); } inline void vzeropd(const Operand_& dst) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vxorpd, Xorpd, Z), dst, dst, dst); } inline void vzeropi(const OpArray& dst) noexcept { for (uint32_t i = 0; i < dst.size(); i++) vzeropi(dst[i]); } inline void vzerops(const OpArray& dst) noexcept { for (uint32_t i = 0; i < dst.size(); i++) vzerops(dst[i]); } inline void vzeropd(const OpArray& dst) noexcept { for (uint32_t i = 0; i < dst.size(); i++) vzeropd(dst[i]); } // Conversion. inline void vmovsi32(const x86::Vec& dst, const x86::Gp& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovd, Movd, X), dst, src); } inline void vmovsi64(const x86::Vec& dst, const x86::Gp& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovq, Movq, X), dst, src); } inline void vmovsi32(const x86::Gp& dst, const x86::Vec& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovd, Movd, X), dst, src); } inline void vmovsi64(const x86::Gp& dst, const x86::Vec& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovq, Movq, X), dst, src); } // Memory Load & Store. inline void vloadi32(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovd, Movd, X), dst, src); } inline void vloadi64(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovq, Movq, X), dst, src); } inline void vloadi128a(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqa, Movaps, X), dst, src); } inline void vloadi128u(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqu, Movups, X), dst, src); } inline void vloadi128u_ro(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vloadi128uRO), dst, src); } inline void vloadi256a(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqa, Movaps, Y), dst, src); } inline void vloadi256u(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqu, Movups, Y), dst, src); } inline void vloadi256u_ro(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vloadi128uRO), dst, src); } inline void vloadi64_u8u16_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovzxbw, Pmovzxbw, X), dst, src); } inline void vloadi32_u8u32_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovzxbd, Pmovzxbd, X), dst, src); } inline void vloadi16_u8u64_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovzxbq, Pmovzxbq, X), dst, src); } inline void vloadi64_u16u32_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovzxwd, Pmovzxwd, X), dst, src); } inline void vloadi32_u16u64_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovzxwq, Pmovzxwq, X), dst, src); } inline void vloadi64_u32u64_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovzxdq, Pmovzxdq, X), dst, src); } inline void vloadi64_i8i16_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovsxbw, Pmovsxbw, X), dst, src); } inline void vloadi32_i8i32_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovsxbd, Pmovsxbd, X), dst, src); } inline void vloadi16_i8i64_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovsxbq, Pmovsxbq, X), dst, src); } inline void vloadi64_i16i32_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovsxwd, Pmovsxwd, X), dst, src); } inline void vloadi32_i16i64_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovsxwq, Pmovsxwq, X), dst, src); } inline void vloadi64_i32i64_(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vpmovsxdq, Pmovsxdq, X), dst, src); } inline void vstorei32(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovd, Movd, X), dst, src); } inline void vstorei64(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovq, Movq, X), dst, src); } inline void vstorei128a(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqa, Movaps, X), dst, src); } inline void vstorei128u(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqu, Movups, X), dst, src); } inline void vstorei256a(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqa, Movaps, Y), dst, src); } inline void vstorei256u(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovdqu, Movups, Y), dst, src); } inline void vloadss(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovss, Movss, X), dst, src); } inline void vloadsd(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovsd, Movsd, X), dst, src); } inline void vloadps_64l(const Operand_& dst, const Operand_& src1, const x86::Mem& src2) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vmovlps, Movlps, X), dst, src1, src2); } inline void vloadps_64h(const Operand_& dst, const Operand_& src1, const x86::Mem& src2) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vmovhps, Movhps, X), dst, src1, src2); } inline void vloadpd_64l(const Operand_& dst, const Operand_& src1, const x86::Mem& src2) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vmovlpd, Movlpd, X), dst, src1, src2); } inline void vloadpd_64h(const Operand_& dst, const Operand_& src1, const x86::Mem& src2) noexcept { vemit_vvv_vv(PACK_AVX_SSE(Vmovhpd, Movhpd, X), dst, src1, src2); } inline void vloadps_128a(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovaps, Movaps, X), dst, src); } inline void vloadps_128u(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovups, Movups, X), dst, src); } inline void vloadpd_128a(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovapd, Movaps, X), dst, src); } inline void vloadpd_128u(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovupd, Movups, X), dst, src); } inline void vloadps_256a(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovaps, Movaps, Y), dst, src); } inline void vloadps_256u(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovups, Movups, Y), dst, src); } inline void vloadpd_256a(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovapd, Movaps, Y), dst, src); } inline void vloadpd_256u(const Operand_& dst, const x86::Mem& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovupd, Movups, Y), dst, src); } inline void vstoress(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovss, Movss, X), dst, src); } inline void vstoresd(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovsd, Movsd, X), dst, src); } inline void vstoreps_64l(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovlps, Movlps, X), dst, src); } inline void vstoreps_64h(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovhps, Movhps, X), dst, src); } inline void vstorepd_64l(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovsd , Movsd , X), dst, src); } inline void vstorepd_64h(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovhpd, Movhpd, X), dst, src); } inline void vstoreps_128a(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovaps, Movaps, X), dst, src); } inline void vstoreps_128u(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovups, Movups, X), dst, src); } inline void vstorepd_128a(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovapd, Movaps, X), dst, src); } inline void vstorepd_128u(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovupd, Movups, X), dst, src); } inline void vstoreps_256a(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovaps, Movaps, Y), dst, src); } inline void vstoreps_256u(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovups, Movups, Y), dst, src); } inline void vstorepd_256a(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovapd, Movaps, Y), dst, src); } inline void vstorepd_256u(const x86::Mem& dst, const Operand_& src) noexcept { vemit_vv_vv(PACK_AVX_SSE(Vmovupd, Movups, Y), dst, src); } // Intrinsics: // // - vmov{x}{y} - Move with sign or zero extension from {x} to {y}. Similar // to instructions like `pmovzx..`, `pmovsx..`, and `punpckl..` // // - vswap{x} - Swap low and high elements. If the vector has more than 2 // elements it's divided into 2 element vectors in which the // operation is performed separately. // // - vdup{l|h}{x} - Duplicate either low or high element into both. If there // are more than 2 elements in the vector it's considered // they are separate units. For example a 4-element vector // can be considered as 2 2-element vectors on which the // duplication operation is performed. template<typename DstT, typename SrcT> inline void vmovu8u16(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vmovu8u16), dst, src); } template<typename DstT, typename SrcT> inline void vmovu8u32(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vmovu8u32), dst, src); } template<typename DstT, typename SrcT> inline void vmovu16u32(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vmovu16u32), dst, src); } template<typename DstT, typename SrcT> inline void vabsi8(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vabsi8), dst, src); } template<typename DstT, typename SrcT> inline void vabsi16(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vabsi16), dst, src); } template<typename DstT, typename SrcT> inline void vabsi32(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vabsi32), dst, src); } template<typename DstT, typename SrcT> inline void vabsi64(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vabsi64), dst, src); } template<typename DstT, typename SrcT> inline void vswapi32(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(2, 3, 0, 1)); } template<typename DstT, typename SrcT> inline void vswapi64(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(1, 0, 3, 2)); } template<typename DstT, typename SrcT> inline void vdupli32(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(2, 2, 0, 0)); } template<typename DstT, typename SrcT> inline void vduphi32(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(3, 3, 1, 1)); } template<typename DstT, typename SrcT> inline void vdupli64(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(1, 0, 1, 0)); } template<typename DstT, typename SrcT> inline void vduphi64(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(3, 2, 3, 2)); } template<typename DstT, typename Src1T, typename Src2T, typename CondT> inline void vblendv8(const DstT& dst, const Src1T& src1, const Src2T& src2, const CondT& cond) noexcept { vemit_vvvv_vvv(PackedInst::packIntrin(kIntrin4Vpblendvb), dst, src1, src2, cond); } template<typename DstT, typename SrcT> inline void vinv255u16(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vinv255u16), dst, src); } template<typename DstT, typename SrcT> inline void vinv256u16(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vinv256u16), dst, src); } template<typename DstT, typename SrcT> inline void vinv255u32(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vinv255u32), dst, src); } template<typename DstT, typename SrcT> inline void vinv256u32(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vinv256u32), dst, src); } template<typename DstT, typename SrcT> inline void vduplpd(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vduplpd), dst, src); } template<typename DstT, typename SrcT> inline void vduphpd(const DstT& dst, const SrcT& src) noexcept { vemit_vv_vv(PackedInst::packIntrin(kIntrin2Vduphpd), dst, src); } template<typename DstT, typename Src1T, typename Src2T> inline void vhaddpd(const DstT& dst, const Src1T& src1, const Src2T& src2) noexcept { vemit_vvv_vv(PackedInst::packIntrin(kIntrin3Vhaddpd), dst, src1, src2); } template<typename DstT, typename SrcT> inline void vexpandli32(const DstT& dst, const SrcT& src) noexcept { vswizi32(dst, src, x86::Predicate::shuf(0, 0, 0, 0)); } // dst.u64[0] = src1.u64[1]; // dst.u64[1] = src2.u64[0]; template<typename DstT, typename Src1T, typename Src2T> inline void vcombhli64(const DstT& dst, const Src1T& src1, const Src2T& src2) noexcept { vemit_vvv_vv(PackedInst::packIntrin(kIntrin3Vcombhli64), dst, src1, src2); } // dst.d64[0] = src1.d64[1]; // dst.d64[1] = src2.d64[0]; template<typename DstT, typename Src1T, typename Src2T> inline void vcombhld64(const DstT& dst, const Src1T& src1, const Src2T& src2) noexcept { vemit_vvv_vv(PackedInst::packIntrin(kIntrin3Vcombhld64), dst, src1, src2); } template<typename DstT, typename Src1T, typename Src2T> inline void vminu16(const DstT& dst, const Src1T& src1, const Src2T& src2) noexcept { vemit_vvv_vv(PackedInst::packIntrin(kIntrin3Vminu16), dst, src1, src2); } template<typename DstT, typename Src1T, typename Src2T> inline void vmaxu16(const DstT& dst, const Src1T& src1, const Src2T& src2) noexcept { vemit_vvv_vv(PackedInst::packIntrin(kIntrin3Vmaxu16), dst, src1, src2); } // Multiplies packed uint64_t in `src1` with packed low uint32_t int `src2`. template<typename DstT, typename Src1T, typename Src2T> inline void vMulU64xU32Lo(const DstT& dst, const Src1T& src1, const Src2T& src2) noexcept { vemit_vvv_vv(PackedInst::packIntrin(kIntrin3Vmulu64x32), dst, src1, src2); } // TODO: [PIPEGEN] Consolidate this to only one implementation. template<typename DstSrcT> BL_NOINLINE void vdiv255u16(const DstSrcT& x) { vaddi16(x, x, constAsXmm(blCommonTable.i128_0080008000800080)); vmulhu16(x, x, constAsXmm(blCommonTable.i128_0101010101010101)); } template<typename DstSrcT> BL_NOINLINE void vdiv255u16_2x( const DstSrcT& v0, const DstSrcT& v1) noexcept { x86::Xmm i128_0080008000800080 = constAsXmm(blCommonTable.i128_0080008000800080); x86::Xmm i128_0101010101010101 = constAsXmm(blCommonTable.i128_0101010101010101); vaddi16(v0, v0, i128_0080008000800080); vmulhu16(v0, v0, i128_0101010101010101); vaddi16(v1, v1, i128_0080008000800080); vmulhu16(v1, v1, i128_0101010101010101); } template<typename DstSrcT> BL_NOINLINE void vdiv255u16_3x( const DstSrcT& v0, const DstSrcT& v1, const DstSrcT& v2) noexcept { x86::Xmm i128_0080008000800080 = constAsXmm(blCommonTable.i128_0080008000800080); x86::Xmm i128_0101010101010101 = constAsXmm(blCommonTable.i128_0101010101010101); vaddi16(v0, v0, i128_0080008000800080); vmulhu16(v0, v0, i128_0101010101010101); vaddi16(v1, v1, i128_0080008000800080); vmulhu16(v1, v1, i128_0101010101010101); vaddi16(v2, v2, i128_0080008000800080); vmulhu16(v2, v2, i128_0101010101010101); } template<typename DstT, typename SrcT> inline void vexpandlps(const DstT& dst, const SrcT& src) noexcept { vexpandli32(dst, src); } template<typename DstT, typename SrcT> inline void vswizps(const DstT& dst, const SrcT& src, int imm) noexcept { vemit_vvi_vi(PackedInst::packIntrin(kIntrin2iVswizps), dst, src, imm); } template<typename DstT, typename SrcT> inline void vswizpd(const DstT& dst, const SrcT& src, int imm) noexcept { vemit_vvi_vi(PackedInst::packIntrin(kIntrin2iVswizpd), dst, src, imm); } template<typename DstT, typename SrcT> inline void vswapps(const DstT& dst, const SrcT& src) noexcept { vswizps(dst, src, x86::Predicate::shuf(2, 3, 0, 1)); } template<typename DstT, typename SrcT> inline void vswappd(const DstT& dst, const SrcT& src) noexcept { vswizpd(dst, src, x86::Predicate::shuf(0, 1)); } // -------------------------------------------------------------------------- // [X-Emit - High-Level] // -------------------------------------------------------------------------- void xLoopMemset32(x86::Gp& dst, x86::Vec& src, x86::Gp& i, uint32_t n, uint32_t granularity) noexcept; void xLoopMemcpy32(x86::Gp& dst, x86::Gp& src, x86::Gp& i, uint32_t n, uint32_t granularity) noexcept; void xInlineMemcpyXmm( const x86::Mem& dPtr, bool dstAligned, const x86::Mem& sPtr, bool srcAligned, int numBytes) noexcept; // -------------------------------------------------------------------------- // [Fetch Utilities] // -------------------------------------------------------------------------- //! Fetch 1 pixel to XMM register(s) in `p` from memory location `sMem`. void xFetchARGB32_1x(PixelARGB& p, uint32_t flags, const x86::Mem& sMem, uint32_t sAlignment) noexcept; //! Fetch 4 pixels to XMM register(s) in `p` from memory location `sMem`. void xFetchARGB32_4x(PixelARGB& p, uint32_t flags, const x86::Mem& sMem, uint32_t sAlignment) noexcept; //! Fetch 8 pixels to XMM register(s) in `p` from memory location `sMem`. void xFetchARGB32_8x(PixelARGB& p, uint32_t flags, const x86::Mem& sMem, uint32_t sAlignment) noexcept; inline void xSatisfyARGB32(PixelARGB& p, uint32_t flags, uint32_t n) noexcept { if (n == 1) xSatisfyARGB32_1x(p, flags); else xSatisfyARGB32_Nx(p, flags); } //! Handle all fetch `flags` in 1 fetched pixel `p`. void xSatisfyARGB32_1x(PixelARGB& p, uint32_t flags) noexcept; //! Handle all fetch `flags` in 4 fetched pixels `p`. void xSatisfyARGB32_Nx(PixelARGB& p, uint32_t flags) noexcept; //! Used by `FetchPart` and `CompOpPart`. void xSatisfySolid(PixelARGB& p, uint32_t flags) noexcept; //! Fill alpha channel to 1. void vFillAlpha(PixelARGB& p) noexcept; // -------------------------------------------------------------------------- // [Utilities - MM] // -------------------------------------------------------------------------- inline void xStore32_ARGB(const x86::Gp& dPtr, const x86::Vec& dPixel) noexcept { vstorei32(x86::dword_ptr(dPtr), dPixel); } BL_NOINLINE void xMovzxBW_LoHi(const x86::Vec& d0, const x86::Vec& d1, const x86::Vec& s) noexcept { BL_ASSERT(d0.id() != d1.id()); if (hasSSE4_1()) { if (d0.id() == s.id()) { vswizi32(d1, d0, x86::Predicate::shuf(1, 0, 3, 2)); vmovu8u16_(d0, d0); vmovu8u16_(d1, d1); } else { vmovu8u16(d0, s); vswizi32(d1, s, x86::Predicate::shuf(1, 0, 3, 2)); vmovu8u16(d1, d1); } } else { x86::Xmm i128_0000000000000000 = constAsXmm(blCommonTable.i128_0000000000000000); if (d1.id() != s.id()) { vunpackhi8(d1, s, i128_0000000000000000); vunpackli8(d0, s, i128_0000000000000000); } else { vunpackli8(d0, s, i128_0000000000000000); vunpackhi8(d1, s, i128_0000000000000000); } } } template<typename Dst, typename Src> inline void vExpandAlphaLo16(const Dst& d, const Src& s) noexcept { vswizli16(d, s, x86::Predicate::shuf(3, 3, 3, 3)); } template<typename Dst, typename Src> inline void vExpandAlphaHi16(const Dst& d, const Src& s) noexcept { vswizhi16(d, s, x86::Predicate::shuf(3, 3, 3, 3)); } template<typename Dst, typename Src> inline void vExpandAlpha16(const Dst& d, const Src& s, int useHiPart = 1) noexcept { vExpandAlphaLo16(d, s); if (useHiPart) vExpandAlphaHi16(d, d); } template<typename Dst, typename Src> inline void vExpandAlphaPS(const Dst& d, const Src& s) noexcept { vswizi32(d, s, x86::Predicate::shuf(3, 3, 3, 3)); } template<typename DstT, typename SrcT> inline void vFillAlpha255B(const DstT& dst, const SrcT& src) noexcept { vor(dst, src, constAsMem(blCommonTable.i128_FF000000FF000000)); } template<typename DstT, typename SrcT> inline void vFillAlpha255W(const DstT& dst, const SrcT& src) noexcept { vor(dst, src, constAsMem(blCommonTable.i128_00FF000000000000)); } template<typename DstT, typename SrcT> inline void vFillAlpha256W(const DstT& dst, const SrcT& src) noexcept { vor(dst, src, constAsMem(blCommonTable.i128_0100000000000000)); } template<typename DstT, typename SrcT> inline void vZeroAlphaB(const DstT& dst, const SrcT& src) noexcept { vand(dst, src, constAsMem(blCommonTable.i128_00FFFFFF00FFFFFF)); } template<typename DstT, typename SrcT> inline void vZeroAlphaW(const DstT& dst, const SrcT& src) noexcept { vand(dst, src, constAsMem(blCommonTable.i128_0000FFFFFFFFFFFF)); } template<typename DstT, typename SrcT> inline void vNegAlpha8B(const DstT& dst, const SrcT& src) noexcept { vxor(dst, src, constAsMem(blCommonTable.i128_FF000000FF000000)); } template<typename DstT, typename SrcT> inline void vNegAlpha8W(const DstT& dst, const SrcT& src) noexcept { vxor(dst, src, constAsMem(blCommonTable.i128_00FF000000000000)); } template<typename DstT, typename SrcT> inline void vNegRgb8B(const DstT& dst, const SrcT& src) noexcept { vxor(dst, src, constAsMem(blCommonTable.i128_00FFFFFF00FFFFFF)); } template<typename DstT, typename SrcT> inline void vNegRgb8W(const DstT& dst, const SrcT& src) noexcept { vxor(dst, src, constAsMem(blCommonTable.i128_000000FF00FF00FF)); } // d = int(floor(a / b) * b). template<typename XmmOrMem> BL_NOINLINE void vmodpd(const x86::Xmm& d, const x86::Xmm& a, const XmmOrMem& b) noexcept { if (hasSSE4_1()) { vdivpd(d, a, b); vroundpd_(d, d, x86::Predicate::kRoundTrunc | x86::Predicate::kRoundInexact); vmulpd(d, d, b); } else { x86::Xmm t = cc->newXmm("vmodpdTmp"); vdivpd(d, a, b); vcvttpdi32(t, d); vcvti32pd(t, t); vcmppd(d, d, t, x86::Predicate::kCmpLT | x86::Predicate::kCmpUNORD); vandpd(d, d, constAsMem(blCommonTable.d128_m1)); vaddpd(d, d, t); vmulpd(d, d, b); } } // Performs 32-bit unsigned modulo of 32-bit `a` (hi DWORD) with 32-bit `b` (lo DWORD). template<typename XmmOrMem_A, typename XmmOrMem_B> BL_NOINLINE void xModI64HIxU64LO(const x86::Xmm& d, const XmmOrMem_A& a, const XmmOrMem_B& b) noexcept { x86::Xmm t0 = cc->newXmm("t0"); x86::Xmm t1 = cc->newXmm("t1"); vswizi32(t1, b, x86::Predicate::shuf(3, 3, 2, 0)); vswizi32(d , a, x86::Predicate::shuf(2, 0, 3, 1)); vcvti32pd(t1, t1); vcvti32pd(t0, d); vmodpd(t0, t0, t1); vcvttpdi32(t0, t0); vsubi32(d, d, t0); vswizi32(d, d, x86::Predicate::shuf(1, 3, 0, 2)); } // Performs 32-bit unsigned modulo of 32-bit `a` (hi DWORD) with 64-bit `b` (DOUBLE). template<typename XmmOrMem_A, typename XmmOrMem_B> BL_NOINLINE void xModI64HIxDouble(const x86::Xmm& d, const XmmOrMem_A& a, const XmmOrMem_B& b) noexcept { x86::Xmm t0 = cc->newXmm("t0"); vswizi32(d, a, x86::Predicate::shuf(2, 0, 3, 1)); vcvti32pd(t0, d); vmodpd(t0, t0, b); vcvttpdi32(t0, t0); vsubi32(d, d, t0); vswizi32(d, d, x86::Predicate::shuf(1, 3, 0, 2)); } BL_NOINLINE void xExtractUnpackedAFromPackedARGB32_1(const x86::Xmm& d, const x86::Xmm& s) noexcept { vswizli16(d, s, x86::Predicate::shuf(1, 1, 1, 1)); vsrli16(d, d, 8); } BL_NOINLINE void xExtractUnpackedAFromPackedARGB32_2(const x86::Xmm& d, const x86::Xmm& s) noexcept { if (hasSSSE3()) { vswizi8v_(d, s, constAsMem(blCommonTable.i128_pshufb_packed_argb32_2x_lo_to_unpacked_a8)); } else { vswizli16(d, s, x86::Predicate::shuf(3, 3, 1, 1)); vswizi32(d, d, x86::Predicate::shuf(1, 1, 0, 0)); vsrli16(d, d, 8); } } BL_NOINLINE void xExtractUnpackedAFromPackedARGB32_4(const x86::Vec& d0, const x86::Vec& d1, const x86::Vec& s) noexcept { BL_ASSERT(d0.id() != d1.id()); if (hasSSSE3()) { if (d0.id() == s.id()) { vswizi8v_(d1, s, constAsMem(blCommonTable.i128_pshufb_packed_argb32_2x_hi_to_unpacked_a8)); vswizi8v_(d0, s, constAsMem(blCommonTable.i128_pshufb_packed_argb32_2x_lo_to_unpacked_a8)); } else { vswizi8v_(d0, s, constAsMem(blCommonTable.i128_pshufb_packed_argb32_2x_lo_to_unpacked_a8)); vswizi8v_(d1, s, constAsMem(blCommonTable.i128_pshufb_packed_argb32_2x_hi_to_unpacked_a8)); } } else { if (d1.id() != s.id()) { vswizhi16(d1, s, x86::Predicate::shuf(3, 3, 1, 1)); vswizli16(d0, s, x86::Predicate::shuf(3, 3, 1, 1)); vswizi32(d1, d1, x86::Predicate::shuf(3, 3, 2, 2)); vswizi32(d0, d0, x86::Predicate::shuf(1, 1, 0, 0)); vsrli16(d1, d1, 8); vsrli16(d0, d0, 8); } else { vswizli16(d0, s, x86::Predicate::shuf(3, 3, 1, 1)); vswizhi16(d1, s, x86::Predicate::shuf(3, 3, 1, 1)); vswizi32(d0, d0, x86::Predicate::shuf(1, 1, 0, 0)); vswizi32(d1, d1, x86::Predicate::shuf(3, 3, 2, 2)); vsrli16(d0, d0, 8); vsrli16(d1, d1, 8); } } } BL_NOINLINE void xPackU32ToU16Lo(const x86::Vec& d0, const x86::Vec& s0) noexcept { if (hasSSE4_1()) { vpacki32u16_(d0, s0, s0); } else if (hasSSSE3()) { vswizi8v_(d0, s0, constAsMem(blCommonTable.i128_pshufb_u32_to_u16_lo)); } else { // Sign extend and then use `packssdw()`. vslli32(d0, s0, 16); vsrai32(d0, d0, 16); vpacki32i16(d0, d0, d0); } } BL_NOINLINE void xPackU32ToU16Lo(const VecArray& d0, const VecArray& s0) noexcept { for (uint32_t i = 0; i < d0.size(); i++) xPackU32ToU16Lo(d0[i], s0[i]); } // -------------------------------------------------------------------------- // [Emit - End] // -------------------------------------------------------------------------- #undef PACK_AVX_SSE #undef V_EMIT_VVVV_VVV #undef V_EMIT_VVVi_VVi #undef V_EMIT_VVVI_VVI #undef V_EMIT_VVV_VV #undef V_EMIT_VVi_VVi #undef V_EMIT_VVI_VVI #undef V_EMIT_VVI_VVI #undef V_EMIT_VVI_VI #undef V_EMIT_VV_VV #undef I_EMIT_3 #undef I_EMIT_2i #undef I_EMIT_2 }; // ============================================================================ // [BLPipeGen::PipeInjectAtTheEnd] // ============================================================================ class PipeInjectAtTheEnd { public: ScopedInjector _injector; BL_INLINE PipeInjectAtTheEnd(PipeCompiler* pc) noexcept : _injector(pc->cc, &pc->_funcEnd) {} }; } // {BLPipeGen} //! \} //! \endcond #endif // BLEND2D_PIPEGEN_BLPIPECOMPILER_P_H
[ "kobalicek.petr@gmail.com" ]
kobalicek.petr@gmail.com
d72df24c7357ddf0e78a6b33b398ad9ace5833de
603a949023236ff5ebb9863b90a1ad4c148946c7
/com/sstl.h
3b74422b1f3910b488ef6ee65e1ae98be2f9c075
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
clear-wing/xoc
108636919d70a9445b444af198f3012864343323
b89d4e207cf3382e85d19b733566e296018958ba
refs/heads/master
2021-05-12T17:26:34.568544
2018-01-07T10:28:52
2018-01-07T10:28:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
129,504
h
/*@ XOC Release License Copyright (c) 2013-2014, Alibaba Group, All rights reserved. compiler@aliexpress.com Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Su Zhenyu 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 "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. author: Su Zhenyu @*/ #ifndef __SSTL_H__ #define __SSTL_H__ namespace xcom { template <class T> class allocator { public: allocator() throw() {} allocator (allocator const& alloc) throw() {} template <class U> allocator (allocator<U> const& alloc) throw() {} ~allocator() {} }; } //namespace xcom template <class T> void * operator new(size_t size, xcom::allocator<T> * pool) { DUMMYUSE(pool); return ::operator new(size); } template <class T> void operator delete(void * ptr, xcom::allocator<T> * pool) { DUMMYUSE(pool); ::operator delete(ptr); } namespace xcom { #define NO_BASIC_MAT_DUMP //Default option #define MAX_SHASH_BUCKET 97 //Default option typedef void* OBJTY; //Structure chain operations. //For easing implementation, there must be 2 fields declared in T // 1. T * next // 2. T * prev template <class T> inline UINT find_position(T const* list, T const* t) { for (UINT c = 0; list != NULL; c++, list = list->next) { if (list == t) { return c; } } UNREACH(); //not find. return 0; } template <class T> inline UINT cnt_list(T const* t) { UINT c = 0; while (t != NULL) { c++; t = t->next; } return c; } //Return true if p is in current list. template <class T> bool in_list(T const* head, T const* p) { if (p == NULL) { return true; } T const* t = head; while (t != NULL) { if (t == p) { return true; } t = t->next; } return false; } template <class T> inline T * get_last(T * t) { while (t != NULL && t->next != NULL) { t = t->next; } return t; } template <class T> inline T * get_first(T * t) { while (t != NULL && t->prev != NULL) { t = t->prev; } return t; } template <class T> inline void add_next(T ** pheader, T * t) { if (pheader == NULL || t == NULL) return ; T * p = NULL; t->prev = NULL; if ((*pheader) == NULL) { *pheader = t; } else { p = (*pheader)->next; ASSERT(t != *pheader, ("\n<add_next> : overlap list member\n")); if (p == NULL) { (*pheader)->next = t; t->prev = *pheader; } else { while (p->next != NULL) { p = p->next; ASSERT(p != t, ("\n<add_next> : overlap list member\n")); } p->next = t; t->prev = p; } } } template <class T> inline void add_next(IN OUT T ** pheader, IN OUT T ** last, IN T * t) { if (pheader == NULL || t == NULL) { return ; } t->prev = NULL; if ((*pheader) == NULL) { *pheader = t; while (t->next != NULL) { t = t->next; } *last = t; } else { ASSERT0(last != NULL && *last != NULL && (*last)->next == NULL); (*last)->next = t; t->prev = *last; while (t->next != NULL) { t = t->next; } *last = t; } } template <class T> inline void remove(T ** pheader, T * t) { if (pheader == NULL || t == NULL) { return; } if (t == *pheader) { *pheader = t->next; if (*pheader != NULL) { (*pheader)->prev = NULL; } t->next = t->prev = NULL; return; } ASSERT(t->prev, ("t is not in list")); t->prev->next = t->next; if (t->next != NULL) { t->next->prev = t->prev; } t->next = t->prev = NULL; } //Swap t1 t2 in list. template <class T> inline void swap(T ** pheader, T * t1, T * t2) { ASSERT0(pheader); T * t1p = t1->prev; T * t1n = t1->next; T * t2p = t2->prev; T * t2n = t2->next; if (t2 == t1n) { t2->next = t1; } else { t2->next = t1n; } if (t2 == t1p) { t2->prev = t1; } else { t2->prev = t1p; } if (t1 == t2n) { t1->next = t2; } else { t1->next = t2n; } if (t1 == t2p) { t1->prev = t2; } else { t1->prev = t2p; } if (t1p != NULL && t1p != t2) { t1p->next = t2; } if (t1n != NULL && t1n != t2) { t1n->prev = t2; } if (t2p != NULL && t2p != t1) { t2p->next = t1; } if (t2n != NULL && t2n != t1) { t2n->prev = t1; } if (*pheader == t1) { *pheader = t2; } else if (*pheader == t2) { *pheader = t1; } } template <class T> inline void replace(T ** pheader, T * olds, T * news) { if (pheader == NULL || olds == NULL) return; if (olds == news) { return; } if (news == NULL) { xcom::remove(pheader, olds); return; } #ifdef _DEBUG_ bool find = false; T * p = *pheader; while (p != NULL) { if (p == olds) { find = true; break; } p = p->next; } ASSERT(find, ("'olds' is not inside in pheader")); #endif news->prev = olds->prev; news->next = olds->next; if (olds->prev != NULL) { olds->prev->next = news; } if (olds->next != NULL) { olds->next->prev = news; } if (olds == *pheader) { *pheader = news; } olds->next = olds->prev = NULL; } template <class T> inline T * removehead(T ** pheader) { if (pheader == NULL || *pheader == NULL) return NULL; T * t = *pheader; *pheader = t->next; if (*pheader != NULL) { (*pheader)->prev = NULL; } t->next = t->prev = NULL; return t; } template <class T> inline T * removehead_single_list(T ** pheader) { if (pheader == NULL || *pheader == NULL) return NULL; T * t = *pheader; *pheader = t->next; t->next = NULL; return t; } template <class T> inline T * removetail(T ** pheader) { if (pheader == NULL || *pheader == NULL) { return NULL; } T * t = *pheader; while (t->next != NULL) { t = t->next; } remove(pheader, t); return t; } //Insert one elem 't' before 'marker'. template <class T> inline void insertbefore_one(T ** head, T * marker, T * t) { if (t == NULL) return; ASSERT(head, ("absent parameter")); if (t == marker) return; if (*head == NULL) { ASSERT(marker == NULL, ("marker must be NULL")); *head = t; return; } if (marker == *head) { //'marker' is head, and replace head. t->prev = NULL; t->next = marker; marker->prev = t; *head = t; return; } ASSERT(marker->prev != NULL, ("marker is head")); marker->prev->next = t; t->prev = marker->prev; t->next = marker; marker->prev = t; } //Insert a list that leading by 't' before 'marker'. //'head': function might modify the header of list. //'t': the head element of list, that to be inserted. template <class T> inline void insertbefore(T ** head, T * marker, T * t) { if (t == NULL) { return; } ASSERT(head, ("absent parameter")); if (t == marker) { return; } if (*head == NULL) { ASSERT(marker == NULL, ("marker must be NULL")); *head = t; return; } if (marker == *head) { //'marker' is head, and replace head. ASSERT(t->prev == NULL, ("t is not the first element")); add_next(&t, *head); *head = t; return; } ASSERT(marker->prev != NULL, ("marker should not be head")); if (marker->prev != NULL) { marker->prev->next = t; t->prev = marker->prev; } t = get_last(t); t->next = marker; marker->prev = t; } //Insert t into list immediately that following 'marker'. //e.g: a->maker->b->c // output is: a->maker->t->b->c //Return header in 'marker' if list is empty. template <class T> inline void insertafter_one(T ** marker, T * t) { if (marker == NULL || t == NULL) return; if (t == *marker) return; if (*marker == NULL) { *marker = t; return; } T * last = get_last(t); if ((*marker)->next != NULL) { (*marker)->next->prev = last; last->next = (*marker)->next; } (*marker)->next = t; t->prev = *marker; } //Append t into head of list. //e.g: given head->a->b->c, and t1->t2. // output is: t1->t2->a->b->c //This function will update the head of list. template <class T> inline void append_head(T ** head, T * t) { if (*head == NULL) { *head = t; return; } T * last = get_last(t); (*head)->prev = last; last->next = *head; *head = t; } //Insert t into marker's list as the subsequent element. //e.g: a->maker->b->c, and t->x->y //output is: a->maker->t->x->y->b->c. template <class T> inline void insertafter(T ** marker, T * t) { if (marker == NULL || t == NULL) return; if (t == *marker) return; if (*marker == NULL) { *marker = t; return; } if ((*marker)->next != NULL) { T * last = get_last(t); (*marker)->next->prev = last; last->next = (*marker)->next; } t->prev = *marker; (*marker)->next = t; } //Reverse list, return the new list-head. template <class T> inline T * reverse_list(T * t) { T * head = t; while (t != NULL) { T * tmp = t->prev; t->prev = t->next; t->next = tmp; head = t; t = t->prev; } return head; } //Double Chain Container. #define C_val(c) ((c)->value) #define C_next(c) ((c)->next) #define C_prev(c) ((c)->prev) template <class T> class C { public: C<T> * prev; C<T> * next; T value; public: C() { init(); } COPY_CONSTRUCTOR(C<T>); void init() { prev = next = NULL; value = T(0); //The default value of container. } T val() { return value; } }; //Single Chain Container. #define SC_val(c) ((c)->value) #define SC_next(c) ((c)->next) template <class T> class SC { public: SC<T> * next; T value; public: SC() { init(); } COPY_CONSTRUCTOR(SC<T>); void init() { next = NULL; value = T(0); } T val() { return value; } }; //FREE-List // //T refer to basis element type. // e.g: Suppose variable type is 'VAR*', then T is 'VAR'. // //For easing implementation, there are 2 fields should be declared in T, // struct T { // T * next; // T * prev; // ... //other field // } template <class T> class FreeList { public: BOOL m_is_clean; T * m_tail; public: FreeList() { m_is_clean = true; m_tail = NULL; } COPY_CONSTRUCTOR(FreeList); ~FreeList() { m_tail = NULL; } UINT count_mem() const { return sizeof(FreeList<T>); } //Note the element in list should be freed by user. void clean() { m_tail = NULL; } //True if invoke ::memset when user query free element. void set_clean(bool is_clean) { m_is_clean = (BYTE)is_clean; } //Add t to tail of the list. //Do not clean t's content. inline void add_free_elem(T * t) { if (t == NULL) {return;} ASSERT0(t->next == NULL && t->prev == NULL); //clean by user. if (m_tail == NULL) { m_tail = t; return; } t->prev = m_tail; m_tail->next = t; m_tail = t; } //Remove an element from tail of list. inline T * get_free_elem() { if (m_tail == NULL) { return NULL; } T * t = m_tail; m_tail = m_tail->prev; if (m_tail != NULL) { ASSERT0(t->next == NULL); m_tail->next = NULL; m_is_clean ? ::memset(t, 0, sizeof(T)) : t->prev = NULL; } else { ASSERT0(t->prev == NULL && t->next == NULL); if (m_is_clean) { ::memset(t, 0, sizeof(T)); } } return t; } }; //END FreeList //Dual Linked List. //NOTICE: // The following operations are the key points which you should // pay attention to: // 1. If you REMOVE one element, its container will be collect by FREE-List. // So if you need a new container, please check the FREE-List first, // accordingly, you should first invoke 'get_free_list' which get free // containers out from 'm_free_list'. // 2. If you want to invoke APPEND, please call 'newc' first to // allocate a new container memory space, record your elements in // container, then APPEND it at list. template <class T, class Allocator = allocator<T> > class List { protected: UINT m_elem_count; C<T> * m_head; C<T> * m_tail; Allocator pool; //It is a marker that used internally by List. Some function will //update the variable, see comments. C<T> * m_cur; //Hold the freed containers for next request. FreeList<C<T> > m_free_list; public: List() { init(); } COPY_CONSTRUCTOR(List); ~List() { destroy(); } void init() { m_elem_count = 0; m_head = m_tail = m_cur = NULL; m_free_list.clean(); m_free_list.set_clean(false); } void destroy() { C<T> * ct = m_free_list.m_tail; while (ct != NULL) { C<T> * t = ct; ct = ct->prev; //Do not need to invoke destructor of C<T>. operator delete(t, &pool); } ct = m_head; while (ct != NULL) { C<T> * t = ct; ct = ct->next; //Do not need to invoke destructor of C<T>. operator delete(t, &pool); } m_free_list.clean(); m_elem_count = 0; m_head = m_tail = m_cur = NULL; } //Return the end of the list. C<T> const* end() const { return NULL; } inline C<T> * newc() { //allocator<T> p; C<T> * c = m_free_list.get_free_elem(); if (c == NULL) { return new (&pool) C<T>(); } else { C_val(c) = T(0); } return c; } //Clean list, and add element containers to free list. void clean() { C<T> * c = m_head; while (c != NULL) { C<T> * next = C_next(c); C_prev(c) = C_next(c) = NULL; m_free_list.add_free_elem(c); c = next; } m_elem_count = 0; m_head = m_tail = m_cur = NULL; } void copy(IN List<T> & src) { clean(); T t = src.get_head(); for (INT n = src.get_elem_count(); n > 0; n--) { append_tail(t); t = src.get_next(); } } UINT count_mem() const { UINT count = 0; count += sizeof(m_elem_count); count += sizeof(m_head); count += sizeof(m_tail); count += sizeof(m_cur); count += m_free_list.count_mem(); C<T> * ct = m_free_list.m_tail; while (ct != NULL) { count += sizeof(C<T>); ct = ct->next; } ct = m_head; while (ct != NULL) { count += sizeof(C<T>); ct = ct->next; } return count; } C<T> * append_tail(T t) { C<T> * c = newc(); ASSERT(c != NULL, ("newc return NULL")); C_val(c) = t; append_tail(c); return c; } void append_tail(C<T> * c) { if (m_head == NULL) { ASSERT(m_tail == NULL, ("tail should be NULL")); m_head = m_tail = c; C_next(m_head) = C_prev(m_head) = NULL; m_elem_count = 1; return; } C_prev(c) = m_tail; C_next(m_tail) = c; m_tail = c; ASSERT0(C_next(c) == NULL); m_elem_count++; return; } //This function will remove all elements in 'src' and //append to tail of current list. //Note 'src' will be clean. void append_tail(IN OUT List<T> & src) { if (src.m_head == NULL) { return; } if (m_tail == NULL) { m_head = src.m_head; m_tail = src.m_tail; m_elem_count = src.m_elem_count; src.m_head = NULL; src.m_tail = NULL; src.m_elem_count = 0; return; } C_next(m_tail) = src.m_head; C_prev(src.m_head) = m_tail; m_elem_count += src.m_elem_count; ASSERT0(src.m_tail != NULL); m_tail = src.m_tail; src.m_head = NULL; src.m_tail = NULL; src.m_elem_count = 0; } //This function copy elements in 'src' and //append to tail of current list. //'src' is unchanged. void append_and_copy_to_tail(List<T> const& src) { C<T> * t = src.m_head; if (t == NULL) { return; } if (m_head == NULL) { C<T> * c = newc(); ASSERT0(c); C_val(c) = C_val(t); ASSERT(m_tail == NULL, ("tail should be NULL")); m_head = m_tail = c; ASSERT0(C_next(c) == NULL && C_prev(c) == NULL); t = C_next(t); } for (; t != T(0); t = C_next(t)) { C<T> * c = newc(); ASSERT0(c); C_val(c) = C_val(t); C_prev(c) = m_tail; C_next(m_tail) = c; m_tail = c; } C_next(m_tail) = NULL; m_elem_count += src.get_elem_count(); } //Append value t to head of list. C<T> * append_head(T t) { C<T> * c = newc(); ASSERT(c, ("newc return NULL")); C_val(c) = t; append_head(c); return c; } //Append container to head of list. void append_head(C<T> * c) { if (m_head == NULL) { ASSERT(m_tail == NULL, ("tail should be NULL")); m_head = m_tail = c; C_next(m_head) = C_prev(m_head) = NULL; m_elem_count = 1; return; } C_next(c) = m_head; C_prev(m_head) = c; m_head = c; ASSERT0(C_prev(c) == NULL); //C_prev(m_head) = NULL; m_elem_count++; return; } //This function will remove all elements in 'src' and //append to current list head. //Note 'src' will be clean. void append_head(IN OUT List<T> & src) { if (src.m_head == NULL) { return; } if (m_tail == NULL) { m_head = src.m_head; m_tail = src.m_tail; m_elem_count = src.m_elem_count; src.m_head = NULL; src.m_tail = NULL; src.m_elem_count = 0; return; } ASSERT0(src.m_tail); C_prev(m_head) = src.m_tail; C_next(src.m_tail) = m_head; m_elem_count += src.m_elem_count; m_head = src.m_head; src.m_head = NULL; src.m_tail = NULL; src.m_elem_count = 0; } //This function copy all elements in 'src' and //append to current list head. void append_and_copy_to_head(List<T> const& src) { C<T> * t = src.m_tail; if (t == NULL) { return; } if (m_head == NULL) { C<T> * c = newc(); ASSERT0(c); C_val(c) = C_val(t); ASSERT(m_tail == NULL, ("tail should be NULL")); m_head = m_tail = c; ASSERT0(C_next(c) == NULL && C_prev(c) == NULL); t = C_prev(t); } for (; t != T(0); t = C_prev(t)) { C<T> * c = newc(); ASSERT0(c); C_val(c) = C_val(t); C_next(c) = m_head; C_prev(m_head) = c; m_head = c; } C_prev(m_head) = NULL; m_elem_count += src.get_elem_count(); } //Return true if p is in current list. bool in_list(C<T> const* p) const { if (p == NULL) { return true; } C<T> const* t = m_head; while (t != NULL) { if (t == p) { return true; } t = C_next(t); } return false; } //Insert value t before marker. //Note this function will do searching for t and marker, so it is //a costly function, and used it be carefully. C<T> * insert_before(T t, T marker) { ASSERT(t != marker, ("element of list cannot be identical")); if (m_head == NULL || marker == C_val(m_head)) { return append_head(t); } C<T> * c = newc(); ASSERT0(c); C_val(c) = t; ASSERT0(m_tail); if (marker == m_tail->val()) { if (C_prev(m_tail) != NULL) { C_next(C_prev(m_tail)) = c; C_prev(c) = C_prev(m_tail); } C_next(c) = m_tail; C_prev(m_tail) = c; } else { //find marker C<T> * mc = m_head; while (mc != NULL) { if (mc->val() == marker) { break; } mc = C_next(mc); } if (mc == NULL) { return NULL; } if (C_prev(mc) != NULL) { C_next(C_prev(mc)) = c; C_prev(c) = C_prev(mc); } C_next(c) = mc; C_prev(mc) = c; } m_elem_count++; return c; } //Insert container 'c' into list before the 'marker'. void insert_before(IN C<T> * c, IN C<T> * marker) { ASSERT0(marker && c && C_prev(c) == NULL && C_next(c) == NULL); ASSERT0(c != marker); ASSERT0(m_tail); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif if (C_prev(marker) != NULL) { C_next(C_prev(marker)) = c; C_prev(c) = C_prev(marker); } C_next(c) = marker; C_prev(marker) = c; m_elem_count++; if (marker == m_head) { m_head = c; } } //Insert 't' into list before the 'marker'. C<T> * insert_before(T t, IN C<T> * marker) { C<T> * c = newc(); ASSERT(c, ("newc return NULL")); C_val(c) = t; insert_before(c, marker); return c; } //Insert 'src' before 'marker', and return the CONTAINER //of src head and src tail. //This function move all element in 'src' into current list. void insert_before( IN OUT List<T> & src, IN C<T> * marker, OUT C<T> ** list_head_ct = NULL, OUT C<T> ** list_tail_ct = NULL) { if (src.m_head == NULL) { return; } ASSERT0(m_head && marker); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif ASSERT0(src.m_tail); if (C_prev(marker) != NULL) { C_next(C_prev(marker)) = src.m_head; C_prev(src.m_head) = C_prev(marker); } C_next(src.m_tail) = marker; C_prev(marker) = src.m_tail; m_elem_count += src.m_elem_count; if (marker == m_head) { m_head = src.m_head; } if (list_head_ct != NULL) { *list_head_ct = src.m_head; } if (list_tail_ct != NULL) { *list_tail_ct = src.m_tail; } src.m_head = NULL; src.m_tail = NULL; src.m_elem_count = 0; } //Insert 'list' before 'marker', and return the CONTAINER //of list head and list tail. void insert_and_copy_before( List<T> const& list, T marker, OUT C<T> ** list_head_ct = NULL, OUT C<T> ** list_tail_ct = NULL) { C<T> * ct = NULL; find(marker, &ct); insert_before(list, ct, list_head_ct, list_tail_ct); } //Insert 'list' before 'marker', and return the CONTAINER //of list head and list tail. void insert_and_copy_before( List<T> const& list, IN C<T> * marker, OUT C<T> ** list_head_ct = NULL, OUT C<T> ** list_tail_ct = NULL) { if (list.m_head == NULL) { return; } ASSERT0(marker); C<T> * list_ct = list.m_tail; marker = insert_before(list_ct->val(), marker); if (list_tail_ct != NULL) { *list_tail_ct = marker; } list_ct = C_prev(list_ct); C<T> * prev_ct = marker; for (; list_ct != NULL; list_ct = C_prev(list_ct)) { marker = insert_before(list_ct->val(), marker); prev_ct = marker; } if (list_head_ct != NULL) { *list_head_ct = prev_ct; } } C<T> * insert_after(T t, T marker) { ASSERT(t != marker,("element of list cannot be identical")); if (m_tail == NULL || marker == m_tail->val()) { append_tail(t); return m_tail; } ASSERT(m_head != NULL, ("Tail is non empty, but head is NULL!")); C<T> * c = newc(); ASSERT(c != NULL, ("newc return NULL")); C_val(c) = t; if (marker == m_head->val()) { if (C_next(m_head) != NULL) { C_prev(C_next(m_head)) = c; C_next(c) = C_next(m_head); } C_prev(c) = m_head; C_next(m_head) = c; } else { //find marker C<T> * mc = m_head; while (mc != NULL) { if (mc->val() == marker) { break; } mc = C_next(mc); } if (mc == NULL) return NULL; if (C_next(mc) != NULL) { C_prev(C_next(mc)) = c; C_next(c) = C_next(mc); } C_prev(c) = mc; C_next(mc) = c; } m_elem_count++; return c; } //Insert 'c' into list after the 'marker'. void insert_after(IN C<T> * c, IN C<T> * marker) { ASSERT0(marker && c && C_prev(c) == NULL && C_next(c) == NULL); if (c == marker) { return; } ASSERT0(m_head); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif if (C_next(marker) != NULL) { C_prev(C_next(marker)) = c; C_next(c) = C_next(marker); } C_prev(c) = marker; C_next(marker) = c; if (marker == m_tail) { m_tail = c; } m_elem_count++; } //Insert 't' into list after the 'marker'. C<T> * insert_after(T t, IN C<T> * marker) { C<T> * c = newc(); ASSERT(c != NULL, ("newc return NULL")); C_val(c) = t; insert_after(c, marker); return c; } //Insert 'src' after 'marker', and return the CONTAINER //of src head and src tail. //This function move all element in 'src' into current list. void insert_after( IN OUT List<T> & src, IN C<T> * marker, OUT C<T> ** list_head_ct = NULL, OUT C<T> ** list_tail_ct = NULL) { if (src.m_head == NULL) { return; } ASSERT0(m_head && marker); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif ASSERT0(src.m_tail); if (C_next(marker) != NULL) { C_prev(C_next(marker)) = src.m_tail; C_next(src.m_tail) = C_next(marker); } C_prev(src.m_head) = marker; C_next(marker) = src.m_head; m_elem_count += src.m_elem_count; if (marker == m_tail) { m_tail = src.m_tail; } if (list_head_ct != NULL) { *list_head_ct = src.m_head; } if (list_tail_ct != NULL) { *list_tail_ct = src.m_tail; } src.m_head = NULL; src.m_tail = NULL; src.m_elem_count = 0; } //Insert 'list' after 'marker', and return the CONTAINER //of list head and list tail. void insert_and_copy_after( List<T> const& list, T marker, OUT C<T> ** list_head_ct = NULL, OUT C<T> ** list_tail_ct = NULL) { C<T> * ct = NULL; find(marker, &ct); insert_after(list, ct, list_head_ct, list_tail_ct); } //Insert 'list' after 'marker', and return the CONTAINER //of head and tail of members in 'list'. void insert_and_copy_after( List<T> const& list, IN C<T> * marker, OUT C<T> ** list_head_ct = NULL, OUT C<T> ** list_tail_ct = NULL) { if (list.m_head == NULL) { return; } ASSERT0(marker); C<T> * list_ct = list.m_head; marker = insert_after(list_ct->val(), marker); if (list_head_ct != NULL) { *list_head_ct = marker; } list_ct = C_next(list_ct); C<T> * prev_ct = marker; for (; list_ct != NULL; list_ct = C_next(list_ct)) { marker = insert_after(list_ct->val(), marker); prev_ct = marker; } if (list_tail_ct != NULL) { *list_tail_ct = prev_ct; } } UINT get_elem_count() const { return m_elem_count; } T get_cur() const { if (m_cur == NULL) { return T(0); } return m_cur->val(); } //Return m_cur and related container, and it does not modify m_cur. T get_cur(IN OUT C<T> ** holder) const { if (m_cur == NULL) { *holder = NULL; return T(0); } ASSERT0(holder != NULL); *holder = m_cur; return m_cur->val(); } //Get tail of list, return the CONTAINER. //This function does not modify m_cur. T get_tail(OUT C<T> ** holder) const { ASSERT0(holder); *holder = m_tail; if (m_tail != NULL) { return m_tail->val(); } return T(0); } //Get tail of list, return the CONTAINER. //This function will modify m_cur. T get_tail() { m_cur = m_tail; if (m_tail != NULL) { return m_tail->val(); } return T(0); } //Get head of list, return the CONTAINER. //This function will modify m_cur. T get_head() { m_cur = m_head; if (m_head != NULL) { return m_head->val(); } return T(0); } //Get head of list, return the CONTAINER. //This function does not modify m_cur. T get_head(OUT C<T> ** holder) const { ASSERT0(holder); *holder = m_head; if (m_head != NULL) { return m_head->val(); } return T(0); } //Get element next to m_cur. //This function will modify m_cur. T get_next() { if (m_cur == NULL || m_cur->next == NULL) { m_cur = NULL; return T(0); } m_cur = m_cur->next; return m_cur->val(); } //Return next container. //Caller could get the element via C_val or val(). //This function does not modify m_cur. C<T> * get_next(IN C<T> * holder) const { ASSERT0(holder); return C_next(holder); } //Return list member and update holder to next member. //This function does not modify m_cur. T get_next(IN OUT C<T> ** holder) const { ASSERT0(holder && *holder); *holder = C_next(*holder); if (*holder != NULL) { return C_val(*holder); } return T(0); } //Get element previous to m_cur. //This function will modify m_cur. T get_prev() { if (m_cur == NULL || m_cur->prev == NULL) { m_cur = NULL; return T(0); } m_cur = m_cur->prev; return m_cur->val(); } //Return list member and update holder to prev member. //This function does not modify m_cur. T get_prev(IN OUT C<T> ** holder) const { ASSERT0(holder && *holder); *holder = C_prev(*holder); if (*holder != NULL) { return C_val(*holder); } return T(0); } //Return prev container. //Caller could get the element via C_val or val(). //This function does not modify m_cur. C<T> * get_prev(IN C<T> * holder) const { ASSERT0(holder); return C_prev(holder); } //Get element for nth at tail. //'n': starting at 0. //This function will modify m_cur. T get_tail_nth(UINT n, IN OUT C<T> ** holder = NULL) { ASSERT(n < m_elem_count,("Access beyond list")); m_cur = NULL; if (m_elem_count == 0) { return T(0); } C<T> * c; if (n <= (m_elem_count >> 1)) { // n<floor(elem_count,2) c = m_tail; while (n > 0) { c = C_prev(c); n--; } } else { return get_head_nth(m_elem_count - n - 1); } m_cur = c; if (holder != NULL) { *holder = c; } return c->val(); } //Get element for nth at head. //'n': getting start with zero. //This function will modify m_cur. T get_head_nth(UINT n, IN OUT C<T> ** holder = NULL) { ASSERT(n < m_elem_count,("Access beyond list")); m_cur = NULL; if (m_head == NULL) { return T(0); } C<T> * c; if (n <= (m_elem_count >> 1)) { // n<floor(elem_count,2) c = m_head; while (n > 0) { c = C_next(c); n--; } } else { return get_tail_nth(m_elem_count - n - 1); } m_cur = c; if (holder != NULL) { *holder = c; } return c->val(); } bool find(IN T t, OUT C<T> ** holder = NULL) const { C<T> * c = m_head; while (c != NULL) { if (c->val() == t) { if (holder != NULL) { *holder = c; } return true; } c = C_next(c); } if (holder != NULL) { *holder = NULL; } return false; } //Reverse list. void reverse() { C<T> * next_ct; for (C<T> * ct = m_head; ct != NULL; ct = next_ct) { next_ct = ct->next; ct->next = ct->prev; ct->prev = next_ct; } next_ct = m_head; m_head = m_tail; m_tail = next_ct; } //Remove from list directly. T remove(C<T> * holder) { ASSERT0(holder); if (holder == m_cur) { m_cur = m_cur->next; } ASSERT(m_head, ("list is empty")); if (m_head == holder) { return remove_head(); } if (m_tail == holder) { return remove_tail(); } ASSERT(C_prev(holder) && C_next(holder), ("illegal t in list")); C_next(C_prev(holder)) = C_next(holder); C_prev(C_next(holder)) = C_prev(holder); m_elem_count--; C_prev(holder) = C_next(holder) = NULL; m_free_list.add_free_elem(holder); return holder->val(); } //Remove from list, and searching for 't' begin at head T remove(T t) { if (m_head == NULL) { return T(0); } if (m_head->val() == t) { return remove_head(); } if (m_tail->val() == t) { return remove_tail(); } C<T> * c = m_head; while (c != NULL) { if (c->val() == t) { break; } c = C_next(c); } if (c == NULL) { return T(0); } return remove(c); } //Remove from tail. T remove_tail() { if (m_tail == NULL) { return T(0); } C<T> * c = NULL; if (C_prev(m_tail) == NULL) { //tail is the only one ASSERT(m_tail == m_head && m_elem_count == 1, ("illegal list-remove")); c = m_tail; m_head = m_tail = m_cur = NULL; } else { c = m_tail; if (m_cur == m_tail) { m_cur = C_prev(m_tail); } m_tail = C_prev(m_tail); C_next(m_tail) = NULL; C_prev(c) = NULL; } m_elem_count--; m_free_list.add_free_elem(c); return c->val(); } //Remove from head. T remove_head() { C<T> * c = NULL; if (m_head == NULL) { return T(0); } if (C_next(m_head) == NULL) { //list_head is the only one ASSERT(m_tail == m_head && m_elem_count == 1, ("illegal list-remove")); c = m_head; m_head = m_tail = m_cur = NULL; } else { c = m_head; if (m_cur == m_head) { m_cur = C_next(m_head); } m_head = C_next(m_head); C_prev(m_head) = NULL; C_prev(c) = C_next(c) = NULL; } m_free_list.add_free_elem(c); m_elem_count--; return c->val(); } }; //Single Linked List Core. //Encapsulate most operations for single list. //Note: // 1. You must invoke init() if the SListCore allocated in mempool. // 2. The single linked list is different with dual linked list. // the dual linked list does not use mempool to hold the container. // Compared to dual linked list, single linked list allocate containers // in a const size pool. // 3. Before going to the destructor, even if the containers have // been allocated in memory pool, you should invoke clean() to free // all of them back to a free list to reuse them. template <class T> class SListCore { protected: UINT m_elem_count; //list elements counter. SC<T> m_head; //list head. protected: SC<T> * new_sc_container(SMemPool * pool) { ASSERT(pool, ("need mem pool")); ASSERT(MEMPOOL_type(pool) == MEM_CONST_SIZE, ("need const size pool")); SC<T> * p = (SC<T>*)smpoolMallocConstSize(sizeof(SC<T>), pool); ASSERT0(p != NULL); ::memset(p, 0, sizeof(SC<T>)); return p; } //Check p is the element in list. bool in_list(SC<T> const* p) const { ASSERT0(p); if (p == &m_head) { return true; } SC<T> const* t = m_head.next; while (t != &m_head) { if (t == p) { return true; } t = t->next; } return false; } SC<T> * get_freed_sc(SC<T> ** free_list) { if (free_list == NULL || *free_list == NULL) { return NULL; } SC<T> * t = *free_list; *free_list = (*free_list)->next; t->next = NULL; return t; } //Find the last element, and return the CONTAINER. //This is a costly operation. Use it carefully. inline SC<T> * get_tail() const { SC<T> * c = m_head.next; SC<T> * tail = NULL; while (c != &m_head) { tail = c; c = c->next; } return tail; } void free_sc(SC<T> * sc, SC<T> ** free_list) { ASSERT0(free_list); sc->next = *free_list; *free_list = sc; } SC<T> * newsc(SC<T> ** free_list, SMemPool * pool) { SC<T> * c = get_freed_sc(free_list); if (c == NULL) { c = new_sc_container(pool); } return c; } public: SListCore() { init(); } COPY_CONSTRUCTOR(SListCore); ~SListCore() { //Note: Before invoked the destructor, even if the containers have //been allocated in memory pool, you should invoke clean() to //free all of them back to a free list to reuse them. } void init() { m_elem_count = 0; m_head.next = &m_head; } SC<T> * append_head(T t, SC<T> ** free_list, SMemPool * pool) { SC<T> * c = newsc(free_list, pool); ASSERT(c != NULL, ("newsc return NULL")); SC_val(c) = t; append_head(c); return c; } void append_head(IN SC<T> * c) { insert_after(c, &m_head); } //Find the last element, and add 'c' after it. //This is a costly operation. Use it carefully. void append_tail(IN SC<T> * c) { SC<T> * cur = m_head.next; SC<T> * prev = &m_head; while (cur != &m_head) { cur = cur->next; prev = cur; } insert_after(c, prev); } void copy(IN SListCore<T> & src, SC<T> ** free_list, SMemPool * pool) { clean(free_list); SC<T> * tgt_st = get_head(); for (SC<T> * src_st = src.get_head(); src_st != src.end(); src_st = src.get_next(src_st), tgt_st = get_next(tgt_st)) { T t = src_st->val(); insert_after(t, tgt_st, free_list, pool); } } void clean(SC<T> ** free_list) { ASSERT0(free_list); SC<T> * tail = get_tail(); if (tail != NULL) { tail->next = *free_list; *free_list = m_head.next; m_head.next = &m_head; m_elem_count = 0; } ASSERT0(m_elem_count == 0); } UINT count_mem() const { UINT count = sizeof(m_elem_count); count += sizeof(m_head); //Do not count SC, they belong to input pool. return count; } //Insert container 'c' after the 'marker'. inline void insert_after(IN SC<T> * c, IN SC<T> * marker) { ASSERT0(marker && c && c != marker); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif c->next = marker->next; marker->next = c; m_elem_count++; } //Insert value 't' after the 'marker'. //free_list: a list record free containers. //pool: memory pool which is used to allocate container. inline SC<T> * insert_after( T t, IN SC<T> * marker, SC<T> ** free_list, SMemPool * pool) { ASSERT0(marker); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif SC<T> * c = newsc(free_list, pool); ASSERT(c != NULL, ("newc return NULL")); SC_val(c) = t; insert_after(c, marker); return c; } UINT get_elem_count() const { return m_elem_count; } //Return the end of the list. SC<T> const * end() const { return &m_head; } //Get head of list, return the CONTAINER. //You could iterate the list via comparing the container with end(). SC<T> * get_head() const { return m_head.next; } //Return the next container. SC<T> * get_next(IN SC<T> * holder) const { ASSERT0(holder); return SC_next(holder); } //Find 't' in list, return the container in 'holder' if 't' existed. //The function is regular list search, and has O(n) complexity. //Note that this is costly operation. Use it carefully. bool find(IN T t, OUT SC<T> ** holder = NULL) const { SC<T> * c = m_head.next; while (c != &m_head) { if (c->val() == t) { if (holder != NULL) { *holder = c; } return true; } c = c->next; } if (holder != NULL) { *holder = NULL; } return false; } //Remove 't' out of list, return true if find t, otherwise return false. //Note that this is costly operation. Use it carefully. bool remove(T t, SC<T> ** free_list) { SC<T> * c = m_head.next; SC<T> * prev = &m_head; while (c != &m_head) { if (c->val() == t) { break; } prev = c; c = c->next; } if (c == &m_head) { return false; } remove(prev, c, free_list); return true; } //Return the element removed. //'prev': the previous one element of 'holder'. T remove(SC<T> * prev, SC<T> * holder, SC<T> ** free_list) { ASSERT0(holder); ASSERT(m_head.next != &m_head, ("list is empty")); ASSERT0(prev); ASSERT(prev->next == holder, ("not prev one")); prev->next = holder->next; m_elem_count--; T t = SC_val(holder); free_sc(holder, free_list); return t; } //Return the element removed. T remove_head(SC<T> ** free_list) { if (m_head.next == &m_head) { return T(0); } SC<T> * c = m_head.next; m_head.next = c->next; T t = c->val(); free_sc(c, free_list); m_elem_count--; return t; } }; //END SListCore //Single List //NOTICE: // The following operations are the key points which you should attention to: // // 1. You must invoke init() if the SList allocated in mempool. // 2. Before going to the destructor, even if the containers have // been allocated in memory pool, you should invoke clean() to free // all of them back to a free list to reuse them. // 3. If you REMOVE one element, its container will be collect by FREE-List. // So if you need a new container, please check the FREE-List first, // accordingly, you should first invoke 'get_free_list' which get free // containers out from 'm_free_list'. // 4. The single linked list is different with dual linked list. // the dual linked list does not use mempool to hold the container. // Compared to dual linked list, single linked list allocate containers // in a const size pool. // Invoke init() to do initialization if you allocate SList by malloc(). // 5. Compare the iterator with end() to determine if meeting the end of list. // 6. Byte size of element in Const Pool is equal to sizeof(SC<T>). // // Usage:SMemPool * pool = smpoolCreate(sizeof(SC<T>) * n, MEM_CONST_SIZE); // SList<T> list(pool); // SList<T> * list2 = smpoolMalloc(); // list2->init(pool); // ... // smpoolDelete(pool); template <class T> class SList : public SListCore<T> { protected: SMemPool * m_free_list_pool; SC<T> * m_free_list; //Hold for available containers public: SList(SMemPool * pool = NULL) { //Invoke init() explicitly if SList is allocated from mempool. set_pool(pool); } COPY_CONSTRUCTOR(SList); ~SList() { //destroy() do the same things as the parent class's destructor. //So it is not necessary to double call destroy(). //Note: Before going to the destructor, even if the containers have //been allocated in memory pool, you should invoke clean() to //free all of them back to a free list to reuse them. } void init(SMemPool * pool) { SListCore<T>::init(); set_pool(pool); } void set_pool(SMemPool * pool) { ASSERT(pool == NULL || MEMPOOL_type(pool) == MEM_CONST_SIZE, ("need const size pool")); m_free_list_pool = pool; m_free_list = NULL; } SMemPool * get_pool() { return m_free_list_pool; } SC<T> * append_head(T t) { ASSERT0(m_free_list_pool); return SListCore<T>::append_head(t, &m_free_list, m_free_list_pool); } void copy(IN SList<T> & src) { SListCore<T>::copy(src, &m_free_list, m_free_list_pool); } void clean() { SListCore<T>::clean(&m_free_list); } UINT count_mem() const { //Do not count SC containers, they belong to input pool. return SListCore<T>::count_mem(); } //Insert 't' into list after the 'marker'. SC<T> * insert_after(T t, IN SC<T> * marker) { ASSERT0(m_free_list_pool); return SListCore<T>::insert_after(t, marker, &m_free_list, m_free_list_pool); } //Remove 't' out of list, return true if find t, otherwise return false. //Note that this is costly operation. bool remove(T t) { ASSERT0(m_free_list_pool); return SListCore<T>::remove(t, &m_free_list); } //Return element removed. //'prev': the previous one element of 'holder'. T remove(SC<T> * prev, SC<T> * holder) { ASSERT0(m_free_list_pool); return SListCore<T>::remove(prev, holder, &m_free_list); } //Return element removed. T remove_head() { ASSERT0(m_free_list_pool); return SListCore<T>::remove_head(&m_free_list); } }; //END SList //The Extended Single List. // //This kind of single list has a tail pointer that allows you access //tail element directly via get_tail(). This will be useful if you //are going to append element at the tail of list. // //Encapsulate most operations for single list. // //Note the single linked list is different with dual linked list. //the dual linked list does not use mempool to hold the container. //Compared to dual linked list, single linked list allocate containers //in a const size pool. template <class T> class SListEx { protected: UINT m_elem_count; SC<T> * m_head; SC<T> * m_tail; protected: SC<T> * new_sc_container(SMemPool * pool) { ASSERT(pool, ("need mem pool")); ASSERT(MEMPOOL_type(pool) == MEM_CONST_SIZE, ("need const size pool")); SC<T> * p = (SC<T>*)smpoolMallocConstSize(sizeof(SC<T>), pool); ASSERT0(p); ::memset(p, 0, sizeof(SC<T>)); return p; } SC<T> * get_freed_sc(SC<T> ** free_list) { if (free_list == NULL || *free_list == NULL) { return NULL; } SC<T> * t = *free_list; *free_list = (*free_list)->next; t->next = NULL; return t; } void free_sc(SC<T> * sc, SC<T> ** free_list) { ASSERT0(free_list); sc->next = *free_list; *free_list = sc; } SC<T> * newsc(SC<T> ** free_list, SMemPool * pool) { SC<T> * c = get_freed_sc(free_list); if (c == NULL) { c = new_sc_container(pool); } return c; } //Check p is the element in list. bool in_list(SC<T> const* p) const { if (p == NULL) { return true; } SC<T> const* t = m_head; while (t != NULL) { if (t == p) { return true; } t = t->next; } return false; } public: SListEx() { init(); } COPY_CONSTRUCTOR(SListEx); ~SListEx() { //Note: Before going to the destructor, even if the containers have //been allocated in memory pool, you should free all of them //back to a free list to reuse them. } void init() { m_elem_count = 0; m_head = NULL; m_tail = NULL; } //Return the end of the list. SC<T> const* end() const { return NULL; } SC<T> * append_tail(T t, SC<T> ** free_list, SMemPool * pool) { SC<T> * c = newsc(free_list, pool); ASSERT(c != NULL, ("newsc return NULL")); SC_val(c) = t; append_tail(c); return c; } void append_tail(IN SC<T> * c) { if (m_head == NULL) { ASSERT(m_tail == NULL, ("tail should be NULL")); ASSERT0(SC_next(c) == NULL); m_head = m_tail = c; m_elem_count++; return; } SC_next(m_tail) = c; m_tail = c; ASSERT0(SC_next(c) == NULL); m_elem_count++; return; } SC<T> * append_head(T t, SC<T> ** free_list, SMemPool * pool) { SC<T> * c = newsc(free_list, pool); ASSERT(c != NULL, ("newsc return NULL")); SC_val(c) = t; append_head(c); return c; } void append_head(IN SC<T> * c) { #ifdef _DEBUG_ if (m_head == NULL) { ASSERT(m_tail == NULL, ("tail should be NULL")); ASSERT0(m_elem_count == 0); } #endif c->next = m_head; m_head = c; m_elem_count++; return; } void copy(IN SListCore<T> & src, SC<T> ** free_list, SMemPool * pool) { clean(free_list); SC<T> * sct; T t = src.get_head(&sct); for (INT n = src.get_elem_count(); n > 0; n--) { append_tail(t, free_list, pool); t = src.get_next(&sct); } } void clean(SC<T> ** free_list) { ASSERT0(free_list); if (m_tail != NULL) { m_tail->next = *free_list; ASSERT0(m_head); *free_list = m_head; m_head = m_tail = NULL; m_elem_count = 0; } ASSERT0(m_head == m_tail && m_head == NULL && m_elem_count == 0); } UINT count_mem() const { UINT count = sizeof(m_elem_count); count += sizeof(m_head); count += sizeof(m_tail); //Do not count SC, they has been involved in pool. return count; } //Insert 'c' into list after the 'marker'. inline void insert_after(IN SC<T> * c, IN SC<T> * marker) { ASSERT0(marker && c && c != marker); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif c->next = marker->next; marker->next = c; m_elem_count++; } //Insert 't' into list after the 'marker'. inline SC<T> * insert_after( T t, IN SC<T> * marker, SC<T> ** free_list, SMemPool * pool) { ASSERT0(marker); #ifdef _SLOW_CHECK_ ASSERT0(in_list(marker)); #endif SC<T> * c = newsc(free_list, pool); ASSERT(c, ("newc return NULL")); SC_val(c) = t; insert_after(c, marker); return c; } UINT get_elem_count() const { return m_elem_count; } //Get tail of list, return the CONTAINER. SC<T> * get_tail() const { return m_tail; } //Get head of list, return the CONTAINER. SC<T> * get_head() const { return m_head; } //Return the next container. SC<T> * get_next(IN SC<T> * holder) const { ASSERT0(holder); return SC_next(holder); } //Find 't' in list, return the container in 'holder' if 't' existed. //The function is regular list search, and has O(n) complexity. bool find(IN T t, OUT SC<T> ** holder = NULL) const { SC<T> * c = m_head; while (c != NULL) { if (c->val() == t) { if (holder != NULL) { *holder = c; } return true; } c = c->next; } if (holder != NULL) { *holder = NULL; } return false; } //Remove 't' out of list, return true if find t, otherwise return false. //Note that this is costly operation. bool remove(T t, SC<T> ** free_list) { if (m_head == NULL) { return false; } if (m_head->val() == t) { remove_head(free_list); return true; } SC<T> * c = m_head->next; SC<T> * prev = m_head; while (c != NULL) { if (c->val() == t) { break; } prev = c; c = c->next; } if (c == NULL) { return false; } remove(prev, c, free_list); return true; } //Return the element removed. //'prev': the previous one element of 'holder'. T remove(SC<T> * prev, SC<T> * holder, SC<T> ** free_list) { ASSERT0(holder); ASSERT(m_head != NULL, ("list is empty")); #ifdef _SLOW_CHECK_ ASSERT0(in_list(prev)); ASSERT0(in_list(holder)); #endif if (prev == NULL) { ASSERT0(holder == m_head); m_head = m_head->next; if (m_head == NULL) { ASSERT0(m_elem_count == 1); m_tail = NULL; } } else { ASSERT(prev->next == holder, ("not prev one")); prev->next = holder->next; } if (holder == m_tail) { m_tail = prev; } m_elem_count--; T t = SC_val(holder); free_sc(holder, free_list); return t; } //Return the element removed. T remove_head(SC<T> ** free_list) { if (m_head == NULL) { return T(0); } SC<T> * c = m_head; m_head = m_head->next; if (m_head == NULL) { m_tail = NULL; } T t = c->val(); free_sc(c, free_list); m_elem_count--; return t; } }; //END SListEx //The Extended List // //Add a hash-mapping table upon List in order to speed up the process //when inserting or removing an element if a 'marker' given. // //NOTICE: User must define a mapping class bewteen. template <class T, class MapTypename2Holder> class EList : public List<T> { protected: MapTypename2Holder m_typename2holder; //map typename 'T' to its list holder. public: EList() {} COPY_CONSTRUCTOR(EList); virtual ~EList() {} //MapTypename2Holder has virtual function. void copy(IN List<T> & src) { clean(); T t = src.get_head(); for (INT n = src.get_elem_count(); n > 0; n--) { append_tail(t); t = src.get_next(); } } void clean() { List<T>::clean(); m_typename2holder.clean(); } size_t count_mem() const { size_t count = m_typename2holder.count_mem(); count += ((List<T>*)this)->count_mem(); return count; } C<T> * append_tail(T t) { C<T> * c = List<T>::append_tail(t); m_typename2holder.setAlways(t, c); return c; } C<T> * append_head(T t) { C<T> * c = List<T>::append_head(t); m_typename2holder.setAlways(t, c); return c; } void append_tail(IN List<T> & list) { UINT i = 0; C<T> * c; for (T t = list.get_head(); i < list.get_elem_count(); i++, t = list.get_next()) { c = List<T>::append_tail(t); m_typename2holder.setAlways(t, c); } } void append_head(IN List<T> & list) { UINT i = 0; C<T> * c; for (T t = list.get_tail(); i < list.get_elem_count(); i++, t = list.get_prev()) { c = List<T>::append_head(t); m_typename2holder.setAlways(t, c); } } T remove(T t) { C<T> * c = m_typename2holder.get(t); if (c == NULL) { return T(0); } T tt = List<T>::remove(c); m_typename2holder.setAlways(t, NULL); return tt; } T remove(C<T> * holder) { ASSERT0(m_typename2holder.get(holder->val()) == holder); T t = List<T>::remove(holder); m_typename2holder.setAlways(t, NULL); return t; } T remove_tail() { T t = List<T>::remove_tail(); m_typename2holder.setAlways(t, NULL); return t; } T remove_head() { T t = List<T>::remove_head(); m_typename2holder.setAlways(t, NULL); return t; } //NOTICE: 'marker' should have been in the list. C<T> * insert_before(T t, T marker) { C<T> * marker_holder = m_typename2holder.get(marker); if (marker_holder == NULL) { ASSERT0(List<T>::get_elem_count() == 0); C<T> * t_holder = List<T>::append_head(t); m_typename2holder.setAlways(t, t_holder); return t_holder; } C<T> * t_holder = List<T>::insert_before(t, marker_holder); m_typename2holder.setAlways(t, t_holder); return t_holder; } //NOTICE: 'marker' should have been in the list, //and marker will be modified. C<T> * insert_before(T t, C<T> * marker) { ASSERT0(marker && m_typename2holder.get(marker->val()) == marker); C<T> * t_holder = List<T>::insert_before(t, marker); m_typename2holder.setAlways(t, t_holder); return t_holder; } //NOTICE: 'marker' should have been in the list. void insert_before(C<T> * c, C<T> * marker) { ASSERT0(c && marker && m_typename2holder.get(marker->val()) == marker); List<T>::insert_before(c, marker); m_typename2holder.setAlways(c->val(), c); } //NOTICE: 'marker' should have been in the list. C<T> * insert_after(T t, T marker) { C<T> * marker_holder = m_typename2holder.get(marker); if (marker_holder == NULL) { ASSERT0(List<T>::get_elem_count() == 0); C<T> * t_holder = List<T>::append_tail(t); m_typename2holder.setAlways(t, t_holder); return t_holder; } C<T> * t_holder = List<T>::insert_after(t, marker_holder); m_typename2holder.setAlways(t, t_holder); return t_holder; } //NOTICE: 'marker' should have been in the list. C<T> * insert_after(T t, C<T> * marker) { ASSERT0(marker && m_typename2holder.get(marker->val()) == marker); C<T> * marker_holder = marker; C<T> * t_holder = List<T>::insert_after(t, marker_holder); m_typename2holder.setAlways(t, t_holder); return t_holder; } //NOTICE: 'marker' should have been in the list. void insert_after(C<T> * c, C<T> * marker) { ASSERT0(c && marker && m_typename2holder.get(marker->val()) == marker); List<T>::insert_after(c, marker); m_typename2holder.setAlways(c->val(), c); } bool find(T t, C<T> ** holder = NULL) const { C<T> * c = m_typename2holder.get(t); if (c == NULL) { return false; } if (holder != NULL) { *holder = c; } return true; } MapTypename2Holder * get_holder_map() const { return &m_typename2holder; } T get_cur() const //Do NOT update 'm_cur' { return List<T>::get_cur(); } T get_cur(IN OUT C<T> ** holder) const //Do NOT update 'm_cur' { return List<T>::get_cur(holder); } T get_next() //Update 'm_cur' { return List<T>::get_next(); } T get_prev() //Update 'm_cur' { return List<T>::get_prev(); } T get_next(IN OUT C<T> ** holder) const //Do NOT update 'm_cur' { return List<T>::get_next(holder); } C<T> * get_next(IN C<T> * holder) const //Do NOT update 'm_cur' { return List<T>::get_next(holder); } T get_prev(IN OUT C<T> ** holder) const //Do NOT update 'm_cur' { return List<T>::get_prev(holder); } C<T> * get_prev(IN C<T> * holder) const //Do NOT update 'm_cur' { return List<T>::get_prev(holder); } T get_next(T marker) const //not update 'm_cur' { C<T> * holder; find(marker, &holder); ASSERT0(holder != NULL); return List<T>::get_next(&holder); } T get_prev(T marker) const //not update 'm_cur' { C<T> * holder; find(marker, &holder); ASSERT0(holder != NULL); return List<T>::get_prev(&holder); } //Return the container of 'newt'. C<T> * replace(T oldt, T newt) { C<T> * old_holder = m_typename2holder.get(oldt); ASSERT(old_holder != NULL, ("old elem not exist")); //add new one C<T> * new_holder = List<T>::insert_before(newt, old_holder); m_typename2holder.setAlways(newt, new_holder); //remove old one m_typename2holder.setAlways(oldt, NULL); List<T>::remove(old_holder); return new_holder; } }; //END EList //STACK template <class T> class Stack : public List<T> { public: Stack() {} COPY_CONSTRUCTOR(Stack); void push(T t) { List<T>::append_tail(t); } T pop() { return List<T>::remove_tail(); } T get_bottom() { return List<T>::get_head(); } T get_top() { return List<T>::get_tail(); } T get_top_nth(INT n) { return List<T>::get_tail_nth(n); } T get_bottom_nth(INT n) { return List<T>::get_head_nth(n); } }; //END Stack //Vector // //T refer to element type. //NOTE: zero is reserved and regard it as the default NULL when we //determine whether an element is exist. //The vector grow dynamic. #define SVEC_init(s) ((s)->m_is_init) template <class T, UINT GrowSize = 8> class Vector { protected: UINT m_elem_num:31; //The number of element in vector. //The number of element when vector is growing. UINT m_is_init:1; INT m_last_idx; //Last element idx public: T * m_vec; Vector() { SVEC_init(this) = false; init(); } explicit Vector(INT size) { SVEC_init(this) = false; init(); grow(size); } Vector(Vector const& vec) { copy(vec); } Vector const& operator = (Vector const&); ~Vector() { destroy(); } void add(T t) { ASSERT(is_init(), ("VECTOR not yet initialized.")); set(m_last_idx < 0 ? 0 : m_last_idx, t); } inline void init() { if (SVEC_init(this)) { return; } m_elem_num = 0; m_vec = NULL; m_last_idx = -1; SVEC_init(this) = true; } inline void init(UINT size) { if (SVEC_init(this)) { return; } ASSERT0(size != 0); m_vec = (T*)::malloc(sizeof(T) * size); ASSERT0(m_vec); ::memset(m_vec, 0, sizeof(T) * size); m_elem_num = size; m_last_idx = -1; SVEC_init(this) = true; } bool is_init() const { return SVEC_init(this); } inline void destroy() { if (!SVEC_init(this)) { return; } m_elem_num = 0; if (m_vec != NULL) { ::free(m_vec); } m_vec = NULL; m_last_idx = -1; SVEC_init(this) = false; } //The function often invoked by destructor, to speed up destruction time. //Since reset other members is dispensable. void destroy_vec() { if (m_vec != NULL) { ::free(m_vec); } } T get(UINT index) const { ASSERT(is_init(), ("VECTOR not yet initialized.")); return (index >= (UINT)m_elem_num) ? T(0) : m_vec[index]; } T * get_vec() { return m_vec; } //Overloaded [] for CONST array reference create an rvalue. //Similar to 'get()', the difference between this operation //and get() is [] opeartion does not allow index is greater than //or equal to m_elem_num. //Note this operation can not be used to create lvalue. //e.g: Vector<int> const v; // int ex = v[i]; T const operator[](UINT index) const { ASSERT(is_init(), ("VECTOR not yet initialized.")); ASSERT(index < (UINT)m_elem_num, ("array subscript over boundary.")); return m_vec[index]; } //Overloaded [] for non-const array reference create an lvalue. //Similar to set(), the difference between this operation //and set() is [] opeartion does not allow index is greater than //or equal to m_elem_num. inline T & operator[](UINT index) { ASSERT(is_init(), ("VECTOR not yet initialized.")); ASSERT(index < (UINT)m_elem_num, ("array subscript over boundary.")); m_last_idx = MAX((INT)index, m_last_idx); return m_vec[index]; } //Copy each elements of 'list' into vector. //NOTE: The default termination factor is '0'. // While we traversing elements of List one by one, or from head to // tail or on opposition way, one can copy list into vector first and // iterating the vector instead of travering list. void copy(List<T> & list) { INT count = 0; set(list.get_elem_count() - 1, 0); //Alloc memory right away. for (T elem = list.get_head(); elem != T(0); elem = list.get_next(), count++) { set(count, elem); } } void copy(Vector const& vec) { ASSERT0(vec.m_elem_num > 0 || (vec.m_elem_num == 0 && vec.m_last_idx == -1)); UINT n = vec.m_elem_num; if (m_elem_num < n) { destroy(); init(n); } if (n > 0) { ::memcpy(m_vec, vec.m_vec, sizeof(T) * n); } m_last_idx = vec.m_last_idx; } //Clean to zero(default) till 'last_idx'. void clean() { ASSERT(is_init(), ("VECTOR not yet initialized.")); if (m_last_idx < 0) { return; } ::memset(m_vec, 0, sizeof(T) * (m_last_idx + 1)); m_last_idx = -1; //No any elements } UINT count_mem() const { return m_elem_num * sizeof(T) + sizeof(Vector<T>); } //Place elem to vector according to index. //Growing vector if 'index' is greater than m_elem_num. void set(UINT index, T elem) { ASSERT(is_init(), ("VECTOR not yet initialized.")); if (index >= (UINT)m_elem_num) { grow(getNearestPowerOf2(index) + 2); } m_last_idx = MAX((INT)index, m_last_idx); m_vec[index] = elem; return; } //Return the number of element the vector could hold. UINT get_capacity() const { ASSERT(is_init(), ("VECTOR not yet initialized.")); return m_elem_num; } INT get_last_idx() const { ASSERT(is_init(), ("VECTOR not yet initialized.")); ASSERT(m_last_idx < (INT)m_elem_num, ("Last index ran over Vector's size.")); return m_last_idx; } //Growing vector up to hold the most num_of_elem elements. //If 'm_elem_num' is 0 , alloc vector to hold num_of_elem elements. //Reallocate memory if necessory. void grow(UINT num_of_elem) { ASSERT(is_init(), ("VECTOR not yet initialized.")); if (num_of_elem == 0) { return; } if (m_elem_num == 0) { ASSERT(m_vec == NULL, ("vector should be NULL if size is zero.")); m_vec = (T*)::malloc(sizeof(T) * num_of_elem); ASSERT0(m_vec); ::memset(m_vec, 0, sizeof(T) * num_of_elem); m_elem_num = num_of_elem; return; } ASSERT0(num_of_elem > (UINT)m_elem_num); T * tmp = (T*)::malloc(num_of_elem * sizeof(T)); ASSERT0(tmp); ::memcpy(tmp, m_vec, m_elem_num * sizeof(T)); ::memset(((CHAR*)tmp) + m_elem_num * sizeof(T), 0, (num_of_elem - m_elem_num)* sizeof(T)); ::free(m_vec); m_vec = tmp; m_elem_num = num_of_elem; } //Return true if there is not any element. bool is_empty() const { return get_last_idx() == -1; } }; //END Vector //The extented class to Vector. //This class maintains an index which call Free Index of Vector. //User can use the Free Index to get to know which slot of vector //is T(0). // //e.g: assume Vector<INT> has 6 elements, {0, 3, 4, 0, 5, 0}. //Three of them are 0, where T(0) served as default NULL and these //elements indicate free slot. //In the case, the first free index is 0, the second is 3, and the //third is 5. template <class T, UINT GrowSize = 8> class VectorWithFreeIndex : public Vector<T, GrowSize> { protected: //Always refers to free space to Vector, //and the first free space position is '0' UINT m_free_idx; public: VectorWithFreeIndex() { SVEC_init(this) = false; init(); } COPY_CONSTRUCTOR(VectorWithFreeIndex); inline void init() { Vector<T, GrowSize>::init(); m_free_idx = 0; } inline void init(UINT size) { Vector<T, GrowSize>::init(size); m_free_idx = 0; } void copy(VectorWithFreeIndex const& vec) { Vector<T, GrowSize>::copy(vec); m_free_idx = vec.m_free_idx; } //Clean to zero(default) till 'last_idx'. void clean() { Vector<T, GrowSize>::clean(); m_free_idx = 0; } //Return index of free-slot into Vector, and allocate memory //if there are not any free-slots. // //v: default NULL value. // //NOTICE: // The condition that we considered a slot is free means the // value of that slot is equal to v. UINT get_free_idx(T v = T(0)) { ASSERT((Vector<T, GrowSize>::is_init()), ("VECTOR not yet initialized.")); if (Vector<T, GrowSize>::m_elem_num == 0) { //VECTOR is empty. ASSERT((Vector<T, GrowSize>::m_last_idx < 0 && Vector<T, GrowSize>::m_vec == NULL), ("exception occur in Vector")); grow(GrowSize); //Free space is started at position '0', //so next free space is position '1'. m_free_idx = 1; return 0; } //VECTOR is not empty. UINT ret = m_free_idx; //Seaching in second-half Vector to find the next free idx. for (UINT i = m_free_idx + 1; i < Vector<T, GrowSize>::m_elem_num; i++) { if (v == Vector<T, GrowSize>::m_vec[i]) { m_free_idx = i; return ret; } } //Seaching in first-half Vector to find the next free idx. for (UINT i = 0; i < m_free_idx; i++) { if (v == Vector<T, GrowSize>::m_vec[i]) { m_free_idx = i; return ret; } } m_free_idx = Vector<T, GrowSize>::m_elem_num; grow(Vector<T, GrowSize>::m_elem_num * 2); return ret; } //Growing vector by size, if 'm_size' is NULL , alloc vector. //Reallocate memory if necessory. void grow(UINT size) { if (Vector<T, GrowSize>::m_elem_num == 0) { m_free_idx = 0; } Vector<T, GrowSize>::grow(size); } }; //Simply Vector. // //T: refer to element type. //NOTE: Zero is treated as the default NULL when we //determine the element existence. #define SVEC_elem_num(s) ((s)->s1.m_elem_num) template <class T, UINT GrowSize> class SimpleVec { protected: struct { UINT m_elem_num:31; //The number of element in vector. UINT m_is_init:1; } s1; public: T * m_vec; public: SimpleVec() { s1.m_is_init = false; init(); } explicit SimpleVec(INT size) { s1.m_is_init = false; init(size); } SimpleVec(SimpleVec const& src) { copy(src); } SimpleVec const& operator = (SimpleVec const&); ~SimpleVec() { destroy(); } inline void init() { if (s1.m_is_init) { return; } SVEC_elem_num(this) = 0; m_vec = NULL; s1.m_is_init = true; } inline void init(UINT size) { if (s1.m_is_init) { return; } ASSERT0(size != 0); m_vec = (T*)::malloc(sizeof(T) * size); ASSERT0(m_vec); ::memset(m_vec, 0, sizeof(T) * size); SVEC_elem_num(this) = size; s1.m_is_init = true; } inline void destroy() { if (!s1.m_is_init) { return; } SVEC_elem_num(this) = 0; if (m_vec != NULL) { ::free(m_vec); m_vec = NULL; } s1.m_is_init = false; } //The function often invoked by destructor, to speed up destruction time. //Since reset other members is dispensable. void destroy_vec() { if (m_vec != NULL) { ::free(m_vec); m_vec = NULL; SVEC_elem_num(this) = 0; } } T get(UINT i) const { ASSERT(s1.m_is_init, ("SimpleVec not yet initialized.")); if (i >= SVEC_elem_num(this)) { return T(0); } return m_vec[i]; } T * get_vec() { return m_vec; } void copy(SimpleVec const& vec) { UINT n = SVEC_elem_num(&vec); if (SVEC_elem_num(this) < n) { destroy(); init(n); } if (n > 0) { ::memcpy(m_vec, vec.m_vec, sizeof(T) * n); } } //Clean to zero(default) till 'last_idx'. void clean() { ASSERT(s1.m_is_init, ("SimpleVec not yet initialized.")); ::memset(m_vec, 0, sizeof(T) * SVEC_elem_num(this)); } UINT count_mem() const { return SVEC_elem_num(this) + sizeof(Vector<T>); } //Return NULL if 'i' is illegal, otherwise return 'elem'. void set(UINT i, T elem) { ASSERT(is_init(), ("SimpleVec not yet initialized.")); if (i >= SVEC_elem_num(this)) { grow(i * 2 + 1); } m_vec[i] = elem; return; } //Return the number of element the vector could hold. UINT get_capacity() const { ASSERT(is_init(), ("SimpleVec not yet initialized.")); return SVEC_elem_num(this); } //Growing vector by size, if 'm_size' is NULL , alloc vector. //Reallocate memory if necessory. void grow(UINT size) { ASSERT(is_init(), ("SimpleVec not yet initialized.")); if (size == 0) { return; } if (SVEC_elem_num(this) == 0) { ASSERT(m_vec == NULL, ("SimpleVec should be NULL if size is zero.")); m_vec = (T*)::malloc(sizeof(T) * size); ASSERT0(m_vec); ::memset(m_vec, 0, sizeof(T) * size); SVEC_elem_num(this) = size; return; } ASSERT0(size > SVEC_elem_num(this)); T * tmp = (T*)::malloc(size * sizeof(T)); ASSERT0(tmp); ::memcpy(tmp, m_vec, SVEC_elem_num(this) * sizeof(T)); ::memset(((CHAR*)tmp) + SVEC_elem_num(this) * sizeof(T), 0, (size - SVEC_elem_num(this))* sizeof(T)); ::free(m_vec); m_vec = tmp; SVEC_elem_num(this) = size; } bool is_init() const { return s1.m_is_init; } }; //Hash // //Hash element recorded not only in hash table but also in Vector, //which is used in order to speed up accessing hashed elements. // //NOTICE: // 1.T(0) is defined as default NULL in Hash, so do not use T(0) as element. // // 2.There are four hash function classes are given as default, and // if you are going to define you own hash function class, the // following member functions you should supply according to your needs. // // * Return hash-key deduced from 'val'. // UINT get_hash_value(OBJTY val) const // // * Return hash-key deduced from 't'. // UINT get_hash_value(T * t) const // // * Compare t1, t2 when inserting a new element. // bool compare(T * t1, T * t2) const // // * Compare t1, val when inserting a new element. // bool compare(T * t1, OBJTY val) const // // 3.Use 'new'/'delete' operator to allocate/free the memory // of dynamic object and the virtual function pointers. #define HC_val(c) (c)->val #define HC_vec_idx(c) (c)->vec_idx #define HC_next(c) (c)->next #define HC_prev(c) (c)->prev template <class T> struct HC { HC<T> * prev; HC<T> * next; UINT vec_idx; T val; }; #define HB_member(hm) (hm).hash_member #define HB_count(hm) (hm).hash_member_count class HashBucket { public: void * hash_member; //hash member list UINT hash_member_count; // }; template <class T> class HashFuncBase { public: UINT get_hash_value(T t, UINT bucket_size) const { ASSERT0(bucket_size != 0); return ((UINT)(size_t)t) % bucket_size; } UINT get_hash_value(OBJTY val, UINT bucket_size) const { ASSERT0(bucket_size != 0); return ((UINT)(size_t)val) % bucket_size; } bool compare(T t1, T t2) const { return t1 == t2; } bool compare(T t1, OBJTY val) const { return t1 == (T)val; } }; template <class T> class HashFuncBase2 : public HashFuncBase<T> { public: UINT get_hash_value(T t, UINT bucket_size) const { ASSERT0(bucket_size != 0); ASSERT0(isPowerOf2(bucket_size)); return hash32bit((UINT)(size_t)t) & (bucket_size - 1); } UINT get_hash_value(OBJTY val, UINT bucket_size) const { ASSERT0(bucket_size != 0); ASSERT0(isPowerOf2(bucket_size)); return hash32bit((UINT)(size_t)val) & (bucket_size - 1); } }; class HashFuncString { public: UINT get_hash_value(CHAR const* s, UINT bucket_size) const { ASSERT0(bucket_size != 0); UINT v = 0; while (*s++) { v += (UINT)(*s); } return hash32bit(v) % bucket_size; } UINT get_hash_value(OBJTY v, UINT bucket_size) const { ASSERT_DUMMYUSE(sizeof(OBJTY) == sizeof(CHAR*), ("exception will taken place in type-cast")); return get_hash_value((CHAR const*)v, bucket_size); } bool compare(CHAR const* s1, CHAR const* s2) const { return strcmp(s1, s2) == 0; } bool compare(CHAR const* s, OBJTY val) const { ASSERT_DUMMYUSE(sizeof(OBJTY) == sizeof(CHAR const*), ("exception will taken place in type-cast")); return (strcmp(s, (CHAR const*)val) == 0); } }; class HashFuncString2 : public HashFuncString { public: UINT get_hash_value(CHAR const* s, UINT bucket_size) const { ASSERT0(bucket_size != 0); UINT v = 0; while (*s++) { v += (UINT)(*s); } ASSERT0(isPowerOf2(bucket_size)); return hash32bit(v) & (bucket_size - 1); } }; //'T': the element type. //'HF': Hash function type. template <class T, class HF = HashFuncBase<T> > class Hash { protected: HF m_hf; SMemPool * m_free_list_pool; FreeList<HC<T> > m_free_list; //Hold for available containers UINT m_bucket_size; HashBucket * m_bucket; VectorWithFreeIndex<T, 8> m_elem_vector; UINT m_elem_count; inline HC<T> * newhc() //Allocate hash container. { ASSERT(m_bucket != NULL, ("HASH not yet initialized.")); ASSERT0(m_free_list_pool); HC<T> * c = m_free_list.get_free_elem(); if (c == NULL) { c = (HC<T>*)smpoolMallocConstSize(sizeof(HC<T>), m_free_list_pool); ASSERT0(c); ::memset(c, 0, sizeof(HC<T>)); } return c; } //Insert element into hash table. //Return true if 't' already exist. inline bool insert_v(OUT HC<T> ** bucket_entry, OUT HC<T> ** hc, OBJTY val) { HC<T> * elemhc = *bucket_entry; HC<T> * prev = NULL; while (elemhc != NULL) { ASSERT(HC_val(elemhc) != T(0), ("Hash element has so far as to be overrided!")); if (m_hf.compare(HC_val(elemhc), val)) { *hc = elemhc; return true; } prev = elemhc; elemhc = HC_next(elemhc); } //end while elemhc = newhc(); ASSERT(elemhc, ("newhc() return NULL")); HC_val(elemhc) = create(val); if (prev != NULL) { //Append on element-list HC_next(prev) = elemhc; HC_prev(elemhc) = prev; } else { *bucket_entry = elemhc; } *hc = elemhc; return false; } //Insert element into hash table. //Return true if 't' already exist. inline bool insert_t(IN OUT HC<T> ** bucket_entry, OUT HC<T> ** hc, IN T t) { HC<T> * prev = NULL; HC<T> * elemhc = *bucket_entry; while (elemhc != NULL) { ASSERT(HC_val(elemhc) != T(0), ("Container is empty")); if (m_hf.compare(HC_val(elemhc), t)) { t = HC_val(elemhc); *hc = elemhc; return true; } prev = elemhc; elemhc = HC_next(elemhc); } elemhc = newhc(); ASSERT(elemhc, ("newhc() return NULL")); HC_val(elemhc) = t; if (prev != NULL) { //Append on elem-list in the bucket. HC_next(prev) = elemhc; HC_prev(elemhc) = prev; } else { *bucket_entry = elemhc; } *hc = elemhc; return false; } virtual T create(OBJTY v) { ASSERT(0, ("Inherited class need to implement")); DUMMYUSE(v); return T(0); } public: Hash(UINT bsize = MAX_SHASH_BUCKET) { m_bucket = NULL; m_bucket_size = 0; m_free_list_pool = NULL; m_elem_count = 0; init(bsize); } COPY_CONSTRUCTOR(Hash); virtual ~Hash() { destroy(); } //Append 't' into hash table and record its reference into //Vector in order to walk through the table rapidly. //If 't' already exists, return the element immediately. //'find': set to true if 't' already exist. // //NOTE: // Do NOT append 0 to table. // Maximum size of T equals sizeof(void*). T append(T t, OUT HC<T> ** hct = NULL, bool * find = NULL) { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); if (t == T(0)) return T(0); UINT hashv = m_hf.get_hash_value(t, m_bucket_size); ASSERT(hashv < m_bucket_size, ("hash value must less than bucket size")); HC<T> * elemhc = NULL; if (!insert_t((HC<T>**)&HB_member(m_bucket[hashv]), &elemhc, t)) { HB_count(m_bucket[hashv])++; m_elem_count++; //Get a free slot in elem-vector HC_vec_idx(elemhc) = m_elem_vector.get_free_idx(); m_elem_vector.set(HC_vec_idx(elemhc), t); if (find != NULL) { *find = false; } } else if (find != NULL) { *find = true; } if (hct != NULL) { *hct = elemhc; } return HC_val(elemhc); } //Append 'val' into hash table. //More comment see above function. //'find': set to true if 't' already exist. // //NOTE: Do NOT append T(0) to table. T append(OBJTY val, OUT HC<T> ** hct = NULL, bool * find = NULL) { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); UINT hashv = m_hf.get_hash_value(val, m_bucket_size); ASSERT(hashv < m_bucket_size, ("hash value must less than bucket size")); HC<T> * elemhc = NULL; if (!insert_v((HC<T>**)&HB_member(m_bucket[hashv]), &elemhc, val)) { HB_count(m_bucket[hashv])++; m_elem_count++; //Get a free slot in elem-vector HC_vec_idx(elemhc) = m_elem_vector.get_free_idx(); m_elem_vector.set(HC_vec_idx(elemhc), HC_val(elemhc)); if (find != NULL) { *find = false; } } else if (find != NULL) { *find = true; } if (hct != NULL) { *hct = elemhc; } return HC_val(elemhc); } //Count up the memory which hash table used. size_t count_mem() const { size_t count = smpoolGetPoolSize(m_free_list_pool); count += m_free_list.count_mem(); count += sizeof(m_bucket_size); count += sizeof(m_bucket); count += m_bucket_size; count += m_elem_vector.count_mem(); count += sizeof(m_elem_count); return count; } //Clean the data structure but not destroy. void clean() { if (m_bucket == NULL) return; ::memset(m_bucket, 0, sizeof(HashBucket) * m_bucket_size); m_elem_count = 0; m_elem_vector.clean(); } //Get the hash bucket size. UINT get_bucket_size() const { return m_bucket_size; } //Get the hash bucket. HashBucket const* get_bucket() const { return m_bucket; } //Get the memory pool handler of free_list. //Note this pool is const size. SMemPool * get_free_list_pool() const { return m_free_list_pool; }; //Get the number of element in hash table. UINT get_elem_count() const { return m_elem_count; } //This function return the first element if it exists, and initialize //the iterator, otherwise return T(0), where T is the template parameter. // //When T is type of integer, return zero may be fuzzy and ambiguous. //Invoke get_next() to get the next element. // //'iter': iterator, when the function return, cur will be updated. // If the first element exist, cur is a value that great and equal 0, // or is -1. T get_first(INT & iter) const { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); T t = T(0); iter = -1; if (m_elem_count <= 0) return T(0); INT l = m_elem_vector.get_last_idx(); for (INT i = 0; i <= l; i++) { if ((t = m_elem_vector.get((UINT)i)) != T(0)) { iter = i; return t; } } return T(0); } //This function return the next element of given iterator. //If it exists, record its index at 'iter' and return the element, //otherwise set 'iter' to -1, and return T(0), where T is the //template parameter. // //'iter': iterator, when the function return, cur will be updated. // If the first element exist, cur is a value that great and equal 0, // or is -1. T get_next(INT & iter) const { ASSERT(m_bucket != NULL && iter >= -1, ("Hash not yet initialized.")); T t = T(0); if (m_elem_count <= 0) return T(0); INT l = m_elem_vector.get_last_idx(); for (INT i = iter + 1; i <= l; i++) { if ((t = m_elem_vector.get((UINT)i)) != T(0)) { iter = i; return t; } } iter = -1; return T(0); } //This function return the last element if it exists, and initialize //the iterator, otherwise return T(0), where T is the template parameter. //When T is type of integer, return zero may be fuzzy and ambiguous. //Invoke get_prev() to get the prev element. // //'iter': iterator, when the function return, cur will be updated. // If the first element exist, cur is a value that great and equal 0, // or is -1. T get_last(INT & iter) const { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); T t = T(0); iter = -1; if (m_elem_count <= 0) return T(0); INT l = m_elem_vector.get_last_idx(); for (INT i = l; i >= 0; i--) { if ((t = m_elem_vector.get((UINT)i)) != T(0)) { iter = i; return t; } } return T(0); } //This function return the previous element of given iterator. //If it exists, record its index at 'iter' and return the element, //otherwise set 'iter' to -1, and return T(0), where T is the //template parameter. // //'iter': iterator, when the function return, cur will be updated. // If the first element exist, cur is a value that great and equal 0, // or is -1. T get_prev(INT & iter) const { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); T t = T(0); if (m_elem_count <= 0) return T(0); for (INT i = iter - 1; i >= 0; i--) { if ((t = m_elem_vector.get((UINT)i)) != T(0)) { iter = i; return t; } } iter = -1; return T(0); } void init(UINT bsize = MAX_SHASH_BUCKET) { if (m_bucket != NULL || bsize == 0) { return; } m_bucket = (HashBucket*)::malloc(sizeof(HashBucket) * bsize); ::memset(m_bucket, 0, sizeof(HashBucket) * bsize); m_bucket_size = bsize; m_elem_count = 0; m_free_list_pool = smpoolCreate(sizeof(HC<T>) * 4, MEM_CONST_SIZE); m_free_list.clean(); m_free_list.set_clean(true); m_elem_vector.init(); } //Free all memory objects. void destroy() { if (m_bucket == NULL) return; ::free(m_bucket); m_bucket = NULL; m_bucket_size = 0; m_elem_count = 0; m_elem_vector.destroy(); smpoolDelete(m_free_list_pool); m_free_list_pool = NULL; } //Dump the distribution of element in hash. void dump_intersp(FILE * h) const { if (h == NULL) return; UINT bsize = get_bucket_size(); HashBucket const* bucket = get_bucket(); fprintf(h, "\n=== Hash ==="); for (UINT i = 0; i < bsize; i++) { HC<T> * elemhc = (HC<T>*)bucket[i].hash_member; fprintf(h, "\nENTRY[%d]:", i); while (elemhc != NULL) { fprintf(h, "*"); elemhc = HC_next(elemhc); if (elemhc != NULL) { //fprintf(g_tfile, ","); } } } fflush(h); } //This function remove one element, and return the removed one. //Note that 't' may be different with the return one accroding to //the behavior of user's defined HF class. // //Do NOT change the order that elements in m_elem_vector and the //value of m_cur. Because it will impact the effect of get_first(), //get_next(), get_last() and get_prev(). T removed(T t) { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); if (t == 0) return T(0); UINT hashv = m_hf.get_hash_value(t, m_bucket_size); ASSERT(hashv < m_bucket_size, ("hash value must less than bucket size")); HC<T> * elemhc = (HC<T>*)HB_member(m_bucket[hashv]); if (elemhc != NULL) { while (elemhc != NULL) { ASSERT(HC_val(elemhc) != T(0), ("Hash element has so far as to be overrided!")); if (m_hf.compare(HC_val(elemhc), t)) { break; } elemhc = HC_next(elemhc); } if (elemhc != NULL) { m_elem_vector.set(HC_vec_idx(elemhc), T(0)); remove((HC<T>**)&HB_member(m_bucket[hashv]), elemhc); m_free_list.add_free_elem(elemhc); HB_count(m_bucket[hashv])--; m_elem_count--; return t; } } return T(0); } //Grow hash to 'bsize' and rehash all elements in the table. //The default grow size is twice as the current bucket size. // //'bsize': expected bucket size, the size can not less than current size. // //NOTE: Extending hash table is costly. //The position of element in m_elem_vector is unchanged. void grow(UINT bsize = 0) { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); if (bsize != 0) { ASSERT0(bsize > m_bucket_size); } else { bsize = m_bucket_size * 2; } HashBucket * new_bucket = (HashBucket*)::malloc(sizeof(HashBucket) * bsize); ::memset(new_bucket, 0, sizeof(HashBucket) * bsize); if (m_elem_count == 0) { ::free(m_bucket); m_bucket = new_bucket; m_bucket_size = bsize; return; } //Free HC containers. for (UINT i = 0; i < m_bucket_size; i++) { HC<T> * hc = NULL; while ((hc = xcom::removehead((HC<T>**)&HB_member(m_bucket[i]))) != NULL) { m_free_list.add_free_elem(hc); } } //Free bucket. ::free(m_bucket); m_bucket = new_bucket; m_bucket_size = bsize; //Rehash all elements, and the position in m_elem_vector is unchanged. INT l = m_elem_vector.get_last_idx(); for (INT i = 0; i <= l; i++) { T t = m_elem_vector.get((UINT)i); if (t == T(0)) { continue; } UINT hashv = m_hf.get_hash_value(t, m_bucket_size); ASSERT(hashv < m_bucket_size, ("hash value must less than bucket size")); HC<T> * elemhc = NULL; bool doit = insert_t((HC<T>**)&HB_member(m_bucket[hashv]), &elemhc, t); ASSERT0(!doit); DUMMYUSE(doit); //to avoid -Werror=unused-variable. HC_vec_idx(elemhc) = (UINT)i; HB_count(m_bucket[hashv])++; } } //Find element accroding to specific 'val'. //You can implement your own find(), but do NOT //change the order that elements in m_elem_vector and the value of m_cur. //Because it will impact the effect of get_first(), get_next(), //get_last() and get_prev(). T find(OBJTY val) const { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); UINT hashv = m_hf.get_hash_value(val, m_bucket_size); ASSERT(hashv < m_bucket_size, ("hash value must less than bucket size")); HC<T> const* elemhc = (HC<T> const*)HB_member(m_bucket[hashv]); if (elemhc != NULL) { while (elemhc != NULL) { ASSERT(HC_val(elemhc) != T(0), ("Hash element has so far as to be overrided!")); if (m_hf.compare(HC_val(elemhc), val)) { return HC_val(elemhc); } elemhc = HC_next(elemhc); } } return T(0); } //Find one element and return the container. //Return true if t exist, otherwise return false. //You can implement your own find(), but do NOT //change the order that elements in m_elem_vector and the value of m_cur. //Because it will impact the effect of get_first(), get_next(), //get_last() and get_prev(). bool find(T t, HC<T> const** ct = NULL) const { ASSERT(m_bucket != NULL, ("Hash not yet initialized.")); if (t == T(0)) { return false; } UINT hashv = m_hf.get_hash_value(t, m_bucket_size); ASSERT(hashv < m_bucket_size, ("hash value must less than bucket size")); HC<T> const* elemhc = (HC<T> const*)HB_member(m_bucket[hashv]); if (elemhc != NULL) { while (elemhc != NULL) { ASSERT(HC_val(elemhc) != T(0), ("Hash element has so far as to be overrided!")); if (m_hf.compare(HC_val(elemhc), t)) { if (ct != NULL) { *ct = elemhc; } return true; } elemhc = HC_next(elemhc); } } return false; } //Find one element and return the element which record in hash table. //Note t may be different with the return one. // //You can implement your own find(), but do NOT //change the order that elements in m_elem_vector and the value of m_cur. //Because it will impact the effect of get_first(), get_next(), //get_last() and get_prev(). // //'ot': output the element if found it. bool find(T t, OUT T * ot) const { HC<T> const* hc; if (find(t, &hc)) { ASSERT0(ot != NULL); *ot = HC_val(hc); return true; } return false; } }; //END Hash // //START RBTNode // typedef enum _RBT_RED { RBT_NON = 0, RBRED = 1, RBBLACK = 2, } RBCOL; template <class T, class Ttgt> class RBTNode { public: RBTNode * parent; union { RBTNode * lchild; RBTNode * prev; }; union { RBTNode * rchild; RBTNode * next; }; T key; Ttgt mapped; RBCOL color; RBTNode() { clean(); } void clean() { parent = NULL; lchild = NULL; rchild = NULL; key = T(0); mapped = Ttgt(0); color = RBBLACK; } }; template <class T> class CompareKeyBase { public: bool is_less(T t1, T t2) const { return t1 < t2; } bool is_equ(T t1, T t2) const { return t1 == t2; } T createKey(T t) { return t; } }; template <class T, class Ttgt, class CompareKey = CompareKeyBase<T> > class RBT { protected: typedef RBTNode<T, Ttgt> RBTNType; UINT m_num_of_tn; RBTNType * m_root; SMemPool * m_pool; RBTNType * m_free_list; CompareKey m_ck; RBTNType * new_tn() { RBTNType * p = (RBTNType*)smpoolMallocConstSize(sizeof(RBTNType), m_pool); ASSERT0(p); ::memset(p, 0, sizeof(RBTNType)); return p; } inline RBTNType * new_tn(T t, RBCOL c) { RBTNType * x = xcom::removehead(&m_free_list); if (x == NULL) { x = new_tn(); } else { x->lchild = NULL; x->rchild = NULL; } x->key = m_ck.createKey(t); x->color = c; return x; } void free_rbt(RBTNType * t) { if (t == NULL) return; t->prev = t->next = t->parent = NULL; t->key = T(0); t->mapped = Ttgt(0); insertbefore_one(&m_free_list, m_free_list, t); } void rleft(RBTNType * x) { ASSERT0(x->rchild != NULL); RBTNType * y = x->rchild; y->parent = x->parent; x->parent = y; x->rchild = y->lchild; if (y->lchild != NULL) { y->lchild->parent = x; } y->lchild = x; if (y->parent == NULL) { m_root = y; } else if (y->parent->lchild == x) { y->parent->lchild = y; } else if (y->parent->rchild == x) { y->parent->rchild = y; } } void rright(RBTNType * y) { ASSERT0(y->lchild != NULL); RBTNType * x = y->lchild; x->parent = y->parent; y->parent = x; y->lchild = x->rchild; if (x->rchild != NULL) { x->rchild->parent = y; } x->rchild = y; if (x->parent == NULL) { m_root = x; } else if (x->parent->lchild == y) { x->parent->lchild = x; } else if (x->parent->rchild == y) { x->parent->rchild = x; } } bool is_lchild(RBTNType const* z) const { ASSERT0(z && z->parent); return z == z->parent->lchild; } bool is_rchild(RBTNType const* z) const { ASSERT0(z && z->parent); return z == z->parent->rchild; } void fixup(RBTNType * z) { RBTNType * y = NULL; while (z->parent != NULL && z->parent->color == RBRED) { if (is_lchild(z->parent)) { y = z->parent->parent->rchild; if (y != NULL && y->color == RBRED) { z->parent->color = RBBLACK; z->parent->parent->color = RBRED; y->color = RBBLACK; z = z->parent->parent; } else if (is_rchild(z)) { z = z->parent; rleft(z); } else { ASSERT0(is_lchild(z)); z->parent->color = RBBLACK; z->parent->parent->color = RBRED; rright(z->parent->parent); } } else { ASSERT0(is_rchild(z->parent)); y = z->parent->parent->lchild; if (y != NULL && y->color == RBRED) { z->parent->color = RBBLACK; z->parent->parent->color = RBRED; y->color = RBBLACK; z = z->parent->parent; } else if (is_lchild(z)) { z = z->parent; rright(z); } else { ASSERT0(is_rchild(z)); z->parent->color = RBBLACK; z->parent->parent->color = RBRED; rleft(z->parent->parent); } } } m_root->color = RBBLACK; } public: RBT() { m_pool = NULL; init(); } COPY_CONSTRUCTOR(RBT); ~RBT() { destroy(); } void init() { if (m_pool != NULL) { return; } m_pool = smpoolCreate(sizeof(RBTNType) * 4, MEM_CONST_SIZE); m_root = NULL; m_num_of_tn = 0; m_free_list = NULL; } void destroy() { if (m_pool == NULL) { return; } smpoolDelete(m_pool); m_pool = NULL; m_num_of_tn = 0; m_root = NULL; m_free_list = NULL; } size_t count_mem() const { size_t c = sizeof(m_num_of_tn); c += sizeof(m_root); c += sizeof(m_pool); c += sizeof(m_free_list); c += smpoolGetPoolSize(m_pool); return c; } void clean() { List<RBTNType*> wl; if (m_root != NULL) { wl.append_tail(m_root); m_root = NULL; } while (wl.get_elem_count() != 0) { RBTNType * x = wl.remove_head(); if (x->rchild != NULL) { wl.append_tail(x->rchild); } if (x->lchild != NULL) { wl.append_tail(x->lchild); } free_rbt(x); } m_num_of_tn = 0; } UINT get_elem_count() const { return m_num_of_tn; } SMemPool * get_pool() { return m_pool; } RBTNType * get_root() { return m_root; } RBTNType * find_with_key(T keyt) const { if (m_root == NULL) { return NULL; } RBTNType * x = m_root; while (x != NULL) { if (m_ck.is_equ(keyt, x->key)) { return x; } else if (m_ck.is_less(keyt, x->key)) { x = x->lchild; } else { x = x->rchild; } } return NULL; } inline RBTNType * find_rbtn(T t) const { if (m_root == NULL) { return NULL; } return find_with_key(t); } RBTNType * insert(T t, bool * find = NULL) { if (m_root == NULL) { RBTNType * z = new_tn(t, RBBLACK); m_num_of_tn++; m_root = z; if (find != NULL) { *find = false; } return z; } RBTNType * mark = NULL; RBTNType * x = m_root; while (x != NULL) { mark = x; if (m_ck.is_equ(t, x->key)) { break; } else if (m_ck.is_less(t, x->key)) { x = x->lchild; } else { x = x->rchild; } } if (x != NULL) { ASSERT0(m_ck.is_equ(t, x->key)); if (find != NULL) { *find = true; } return x; } if (find != NULL) { *find = false; } //Add new. RBTNType * z = new_tn(t, RBRED); z->parent = mark; if (mark == NULL) { //The first node. m_root = z; } else { if (m_ck.is_less(t, mark->key)) { mark->lchild = z; } else { mark->rchild = z; } } ASSERT0(z->lchild == NULL && z->rchild == NULL); m_num_of_tn++; fixup(z); return z; } RBTNType * find_min(RBTNType * x) { ASSERT0(x); while (x->lchild != NULL) { x = x->lchild; } return x; } RBTNType * find_succ(RBTNType * x) { if (x->rchild != NULL) { return find_min(x->rchild); } RBTNType * y = x->parent; while (y != NULL && x == y->rchild) { x = y; y = y->parent; } return y; } inline bool both_child_black(RBTNType * x) { if (x->lchild != NULL && x->lchild->color == RBRED) { return false; } if (x->rchild != NULL && x->rchild->color == RBRED) { return false; } return true; } void rmfixup(RBTNType * x) { ASSERT0(x); while (x != m_root && x->color == RBBLACK) { if (is_lchild(x)) { RBTNType * bro = x->parent->rchild; ASSERT0(bro); if (bro->color == RBRED) { bro->color = RBBLACK; x->parent->color = RBRED; rleft(x->parent); bro = x->parent->rchild; } if (both_child_black(bro)) { bro->color = RBRED; x = x->parent; continue; } else if (bro->rchild == NULL || bro->rchild->color == RBBLACK) { ASSERT0(bro->lchild && bro->lchild->color == RBRED); bro->lchild->color = RBBLACK; bro->color = RBRED; rright(bro); bro = x->parent->rchild; } bro->color = x->parent->color; x->parent->color = RBBLACK; bro->rchild->color = RBBLACK; rleft(x->parent); x = m_root; } else { ASSERT0(is_rchild(x)); RBTNType * bro = x->parent->lchild; if (bro->color == RBRED) { bro->color = RBBLACK; x->parent->color = RBRED; rright(x->parent); bro = x->parent->lchild; } if (both_child_black(bro)) { bro->color = RBRED; x = x->parent; continue; } else if (bro->lchild == NULL || bro->lchild->color == RBBLACK) { ASSERT0(bro->rchild && bro->rchild->color == RBRED); bro->rchild->color = RBBLACK; bro->color = RBRED; rleft(bro); bro = x->parent->lchild; } bro->color = x->parent->color; x->parent->color = RBBLACK; bro->lchild->color = RBBLACK; rright(x->parent); x = m_root; } } x->color = RBBLACK; } void remove(T t) { RBTNType * z = find_rbtn(t); if (z == NULL) { return; } remove(z); } void remove(RBTNType * z) { if (z == NULL) { return; } if (m_num_of_tn == 1) { ASSERT(z == m_root, ("z is not the node of tree")); ASSERT(z->rchild == NULL && z->lchild == NULL, ("z is the last node")); free_rbt(z); m_num_of_tn--; m_root = NULL; return; } RBTNType * y; if (z->lchild == NULL || z->rchild == NULL) { y = z; } else { y = find_min(z->rchild); } RBTNType * x = y->lchild != NULL ? y->lchild : y->rchild; RBTNType holder; if (x != NULL) { x->parent = y->parent; } else { holder.parent = y->parent; } if (y->parent == NULL) { m_root = x; } else if (is_lchild(y)) { if (x != NULL) { y->parent->lchild = x; } else { y->parent->lchild = &holder; } } else { if (x != NULL) { y->parent->rchild = x; } else { y->parent->rchild = &holder; } } if (y != z) { z->key = y->key; z->mapped = y->mapped; } if (y->color == RBBLACK) { //Need to keep RB tree property: the number //of black must be same in all path. if (x != NULL) { rmfixup(x); } else { rmfixup(&holder); if (is_rchild(&holder)) { holder.parent->rchild = NULL; } else { ASSERT0(is_lchild(&holder)); holder.parent->lchild = NULL; } } } else if (holder.parent != NULL) { if (is_rchild(&holder)) { holder.parent->rchild = NULL; } else { ASSERT0(is_lchild(&holder)); holder.parent->lchild = NULL; } } free_rbt(y); m_num_of_tn--; } //iter should be clean by caller. T get_first(List<RBTNType*> & iter, Ttgt * mapped = NULL) const { if (m_root == NULL) { if (mapped != NULL) { *mapped = Ttgt(0); } return T(0); } iter.append_tail(m_root); if (mapped != NULL) { *mapped = m_root->mapped; } return m_root->key; } T get_next(List<RBTNType*> & iter, Ttgt * mapped = NULL) const { RBTNType * x = iter.remove_head(); if (x == NULL) { if (mapped != NULL) { *mapped = Ttgt(0); } return T(0); } if (x->rchild != NULL) { iter.append_tail(x->rchild); } if (x->lchild != NULL) { iter.append_tail(x->lchild); } x = iter.get_head(); if (x == NULL) { if (mapped != NULL) { *mapped = Ttgt(0); } return T(0); } if (mapped != NULL) { *mapped = x->mapped; } return x->key; } }; //END RBTNode //TMap Iterator based on Double Linked List. //This class is used to iterate elements in TMap. //You should call clean() to initialize the iterator. template <class Tsrc, class Ttgt> class TMapIter : public List<RBTNode<Tsrc, Ttgt>*> { public: TMapIter() {} COPY_CONSTRUCTOR(TMapIter); }; //TMap Iterator based on Single Linked List. //This class is used to iterate elements in TMap. //You should call clean() to initialize the iterator. template <class Tsrc, class Ttgt> class TMapIter2 : public SList<RBTNode<Tsrc, Ttgt>*> { public: typedef RBTNode<Tsrc, Ttgt>* Container; public: TMapIter2(SMemPool * pool) : SList<RBTNode<Tsrc, Ttgt>*>(pool) { ASSERT0(pool); } COPY_CONSTRUCTOR(TMapIter2); }; //TMap // //Make a map between Tsrc and Ttgt. // //Tsrc: the type of keys maintained by this map. //Ttgt: the type of mapped values. // //Usage: Make a mapping from SRC* to TGT*. // class SRC2TGT_MAP : public TMap<SRC*, TGT*> { // public: // }; // //NOTICE: // 1. Tsrc(0) is defined as default NULL in TMap, do NOT use T(0) as element. // 2. Keep the key *UNIQUE* . // 3. Overload operator == and operator < if Tsrc is neither basic type // nor pointer type. template <class Tsrc, class Ttgt, class CompareKey = CompareKeyBase<Tsrc> > class TMap : public RBT<Tsrc, Ttgt, CompareKey> { public: typedef RBT<Tsrc, Ttgt, CompareKey> BaseType; typedef RBTNode<Tsrc, Ttgt> RBTNType; TMap() {} COPY_CONSTRUCTOR(TMap); ~TMap() {} //This function should be invoked if TMap is initialized manually. void init() { RBT<Tsrc, Ttgt, CompareKey>::init(); } //This function should be invoked if TMap is destroied manually. void destroy() { RBT<Tsrc, Ttgt, CompareKey>::destroy(); } //Alway set new mapping even if it has done. //This function will enforce mapping between t and mapped. Tsrc setAlways(Tsrc t, Ttgt mapped) { RBTNType * z = BaseType::insert(t, NULL); ASSERT0(z); z->mapped = mapped; return z->key; //key may be different with t. } //Establishing mapping in between 't' and 'mapped'. Tsrc set(Tsrc t, Ttgt mapped) { bool find = false; RBTNType * z = BaseType::insert(t, &find); ASSERT0(z); ASSERT(!find, ("already mapped")); z->mapped = mapped; return z->key; //key may be different with t. } //Get mapped element of 't'. Set find to true if t is already be mapped. //Note this function is readonly. Ttgt get(Tsrc t, bool * f = NULL) const { RBTNType * z = BaseType::find_rbtn(t); if (z == NULL) { if (f != NULL) { *f = false; } return Ttgt(0); } if (f != NULL) { *f = true; } return z->mapped; } //iter should be clean by caller. Tsrc get_first(TMapIter<Tsrc, Ttgt> & iter, Ttgt * mapped = NULL) const { return BaseType::get_first(iter, mapped); } Tsrc get_next(TMapIter<Tsrc, Ttgt> & iter, Ttgt * mapped = NULL) const { return BaseType::get_next(iter, mapped); } bool find(Tsrc t) const { bool f; get(t, &f); return f; } void remove(Tsrc t) { BaseType::remove(t); } }; //END TMap //TTab // //NOTICE: // 1. T(0) is defined as default NULL in TTab, do not use T(0) as element. // 2. Keep the key *UNIQUE*. // 3. Overload operator == and operator < if Tsrc is neither basic type // nor pointer type. // // e.g: Make a table to record OPND. // class OPND_TAB : public TTab<OPND*> { // public: // }; //TTab Iterator. //This class is used to iterate elements in TTab. //You should call clean() to initialize the iterator. template <class T> class TabIter : public List<RBTNode<T, T>*> { public: TabIter() {} COPY_CONSTRUCTOR(TabIter); }; template <class T, class CompareKey = CompareKeyBase<T> > class TTab : public TMap<T, T, CompareKey> { public: TTab() {} COPY_CONSTRUCTOR(TTab); typedef RBT<T, T, CompareKey> BaseTypeofTMap; typedef TMap<T, T, CompareKey> BaseTMap; //Add element into table. //Note: the element in the table must be unqiue. T append(T t) { ASSERT0(t != T(0)); #ifdef _DEBUG_ //Mapped element may not same with 't'. //bool find = false; //T mapped = BaseTMap::get(t, &find); //if (find) { // ASSERT0(mapped == t); //} #endif return BaseTMap::setAlways(t, t); } //Add element into table, if it is exist, return the exist one. T append_and_retrieve(T t) { ASSERT0(t != T(0)); bool find = false; T mapped = BaseTMap::get(t, &find); if (find) { return mapped; } return BaseTMap::setAlways(t, t); } void remove(T t) { ASSERT0(t != T(0)); BaseTMap::remove(t); } bool find(T t) const { return BaseTMap::find(t); } //iter should be clean by caller. T get_first(TabIter<T> & iter) const { return BaseTypeofTMap::get_first(iter, NULL); } T get_next(TabIter<T> & iter) const { return BaseTypeofTMap::get_next(iter, NULL); } }; //END TTab //Unidirectional Hashed Map // //Tsrc: the type of keys maintained by this map. //Ttgt: the type of mapped values. // //Usage: Make a mapping from OPND to OPER. // typedef HMap<OPND*, OPER*, HashFuncBase<OPND*> > OPND2OPER_MAP; // //NOTICE: // 1. Tsrc(0) is defined as default NULL in HMap, so do not use T(0) as element. // 2. The map is implemented base on Hash, and one hash function class // have been given. // // 3. Must use 'new'/'delete' operator to allocate/free the // memory of dynamic object of MAP, because the // virtual-function-pointers-table is needed. template <class Tsrc, class Ttgt, class HF = HashFuncBase<Tsrc> > class HMap : public Hash<Tsrc, HF> { protected: Vector<Ttgt> m_mapped_elem_table; //Find hash container HC<Tsrc> * findhc(Tsrc t) const { if (t == Tsrc(0)) { return NULL; } UINT hashv = Hash<Tsrc, HF>::m_hf.get_hash_value(t, Hash<Tsrc, HF>::m_bucket_size); ASSERT((hashv < Hash<Tsrc, HF>::m_bucket_size), ("hash value must less than bucket size")); HC<Tsrc> * elemhc = (HC<Tsrc>*)HB_member((Hash<Tsrc, HF>::m_bucket[hashv])); if (elemhc != NULL) { while (elemhc != NULL) { ASSERT(HC_val(elemhc) != Tsrc(0), ("Hash element has so far as to be overrided!")); if (Hash<Tsrc, HF>::m_hf.compare(HC_val(elemhc), t)) { return elemhc; } elemhc = HC_next(elemhc); } //end while } return NULL; } public: HMap(UINT bsize = MAX_SHASH_BUCKET) : Hash<Tsrc, HF>(bsize) { m_mapped_elem_table.init(); } COPY_CONSTRUCTOR(HMap); virtual ~HMap() { destroy(); } //Alway set new mapping even if it has done. void setAlways(Tsrc t, Ttgt mapped) { ASSERT((Hash<Tsrc, HF>::m_bucket != NULL), ("not yet initialize.")); if (t == Tsrc(0)) { return; } HC<Tsrc> * elemhc = NULL; Hash<Tsrc, HF>::append(t, &elemhc, NULL); ASSERT(elemhc != NULL, ("Element does not append into hash table.")); m_mapped_elem_table.set(HC_vec_idx(elemhc), mapped); } SMemPool * get_pool() { return Hash<Tsrc, HF>::get_free_list_pool(); } //Get mapped pointer of 't' Ttgt get(Tsrc t, bool * find = NULL) { ASSERT((Hash<Tsrc, HF>::m_bucket != NULL), ("not yet initialize.")); HC<Tsrc> * elemhc = findhc(t); if (elemhc != NULL) { if (find != NULL) { *find = true; } return m_mapped_elem_table.get(HC_vec_idx(elemhc)); } if (find != NULL) { *find = false; } return Ttgt(0); } Vector<Ttgt> * get_tgt_elem_vec() { return &m_mapped_elem_table; } void clean() { ASSERT((Hash<Tsrc, HF>::m_bucket != NULL), ("not yet initialize.")); Hash<Tsrc, HF>::clean(); m_mapped_elem_table.clean(); } UINT count_mem() const { UINT count = m_mapped_elem_table.count_mem(); count += ((Hash<Tsrc, HF>*)this)->count_mem(); return count; } void init(UINT bsize = MAX_SHASH_BUCKET) { //Only do initialization while m_bucket is NULL. Hash<Tsrc, HF>::init(bsize); m_mapped_elem_table.init(); } void destroy() { Hash<Tsrc, HF>::destroy(); m_mapped_elem_table.destroy(); } //This function iterate mappped elements. //Note Ttgt(0) will be served as default NULL. Ttgt get_first_elem(INT & pos) const { for (INT i = 0; i <= m_mapped_elem_table.get_last_idx(); i++) { Ttgt t = m_mapped_elem_table.get((UINT)i); if (t != Ttgt(0)) { pos = i; return t; } } pos = -1; return Ttgt(0); } //This function iterate mappped elements. //Note Ttgt(0) will be served as default NULL. Ttgt get_next_elem(INT & pos) const { ASSERT0(pos >= 0); for (INT i = pos + 1; i <= m_mapped_elem_table.get_last_idx(); i++) { Ttgt t = m_mapped_elem_table.get((UINT)i); if (t != Ttgt(0)) { pos = i; return t; } } pos = -1; return Ttgt(0); } //Establishing mapping in between 't' and 'mapped'. void set(Tsrc t, Ttgt mapped) { ASSERT((Hash<Tsrc, HF>::m_bucket != NULL), ("not yet initialize.")); if (t == Tsrc(0)) { return; } HC<Tsrc> * elemhc = NULL; Hash<Tsrc, HF>::append(t, &elemhc, NULL); ASSERT(elemhc != NULL, ("Element does not append into hash table yet.")); ASSERT(Ttgt(0) == m_mapped_elem_table.get(HC_vec_idx(elemhc)), ("Already be mapped")); m_mapped_elem_table.set(HC_vec_idx(elemhc), mapped); } void setv(OBJTY v, Ttgt mapped) { ASSERT((Hash<Tsrc, HF>::m_bucket != NULL), ("not yet initialize.")); if (v == 0) { return; } HC<Tsrc> * elemhc = NULL; Hash<Tsrc, HF>::append(v, &elemhc, NULL); ASSERT(elemhc != NULL, ("Element does not append into hash table yet.")); ASSERT(Ttgt(0) == m_mapped_elem_table.get(HC_vec_idx(elemhc)), ("Already be mapped")); m_mapped_elem_table.set(HC_vec_idx(elemhc), mapped); } }; //END MAP //Dual directional Map // //MAP_Tsrc2Ttgt: class derive from HMap<Tsrc, Ttgt> //MAP_Ttgt2Tsrc: class derive from HMap<Ttgt, Tsrc> // //Usage: Mapping OPND to corresponding OPER. // class MAP1 : public HMap<OPND*, OPER*> { // public: // }; // // class MAP2 : public HMap<OPER*, OPND*>{ // public: // }; // // DMap<OPND*, OPER*, MAP1, MAP2> opnd2oper_dmap; // //NOTICE: // 1. Tsrc(0) is defined as default NULL in DMap, so do not use T(0) as element. // 2. DMap Object's memory can be allocated by malloc() dynamically. template <class Tsrc, class Ttgt, class MAP_Tsrc2Ttgt, class MAP_Ttgt2Tsrc> class DMap { protected: MAP_Tsrc2Ttgt m_src2tgt_map; MAP_Ttgt2Tsrc m_tgt2src_map; public: DMap() {} COPY_CONSTRUCTOR(DMap); ~DMap() {} //Alway overlap the old value by new 'mapped' value. void setAlways(Tsrc t, Ttgt mapped) { if (t == Tsrc(0)) { return; } m_src2tgt_map.setAlways(t, mapped); m_tgt2src_map.setAlways(mapped, t); } UINT count_mem() const { UINT count = m_src2tgt_map.count_mem(); count += m_tgt2src_map.count_mem(); return count; } //Establishing mapping in between 't' and 'mapped'. void set(Tsrc t, Ttgt mapped) { if (t == Tsrc(0)) { return; } m_src2tgt_map.set(t, mapped); m_tgt2src_map.set(mapped, t); } //Get mapped pointer of 't' Ttgt get(Tsrc t) { return m_src2tgt_map.get(t); } //Inverse mapping Tsrc geti(Ttgt t) { return m_tgt2src_map.get(t); } }; //END DMap //Multiple Target Map // //Map src with type Tsrc to many tgt elements with type Ttgt. // //'TAB_Ttgt': records tgt elements. // e.g: We implement TAB_Ttgt via deriving from Hash. // // class TAB_Ttgt: public Hash<Ttgt, HashFuncBase<Ttgt> > { // public: // }; // // or deriving from List, typedef List<Ttgt> TAB_Ttgt; // //NOTICE: // 1. Tsrc(0) is defined as default NULL in MMap, do not use T(0) as element. // // 2. MMap allocate memory for 'TAB_Ttgt' and return 'TAB_Ttgt *' // when get(Tsrc) be invoked. DO NOT free these objects yourself. // // 3. TAB_Ttgt should be pointer type. // e.g: Given type of tgt's table is a class that // OP_HASH : public Hash<OPER*>, // then type MMap<OPND*, OPER*, OP_HASH> is ok, but // type MMap<OPND*, OPER*, OP_HASH*> is not expected. // // 4. Do not use DMap directly, please overload following functions optionally: // * create hash-element container. // T * create(OBJTY v) // // e.g: Mapping one OPND to a number of OPERs. // class OPND2OPER_MMAP : public MMap<OPND*, OPER*, OP_TAB> { // public: // virtual T create(OBJTY id) // { // //Allocate OPND. // return new OPND(id); // } // }; // // 4. Please use 'new'/'delete' operator to allocate/free // the memory of dynamic object of MMap, because the // virtual-function-pointers-table is needed. template <class Tsrc, class Ttgt, class TAB_Ttgt, class HF = HashFuncBase<Tsrc> > class MMap : public HMap<Tsrc, TAB_Ttgt*, HF> { protected: bool m_is_init; public: MMap() { m_is_init = false; init(); } COPY_CONSTRUCTOR(MMap); virtual ~MMap() { destroy(); } UINT count_mem() const { return ((HMap<Tsrc, TAB_Ttgt*, HF>*)this)->count_mem() + sizeof(m_is_init); } //Establishing mapping in between 't' and 'mapped'. void set(Tsrc t, Ttgt mapped) { if (t == Tsrc(0)) return; TAB_Ttgt * tgttab = HMap<Tsrc, TAB_Ttgt*, HF>::get(t); if (tgttab == NULL) { //Do NOT use Hash::xmalloc(sizeof(TAB_Ttgt)) to allocate memory, //because __vfptr is NULL. __vfptr points to TAB_Ttgt::vftable. tgttab = new TAB_Ttgt; HMap<Tsrc, TAB_Ttgt*, HF>::set(t, tgttab); } tgttab->append_node(mapped); } //Get mapped elements of 't' TAB_Ttgt * get(Tsrc t) { return HMap<Tsrc, TAB_Ttgt*, HF>::get(t); } void init() { if (m_is_init) { return; } HMap<Tsrc, TAB_Ttgt*, HF>::init(); m_is_init = true; } void destroy() { if (!m_is_init) { return; } TAB_Ttgt * tgttab = get(HMap<Tsrc, TAB_Ttgt*, HF>::get_first()); UINT n = HMap<Tsrc, TAB_Ttgt*, HF>::get_elem_count(); for (UINT i = 0; i < n; i++) { ASSERT0(tgttab); delete tgttab; tgttab = HMap<Tsrc, TAB_Ttgt*, HF>:: get(HMap<Tsrc, TAB_Ttgt*, HF>::get_next()); } HMap<Tsrc, TAB_Ttgt*, HF>::destroy(); m_is_init = false; } }; } //namespace xcom #endif
[ "steven.known@gmail.com" ]
steven.known@gmail.com
457f7c83206ec3590aaa5d4011a2efdf885b1fd6
945e7bf2e9aef413082e32616b0db1d77f5e4c7e
/StereoViewer/IGlut.cpp
ffdc9768ac4924ef7283269208a12011cec2683f
[]
no_license
basarugur/bu-medialab
90495e391eda11cdaddfedac241c76f4c8ff243d
45eb9aebb375427f8e247878bc602eaa5aab8e87
refs/heads/master
2020-04-18T21:01:41.722022
2015-03-15T16:49:29
2015-03-15T16:49:29
32,266,742
1
0
null
null
null
null
UTF-8
C++
false
false
22,184
cpp
#include "common.h" #include "IGlut.h" #include "HeadTrackerClient.h" #include "cv.h" #include "wiimote.h" #include "GL/glui.h" #include <fstream> #include <stdexcept> #include "../SceneModeller_API/src/core/gfxobject.h" #include "../SceneModeller_API/src/core/rectangle.h" #include "../SceneModeller_API/src/core/cube.h" #include "../SceneModeller_API/src/core/cylinder.h" extern char wii_msg[255]; // to use in opengl context HeadTrackerClient* IGlut::p_htc; Scene* IGlut::p_scene = NULL; Camera* IGlut::p_camera = NULL; CanvasGrid* IGlut::p_grid; RenderController* IGlut::p_rc; Light* IGlut::p_light; Shader* IGlut::p_shader; GLUI* glui = NULL; GLUI_FileBrowser* fb; int IGlut::submenus[1]; GLuint IGlut::textures[1]; using namespace glut_env; IGlut::IGlut(int argc, char** argv) { full_screen = false; cm_win_width = 85; cm_win_height = 64; px_win_width = PX_WIN_WIDTH; px_win_height = PX_WIN_HEIGHT; cm_user_height = 70; cm_user_to_screen_center = 70; deg_user_yaw = 0.0; K = 0.5; last_x = 0; last_y = 0; Buttons[0] = 0; Buttons[1] = 0; Buttons[2] = 0; delta_t = 1.f; use_stereo_camera = false; use_wiimote = false; use_shaders = false; online_mode = false; half_eye_sep_x = 0.f; half_eye_sep_y = 0.f; p_htc = NULL; /// Notice: VRML file should be taken as program argument. //CreateScene("res/chapel_97-5.wrl"); CreateScene("res/boxes.wrl"); p_grid = new CanvasGrid( XY_GRID ); p_grid->setAxesDrawn(false); p_shader = new Shader(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STEREO); glutInitWindowSize(px_win_width, px_win_height); glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH) - px_win_width) * 0.5, (glutGet(GLUT_SCREEN_HEIGHT) - px_win_height) * 0.5 ); glutCreateWindow("Stereo VRML Viewer | BoUn CmpE Medialab"); } IGlut::~IGlut() { if (p_htc != NULL) CloseHeadTracker(); disconnect_wiimote(); delete p_scene; delete p_camera; delete p_grid; delete p_rc; delete p_light; delete p_shader; } void IGlut::Init() { glutDisplayFunc(Display); glutTimerFunc(20, Timer, 0); glutReshapeFunc(Reshape); glutMouseFunc(Mouse); glutKeyboardFunc(Keyboard); glutMotionFunc(Motion); PrepareMenus(); // glutFullScreen(); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_POSITION, gl_light_position); glLightfv(GL_LIGHT0, GL_AMBIENT, gl_ambient_intensity); glLightfv(GL_LIGHT0, GL_DIFFUSE, gl_light_intensity); glLightfv(GL_LIGHT0, GL_SPECULAR, gl_light_intensity); glClearColor(0.0, 0.0, 0.0, 1.0); glEnable(GL_DEPTH_TEST); glEnable(GL_NORMALIZE); glDepthFunc(GL_LEQUAL); glCullFace(GL_BACK); glEnable(GL_COLOR_MATERIAL); glShadeModel(GL_FLAT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); InitTextures(); p_shader->setShaders(); glutMainLoop(); } void IGlut::InitTextures() { glEnable(GL_TEXTURE_2D); glGenTextures(1, &textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]); glTexImage2D( GL_TEXTURE_2D, 0, 4, PX_WIN_WIDTH, PX_WIN_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, frame_buf); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); } void IGlut::PrepareMenus() { submenus[0] = glutCreateMenu( SelectOption ); glutAddMenuEntry("Toggle fullscreen view", 0); glutAddMenuEntry("Use wiimote", 1); glutAddMenuEntry("Render the scene", 2); glutAttachMenu(GLUT_RIGHT_BUTTON); } void IGlut::Motion(int x, int y) { if (Buttons[0]) { UpdateUserPositionByMouse(x, y); } else if (Buttons[2]) { // right click + y movement: affects z p_camera->setPosition( Point3(p_camera->position().x(), p_camera->position().y(), cm_user_height + (y - px_win_width*0.5) * 2) ); // cout << cam_pos.z << endl; } glutPostRedisplay(); } void IGlut::SelectOption(int opt) { glutSetMenu( -1 ); switch (opt) { case TOGGLE_FULLSCREEN: full_screen = !full_screen; if ( full_screen && glutGameModeGet(GLUT_GAME_MODE_ACTIVE) == 0 ) //argc > 2 && strcmp(argv[2], "f") == 0) { // Enter game mode: char mode_string[100]; // DOUBLE SCREEN: // sprintf(mode_string, "%dx%d:%d@%d", 1024, 1536, 32, 120); // SINGLE SCREEN: sprintf(mode_string, "%dx%d:%d@%d", 1024, 768, 32, 120); cout << "GLUT-Game-Mode: " << mode_string << endl; glutGameModeString( mode_string ); glutEnterGameMode(); // register callbacks again Init(); } else { glutLeaveGameMode(); } break; case TOGGLE_WIIMOTE: use_wiimote = !use_wiimote; glutChangeToMenuEntry(2, use_wiimote ? "Disconnect Wiimote" : "Use Wiimote", TOGGLE_WIIMOTE); if (!use_wiimote) disconnect_wiimote(); break; case RENDER_SCENE: if (p_rc == NULL) p_rc = new RenderController(); /// We use asymmetric frustum for off-axis projection in OpenGL; /// therefore we have to correct the camera direction for rendering: Point3 save_lookAtPoint( p_camera->lookAtPoint() ); Vector3 save_upVector( p_camera->upVector() ); p_camera->setLookAtPoint( Point3(0, 0, 0) ); p_camera->setUpVector( Vector3(0, 0, 1) ); p_rc->render(p_scene, p_camera); p_camera->setLookAtPoint( save_lookAtPoint ); p_camera->setUpVector( save_upVector ); break; } } void IGlut::GLUIControl(int ui_item_id) { switch (ui_item_id) { case 1: char fn[127] = "res/"; strcat( fn, fb->get_file() ); CreateScene( fn ); glui->close(); glutTimerFunc(20, Timer, 0); break; } } void IGlut::Keyboard(unsigned char key, int x, int y) { if (key == 'f' || key == 'F') { SelectOption( TOGGLE_FULLSCREEN ); } else if (key == 'o' || key == 'O') { glui = GLUI_Master.create_glui("Open File..", 0); GLUI_Panel *ep = new GLUI_Panel(glui, "", true); fb = new GLUI_FileBrowser(ep, "", GLUI_PANEL_EMBOSSED, 1, GLUIControl); new GLUI_Button(ep, "Open..", 2, GLUIControl); fb->set_w( 320 ); fb->set_h( 240 ); fb->fbreaddir( "res/" ); int main_window = glui->get_glut_window_id(); glui->set_main_gfx_window(main_window); } else if (key == 'c' || key == 'C') { use_stereo_camera = !use_stereo_camera; if (use_stereo_camera) // Reinitialize head: { if (p_htc == NULL) InitHeadTracker(); } else CloseHeadTracker(); } else if (key == 'd' || key == 'D') { // let maximum delta_t be 1.f if ( (delta_t = delta_t + 0.1f) > 1.f ) delta_t = 0.1f; } else if (key == 'w' || key == 'W') { SelectOption( TOGGLE_WIIMOTE ); } else if (key == 'z' || key == 'Z') { cout << "Height: " << p_camera->position().z() << endl; } else if (key == 'r' || key == 'R') { SelectOption( RENDER_SCENE ); } /*else if (key == 'f' || key == 'F') FogEffect(.01);*/ else if (key == 27) exit(0); switch (key)//************************************ { case '1': FogEffect(20.0); break; case '2': FogEffect(40.0); break; case '3': FogEffect(60.0); break; case '4': FogEffect(80.0); break; case '5': FogEffect(100.0); break; case '6': FogEffect(120.0); break; case '7': FogEffect(500.0); break; /*case 'r': // Toggle grid case 'R': showgrid = !showgrid; break;*/ } } void IGlut::Mouse(int button, int state, int x, int y) { last_x = x; last_y = y; switch(button) { case GLUT_LEFT_BUTTON: Buttons[0] = (int)(state == GLUT_DOWN); UpdateUserPositionByMouse(x, y); break; case GLUT_MIDDLE_BUTTON: Buttons[1] = (int)(state == GLUT_DOWN); break; case GLUT_RIGHT_BUTTON: Buttons[2] = (int)(state == GLUT_DOWN); //cam_pos.z = user_height + (y-px_win_width*0.5); p_camera->position().setZ( cm_user_height + (y-px_win_width*0.5)*2 ); break; default: break; } glutPostRedisplay(); } void IGlut::Reshape(int w, int h) { // prevent divide by 0 error when minimized if (w==0) h = 1; px_win_width = w; px_win_height = h; /*glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45,(float)w/h,0.1,100); //glFrustum(-.20, .20, .1, .4, 0.15, 100); glMatrixMode(GL_MODELVIEW); glLoadIdentity();*/ } void IGlut::CreateScene(string VRMLfile) { /*GfxObject* new_obj1 = new GfxObject(new RectangleShape(),new Material(),new Transformation()); new_obj1->getMaterial()->enableTexture(true); new_obj1->getMaterial()->getTexture().m_scale_x = 30 ; new_obj1->getMaterial()->getTexture().m_scale_y = 30 ; if (new_obj1->getShape()->type() == RECTANGLE) { RectangleShape* rct_ = static_cast<RectangleShape*>(new_obj1->getShape()); rct_->m_x = 100 ; rct_->m_y = 100 ; } GfxObject* new_obj2 = new GfxObject(new Cube(),new Material(),new Transformation()); new_obj2->getLocalTransform()->scale(4,6,0.5); new_obj2->getLocalTransform()->translate(4,0,6.5); new_obj2->getMaterial()->setDiffColor(TRadiance(0,0.5,0)); GfxObject* new_obj3 = new GfxObject(new Cylinder(),new Material(),new Transformation()); GfxObject* new_obj4 = new GfxObject(new Cylinder(),new Material(),new Transformation()); GfxObject* new_obj5 = new GfxObject(new Cylinder(),new Material(),new Transformation()); GfxObject* new_obj6 = new GfxObject(new Cylinder(),new Material(),new Transformation()); new_obj3->getMaterial()->setDiffColor(TRadiance(1,0,0)); new_obj4->getMaterial()->setDiffColor(TRadiance(1,0,0)); new_obj5->getMaterial()->setDiffColor(TRadiance(1,0,0)); new_obj6->getMaterial()->setDiffColor(TRadiance(1,0,0)); // new_obj3->getLocalTransform()->scale(0.25, 0.16666, 2); // new_obj3->getLocalTransform()->translate(0.25, 4/3, -13); // new_obj4->getLocalTransform()->translate(1,-8,0); // new_obj5->getLocalTransform()->translate(-5,-8,0); // new_obj6->getLocalTransform()->translate(-5,8,0); Cylinder* tmp_ = static_cast<Cylinder*>(new_obj3->getShape()); tmp_->m_h = 6 ; tmp_->m_r = 1; tmp_ = static_cast<Cylinder*>(new_obj4->getShape()); tmp_->m_h = 6 ; tmp_->m_r = 1; tmp_ = static_cast<Cylinder*>(new_obj5->getShape()); tmp_->m_h = 6 ; tmp_->m_r = 1; tmp_ = static_cast<Cylinder*>(new_obj6->getShape()); tmp_->m_h = 6 ; tmp_->m_r = 1; new_obj2->addChild(new_obj3); new_obj2->addChild(new_obj4); new_obj2->addChild(new_obj5); new_obj2->addChild(new_obj6); *p_scene += new_obj1; *p_scene += new_obj2; // *p_scene += new_obj3; //*p_scene += new_obj4; // *p_scene += new_obj5; // *p_scene += new_obj6; */ if (p_scene != NULL) { delete p_scene; delete p_camera; } p_scene = new Scene(); VrmlDevice vrml_dev; vrml_dev.loadScene(VRMLfile, p_scene); // Add GL lights to the Scene; Point3 l_pos( gl_light_position[0], gl_light_position[2], gl_light_position[1] ); Vector3 l_dir( -gl_light_position[0], -gl_light_position[2], -gl_light_position[1] ); p_light = new PointLight( l_pos, l_dir ); if ( p_scene->lights().empty() ) p_scene->lights().push_back( p_light ); else p_scene->lights()[0] = p_light; cout << "OBJS:" << p_scene->objects().size() << endl; for (int i = 0; i<p_scene->objects().size(); i++) { GfxObject* gobj = p_scene->objects()[i]; cout << "CN: " << gobj->getChildList().size() << endl; } /// skip this part; /*if (p_scene->cameras().size() != 0) { // blender setup p_camera = p_scene->cameras()[0]; cout << "CFR: " << p_camera->position().x() << " * " << p_camera->position().y() << " * " << p_camera->position().z() << endl; cout << "CTO: " << p_camera->lookAtPoint().x() << " * " << p_camera->lookAtPoint().y() << " * " << p_camera->lookAtPoint().z() << endl; cout << "CUP: " << p_camera->upVector().x() << " * " << p_camera->upVector().y() << " * " << p_camera->upVector().z() << endl; cout << "OBJ::" << p_scene->objects()[0]->getName() << endl; } else { p_camera = new Camera(); // serhat's setup: p_camera->setPosition(Point3(30,30,10)); p_camera->setLookAtPoint(Point3(0,0,0)); p_camera->setUpVector(Vector3(-0.5,-0.5,6).normalize()); // basar's manual setup: for chapel.wrl //p_camera->setPosition( Point3(0, 5, 5) ); //p_camera->setLookAtPoint( Point3(0, 0, 0) ); //p_camera->setUpVector( Vector3(0, 1, 0).normalize() ); }*/ p_camera = new Camera( Point3(0, -cm_user_to_screen_center, cm_user_height) ); // vrml_dev.saveToFile("output.wrl", p_scene); } void IGlut::Timer(int timer_id) { if (use_wiimote) update_scene_by_wiimote( p_scene, last_x, last_y ); if (use_stereo_camera && p_htc != NULL) { try { if ( online_mode ) // network client mode p_htc->read_online(); else p_htc->read_offline(); UpdateUserPositionByTracking(); } catch (runtime_error e) { cout << e.what() << endl; CloseHeadTracker(); return; } } if ( glutGetWindow() == 1 ) { glutPostRedisplay(); // triggers a display event glutSwapBuffers(); } else glutSetWindow( 1 ); glutTimerFunc(20, Timer, 0); } void IGlut::Display(void) { //usleep(25000); glDrawBuffer(GL_BACK_LEFT); if (use_shaders) { glReadBuffer(GL_BACK_LEFT); DrawToOneBuffer(half_eye_sep_x, half_eye_sep_y, 1, 2, true); DrawTextureWithShader(half_eye_sep_x, half_eye_sep_y); DrawToOneBuffer(half_eye_sep_x, half_eye_sep_y, 0.1, 1, false); } else DrawToOneBuffer(half_eye_sep_x, half_eye_sep_y, 0.1, 2, true); /*GLenum e; while ( (e=glGetError()) != GL_NO_ERROR ) cout << "Error " << e << endl;*/ glDrawBuffer(GL_BACK_RIGHT); if (use_shaders) { glReadBuffer(GL_BACK_RIGHT); DrawToOneBuffer(-half_eye_sep_x, -half_eye_sep_y, 1, 2, true); DrawTextureWithShader(-half_eye_sep_x, -half_eye_sep_y); DrawToOneBuffer(-half_eye_sep_x, -half_eye_sep_y, 0.1, 1, false); } else DrawToOneBuffer(-half_eye_sep_x, -half_eye_sep_y, 0.1, 2, true); } void IGlut::CopyFrameBufferToTexture() { /// Get a copy of framebuffer to texture0 glActiveTexture( GL_TEXTURE0 ); glBindTexture(GL_TEXTURE_2D, textures[0]); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, px_win_width, px_win_height); glBindTexture(GL_TEXTURE_2D, 0); } void IGlut::DrawTextureWithShader(float cm_camera_tilt_x, float cm_camera_tilt_y) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram( p_shader->sh_prog[BLUR] ); /// Prepare orthographic 2D projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, px_win_width, 0, px_win_height, 0, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); /// Use texture0 with the last frame buffer glActiveTexture( GL_TEXTURE0 ); glBindTexture(GL_TEXTURE_2D, textures[0]); /// Parameter for translating orthographic coordinates to perspective projection float o2p = 5.f; glTranslatef(cm_camera_tilt_x * o2p, cm_camera_tilt_y * o2p, 0.f); glNormal3f(0.f, 0.f, 1.f); glBegin(GL_QUADS); glMultiTexCoord2f(GL_TEXTURE0, 0, 0); glVertex2f( 0.f, 0.f ); glMultiTexCoord2f(GL_TEXTURE0, 1, 0); glVertex2f( px_win_width, 0.f ); glMultiTexCoord2f(GL_TEXTURE0, 1, 1); glVertex2f( px_win_width, px_win_height ); glMultiTexCoord2f(GL_TEXTURE0, 0, 1); glVertex2f( 0.f, px_win_height ); glEnd(); glBindTexture(GL_TEXTURE_2D, 0); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glPopMatrix(); } float z_h = 16; void IGlut::DrawToOneBuffer(float cm_camera_tilt_x, float cm_camera_tilt_y, float frustum_z_start, float frustum_z_end, bool first_pass) { if (first_pass) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram( p_shader->sh_prog[SAME] ); /** Here, t is used as both the frustum z direction start (= near clipping), * and scaling parameter for x and y directions * frustum z direction end is "far clipping" parameter */ float frusLeft, frusRight, frusBottom, frusTop, frusNear, frusFar, t = frustum_z_start; /* glViewport(0, win_h/2, win_w, win_h/2); glScissor(0, win_h/2, win_w, win_h/2); */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); frusLeft = ( - p_camera->position().x() - cm_win_width * .5 - cm_camera_tilt_x ) * t; frusRight = (- p_camera->position().x() + cm_win_width * .5 - cm_camera_tilt_x ) * t; frusBottom = (- p_camera->position().y() - cm_win_height * .5 - cm_camera_tilt_y ) * t; frusTop = ( - p_camera->position().y() + cm_win_height * .5 - cm_camera_tilt_y ) * t; /* frusBottom = (-(cam_pos.z-cm_win_height * .5) - cm_win_height * .5) * 0.1; frusTop = (-(cam_pos.z-cm_win_height * .5) + cm_win_height * .5) * 0.1; */ frusNear = p_camera->position().z() * frustum_z_start; frusFar = p_camera->position().z() * frustum_z_end; /// Define the frustum glFrustum( frusLeft, frusRight, frusBottom, frusTop, frusNear, frusFar); glMatrixMode(GL_MODELVIEW); glPushMatrix(); ((PointLight*)p_scene->lights()[0])->position() = Point3(gl_light_position[0], gl_light_position[2], gl_light_position[1]); // Assign camera values for gluLookAt Point3 glEyePos(p_camera->position().x() + cm_camera_tilt_x, p_camera->position().y() + cm_camera_tilt_y, p_camera->position().z() ); Point3 glCenterPos(p_camera->position().x() + cm_camera_tilt_x, p_camera->position().y() + cm_camera_tilt_y, 0.0); Vector3 glUpVector(0, 1, 0); p_camera->setPosition( glEyePos ); p_camera->setLookAtPoint( glCenterPos ); p_camera->setUpVector( glUpVector ); glTranslatef(0, 0, -z_h); p_scene->draw(p_camera, NULL, SHADED); /// Display Wiimote text message if exists glColor3f(0.0f, 1.0f, 0.0f); renderString(-cm_win_width * 0.5 + 5, -cm_win_height * 0.5 + 5, 0, wii_msg); glPopMatrix(); if (use_shaders && first_pass) CopyFrameBufferToTexture(); } void IGlut::UpdateUserPositionByMouse(int mouse_x, int mouse_y) { float user_vector_x = mouse_x - px_win_width* 0.5, user_vector_y = px_win_height* 0.5 - mouse_y; deg_user_yaw = atan2( user_vector_y, user_vector_x ); p_camera->setPosition( Point3( user_vector_x * PX_2_CM, // cm_user_to_screen_center * cos(deg_user_yaw); user_vector_y * PX_2_CM, // cm_user_to_screen_center * sin(deg_user_yaw); cm_user_height + z_h ) ); half_eye_sep_x = HALF_EYE_SEP_CM * -sin(deg_user_yaw); half_eye_sep_y = HALF_EYE_SEP_CM * cos(deg_user_yaw); // cout << cam_pos.z << endl; } void IGlut::UpdateUserPositionByTracking() { deg_user_yaw = atan2( p_htc->lookVector->y, p_htc->lookVector->x ); /** * DO NOT ASSIGN NEW VALUES DIRECTLY * add the difference with a delta */ //cam_pos.x += ( p_htc->headPosition->x - cam_pos.x ) * delta_t; //cout << p_htc->lookVector->x() << ", " << p_htc->lookVector->y() << endl; /// constant x; // p_camera->position().setX( -80 ); p_camera->position().setX( p_camera->position().x() + ( p_htc->headPosition->x - p_camera->position().x() ) * delta_t ); p_camera->position().setY( p_camera->position().y() + ( p_htc->headPosition->y - p_camera->position().y() ) * delta_t ); //cam_pos.z += ( p_htc->headPosition->z - cam_pos.z ) * delta_t; half_eye_sep_x = HALF_EYE_SEP_CM * sin(deg_user_yaw); half_eye_sep_y = HALF_EYE_SEP_CM * -cos(deg_user_yaw); //cout << cam_pos.z << endl; } void IGlut::FogEffect(float fogkey) { int fogMode[] = {GL_EXP, GL_EXP2, GL_LINEAR}; int fogfilter = 2; float fogColor[4] = {0.0f, 0.0f, 0.0f, 1.f}; glEnable(GL_FOG); glFogi(GL_FOG_MODE, fogMode[fogfilter]); glFogfv(GL_FOG_COLOR, fogColor); //glFogf(GL_FOG_COORD_SRC, GL_FOG_COORD); glFogf(GL_FOG_DENSITY, .1f); glFogf(GL_FOG_START, p_camera->position().z()-140);//cam_pos[2] glFogf(GL_FOG_END, p_camera->position().z() + fogkey);//* 2 - 8000); glHint(GL_FOG_HINT,GL_FASTEST); } void IGlut::InitHeadTracker() { try { p_htc = new HeadTrackerClient(SERVER_IP, online_mode); } catch (runtime_error e) { cout << e.what() << endl; p_htc = NULL; } } void IGlut::CloseHeadTracker() { use_stereo_camera = false; delete p_htc; p_htc = NULL; }
[ "basarugur@19b6b63a-0a50-11de-97d8-e990b0f60ea0" ]
basarugur@19b6b63a-0a50-11de-97d8-e990b0f60ea0
e96596a7bf1cca4a3bf7c2bf08c4e2abeb87924d
297a6efa719f1421f921f145a9190fb0006e315f
/09-CocheFantasticoMejorado/Ejercicio05-CocheFantasticoMejorado.ino
ee9f52036d550cf74e7ff92aca611c00f4dd8767
[]
no_license
therobotacademy/iot-arduino
690350053493f023ffe3aa58c213859f54eb66af
3fe9163f557d5e464ad4b769e3b1dd13d0613265
refs/heads/master
2021-05-02T03:43:36.339678
2018-03-16T17:38:40
2018-03-16T17:38:40
120,903,461
0
1
null
null
null
null
UTF-8
C++
false
false
1,149
ino
/* Knight Rider 2 -------------- Reducing the amount of code using for(;;). (cleft) 2005 K3, Malmo University @author: David Cuartielles @hardware: David Cuartielles, Aaron Hallborg @modified by: aprendiendoarduino */ int pinArray[] = {3, 5, 8, 10, 12}; int count = 0; int timer = 400; void setup() { Serial.begin(9600); // we make all the declarations at once for (count = 0; count < 5; count++) { pinMode(pinArray[count], OUTPUT); } } void loop() { timer = analogRead(A0)/4; //El valor leido por analog read es el temporizador Serial.print("timer= "); Serial.println(timer); for (count = 0; count < 5; count++) { //timer = analogRead(A0); digitalWrite(pinArray[count], HIGH); Serial.print("Enciendo led "); Serial.println(pinArray[count]); delay(timer); digitalWrite(pinArray[count], LOW); delay(timer); } for (count = 4; count >= 0; count--) { //timer = analogRead(A0); digitalWrite(pinArray[count], HIGH); Serial.print("Enciendo led "); Serial.println(pinArray[count]); delay(timer); digitalWrite(pinArray[count], LOW); delay(timer); } }
[ "brjapon@therobotacademy.com" ]
brjapon@therobotacademy.com
edd401d32889e3862267797b16e95a837164fe51
547a31c6d098df866be58befd8642ab773b32226
/vc/DataLogger/PDFLib/except.cpp
27cc6a57375c6a083714494715dce488274d5291
[]
no_license
neirons/pythondatalogger
64634d97eaa724a04707e4837dced51bcf750146
f1cd1aea4d63407c3d4156ddccd02339dc96dcec
refs/heads/master
2020-05-17T07:48:33.707106
2010-08-08T13:37:33
2010-08-08T13:37:33
41,642,510
0
0
null
null
null
null
UTF-8
C++
false
false
2,555
cpp
/*---------------------------------------------------------------------------* | PDFlib - A library for generating PDF on the fly | +---------------------------------------------------------------------------+ | Copyright (c) 1997-2002 PDFlib GmbH and Thomas Merz. All rights reserved. | +---------------------------------------------------------------------------+ | This software is NOT in the public domain. It can be used under two | | substantially different licensing terms: | | | | The commercial license is available for a fee, and allows you to | | - ship a commercial product based on PDFlib | | - implement commercial Web services with PDFlib | | - distribute (free or commercial) software when the source code is | | not made available | | Details can be found in the file PDFlib-license.pdf. | | | | The "Aladdin Free Public License" doesn't require any license fee, | | and allows you to | | - develop and distribute PDFlib-based software for which the complete | | source code is made available | | - redistribute PDFlib non-commercially under certain conditions | | - redistribute PDFlib on digital media for a fee if the complete | | contents of the media are freely redistributable | | Details can be found in the file aladdin-license.pdf. | | | | These conditions extend to ports to other programming languages. | | PDFlib is distributed with no warranty of any kind. Commercial users, | | however, will receive warranty and support statements in writing. | *---------------------------------------------------------------------------*/ /* $Id: except.c,v 1.1.2.6 2002/01/07 18:26:29 tm Exp $ */ #include "stdafx.h" #include <string.h> #include "pdflib.h" #include "except.h" void pdf_cpp_errorhandler(PDF *p, int type, const char *msg) { pdf_err_info *ei = (pdf_err_info *) PDF_get_opaque(p); ei->type = type; strcpy(ei->msg, msg); longjmp(ei->jbuf, 1); }
[ "shixiaoping79@5c1c4db6-e7b1-408c-73c2-e61316242a6a" ]
shixiaoping79@5c1c4db6-e7b1-408c-73c2-e61316242a6a
58f473811da92d69b93a777f0bc32a4d5915dd4b
cee40740786d05833f67dbf57c9a2fb76ff12168
/Cmpe226/HW2/queue.h
8dd7650d4306a9d1a27e421bf29971f3ae08b59c
[]
no_license
mcakici/Coding-HWs
76251e47a2b7c2bd666b584b53f785eb6a31e094
e4da3e3c97178842d53082fd6c97d7a0929bb50a
refs/heads/master
2022-12-15T18:22:24.641353
2022-11-27T17:44:33
2022-11-27T17:44:33
259,754,141
2
0
null
null
null
null
UTF-8
C++
false
false
966
h
#define QUEUE_H #include <iostream> #include <cassert> template <typename T> class Queue{ private: int maxsize; int count; int front,rear; T *data; public: Queue(int sz=100){ maxsize = sz; data = new T[maxsize]; front = 0; rear = maxsize-1; count = 0; } ~Queue(){ delete[] data; } bool isEmpty(){ return count==0; } bool isFull(){ return count==maxsize; } T getFront(){ assert(!isEmpty()); return data[front]; } T getRear(){ assert(!isEmpty()); return data[rear]; } void push(const T &item){ if(!isFull()){ rear = (rear+1) % maxsize; data[rear] = item; count++; }else{ std::cout<<"Queue is full"; } } T pop(){ assert(!isEmpty()); T tmp = data[front]; front = (front+1)%maxsize; count--; return tmp; } int size(){ return count; } int capacity(){ return maxsize; } void destroyQueue(){ front=count=0; rear=maxsize-1; } };
[ "glikoz@live.com" ]
glikoz@live.com
6a77f8a90306ecc4caf802ec2693da7a4bc3acd5
8944ff60725282eea466ae6004a7e6021496a8f9
/xmlobj/xml_lexer.h
3a6fdf66b75454c8b11b45ead304949e9c3c5c32
[ "MIT" ]
permissive
yikailee/xmlobj
e33e9bce61bff95dd1c30b77c2cf7a5ce7491477
cc6ab6dbf1ddbe39bc5fdcd8d61e1c2ed2b3e2e5
refs/heads/master
2021-01-17T18:35:04.582671
2016-08-17T09:04:19
2016-08-17T09:04:19
65,794,005
0
0
null
null
null
null
UTF-8
C++
false
false
1,400
h
/* * XML lexer and token define * a Token object should have its text, * and atts(reserve for start of node which has attributes). * 1. Xml declaration should be a T_COMMENT token start with "<?" and end with "?>"; * 2. A line a comment is a T_PROCINST token start with "<!--" and end with "-->"; * 3. Start of node should be a T_NODE_START token start with "<" and end with ">", * if end with "/>", will break down into two token, T_NODE_START and T_NODE_END * 4. End of node should be a T_NODE_END token * 5. between a start node and end node should be a T_STRING token if there is no * sub node inside. * 6. end of xml should be a T_EOF node. */ #pragma once #include <string> #include <unordered_map> #include <stdint.h> namespace xml { //---------------------------------------------------------------- enum TokenType { T_UNKNOWN, T_NODE_START, // </ or < T_NODE_END, // > or /> T_COMMENT, T_PROCINST, // <? xxxx ?> T_STRING, T_EOF }; //---------------------------------------------------------------- struct Token { // defalut is a T_UNKNOWN token Token() : type(T_UNKNOWN) {} // if a T_NODE_START or T_NODE_END, will be node name // if T_STRING, will be this string value. std::string text; // if start of node, save node attributes. std::unordered_map<std::string, std::string> attrs; // token type of a node TokenType type; }; } // end namespace
[ "admin@example.com" ]
admin@example.com
aafc427123fd7eae023412c1d845c3d60db0443a
343be0148831bcc76cc69829815eacf5e72488a2
/ast/operators/ASTAssignOperator.cpp
620b1dd0aa13e4410354493a0f0a4942ce6652bc
[]
no_license
tranvanh/PJP_semestralwork
f281ce2697b1462fd82d827555d2dccb80b5a22f
6687882620b2af3a5cd659d53af5596fbd67aee4
refs/heads/master
2022-12-27T03:58:32.307198
2020-09-10T20:16:03
2020-09-10T20:16:03
268,293,173
0
0
null
null
null
null
UTF-8
C++
false
false
304
cpp
// // Created by Tomas Tran on 01/06/2020. // #include "ASTAssignOperator.hpp" ASTAssignOperator::ASTAssignOperator(std::unique_ptr<ASTReference> variable, std::unique_ptr<ASTExpression> value) : m_Variable(std::move(variable)), m_Value(std::move(value)) {}
[ "tranvanh@fit.cvut.cz" ]
tranvanh@fit.cvut.cz
fe99ee52f6bf18aa43bce9f1bfe7d6dfdacdf8b8
c8a08848741a8827ea54cc34e48d16697734e2bf
/Beach/Road/main.cpp
f98f700f31862a8bf984d632f22d447f4948b564
[]
no_license
aaryasharma2/robomanipal
49b31cfc19ce23823f64f76f6287512d7fd80109
b50ec51ed2de5ae3b1e72f187fc8f51029db34f2
refs/heads/master
2023-02-21T23:06:22.792732
2019-07-31T16:59:21
2019-07-31T16:59:21
154,561,378
1
0
null
2023-02-09T07:30:02
2018-10-24T19:58:19
C++
UTF-8
C++
false
false
35,041
cpp
#include <windows.h> #include<GL/gl.h> #include<GL/glut.h> #include<math.h> #define PI 3.141592653589793238 float add_r,add_g,add_b; void circle(float x_value,float y_value, float radious_value) { float x =x_value; float y =y_value; float radious = radious_value; float twicePI = 2.0f*PI; int racmax=50; glBegin(GL_TRIANGLE_FAN); glVertex2f(x,y); for(int i=0; i<=racmax; i++) { glVertex2f( x+(radious*cos(i*twicePI/racmax)), y+(radious*sin(i*twicePI/racmax)) ); } glEnd(); } //////Sun & Moon////////// float sun_y_position =80; float moon_y_position=400; float sun_color_g=1.0; bool night = false; bool evening=false; void Sun() { float x =680; float y = 300; float radious = 100; float twicePI = 2.0f*PI; int racmax=50; glBegin(GL_TRIANGLE_FAN); glColor3f(1.0f,sun_color_g,0.0f); glVertex2f(x,y); for(int i=0; i<=racmax; i++) { glVertex2f( x+(radious*cos(i*twicePI/racmax)), y+(radious*sin(i*twicePI/racmax)) ); } glEnd(); } void Moon() { float x =680; float y = 300; float radious = 100; float twicePI = 2.0f*PI; int racmax=50; glBegin(GL_TRIANGLE_FAN); glColor3f(1.0f,1.0f,1.0f); glVertex2f(x,y); for(int i=0; i<=racmax; i++) { glVertex2f( x+(radious*cos(i*twicePI/racmax)), y+(radious*sin(i*twicePI/racmax)) ); } glEnd(); } /////////Sky/////////// float sky_r=0.3019,sky_g=0.9568,sky_b=1.0; void Sky() { glBegin(GL_QUADS); if(night==true) glColor3f(0.282353,0.282353,0.941176); else glColor3f(sky_r,sky_g,sky_b); glVertex2f(0,50); if(night==true) glColor3f(0.282353,0.282353,0.941176); else glColor3f(sky_r,sky_g,sky_b); glVertex2f(1900,50); if (evening==true) glColor3f(0.980392,0.627451,0.137255); else glColor3f(sky_r,sky_g,sky_b); glVertex2f(1900,528); if (evening==true) glColor3f(0.980392,0.627451,0.137255); else glColor3f(sky_r,sky_g,sky_b); glVertex2f(0,528); glEnd(); } /////////////////////////// ////////Clouds///////////// float Cloud_1_x_pos=0; void Cloud_1() { if(evening) glColor3f(1,0.843137,0.568627); else if(night) glColor3f(0.509804,0.564706,0.619608); else glColor3f(1,1,1); circle(200,200,40); circle(210,209,40); circle(230,200,40); circle(220,190,40); circle(250,230,40); circle(260,180,40); circle(220,200,40); circle(190,195,40); circle(280,200,40); circle(300,197,40); } float Cloud_1cpy_x_pos=0; void Cloud_1cpy() { if(evening) glColor3f(1,0.843137,0.568627); else if(night) glColor3f(0.509804,0.564706,0.619608); else glColor3f(1,1,1); circle(200,400,40); circle(210,409,40); circle(230,400,40); circle(220,390,40); circle(250,430,40); circle(260,380,40); circle(220,400,40); circle(190,395,40); circle(280,400,40); circle(300,397,40); } float Cloud_2_x_pos =0; void Cloud_2() { if(evening) glColor3f(1,0.843137,0.568627); else if(night) glColor3f(0.509804,0.564706,0.619608); else glColor3f(1,1,1); circle(400,300,40); circle(410,309,40); circle(430,300,40); circle(420,290,40); circle(450,330,40); circle(460,280,40); circle(420,300,40); circle(390,295,40); circle(480,300,40); circle(500,297,40); circle(380,300,40); circle(520,300,40); circle(515,310,40); circle(530,295,40); circle(360,310,40); circle(550,300,40); circle(581,315,40); } float Cloud_3_x_pos=0; void Cloud_3() { if(evening) glColor3f(1,0.843137,0.568627); else if(night) glColor3f(0.509804,0.564706,0.619608); else glColor3f(1,1,1); circle(100,430,40); circle(110,439,40); circle(130,420,40); circle(120,420,40); circle(150,460,40); circle(160,410,40); circle(120,430,40); circle(90,425,40); circle(180,420,40); circle(200,407,40); circle(80,420,40); circle(220,430,40); circle(215,440,40); circle(230,405,40); circle(60,450,40); circle(250,430,40); circle(281,425,40); circle(70,430,40); } void cloud_movement_timer(int) { glutTimerFunc(1000/90,cloud_movement_timer,0); if(Cloud_1_x_pos<1600) { Cloud_1_x_pos+=0.6;///cloud_1speed } else if (Cloud_1_x_pos>=1600) { Cloud_1_x_pos=(0); } if (Cloud_1cpy_x_pos<1600) Cloud_1cpy_x_pos+=0.8;///speed else if(Cloud_1cpy_x_pos>=1600) Cloud_1cpy_x_pos=0; if (Cloud_2_x_pos<1600) Cloud_2_x_pos+=0.3;///speed else if (Cloud_2_x_pos>=1600) Cloud_2_x_pos=-100; if(Cloud_3_x_pos<1600) Cloud_3_x_pos+=0.25;///speed else if(Cloud_3_x_pos>=1600) Cloud_3_x_pos=0; glutPostRedisplay(); } /////////////////////////// ///////Buildings/////////// void Building_1() { glColor3f(0.054902,0.105882,0.141176); glBegin(GL_POLYGON); glVertex2f(435,528); glVertex2f(450,528); glVertex2f(450,-150); glVertex2f(435,-150); glEnd(); glColor3f(0.627451+add_r,0.921569+add_g,0.980392+add_b); glBegin(GL_POLYGON); glVertex2f(365,528); glVertex2f(390,528); glVertex2f(390,500); glVertex2f(365,500); glEnd(); float glass_y=45; for(int i = 0; i<14; i++) { if(night==true &&(i==1||i==3||i==4||i==5||i==10)) glColor3f(0.984314,1,0); else glColor3f(0.627451+add_r,0.921569+add_g,0.980392+add_b); glBegin(GL_POLYGON); glVertex2f(365,528-glass_y); glVertex2f(390,528-glass_y); glVertex2f(390,500-glass_y); glVertex2f(365,500-glass_y); glEnd(); glass_y+=45; } glColor3f(0.2+add_r,0.054902+add_g,0.145098+add_b); glBegin(GL_POLYGON); glVertex2f(355,528); glVertex2f(400,528); glVertex2f(400,-150); glVertex2f(355,-150); glEnd(); glColor3f(0.054902+add_r,0.105882+add_g,0.141176+add_b); glBegin(GL_POLYGON); glVertex2f(305,528); glVertex2f(355,528); glVertex2f(355,-150); glVertex2f(305,-150); glEnd(); glColor3f(0.631373+add_r,0.486275+add_g,0.384314+add_b); glBegin(GL_POLYGON); glVertex2f(205,528); glVertex2f(305,528); glVertex2f(305,450); glVertex2f(205,450); glEnd(); glColor3f(0.054902+add_r,0.105882+add_g,0.141176+add_b); glBegin(GL_POLYGON); glVertex2f(195,528); glVertex2f(205,528); glVertex2f(205,-150); glVertex2f(195,-150); glEnd(); glColor3f(0.054902+add_r,0.105882+add_g,0.141176+add_b); glBegin(GL_POLYGON); glVertex2f(155,528); glVertex2f(195,528); glVertex2f(195,508); glVertex2f(155,508); glEnd(); float yx = 40; for (int i = 0; i<16; i++) { glBegin(GL_POLYGON); glVertex2f(155,528-yx); glVertex2f(195,528-yx); glVertex2f(195,508-yx); glVertex2f(155,508-yx); glEnd(); yx=yx+40; } glColor3f(0.631373+add_r,0.486275+add_g,0.384314+add_b); glBegin(GL_POLYGON); glVertex2f(110,528); glVertex2f(150,528); glVertex2f(150,450); glVertex2f(110,450); glEnd(); glColor3f(0.054902+add_r,0.105882+add_g,0.141176+add_b); glBegin(GL_POLYGON); glVertex2f(90,528); glVertex2f(105,528); glVertex2f(105,-150); glVertex2f(90,-150); glEnd(); glColor3f(0.631373+add_r,0.486275+add_g,0.384314+add_b); glBegin(GL_POLYGON); glVertex2f(22,528); glVertex2f(85,528); glVertex2f(85,450); glVertex2f(22,450); glEnd(); glColor3f(0.631373+add_r,0.486275+add_g,0.384314+add_b); glBegin(GL_POLYGON); glVertex2f(0,528); glVertex2f(20,528); glVertex2f(20,-150); glVertex2f(0,-150); glEnd(); glColor3f(0.929412+add_r,0.611765+add_g,0.380392+add_b); glBegin(GL_POLYGON); glVertex2f(0,528); glVertex2f(450,528); glVertex2f(450,-150); glVertex2f(0,-150); glEnd(); } void Building_2() { glColor3f(0.627451+add_r,0.921569+add_g,0.980392+add_b); glBegin(GL_POLYGON); glVertex2f(460,330); glVertex2f(528,330); glVertex2f(528,280); glVertex2f(460,280); glEnd(); glPushMatrix(); float glass_y=70; for(int i=0; i<5; i++) { if(night==true &&(i==0||i==1||i==3||i==4)) glColor3f(0.984314,1,0); else glColor3f(0.627451+add_r,0.921569+add_g,0.980392+add_b); glTranslatef(0,-glass_y,0); glBegin(GL_POLYGON); glVertex2f(460,330); glVertex2f(528,330); glVertex2f(528,280); glVertex2f(460,280); glEnd(); } glPopMatrix(); glColor3f(0.211765+add_r,0.321569+add_g,0.490196+add_b); glBegin(GL_POLYGON); glVertex2f(450,358); glVertex2f(538,358); glVertex2f(538,-80); glVertex2f(450,-80); glEnd(); glColor3f(0.498039+add_r,0.654902+add_g,0.890196+add_b); glBegin(GL_POLYGON); glVertex2f(450,428); glVertex2f(550,428); glVertex2f(550,438); glVertex2f(450,438); glEnd(); glColor3f(0.498039+add_r,0.654902+add_g,0.890196+add_b); glBegin(GL_POLYGON); glVertex2f(450,378); glVertex2f(550,378); glVertex2f(550,388); glVertex2f(450,388); glEnd(); glColor3f(0.309804+add_r,0.490196+add_g,0.760784+add_b); glBegin(GL_POLYGON); glVertex2f(450,428); glVertex2f(550,428); glVertex2f(550,-80); glVertex2f(450,-80); glEnd(); } void Building_3() { float x_div=0,y_div=0; glColor3f(0.501961+add_r,0.415686+add_g,0.27451+add_b); for (int i=0; i<8; i++) { for(int j=0; j<7; j++) { glBegin(GL_POLYGON); glVertex2f(1000+x_div,20-y_div); glVertex2f(1040+x_div,20-y_div); glVertex2f(1040+x_div,17-y_div); glVertex2f(1000+x_div,17-y_div); glEnd(); y_div+=30; } y_div=0; x_div+=50; } glColor3f(0.054902,0.0509804,0.14902); glBegin(GL_POLYGON); glVertex2f(1000,50); glVertex2f(1040,50); glVertex2f(1040,-200); glVertex2f(1000,-200); glEnd(); float x_pos=50; for(int i=0; i<7; i++) { glBegin(GL_POLYGON); glVertex2f(1000+x_pos,50); glVertex2f(1040+x_pos,50); glVertex2f(1040+x_pos,-200); glVertex2f(1000+x_pos,-200); glEnd(); x_pos+=50; } glColor3f(1,0.819608,0.6); glBegin(GL_POLYGON); glVertex2f(1030,60); glVertex2f(1370,60); glVertex2f(1370,95); glVertex2f(1030,95); glEnd(); glColor3f(0.929412,0.733333,0.494118); glBegin(GL_POLYGON); glVertex2f(1000,-200); glVertex2f(1400,-200); glVertex2f(1400,50); glVertex2f(1000,50); glEnd(); } void Building_4() { float y_pos=0,y_pos_1=0; glPushMatrix(); glTranslatef(110,0,0); for(int i=0; i<13; i++) { if(night==true && (i==1||i==10||i==7||i==6||i==3)) glColor3f(0.984314,1,0); else glColor3f(0.266667+add_r,0.345098+add_g,0.580392+add_b); glBegin(GL_POLYGON); glVertex2f(962,528-y_pos_1); glVertex2f(999,528-y_pos_1); glVertex2f(999,483-y_pos_1); glVertex2f(962,483-y_pos_1); glEnd(); glBegin(GL_POLYGON); glVertex2f(1048,528-y_pos_1); glVertex2f(1011,528-y_pos_1); glVertex2f(1011,483-y_pos_1); glVertex2f(1048,483-y_pos_1); glEnd(); y_pos_1+=52; } glPopMatrix(); for(int i=0; i<13; i++) { if(night==true && (i==2||i==11||i==4||i==8||i==7)) glColor3f(0.984314,1,0); else glColor3f(0.266667+add_r,0.345098+add_g,0.580392+add_b); glBegin(GL_POLYGON); glVertex2f(962,528-y_pos); glVertex2f(999,528-y_pos); glVertex2f(999,483-y_pos); glVertex2f(962,483-y_pos); glEnd(); glBegin(GL_POLYGON); glVertex2f(1048,528-y_pos); glVertex2f(1011,528-y_pos); glVertex2f(1011,483-y_pos); glVertex2f(1048,483-y_pos); glEnd(); y_pos+=52.00; } glColor3f(0.929412,0.733333,0.494118); glBegin(GL_POLYGON); glVertex2f(1200,528); glVertex2f(1180,528); glVertex2f(1180,-150); glVertex2f(1200,-150); glEnd(); glColor3f(0.0156863,0.054902,0.168627); glBegin(GL_POLYGON); glVertex2f(900,528); glVertex2f(950,528); glVertex2f(950,-150); glVertex2f(900,-150); glEnd(); glBegin(GL_POLYGON); glVertex2f(955,528); glVertex2f(1055,528); glVertex2f(1055,-150); glVertex2f(955,-150); glEnd(); glBegin(GL_POLYGON); glVertex2f(1065,528); glVertex2f(1165,528); glVertex2f(1165,-150); glVertex2f(1065,-150); glEnd(); glColor3f(0.862745,0.886275,0.960784); glBegin(GL_POLYGON); glVertex2f(900,528); glVertex2f(1200,528); glVertex2f(1200,-150); glVertex2f(900,-150); glEnd(); } void Building_5() { float y_pos=0; for (int i=0; i<10; i++) { if(night==true&&(i==0||i==3||i==5||i==6||i==9)) glColor3f(0.984314,1,0); else glColor3f(0.266667+add_r,0.345098+add_g,0.580392+add_b); glBegin(GL_POLYGON); glVertex2f(830,325-y_pos); glVertex2f(950,325-y_pos); glVertex2f(950,290-y_pos); glVertex2f(830,290-y_pos); glEnd(); y_pos+=40; } glColor3f(0.0156863,0.054902,0.168627); glBegin(GL_POLYGON); glVertex2f(820,328); glVertex2f(1000,328); glVertex2f(1000,348); glVertex2f(820,348); glEnd(); glColor3f(0.941176,0.435294,0.282353); glBegin(GL_POLYGON); glVertex2f(820,328); glVertex2f(1000,328); glVertex2f(1000,-100); glVertex2f(820,-100); glEnd(); } void Building_6() { glColor3f(0.309804+add_r,0.490196+add_g,0.760784+add_b); glBegin(GL_POLYGON); glVertex2f(1280,428); glVertex2f(1360,428); glVertex2f(1360,490); glVertex2f(1280,490); glEnd(); float x_pos=0; glColor3f(0.541176+add_r,0.705882+add_g,0.831373+add_b); for(int i=0; i<9; i++) { glBegin(GL_POLYGON); glVertex2f(1285+x_pos,328); glVertex2f(1290+x_pos,328); glVertex2f(1290+x_pos,400); glVertex2f(1285+x_pos,400); glEnd(); x_pos+=10; } glColor3f(0.156863+add_r,0.345098+add_g,0.490196+add_b); glBegin(GL_POLYGON); glVertex2f(1280,328); glVertex2f(1375,328); glVertex2f(1375,400); glVertex2f(1280,400); glEnd(); float y_pos=0; //glass for (int i=0; i<6; i++) { if(night==true) glColor3f(0.984314,1,0); else glColor3f(0.337255+add_r,0.662745+add_g,0.909804+add_b); glBegin(GL_POLYGON); glVertex2f(1210,318-y_pos); glVertex2f(1270,318-y_pos); glVertex2f(1270,278-y_pos); glVertex2f(1210,278-y_pos); glEnd(); y_pos+=50; } glColor3f(0.156863+add_r,0.345098+add_g,0.490196+add_b); glBegin(GL_POLYGON); glVertex2f(1000,328); glVertex2f(1280,328); glVertex2f(1280,-100); glVertex2f(1000,-100); glEnd(); float y_pos_1=0; //glass for(int i=0; i<6; i++) { if(night==true&&(i==2||i==4||i==5)) glColor3f(0.984314,1,0); else glColor3f(0.490196+add_r,0.627451+add_g,0.729412+add_b); glBegin(GL_POLYGON); glVertex2f(1285,318-y_pos_1); glVertex2f(1370,318-y_pos_1); glVertex2f(1370,278-y_pos_1); glVertex2f(1285,278-y_pos_1); glEnd(); y_pos_1+=50; } glColor3f(0.109804+add_r,0.223529+add_g,0.309804+add_b); glBegin(GL_POLYGON); glVertex2f(1280,328); glVertex2f(1375,328); glVertex2f(1375,-100); glVertex2f(1280,-100); glEnd(); glColor3f(0.309804+add_r,0.490196+add_g,0.760784+add_b); glBegin(GL_POLYGON); glVertex2f(1000,428); glVertex2f(1380,428); glVertex2f(1380,-100); glVertex2f(1000,-100); glEnd(); } void Building_7() { float x_pos=0,y_pos=0; for(int y =0; y<16; y++) { for(int x=0; x<5; x++) { if(night==true&&((y==2&&(x==3||x==2))||(y==4&&(x==1||x==4))||(y==5&&x==0)||(y==1&&(x==0||x==2))||(y==6&&x==2)||(y==7&&(x==0||x==4)) ||(y==8&&(x==0||x==4))||(y==11)||y==13||(y==15&&(x==0||x==2)))) glColor3f(0.984314,1,0); else glColor3f(0.568627+add_r,0.180392+add_g,0.121569+add_b); glBegin(GL_POLYGON); glVertex2f(1710+x_pos,528-y_pos); glVertex2f(1742+x_pos,528-y_pos); glVertex2f(1742+x_pos,498-y_pos); glVertex2f(1710+x_pos,498-y_pos); glEnd(); x_pos+=40; } x_pos=0; y_pos+=40; } glColor3f(0.580392+add_r,0.545098+add_g,0.282353+add_b); glBegin(GL_POLYGON); glVertex2f(1700,-130); glVertex2f(1900,-130); glVertex2f(1900,528); glVertex2f(1700,528); glEnd(); } void Building_8() { float y_pos=0; for(int x=0; x<10; x++) { glColor3f(0.74902+add_r,0.588235+add_g,0.427451+add_b); glBegin(GL_POLYGON); glVertex2f(1643,420-y_pos); glVertex2f(1700,420-y_pos); glVertex2f(1700,427-y_pos); glVertex2f(1643,427-y_pos); glEnd(); glColor3f(0.431373+add_r,0.364706+add_g,0.329412+add_b); glBegin(GL_POLYGON); glVertex2f(1643,420-y_pos); glVertex2f(1700,420-y_pos); glVertex2f(1700,417-y_pos); glVertex2f(1643,417-y_pos); glEnd(); y_pos+=50; } glColor3f(0.0509804+add_r,0,0.219608+add_b); glBegin(GL_POLYGON); glVertex2f(1635,-80); glVertex2f(1645,-80); glVertex2f(1645,420); glVertex2f(1635,420); glEnd(); glColor3f(0.568627+add_r,0.247059+add_g,0.0980392+add_b); glBegin(GL_POLYGON); glVertex2f(1600,-80); glVertex2f(1635,-80); glVertex2f(1635,420); glVertex2f(1600,420); glEnd(); glColor3f(0.811765+add_r,0.333333+add_g,0.113725+add_b); glBegin(GL_POLYGON); glVertex2f(1600,-80); glVertex2f(1700,-80); glVertex2f(1700,420); glVertex2f(1600,420); glEnd(); } void Building_9() { if(night||evening) { float point_x=0; glPointSize(4); glColor3f(0.152941,0.729412,0.768627); glBegin(GL_POINTS); for(int i=0; i<11; i++) { glVertex2f(660+point_x,30); point_x+=6; } glVertex2f(560,140); glVertex2f(590,120); glVertex2f(575,100); glVertex2f(560,80); glVertex2f(670,180); glVertex2f(680,180); glVertex2f(690,180); glVertex2f(700,160); glVertex2f(710,160); glVertex2f(720,160); glVertex2f(730,160); glVertex2f(700,140); glVertex2f(690,140); glVertex2f(670,120); glVertex2f(730,100); glVertex2f(670,80); glVertex2f(710,80); glVertex2f(720,80); glVertex2f(730,80); glVertex2f(570,80); glVertex2f(610,80); glVertex2f(570,60); glVertex2f(580,60); glVertex2f(590,60); glVertex2f(600,60); glVertex2f(610,60); glVertex2f(740,100); glVertex2f(780,100); glVertex2f(740,150); glVertex2f(780,50); glVertex2f(790,50); glVertex2f(800,50); glVertex2f(800,150); glVertex2f(820,200); glVertex2f(810,200); glVertex2f(800,200); glVertex2f(810,250); glVertex2f(1500,200); glVertex2f(1450,200); glVertex2f(1400,200); glVertex2f(1390,200); glVertex2f(1410,200); glVertex2f(1420,200); glVertex2f(1400,250); glVertex2f(1390,300); glVertex2f(1530,250); glVertex2f(1520,250); glVertex2f(1510,250); glVertex2f(1500,250); glVertex2f(1450,250); glVertex2f(1440,250); glVertex2f(1500,230); glVertex2f(1480,230); glVertex2f(1480,210); glVertex2f(1490,210); glVertex2f(1470,210); glVertex2f(1430,180); glVertex2f(1440,180); glVertex2f(1380,180); glVertex2f(1470,180); glVertex2f(1460,180); glVertex2f(1530,180); glVertex2f(1510,180); glVertex2f(1430,160); glVertex2f(1440,160); glVertex2f(1450,160); glVertex2f(1460,160); glVertex2f(1530,140); glVertex2f(1520,140); glVertex2f(1510,140); glVertex2f(1500,140); glVertex2f(1430,140); glVertex2f(1420,140); glVertex2f(1390,100); glVertex2f(1490,100); glVertex2f(1480,100); glVertex2f(1470,100); glVertex2f(1460,100); glVertex2f(1410,60); glVertex2f(1420,60); glVertex2f(1430,60); glVertex2f(1510,60); glVertex2f(1440,30); glVertex2f(1450,30); glVertex2f(1460,30); glEnd(); } if(evening) glColor3f(0.00784314,0.25098,0.639216); else if(night) glColor3f(0,0,0.529412); else glColor3f(0.454902,0.686275,0.94902); glBegin(GL_POLYGON); glVertex2f(550,150); glVertex2f(600,150); glVertex2f(600,-10); glVertex2f(550,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(600,100); glVertex2f(650,100); glVertex2f(650,-10); glVertex2f(600,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(650,180); glVertex2f(655,180); glVertex2f(655,-10); glVertex2f(650,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(655,190); glVertex2f(670,190); glVertex2f(670,-10); glVertex2f(655,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(670,250); glVertex2f(700,250); glVertex2f(700,-10); glVertex2f(670,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(700,200); glVertex2f(750,200); glVertex2f(750,-10); glVertex2f(700,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(750,170); glVertex2f(780,170); glVertex2f(780,-10); glVertex2f(750,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(780,280); glVertex2f(820,280); glVertex2f(820,-10); glVertex2f(780,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(1350,320); glVertex2f(1410,320); glVertex2f(1410,-10); glVertex2f(1350,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(1350,320); glVertex2f(1410,320); glVertex2f(1410,-10); glVertex2f(1350,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(1410,260); glVertex2f(1470,260); glVertex2f(1470,-10); glVertex2f(1410,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(1470,290); glVertex2f(1510,290); glVertex2f(1510,-10); glVertex2f(1470,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(1510,320); glVertex2f(1550,320); glVertex2f(1550,-10); glVertex2f(1510,-10); glEnd(); glBegin(GL_POLYGON); glVertex2f(1550,380); glVertex2f(1650,380); glVertex2f(1650,-10); glVertex2f(1550,-10); glEnd(); } ////////////////////////// ////////Slab////////////// void slab_1() { glColor3f(0.309804+add_r,0.368627+add_g,0.333333+add_b); glBegin(GL_POLYGON); glVertex2f(0,50); glVertex2f(650,50); glVertex2f(540,-250); glVertex2f(0,-250); glEnd(); } void slab_2() { glColor3f(0.309804+add_r,0.368627+add_g,0.333333+add_b); glBegin(GL_QUADS); glVertex2f(730,50); glVertex2f(1100,50); glVertex2f(1590,-250); glVertex2f(850,-250); glEnd(); } void slab_3() { glColor3f(0.309804+add_r,0.368627+add_g,0.333333+add_b); glBegin(GL_QUADS); glVertex2f(1300,50); glVertex2f(1900,50); glVertex2f(1900,-250); glVertex2f(1900,-250); glEnd(); } ///////road////// void road() { glColor3f(1,1,1); float x_r_p=0,y_r_p=0; for(int i=0; i<6; i++) { glBegin(GL_POLYGON); glVertex2f(0+x_r_p,-346); glVertex2f(250+x_r_p,-346); glVertex2f(250+x_r_p,-352); glVertex2f(0+x_r_p,-352); glEnd(); x_r_p+=350; } for(int i=0; i<2; i++) { glBegin(GL_POLYGON); glVertex2f(685,-250+y_r_p); glVertex2f(691,-250+y_r_p); glVertex2f(691,-100+y_r_p); glVertex2f(685,-100+y_r_p); glEnd(); y_r_p+=180; } glColor3f(0.258824,0.258824,0.258824); glBegin(GL_POLYGON); glVertex2f(0,-10); glVertex2f(1900,-10); glVertex2f(1900,-528); glVertex2f(0,-528); glEnd(); } ////tree/// void tree() { glColor3f(0.337255,0.54902,0.152941); glBegin(GL_TRIANGLES); glVertex2f(50,-40); glVertex2f(25,-160); glVertex2f(50,-170); glEnd(); glColor3f(0.188235,0.329412,0.0627451); glBegin(GL_TRIANGLES); glVertex2f(50,-40); glVertex2f(75,-160); glVertex2f(50,-170); glEnd(); glColor3f(0.180392,0.0627451,0.0627451); glBegin(GL_POLYGON); glVertex2f(46,-167); glVertex2f(56,-167); glVertex2f(56,-180); glVertex2f(46,-180); glEnd(); } void tree_1() { glColor3f(0.403922,0.541176,0.227451); glBegin(GL_POLYGON); glVertex2f(840,-40); glVertex2f(910,-40); glVertex2f(910,-100); glVertex2f(840,-100); glEnd(); glColor3f(0.231373,0.341176,0.0862745); glBegin(GL_POLYGON); glVertex2f(800,-70); glVertex2f(860,-70); glVertex2f(860,-120); glVertex2f(800,-120); glEnd(); glBegin(GL_POLYGON); glVertex2f(890,-70); glVertex2f(950,-70); glVertex2f(950,-120); glVertex2f(890,-120); glEnd(); glColor3f(0.501961,0.278431,0.0980392); glBegin(GL_POLYGON); glVertex2f(870,-180); glVertex2f(880,-180); glVertex2f(880,-100); glVertex2f(870,-100); glEnd(); glBegin(GL_POLYGON); glVertex2f(840,-100); glVertex2f(850,-100); glVertex2f(870,-140); glVertex2f(880,-140); glEnd(); glBegin(GL_POLYGON); glVertex2f(900,-100); glVertex2f(910,-100); glVertex2f(870,-137); glVertex2f(880,-137); glEnd(); } ////////car/////// float car_1_xpos=0; void Car_1() { if(night==true) glColor3f(0.984314,1,0); else glColor3f(0.537255,0.537255,0.533333); glBegin(GL_QUADS); glVertex2f(450,-250); glVertex2f(440,-250); glVertex2f(440,-230); glVertex2f(450,-230); glEnd(); glColor3f(0.686275+add_r,0.839216+add_g,0.509804+add_b); circle(200,-180,60); glColor3f(0.129412+add_r,0.129412+add_g,0.129412+add_b); glBegin(GL_QUADS); glVertex2f(450,-270); glVertex2f(440,-270); glVertex2f(440,-260); glVertex2f(450,-260); glEnd(); glColor3f(0.129412+add_r,0.129412+add_g,0.129412+add_b); circle(170,-280,35); glColor3f(0.129412,0.129412,0.129412); circle(400,-280,35); glColor3f(0.2,0.2,0.2); glBegin(GL_POLYGON); glVertex2f(100,-270); glVertex2f(130,-280); glVertex2f(420,-280); glVertex2f(450,-270); glEnd(); glColor3f(0.34902+add_r,0.431373+add_g,0.431373+add_b); glLineWidth(5); glBegin(GL_LINES); glVertex2f(300,-270); glVertex2f(300,-100); glEnd(); glBegin(GL_LINES); glVertex2f(300,-100); glVertex2f(100,-100); glEnd(); glBegin(GL_LINES); glVertex2f(100,-100); glVertex2f(100,-270); glEnd(); glColor3f(0.603922+add_r,0.721569+add_g,0.705882+add_b); glBegin(GL_POLYGON); glVertex2f(300,-270); glVertex2f(300,-100); glVertex2f(100,-100); glVertex2f(100,-270); glEnd(); glColor3f(0.227451+add_r,0.231373+add_g,0.231373+add_b); glBegin(GL_POLYGON); glVertex2f(305,-155); glVertex2f(345,-155); glVertex2f(395,-205); glVertex2f(305,-205); glEnd(); glColor3f(0.603922+add_r,0.721569+add_g,0.705882+add_b); glBegin(GL_POLYGON); glVertex2f(300,-150); glVertex2f(350,-150); glVertex2f(400,-200); glVertex2f(450,-230); glVertex2f(450,-270); glVertex2f(300,-270); glEnd(); glColor3f(0.34902+add_r,0.431373+add_g,0.431373+add_b); circle(310,-150,36); } void Car_1_move(int) { glutTimerFunc(1000/90,Car_1_move,1); if(car_1_xpos<=1950) car_1_xpos+=3; else car_1_xpos=-450; glutPostRedisplay(); } void Car_2() { if(night==true) glColor3f(0.984314,1,0); else glColor3f(0.537255,0.537255,0.533333); glBegin(GL_QUADS); glVertex2f(450,-250); glVertex2f(440,-250); glVertex2f(440,-230); glVertex2f(450,-230); glEnd(); glColor3f(0.686275+add_r,0.839216+add_g,0.509804+add_b); circle(200,-180,60); glColor3f(0.129412+add_r,0.129412+add_g,0.129412+add_b); glBegin(GL_QUADS); glVertex2f(450,-270); glVertex2f(440,-270); glVertex2f(440,-260); glVertex2f(450,-260); glEnd(); glColor3f(0.129412+add_r,0.129412+add_g,0.129412+add_b); circle(170,-280,35); glColor3f(0.129412,0.129412,0.129412); circle(400,-280,35); glColor3f(0.2,0.2,0.2); glBegin(GL_POLYGON); glVertex2f(100,-270); glVertex2f(130,-280); glVertex2f(420,-280); glVertex2f(450,-270); glEnd(); glColor3f(0.34902+add_r,0.431373+add_g,0.431373+add_b); glLineWidth(5); glBegin(GL_LINES); glVertex2f(300,-270); glVertex2f(300,-100); glEnd(); glBegin(GL_LINES); glVertex2f(300,-100); glVertex2f(100,-100); glEnd(); glBegin(GL_LINES); glVertex2f(100,-100); glVertex2f(100,-270); glEnd(); glColor3f(0.878431+add_r,0.835294+add_g,0.00784314+add_b); glBegin(GL_POLYGON); glVertex2f(300,-270); glVertex2f(300,-100); glVertex2f(100,-100); glVertex2f(100,-270); glEnd(); glColor3f(0.227451+add_r,0.231373+add_g,0.231373+add_b); glBegin(GL_POLYGON); glVertex2f(305,-155); glVertex2f(345,-155); glVertex2f(395,-205); glVertex2f(305,-205); glEnd(); glColor3f(0.878431+add_r,0.835294+add_g,0.00784314+add_b); glBegin(GL_POLYGON); glVertex2f(300,-150); glVertex2f(350,-150); glVertex2f(400,-200); glVertex2f(450,-230); glVertex2f(450,-270); glVertex2f(300,-270); glEnd(); glColor3f(0.34902+add_r,0.431373+add_g,0.431373+add_b); circle(310,-150,36); } float car_2_xpos=10; void Car_2_perfectPlace() { glPushMatrix(); glTranslatef(0,-110,0); Car_2(); glPopMatrix(); } void car_2_move(int) { glutTimerFunc(1000/90,car_2_move,1); if(car_2_xpos<=1950) car_2_xpos+=1.5; else car_2_xpos=-450; glutPostRedisplay(); } void reshape(int w,int h) { glViewport(0,0,(GLsizei)w,(GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0,1900,-528,528); glMatrixMode(GL_MODELVIEW); } void init() { glClearColor(0,0,0,1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); } void keyboard(unsigned char key, int x, int y) { switch (key) { case 'd': { night=false; evening=false; sun_y_position=80; sky_r=0.3019; sky_g=0.9538; sky_b=1.0; sun_color_g=1.0; add_r=0; add_g=0; add_b=0; glClear(GL_COLOR_BUFFER_BIT); glutPostRedisplay(); break; } case 'e': { night=false; evening=true; sun_y_position=-100; sun_color_g=.9; add_r=-0.0588235; add_g=-0.0588235; add_b=-0.0588235; glutPostRedisplay(); break; } case 'n': { night = true; evening=false; sky_r=0; sky_g=0.0823529; sky_b=0.278431; add_r=-0.117647; add_g=-0.117647; add_b=-0.117647; glutPostRedisplay(); break; } } } void Display() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); ///car/// glPushMatrix(); glTranslatef(car_2_xpos,0,0); Car_2_perfectPlace(); glPopMatrix(); glPushMatrix(); glTranslatef(car_1_xpos,0,0); Car_1(); glPopMatrix(); ///buildings/// glPushMatrix(); glTranslatef(-350,0,0); tree_1(); glPopMatrix(); glPushMatrix(); glTranslatef(-20,0,0); tree_1(); glPopMatrix(); float tree_1_x_pos=0; for(int i=0; i<6; i++) { glPushMatrix(); glTranslatef(tree_1_x_pos,0,0); tree(); glPopMatrix(); tree_1_x_pos+=70; } tree_1_x_pos=0; glPushMatrix(); glTranslatef(2000,0,0); glScalef(-.8,0.8,0); for(int i=0; i<5; i++) { glPushMatrix(); glTranslatef(tree_1_x_pos,0,0); tree(); glPopMatrix(); tree_1_x_pos+=70; } glPopMatrix(); Building_1(); glPushMatrix(); glScalef(0.8,0.8,0); glTranslatef(-180,40,0); tree_1(); glPopMatrix(); Building_2(); glPushMatrix(); glScalef(0.6,0.6,0); glTranslatef(90,90,0); tree_1(); glPopMatrix(); Building_3(); Building_4(); glPushMatrix(); glScalef(0.8,0.8,0); glTranslatef(150,40,0); tree_1(); glPopMatrix(); Building_5(); Building_6(); glPushMatrix(); glScalef(0.6,0.6,0); glTranslatef(450,90,0); tree_1(); glPopMatrix(); Building_7(); Building_8(); glPushMatrix(); glTranslatef(720,50,0); Building_5(); glPopMatrix(); Building_9(); ///Slabs// slab_1(); slab_2(); slab_3(); ///road/// road(); ///Clouds// glPushMatrix(); glTranslatef(Cloud_2_x_pos,0,0); Cloud_2(); glPopMatrix(); glPushMatrix(); glTranslatef(Cloud_1_x_pos,0,0); Cloud_1(); glPopMatrix(); glPushMatrix(); glTranslatef(Cloud_1cpy_x_pos,0,0); Cloud_1cpy(); glPopMatrix(); glPushMatrix(); glTranslatef(Cloud_3_x_pos,0,0); Cloud_3(); glPopMatrix(); ///Sun&Moon/// if(night == false) { glPushMatrix(); glTranslatef(0.0,sun_y_position,0.0); Sun(); glPopMatrix(); } else if(night = true) { glPushMatrix(); glTranslatef(0.0,80,0.0); Moon(); glPopMatrix(); } ///Sky// Sky(); glFlush(); glutSwapBuffers(); } void TimerHolder(int) { cloud_movement_timer(0); Car_1_move(0); car_2_move(0); } int main(int argc,char ** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH); glutInitWindowSize(1900,1060); glutInitWindowPosition(0,0); glutCreateWindow("City view"); glutReshapeFunc(reshape); glutDisplayFunc(Display); glutKeyboardFunc(keyboard); init(); glutIdleFunc(Display); glutTimerFunc(0,TimerHolder,0); glutMainLoop(); }
[ "iamamysharma@gmail.com" ]
iamamysharma@gmail.com
e6ac8e2603f7912e8931b47184828b14b75bc4c6
48298469e7d828ab1aa54a419701c23afeeadce1
/Common/Packets/GCPlayerShopMoney.h
8dcdee4afadf93dada3f8e8bfeb6133f45986499
[]
no_license
brock7/TianLong
c39fccb3fd2aa0ad42c9c4183d67a843ab2ce9c2
8142f9ccb118e76a5cd0a8b168bcf25e58e0be8b
refs/heads/master
2021-01-10T14:19:19.850859
2016-02-20T13:58:55
2016-02-20T13:58:55
52,155,393
5
3
null
null
null
null
GB18030
C++
false
false
2,165
h
// GCPlayerShopMoney.h // // 通知客户端金钱存取 // ////////////////////////////////////////////////////// #ifndef __GCPLAYERSHOPMONEY_H__ #define __GCPLAYERSHOPMONEY_H__ #include "Type.h" #include "Packet.h" #include "PacketFactory.h" namespace Packets { class GCPlayerShopMoney : public Packet { public: enum { TYPE_BASE_MONEY = 0, TYPE_PROFIT_MONEY, }; public: GCPlayerShopMoney( ) { m_Type = TYPE_BASE_MONEY; //存到哪 m_Amount = 0; //数量 m_nShopSerial= 0; //商店序列号 }; virtual ~GCPlayerShopMoney( ){}; //公用继承接口 virtual BOOL Read( SocketInputStream& iStream ) ; virtual BOOL Write( SocketOutputStream& oStream )const ; virtual UINT Execute( Player* pPlayer ) ; virtual PacketID_t GetPacketID()const { return PACKET_GC_PLAYERSHOPMONEY; } virtual UINT GetPacketSize()const { return sizeof(_PLAYERSHOP_GUID) + sizeof(BYTE) + sizeof(BYTE) + sizeof(UINT);} _PLAYERSHOP_GUID GetShopID(VOID) const {return m_ShopID;} VOID SetShopID(_PLAYERSHOP_GUID nShopID) {m_ShopID = nShopID;} BYTE GetType(VOID) const {return m_Type;} VOID SetType(BYTE nType) {m_Type = nType;} UINT GetAmount(VOID) const {return m_Amount;} VOID SetAmount(UINT nAmount) {m_Amount = nAmount;} BYTE GetShopSerial(VOID) const {return m_nShopSerial;} VOID SetShopSerial(BYTE nSerial) {m_nShopSerial = nSerial;} private: _PLAYERSHOP_GUID m_ShopID; //商店ID BYTE m_Type; //存到哪 UINT m_Amount; //数量 BYTE m_nShopSerial; //商店序列号 }; class GCPlayerShopMoneyFactory : public PacketFactory { public: Packet* CreatePacket() { return new GCPlayerShopMoney() ; } PacketID_t GetPacketID()const { return PACKET_GC_PLAYERSHOPMONEY; }; UINT GetPacketMaxSize()const { return sizeof(_PLAYERSHOP_GUID) + sizeof(BYTE) + sizeof(BYTE) + sizeof(UINT);} }; class GCPlayerShopMoneyHandler { public: static UINT Execute( GCPlayerShopMoney* pPacket, Player* pPlayer ) ; }; } using namespace Packets; #endif
[ "xiaowave@gmail.com" ]
xiaowave@gmail.com
aecdd06ea0d82ac6c6c79d54bdd16f0d2cccd919
284d841aa85d0b1731ca28f50bbf838868b5c0f7
/source/ncm/ncm.cpp
11baa542d185f723c5ed718df43f6c3723201ff9
[ "MIT" ]
permissive
blawar/nn
9e6b91d31ede1faea98f78098bbae1025913ee24
cfd66e0071ddd2756efe9171d2b7a876cc51fde7
refs/heads/master
2020-06-03T03:49:21.520485
2019-06-12T21:45:26
2019-06-12T21:45:26
191,426,129
3
0
null
null
null
null
UTF-8
C++
false
false
498
cpp
#include "nn.h" namespace nn::ncm { Service service() { Service s; return s; } Result OpenContentStorage(ContentStorage* contentStorage, const StorageId storageId) { return Request<4, ResponseS<ContentStorage>>().send(service()).result(contentStorage); } Result OpenContentMetaDatabase(ContentMetaDatabase* contentMetaDatabase, const StorageId storageId) { return Request<5, ResponseS<ContentMetaDatabase>>().send(service()).result(contentMetaDatabase); } }
[ "blake@null3d.com" ]
blake@null3d.com
1129fa85e7266bed065689b5d637d57e4da00a42
708539d6d01fc5de5681effd747dd171e0dab2f5
/src/ast.cpp
dd8c3ec7fe34b639c76771c83bf9447f7b61c3f3
[]
no_license
AlexGibson12/c-style-lang-compiler-
706e61c0a093c6c54f460a50ca1ff18855b231f5
8d1297f2dbf25e37e3c66401eb3d099d7ba35553
refs/heads/main
2023-08-30T22:16:01.378152
2021-10-06T17:15:26
2021-10-06T17:15:26
412,627,658
0
0
null
null
null
null
UTF-8
C++
false
false
11,307
cpp
#include "../headers/ast.h" #include "../headers/scope.h" CompoundStatement::CompoundStatement(Statement* initcurrentstatement,CompoundStatement* initnextstatements){ currentstatement = initcurrentstatement; nextstatements = initnextstatements; statementtype = STATCOMPOUND; } AssignStatement::AssignStatement(string initidentifier,Expression* initexpression){ identifier = initidentifier; expression = initexpression; statementtype = STATASSIGN; } PrintStatement::PrintStatement(Expression* initexpression){ expression = initexpression; statementtype = STATPRINT; } IfStatement::IfStatement(Expression* initcondition,CompoundStatement* initstatements){ condition = initcondition; statements = initstatements; statementtype = STATIF; } IfElseStatement::IfElseStatement(Expression* initcondition,CompoundStatement* initvalid,CompoundStatement* initinvalid){ condition = initcondition; valid = initvalid; invalid = initinvalid; statementtype = STATIFELSE; } WhileStatement::WhileStatement(Expression* initcondition,CompoundStatement* initstatements){ condition = initcondition; statements = initstatements; statementtype = STATWHILE; } ForStatement::ForStatement(AssignStatement* initinitializer, Expression* initcondition,AssignStatement* initnext,CompoundStatement* initstatements){ initializer = initinitializer; condition = initcondition; next = initnext; statements = initstatements; statementtype = STATFOR; } Literal::Literal(int initvalue){ type =INT; expressiontype = EXPRLITERAL; value = initvalue; } Identifier::Identifier(string initidentifier){ identifier = initidentifier; expressiontype = EXPRIDENTIFIER; } BinOp::BinOp(Operation* initoperation,Expression* initexpr1,Expression* initexpr2){ type = UNCOMPLETE; expressiontype = EXPRBINARYOP; operation = initoperation; expr1 = initexpr1; expr2 = initexpr2; } void TrickleSymbolTableDown(Expression* expression){ if(expression){ switch(expression->expressiontype){ case EXPRBINARYOP:{ (expression->expr1)->symboltable = expression->symboltable; (expression->expr2)->symboltable = expression->symboltable; TrickleSymbolTableDown(expression->expr1); TrickleSymbolTableDown(expression->expr2); break; } } } } void TrickleSymbolTableDown(Statement* statement){ // Trickles symbol table down if(statement){ switch(statement->statementtype){ case STATCOMPOUND:{ Statement* compoundstatement = statement; (compoundstatement->currentstatement)->symboltable = compoundstatement->symboltable; if(compoundstatement->nextstatements){ (compoundstatement->nextstatements)->symboltable = compoundstatement->symboltable; } TrickleSymbolTableDown(compoundstatement->currentstatement); if(compoundstatement->nextstatements){ TrickleSymbolTableDown(compoundstatement->nextstatements); } break; } case STATASSIGN:{ Statement* assignstatement = statement; Expression* expr = assignstatement->expression; for(auto x: (assignstatement->symboltable).maintable){ } (assignstatement->expression)->symboltable = assignstatement->symboltable; TrickleSymbolTableDown(assignstatement->expression); break; } case STATWHILE:{ Statement* whilestatement = statement; (whilestatement->condition)->symboltable = whilestatement->symboltable; (whilestatement->statements)->symboltable = whilestatement->symboltable; TrickleSymbolTableDown(whilestatement->condition); TrickleSymbolTableDown(whilestatement->statements); break; } case STATPRINT:{ Statement* printstatement = statement; (printstatement->expression)->symboltable = printstatement->symboltable; TrickleSymbolTableDown(printstatement->expression); break; } case STATIF:{ Statement* ifstatement = statement; (ifstatement->condition)->symboltable = ifstatement->symboltable; (ifstatement->statements)->symboltable = ifstatement->symboltable; TrickleSymbolTableDown(ifstatement->condition); TrickleSymbolTableDown(ifstatement->statements); break; } case STATIFELSE:{ Statement* ifelsestatement = statement; (ifelsestatement->condition)->symboltable = ifelsestatement->symboltable; (ifelsestatement->valid)->symboltable = ifelsestatement->symboltable; (ifelsestatement->invalid)->symboltable = ifelsestatement->symboltable; TrickleSymbolTableDown(ifelsestatement->condition); TrickleSymbolTableDown(ifelsestatement->valid); TrickleSymbolTableDown(ifelsestatement->invalid); break; } case STATFOR:{ Statement* forstatement = statement; (forstatement->initializer)->symboltable = forstatement->symboltable; (forstatement->condition)->symboltable = forstatement->symboltable; (forstatement->next)->symboltable = forstatement->symboltable; (forstatement->statements)->symboltable = forstatement->symboltable; TrickleSymbolTableDown(forstatement->initializer); TrickleSymbolTableDown(forstatement->condition); TrickleSymbolTableDown(forstatement->next); TrickleSymbolTableDown(forstatement->statements); break; } } } } void TrickleStartSymbolTable(Statement* statement){ if(statement){ switch(statement->statementtype){ case STATCOMPOUND:{ Statement* compoundstatement =statement; if((compoundstatement->currentstatement)->statementtype == STATASSIGN){ if(compoundstatement->nextstatements){ (compoundstatement->nextstatements)->symboltable = (compoundstatement->symboltable); TrickleSymbolTableDown(compoundstatement->nextstatements); } }else{ (compoundstatement->currentstatement)->symboltable = compoundstatement->symboltable; if(compoundstatement->nextstatements){ (compoundstatement->nextstatements)->symboltable = compoundstatement->symboltable; } TrickleSymbolTableDown(compoundstatement->currentstatement); if(compoundstatement->nextstatements){ TrickleSymbolTableDown(compoundstatement->nextstatements); } } break; } case STATASSIGN:{ Statement* assignstatement = statement; (assignstatement->expression)->symboltable = assignstatement->symboltable; TrickleSymbolTableDown(assignstatement->expression); break; } case STATWHILE:{ Statement* whilestatement =statement; (whilestatement->condition)->symboltable = whilestatement->symboltable; if(whilestatement->statements){ (whilestatement->statements)->symboltable = whilestatement->symboltable; } TrickleSymbolTableDown(whilestatement->condition); if(whilestatement->statements){ CompleteSymbolTables(whilestatement->statements); } break; } case STATPRINT:{ Statement* printstatement = statement; (printstatement->expression)->symboltable = printstatement->symboltable; TrickleSymbolTableDown(printstatement->expression); break; } case STATIF:{ Statement* ifstatement = statement; (ifstatement->condition)->symboltable = ifstatement->symboltable; (ifstatement->statements)->symboltable = ifstatement->symboltable; TrickleSymbolTableDown(ifstatement->condition); CompleteSymbolTables(ifstatement->statements); break; } case STATIFELSE:{ Statement* ifelsestatement =statement; (ifelsestatement->condition)->symboltable = ifelsestatement->symboltable; (ifelsestatement->valid)->symboltable = ifelsestatement->symboltable; (ifelsestatement->invalid)->symboltable = ifelsestatement->symboltable; TrickleSymbolTableDown(ifelsestatement->condition); CompleteSymbolTables(ifelsestatement->valid); CompleteSymbolTables(ifelsestatement->invalid); break; } case STATFOR:{ Statement* forstatement = statement; (forstatement->condition)->symboltable = forstatement->symboltable; (forstatement->next)->symboltable = forstatement->symboltable; (forstatement->statements)->symboltable = forstatement->symboltable; TrickleSymbolTableDown(forstatement->condition); TrickleSymbolTableDown(forstatement->next); CompleteSymbolTables(forstatement->statements); break; } } } } void CompleteSymbolTables(Statement* statement){ if(statement){ Statement* compoundstatement = statement; switch(statement->statementtype){ case STATCOMPOUND:{ if((compoundstatement->currentstatement)->statementtype == STATASSIGN){ Statement* currentstatement = (compoundstatement->currentstatement); compoundstatement->symboltable.appendsymbol(currentstatement->identifier); TrickleStartSymbolTable(compoundstatement); if(compoundstatement->nextstatements){ CompleteSymbolTables(compoundstatement->nextstatements); } }else{ CompleteSymbolTables(compoundstatement->currentstatement); if(compoundstatement->nextstatements){ CompleteSymbolTables(compoundstatement->nextstatements); } } break; } case STATFOR:{ Statement* forstatement = statement; Statement* currentstatement = (compoundstatement->currentstatement); forstatement->symboltable.appendsymbol(currentstatement->identifier); TrickleStartSymbolTable(forstatement); if(forstatement->statements){ CompleteSymbolTables(forstatement->statements); } break; } default:{ TrickleStartSymbolTable(statement); break; } } } }
[ "afg9000@gmail.com" ]
afg9000@gmail.com
cac6dd88f6b881a02e542a075a874d678293135c
650f32ec6c8a83646a043133fd95f0f3d6269aa3
/book/CH08/S12_Creating_a_pipeline_layout.cpp
0b94fd4cd1b1a1110bea4d4bdb762219c3562443
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
THISISAGOODNAME/vkCookBook
0478b3eb80dec179f38dc2812416f3c3f4cb22f8
d022b4151a02c33e5c58534dc53ca39610eee7b5
refs/heads/master
2021-01-25T11:49:37.695292
2017-07-23T14:28:52
2017-07-23T14:28:52
93,948,327
9
2
null
null
null
null
UTF-8
C++
false
false
1,805
cpp
// // Created by aicdg on 2017/6/22. // // // Chapter: 08 Graphics and Compute Pipelines // Recipe: 12 Creating a pipeline layout #include "S12_Creating_a_pipeline_layout.h" namespace VKCookbook { bool CreatePipelineLayout( VkDevice logical_device, std::vector<VkDescriptorSetLayout> const & descriptor_set_layouts, std::vector<VkPushConstantRange> const & push_constant_ranges, VkPipelineLayout & pipeline_layout ){ VkPipelineLayoutCreateInfo pipeline_layout_create_info = { VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType nullptr, // const void * pNext 0, // VkPipelineLayoutCreateFlags flags static_cast<uint32_t>(descriptor_set_layouts.size()), // uint32_t setLayoutCount descriptor_set_layouts.data(), // const VkDescriptorSetLayout * pSetLayouts static_cast<uint32_t>(push_constant_ranges.size()), // uint32_t pushConstantRangeCount push_constant_ranges.data() // const VkPushConstantRange * pPushConstantRanges }; VkResult result = vkCreatePipelineLayout( logical_device, &pipeline_layout_create_info, nullptr, &pipeline_layout ); if( VK_SUCCESS != result ) { std::cout << "Could not create pipeline layout." << std::endl; return false; } return true; } }
[ "yangyj19931231@gmail.com" ]
yangyj19931231@gmail.com
01f3213402afcf86032331bb99ed80140e7c8429
80dbff2ef81196130a254738e27568385f1eaa88
/MFCApplicationSPC2/CalculatorDlg.h
7ea2439dabfe7c3a1f9512e6a3acd00cf98a459e
[]
no_license
RoyKo222/Calculator001
8934db705de909519f2c82f8caef120e6ae5adf0
7575263291ab38657af671e0512e0427d2e23b3c
refs/heads/master
2020-04-01T07:26:02.207079
2018-10-14T15:53:22
2018-10-14T15:53:22
152,989,824
0
0
null
null
null
null
UTF-8
C++
false
false
2,141
h
#pragma once #include "afxwin.h" #include <memory> #include "CalculatorDlg.h" class CCalculatorDlg : public CDialogEx { public: CCalculatorDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data #ifdef AFX_DESIGN_TIME enum { IDD = IDD_CALCULATOR_DIALOG }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedButton1(); afx_msg void OnBnClickedButton2(); afx_msg void OnBnClickedButton3(); afx_msg void OnBnClickedButton0(); afx_msg void OnBnClickedButton4(); afx_msg void OnBnClickedButton5(); afx_msg void OnBnClickedButton6(); afx_msg void OnBnClickedButton7(); afx_msg void OnBnClickedButton8(); afx_msg void OnBnClickedButton9(); afx_msg void OnBnClickedButtonPlus(); afx_msg void OnBnClickedButtonEquals(); afx_msg void OnBnClickedButtonC(); afx_msg void OnBnClickedButtonDivide(); afx_msg void OnBnClickedButtonMultiply(); afx_msg void OnBnClickedButtonMinus(); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); private: bool m_errorInput = false; const CString m_outputResetString{"0"}; void resetOutput(); void reset(); void addDigit(char digit); void doOperation(Calculator::ActionType operation, bool handleNumber=true); void createHistoryText(); void addDigit(char digit); Calculator m_calculator; CString m_output; CFont m_font; CFont m_historyFont; BOOL m_firstDigitEntered = FALSE; CEdit m_editResult; CButton m_button0; CButton m_button1; CButton m_button2; CButton m_button3; CButton m_button4; CButton m_button5; CButton m_button6; CButton m_button7; CButton m_button8; CButton m_button9; CButton m_buttonPlus; CButton m_buttonEquals; CButton m_buttonC; CButton m_buttonMinus; CButton m_buttonMultiply; CButton m_buttonDivide; CEdit m_editHistory; CString m_historyText; std::unique_ptr<CBrush> m_historyBkBrush; COLORREF m_historyBkColor; };
[ "Roy@DESKTOP-B880FOR" ]
Roy@DESKTOP-B880FOR
90d091d130cff14bd091453c7ab5ecad397a9d13
ac1c4bdfdc7445b1bf88cf4811162febf48f127e
/Chapter4/strtype3.cpp
74d33a1b59d744175fb5f96958bdce06bd747a69
[]
no_license
Linuslan/C-Primer-Plus
8da4f4625f906225be3b4c6f4de7f0579472b826
1edeafb2e5d2c6ff5e6982973210a4115ef393d2
refs/heads/master
2021-09-06T18:12:28.914879
2018-02-09T14:12:15
2018-02-09T14:12:15
103,092,128
0
0
null
null
null
null
UTF-8
C++
false
false
558
cpp
#include <iostream> #include <string> #include <cstring> int main() { using namespace std; char charr1[20]; char charr2[20] = "jaguar"; string str1; string str2 = {"panther"}; str1 = str2; strcpy(charr1, charr2); str1 += " paste"; strcat(charr1, " juice"); int len1 = str1.size(); int len2 = strlen(charr1); cout << "The string " << str1 << " contains " << len1 << " characters." << endl; cout << "The string " << charr1 << " contains " << len2 << " characters." << endl; return 0; }
[ "linuslan@sina.cn" ]
linuslan@sina.cn
2b03b16b76044b48e71da74a4ef7889eeb6581bf
c093f943bfab59db2f4f64c3893db06ee1738c77
/Guitar/Guitar.cpp
45775f3789a2fbb90e7e862a1c7a4ccc2b80c9a3
[]
no_license
TheodorSergeev/WaveSolver
c7ce68677b710d8187e66a44523f02f7ff8d8a39
d2564c28fe9fbf35697479afba607ab85d8257cc
refs/heads/master
2020-05-19T14:45:36.806107
2019-05-13T16:04:06
2019-05-13T16:04:06
185,067,649
2
0
null
null
null
null
UTF-8
C++
false
false
1,147
cpp
#include "Guitar.h" double Guitar::InitCoord(double x) { //return 0.0; CheckX(x); return (x < X0) ? a * x / X0 : a / (length - X0) * (length - x); } double Guitar::WaveSpeed(double x) { CheckX(x); //if(x > length * 0.1 && x < length * 0.4) // return wavespeed * 2.0; return wavespeed; } Guitar::Guitar() { length = 0.75; freq = 440; wavelength = 2 * length; wavespeed = freq * wavelength; omega = 2 * M_PI * freq; periods = 4.0; time_lim = 2 * M_PI / omega * periods; t_step = length / 100.0 / wavespeed; courant_num = 0.85; x_step = wavespeed * t_step / courant_num; // !!! a = 0.005; X0 = 0.8 * length; mesh_size = (int)(round(length / x_step)); curr_sol_arr.assign(mesh_size, 0.0); next_sol_arr = curr_sol_arr; prev_sol_arr = curr_sol_arr; t_st_sq = t_step * t_step; coef_sq = t_st_sq / (x_step * x_step); left_bound_cond = DIRICHLET; right_bound_cond = DIRICHLET; Check(); //Dump(); } double Guitar::DirL(double t) { return 0.0; } double Guitar::DirR(double t) { return 0.0; }
[ "sergeev.fi@phystech.edu" ]
sergeev.fi@phystech.edu
c16c3e86228fff9051dc2bb967ac56e170b9e94f
8d86eda47e545fd8e928cd7b49c2a8bc49c6e70e
/LeetCode0029.cpp
3ddf2de8a80013319a7e5813aa62417a32f2702a
[ "Unlicense" ]
permissive
chibai/LeetCodeInCPP
912628698cb6426480b958a4bef34077b1b68e7e
36e82087e5608181471b2fec99a771ab03c78b3e
refs/heads/master
2022-08-27T19:41:03.581004
2021-12-12T17:05:31
2021-12-12T17:05:31
75,583,686
1
0
null
2019-11-30T10:45:35
2016-12-05T03:06:46
C++
UTF-8
C++
false
false
1,737
cpp
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> #include <vector> #include <map> #include <queue> #include <set> #include <stack> using namespace std; //Definition for singly linked list struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : val(x), next(nullptr) {} ListNode(int x, ListNode *next) : val(x), next(next) {} }; class Solution { public: int myDivide(int dividend, int divisor) { if (dividend == 0) return 0; else if (divisor == 1) return dividend; else if (divisor == -1) return dividend == INT32_MIN ? INT32_MAX : -dividend; else if (divisor == INT32_MIN) return dividend == divisor ? 1 : 0; //////////////////// bool isDividendPositive = dividend > 0; bool isDivisorPositive = divisor > 0; int extraOne = 0; if (!isDividendPositive) { if (dividend == INT32_MIN) { dividend = INT32_MAX; extraOne = 1; } else { dividend = -dividend; } } divisor = isDivisorPositive ? divisor : -divisor; int result = 0; while (dividend >= divisor - extraOne) { int tmp_divisor = divisor; int tmp_result = 1; while (tmp_divisor < (INT32_MAX>>2) && dividend >= ((tmp_divisor<<2) - extraOne)) { tmp_result = tmp_result << 2; tmp_divisor = tmp_divisor << 2; } if (extraOne == 1) { dividend = dividend - tmp_divisor + extraOne; extraOne = 0; } else dividend -= tmp_divisor; result += tmp_result; } return isDividendPositive ^ isDivisorPositive?-result : result; } int divide(int dividend, int divisor) { } }; int main() { Solution solution = Solution(); auto result = solution.divide(INT32_MIN, 2); std::cout << result; return 0; }
[ "470598003@qq.com" ]
470598003@qq.com
492b3e40f9bccaf0aa4c7f7dbe05ebcb3b909102
731baff7404d53beb53e34eb4897cae2d5a190b3
/src/wallet.cpp
1704e5a73154adccdb375972bf6b5d1e610f3fd4
[ "MIT" ]
permissive
bitvier/bitvier
65c762fd74ae8a1b9fe799d6cabf855bc33dcdf3
253c13ca839e2e738fc31d74a50b34a2e0179fda
refs/heads/master
2021-09-08T19:14:44.684034
2018-03-11T21:28:55
2018-03-11T21:28:55
124,801,209
0
0
null
null
null
null
UTF-8
C++
false
false
89,153
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "txdb.h" #include "wallet.h" #include "walletdb.h" #include "crypter.h" #include "ui_interface.h" #include "base58.h" #include "kernel.h" #include "coincontrol.h" #include <boost/algorithm/string/replace.hpp> using namespace std; unsigned int nStakeSplitAge = 1 * 24 * 60 * 60; int64_t nStakeCombineThreshold = 1000 * COIN; ////////////////////////////////////////////////////////////////////////////// // // mapWallet // struct CompareValueOnly { bool operator()(const pair<int64_t, pair<const CWalletTx*, unsigned int> >& t1, const pair<int64_t, pair<const CWalletTx*, unsigned int> >& t2) const { return t1.first < t2.first; } }; CPubKey CWallet::GenerateNewKey() { bool fCompressed = CanSupportFeature(FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets RandAddSeedPerfmon(); CKey key; key.MakeNewKey(fCompressed); // Compressed public keys were introduced in version 0.6.0 if (fCompressed) SetMinVersion(FEATURE_COMPRPUBKEY); CPubKey pubkey = key.GetPubKey(); // Create new metadata int64_t nCreationTime = GetTime(); mapKeyMetadata[pubkey.GetID()] = CKeyMetadata(nCreationTime); if (!nTimeFirstKey || nCreationTime < nTimeFirstKey) nTimeFirstKey = nCreationTime; if (!AddKey(key)) throw std::runtime_error("CWallet::GenerateNewKey() : AddKey failed"); return key.GetPubKey(); } bool CWallet::AddKey(const CKey& key) { CPubKey pubkey = key.GetPubKey(); if (!CCryptoKeyStore::AddKey(key)) return false; if (!fFileBacked) return true; if (!IsCrypted()) return CWalletDB(strWalletFile).WriteKey(pubkey, key.GetPrivKey(), mapKeyMetadata[pubkey.GetID()]); return true; } bool CWallet::AddCryptedKey(const CPubKey &vchPubKey, const vector<unsigned char> &vchCryptedSecret) { if (!CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret)) return false; if (!fFileBacked) return true; { LOCK(cs_wallet); if (pwalletdbEncryption) return pwalletdbEncryption->WriteCryptedKey(vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); else return CWalletDB(strWalletFile).WriteCryptedKey(vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); } return false; } bool CWallet::LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &meta) { if (meta.nCreateTime && (!nTimeFirstKey || meta.nCreateTime < nTimeFirstKey)) nTimeFirstKey = meta.nCreateTime; mapKeyMetadata[pubkey.GetID()] = meta; return true; } bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); } bool CWallet::AddCScript(const CScript& redeemScript) { if (!CCryptoKeyStore::AddCScript(redeemScript)) return false; if (!fFileBacked) return true; return CWalletDB(strWalletFile).WriteCScript(Hash160(redeemScript), redeemScript); } // optional setting to unlock wallet for staking only // serves to disable the trivial sendmoney when OS account compromised // provides no real security bool fWalletUnlockStakingOnly = false; bool CWallet::Unlock(const SecureString& strWalletPassphrase) { if (!IsLocked()) return false; CCrypter crypter; CKeyingMaterial vMasterKey; { LOCK(cs_wallet); BOOST_FOREACH(const MasterKeyMap::value_type& pMasterKey, mapMasterKeys) { if(!crypter.SetKeyFromPassphrase(strWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) return false; if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, vMasterKey)) return false; if (CCryptoKeyStore::Unlock(vMasterKey)) return true; } } return false; } bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase) { bool fWasLocked = IsLocked(); { LOCK(cs_wallet); Lock(); CCrypter crypter; CKeyingMaterial vMasterKey; BOOST_FOREACH(MasterKeyMap::value_type& pMasterKey, mapMasterKeys) { if(!crypter.SetKeyFromPassphrase(strOldWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) return false; if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, vMasterKey)) return false; if (CCryptoKeyStore::Unlock(vMasterKey)) { int64_t nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod); pMasterKey.second.nDeriveIterations = pMasterKey.second.nDeriveIterations * (100 / ((double)(GetTimeMillis() - nStartTime))); nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod); pMasterKey.second.nDeriveIterations = (pMasterKey.second.nDeriveIterations + pMasterKey.second.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime))) / 2; if (pMasterKey.second.nDeriveIterations < 25000) pMasterKey.second.nDeriveIterations = 25000; printf("Wallet passphrase changed to an nDeriveIterations of %i\n", pMasterKey.second.nDeriveIterations); if (!crypter.SetKeyFromPassphrase(strNewWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) return false; if (!crypter.Encrypt(vMasterKey, pMasterKey.second.vchCryptedKey)) return false; CWalletDB(strWalletFile).WriteMasterKey(pMasterKey.first, pMasterKey.second); if (fWasLocked) Lock(); return true; } } } return false; } void CWallet::SetBestChain(const CBlockLocator& loc) { CWalletDB walletdb(strWalletFile); walletdb.WriteBestBlock(loc); } // This class implements an addrIncoming entry that causes pre-0.4 // clients to crash on startup if reading a private-key-encrypted wallet. class CCorruptAddress { public: IMPLEMENT_SERIALIZE ( if (nType & SER_DISK) READWRITE(nVersion); ) }; bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn, bool fExplicit) { if (nWalletVersion >= nVersion) return true; // when doing an explicit upgrade, if we pass the max version permitted, upgrade all the way if (fExplicit && nVersion > nWalletMaxVersion) nVersion = FEATURE_LATEST; nWalletVersion = nVersion; if (nVersion > nWalletMaxVersion) nWalletMaxVersion = nVersion; if (fFileBacked) { CWalletDB* pwalletdb = pwalletdbIn ? pwalletdbIn : new CWalletDB(strWalletFile); if (nWalletVersion >= 40000) { // Versions prior to 0.4.0 did not support the "minversion" record. // Use a CCorruptAddress to make them crash instead. CCorruptAddress corruptAddress; pwalletdb->WriteSetting("addrIncoming", corruptAddress); } if (nWalletVersion > 40000) pwalletdb->WriteMinVersion(nWalletVersion); if (!pwalletdbIn) delete pwalletdb; } return true; } bool CWallet::SetMaxVersion(int nVersion) { // cannot downgrade below current version if (nWalletVersion > nVersion) return false; nWalletMaxVersion = nVersion; return true; } bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) { if (IsCrypted()) return false; CKeyingMaterial vMasterKey; RandAddSeedPerfmon(); vMasterKey.resize(WALLET_CRYPTO_KEY_SIZE); RAND_bytes(&vMasterKey[0], WALLET_CRYPTO_KEY_SIZE); CMasterKey kMasterKey(nDerivationMethodIndex); RandAddSeedPerfmon(); kMasterKey.vchSalt.resize(WALLET_CRYPTO_SALT_SIZE); RAND_bytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE); CCrypter crypter; int64_t nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, 25000, kMasterKey.nDerivationMethod); kMasterKey.nDeriveIterations = 2500000 / ((double)(GetTimeMillis() - nStartTime)); nStartTime = GetTimeMillis(); crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, kMasterKey.nDeriveIterations, kMasterKey.nDerivationMethod); kMasterKey.nDeriveIterations = (kMasterKey.nDeriveIterations + kMasterKey.nDeriveIterations * 100 / ((double)(GetTimeMillis() - nStartTime))) / 2; if (kMasterKey.nDeriveIterations < 25000) kMasterKey.nDeriveIterations = 25000; printf("Encrypting Wallet with an nDeriveIterations of %i\n", kMasterKey.nDeriveIterations); if (!crypter.SetKeyFromPassphrase(strWalletPassphrase, kMasterKey.vchSalt, kMasterKey.nDeriveIterations, kMasterKey.nDerivationMethod)) return false; if (!crypter.Encrypt(vMasterKey, kMasterKey.vchCryptedKey)) return false; { LOCK(cs_wallet); mapMasterKeys[++nMasterKeyMaxID] = kMasterKey; if (fFileBacked) { pwalletdbEncryption = new CWalletDB(strWalletFile); if (!pwalletdbEncryption->TxnBegin()) return false; pwalletdbEncryption->WriteMasterKey(nMasterKeyMaxID, kMasterKey); } if (!EncryptKeys(vMasterKey)) { if (fFileBacked) pwalletdbEncryption->TxnAbort(); exit(1); //We now probably have half of our keys encrypted in memory, and half not...die and let the user reload their unencrypted wallet. } // Encryption was introduced in version 0.4.0 SetMinVersion(FEATURE_WALLETCRYPT, pwalletdbEncryption, true); if (fFileBacked) { if (!pwalletdbEncryption->TxnCommit()) exit(1); //We now have keys encrypted in memory, but no on disk...die to avoid confusion and let the user reload their unencrypted wallet. delete pwalletdbEncryption; pwalletdbEncryption = NULL; } Lock(); Unlock(strWalletPassphrase); NewKeyPool(); Lock(); // Need to completely rewrite the wallet file; if we don't, bdb might keep // bits of the unencrypted private key in slack space in the database file. CDB::Rewrite(strWalletFile); } NotifyStatusChanged(this); return true; } int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb) { int64_t nRet = nOrderPosNext++; if (pwalletdb) { pwalletdb->WriteOrderPosNext(nOrderPosNext); } else { CWalletDB(strWalletFile).WriteOrderPosNext(nOrderPosNext); } return nRet; } CWallet::TxItems CWallet::OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount) { CWalletDB walletdb(strWalletFile); // First: get all CWalletTx and CAccountingEntry into a sorted-by-order multimap. TxItems txOrdered; // Note: maintaining indices in the database of (account,time) --> txid and (account, time) --> acentry // would make this much faster for applications that do this a lot. for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { CWalletTx* wtx = &((*it).second); txOrdered.insert(make_pair(wtx->nOrderPos, TxPair(wtx, (CAccountingEntry*)0))); } acentries.clear(); walletdb.ListAccountCreditDebit(strAccount, acentries); BOOST_FOREACH(CAccountingEntry& entry, acentries) { txOrdered.insert(make_pair(entry.nOrderPos, TxPair((CWalletTx*)0, &entry))); } return txOrdered; } void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock) { // Anytime a signature is successfully verified, it's proof the outpoint is spent. // Update the wallet spent flag if it doesn't know due to wallet.dat being // restored from backup or the user making copies of wallet.dat. { LOCK(cs_wallet); BOOST_FOREACH(const CTxIn& txin, tx.vin) { map<uint256, CWalletTx>::iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { CWalletTx& wtx = (*mi).second; if (txin.prevout.n >= wtx.vout.size()) printf("WalletUpdateSpent: bad wtx %s\n", wtx.GetHash().ToString().c_str()); else if (!wtx.IsSpent(txin.prevout.n) && IsMine(wtx.vout[txin.prevout.n])) { printf("WalletUpdateSpent found spent coin %s BC %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str()); wtx.MarkSpent(txin.prevout.n); wtx.WriteToDisk(); NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED); } } } if (fBlock) { uint256 hash = tx.GetHash(); map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash); CWalletTx& wtx = (*mi).second; BOOST_FOREACH(const CTxOut& txout, tx.vout) { if (IsMine(txout)) { wtx.MarkUnspent(&txout - &tx.vout[0]); wtx.WriteToDisk(); NotifyTransactionChanged(this, hash, CT_UPDATED); } } } } } void CWallet::MarkDirty() { { LOCK(cs_wallet); BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet) item.second.MarkDirty(); } } bool CWallet::AddToWallet(const CWalletTx& wtxIn) { uint256 hash = wtxIn.GetHash(); { LOCK(cs_wallet); // Inserts only if not already there, returns tx inserted or tx found pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn)); CWalletTx& wtx = (*ret.first).second; wtx.BindWallet(this); bool fInsertedNew = ret.second; if (fInsertedNew) { wtx.nTimeReceived = GetAdjustedTime(); wtx.nOrderPos = IncOrderPosNext(); wtx.nTimeSmart = wtx.nTimeReceived; if (wtxIn.hashBlock != 0) { if (mapBlockIndex.count(wtxIn.hashBlock)) { unsigned int latestNow = wtx.nTimeReceived; unsigned int latestEntry = 0; { // Tolerate times up to the last timestamp in the wallet not more than 5 minutes into the future int64_t latestTolerated = latestNow + 300; std::list<CAccountingEntry> acentries; TxItems txOrdered = OrderedTxItems(acentries); for (TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) { CWalletTx *const pwtx = (*it).second.first; if (pwtx == &wtx) continue; CAccountingEntry *const pacentry = (*it).second.second; int64_t nSmartTime; if (pwtx) { nSmartTime = pwtx->nTimeSmart; if (!nSmartTime) nSmartTime = pwtx->nTimeReceived; } else nSmartTime = pacentry->nTime; if (nSmartTime <= latestTolerated) { latestEntry = nSmartTime; if (nSmartTime > latestNow) latestNow = nSmartTime; break; } } } unsigned int& blocktime = mapBlockIndex[wtxIn.hashBlock]->nTime; wtx.nTimeSmart = std::max(latestEntry, std::min(blocktime, latestNow)); } else printf("AddToWallet() : found %s in block %s not in index\n", wtxIn.GetHash().ToString().substr(0,10).c_str(), wtxIn.hashBlock.ToString().c_str()); } } bool fUpdated = false; if (!fInsertedNew) { // Merge if (wtxIn.hashBlock != 0 && wtxIn.hashBlock != wtx.hashBlock) { wtx.hashBlock = wtxIn.hashBlock; fUpdated = true; } if (wtxIn.nIndex != -1 && (wtxIn.vMerkleBranch != wtx.vMerkleBranch || wtxIn.nIndex != wtx.nIndex)) { wtx.vMerkleBranch = wtxIn.vMerkleBranch; wtx.nIndex = wtxIn.nIndex; fUpdated = true; } if (wtxIn.fFromMe && wtxIn.fFromMe != wtx.fFromMe) { wtx.fFromMe = wtxIn.fFromMe; fUpdated = true; } fUpdated |= wtx.UpdateSpent(wtxIn.vfSpent); } //// debug print printf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString().substr(0,10).c_str(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : "")); // Write to disk if (fInsertedNew || fUpdated) if (!wtx.WriteToDisk()) return false; #ifndef QT_GUI // If default receiving address gets used, replace it with a new one if (vchDefaultKey.IsValid()) { CScript scriptDefaultKey; scriptDefaultKey.SetDestination(vchDefaultKey.GetID()); BOOST_FOREACH(const CTxOut& txout, wtx.vout) { if (txout.scriptPubKey == scriptDefaultKey) { CPubKey newDefaultKey; if (GetKeyFromPool(newDefaultKey, false)) { SetDefaultKey(newDefaultKey); SetAddressBookName(vchDefaultKey.GetID(), ""); } } } } #endif // since AddToWallet is called directly for self-originating transactions, check for consumption of own coins WalletUpdateSpent(wtx, (wtxIn.hashBlock != 0)); // Notify UI of new or updated transaction NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED); // notify an external script when a wallet transaction comes in or is updated std::string strCmd = GetArg("-walletnotify", ""); if ( !strCmd.empty()) { boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex()); boost::thread t(runCommand, strCmd); // thread runs free } } return true; } // Add a transaction to the wallet, or update it. // pblock is optional, but should be provided if the transaction is known to be in a block. // If fUpdate is true, existing transactions will be updated. bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate, bool fFindBlock) { uint256 hash = tx.GetHash(); { LOCK(cs_wallet); bool fExisted = mapWallet.count(hash); if (fExisted && !fUpdate) return false; if (fExisted || IsMine(tx) || IsFromMe(tx)) { CWalletTx wtx(this,tx); // Get merkle branch if transaction was found in a block if (pblock) wtx.SetMerkleBranch(pblock); return AddToWallet(wtx); } else WalletUpdateSpent(tx); } return false; } bool CWallet::EraseFromWallet(uint256 hash) { if (!fFileBacked) return false; { LOCK(cs_wallet); if (mapWallet.erase(hash)) CWalletDB(strWalletFile).EraseTx(hash); } return true; } bool CWallet::IsMine(const CTxIn &txin) const { { LOCK(cs_wallet); map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { const CWalletTx& prev = (*mi).second; if (txin.prevout.n < prev.vout.size()) if (IsMine(prev.vout[txin.prevout.n])) return true; } } return false; } int64_t CWallet::GetDebit(const CTxIn &txin) const { { LOCK(cs_wallet); map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { const CWalletTx& prev = (*mi).second; if (txin.prevout.n < prev.vout.size()) if (IsMine(prev.vout[txin.prevout.n])) return prev.vout[txin.prevout.n].nValue; } } return 0; } bool CWallet::IsChange(const CTxOut& txout) const { CTxDestination address; // TODO: fix handling of 'change' outputs. The assumption is that any // payment to a TX_PUBKEYHASH that is mine but isn't in the address book // is change. That assumption is likely to break when we implement multisignature // wallets that return change back into a multi-signature-protected address; // a better way of identifying which outputs are 'the send' and which are // 'the change' will need to be implemented (maybe extend CWalletTx to remember // which output, if any, was change). if (ExtractDestination(txout.scriptPubKey, address) && ::IsMine(*this, address)) { LOCK(cs_wallet); if (!mapAddressBook.count(address)) return true; } return false; } int64_t CWalletTx::GetTxTime() const { int64_t n = nTimeSmart; return n ? n : nTimeReceived; } int CWalletTx::GetRequestCount() const { // Returns -1 if it wasn't being tracked int nRequests = -1; { LOCK(pwallet->cs_wallet); if (IsCoinBase() || IsCoinStake()) { // Generated block if (hashBlock != 0) { map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); if (mi != pwallet->mapRequestCount.end()) nRequests = (*mi).second; } } else { // Did anyone request this transaction? map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(GetHash()); if (mi != pwallet->mapRequestCount.end()) { nRequests = (*mi).second; // How about the block it's in? if (nRequests == 0 && hashBlock != 0) { map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); if (mi != pwallet->mapRequestCount.end()) nRequests = (*mi).second; else nRequests = 1; // If it's in someone else's block it must have got out } } } } return nRequests; } void CWalletTx::GetAmounts(list<pair<CTxDestination, int64_t> >& listReceived, list<pair<CTxDestination, int64_t> >& listSent, int64_t& nFee, string& strSentAccount) const { nFee = 0; listReceived.clear(); listSent.clear(); strSentAccount = strFromAccount; // Compute fee: int64_t nDebit = GetDebit(); if (nDebit > 0) // debit>0 means we signed/sent this transaction { int64_t nValueOut = GetValueOut(); nFee = nDebit - nValueOut; } // Sent/received. BOOST_FOREACH(const CTxOut& txout, vout) { // Skip special stake out if (txout.scriptPubKey.empty()) continue; bool fIsMine; // Only need to handle txouts if AT LEAST one of these is true: // 1) they debit from us (sent) // 2) the output is to us (received) if (nDebit > 0) { // Don't report 'change' txouts if (pwallet->IsChange(txout)) continue; fIsMine = pwallet->IsMine(txout); } else if (!(fIsMine = pwallet->IsMine(txout))) continue; // In either case, we need to get the destination address CTxDestination address; if (!ExtractDestination(txout.scriptPubKey, address)) { printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n", this->GetHash().ToString().c_str()); address = CNoDestination(); } // If we are debited by the transaction, add the output as a "sent" entry if (nDebit > 0) listSent.push_back(make_pair(address, txout.nValue)); // If we are receiving the output, add it as a "received" entry if (fIsMine) listReceived.push_back(make_pair(address, txout.nValue)); } } void CWalletTx::GetAccountAmounts(const string& strAccount, int64_t& nReceived, int64_t& nSent, int64_t& nFee) const { nReceived = nSent = nFee = 0; int64_t allFee; string strSentAccount; list<pair<CTxDestination, int64_t> > listReceived; list<pair<CTxDestination, int64_t> > listSent; GetAmounts(listReceived, listSent, allFee, strSentAccount); if (strAccount == strSentAccount) { BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64_t)& s, listSent) nSent += s.second; nFee = allFee; } { LOCK(pwallet->cs_wallet); BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64_t)& r, listReceived) { if (pwallet->mapAddressBook.count(r.first)) { map<CTxDestination, string>::const_iterator mi = pwallet->mapAddressBook.find(r.first); if (mi != pwallet->mapAddressBook.end() && (*mi).second == strAccount) nReceived += r.second; } else if (strAccount.empty()) { nReceived += r.second; } } } } void CWalletTx::AddSupportingTransactions(CTxDB& txdb) { vtxPrev.clear(); const int COPY_DEPTH = 3; if (SetMerkleBranch() < COPY_DEPTH) { vector<uint256> vWorkQueue; BOOST_FOREACH(const CTxIn& txin, vin) vWorkQueue.push_back(txin.prevout.hash); // This critsect is OK because txdb is already open { LOCK(pwallet->cs_wallet); map<uint256, const CMerkleTx*> mapWalletPrev; set<uint256> setAlreadyDone; for (unsigned int i = 0; i < vWorkQueue.size(); i++) { uint256 hash = vWorkQueue[i]; if (setAlreadyDone.count(hash)) continue; setAlreadyDone.insert(hash); CMerkleTx tx; map<uint256, CWalletTx>::const_iterator mi = pwallet->mapWallet.find(hash); if (mi != pwallet->mapWallet.end()) { tx = (*mi).second; BOOST_FOREACH(const CMerkleTx& txWalletPrev, (*mi).second.vtxPrev) mapWalletPrev[txWalletPrev.GetHash()] = &txWalletPrev; } else if (mapWalletPrev.count(hash)) { tx = *mapWalletPrev[hash]; } else if (!fClient && txdb.ReadDiskTx(hash, tx)) { ; } else { printf("ERROR: AddSupportingTransactions() : unsupported transaction\n"); continue; } int nDepth = tx.SetMerkleBranch(); vtxPrev.push_back(tx); if (nDepth < COPY_DEPTH) { BOOST_FOREACH(const CTxIn& txin, tx.vin) vWorkQueue.push_back(txin.prevout.hash); } } } } reverse(vtxPrev.begin(), vtxPrev.end()); } bool CWalletTx::WriteToDisk() { return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this); } // Scan the block chain (starting in pindexStart) for transactions // from or to us. If fUpdate is true, found transactions that already // exist in the wallet will be updated. int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) { int ret = 0; CBlockIndex* pindex = pindexStart; { LOCK(cs_wallet); while (pindex) { // no need to read and scan block, if block was created before // our wallet birthday (as adjusted for block time variability) if (nTimeFirstKey && (pindex->nTime < (nTimeFirstKey - 7200))) { pindex = pindex->pnext; continue; } CBlock block; block.ReadFromDisk(pindex, true); BOOST_FOREACH(CTransaction& tx, block.vtx) { if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) ret++; } pindex = pindex->pnext; } } return ret; } int CWallet::ScanForWalletTransaction(const uint256& hashTx) { CTransaction tx; tx.ReadFromDisk(COutPoint(hashTx, 0)); if (AddToWalletIfInvolvingMe(tx, NULL, true, true)) return 1; return 0; } void CWallet::ReacceptWalletTransactions() { CTxDB txdb("r"); bool fRepeat = true; while (fRepeat) { LOCK(cs_wallet); fRepeat = false; vector<CDiskTxPos> vMissingTx; BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet) { CWalletTx& wtx = item.second; if ((wtx.IsCoinBase() && wtx.IsSpent(0)) || (wtx.IsCoinStake() && wtx.IsSpent(1))) continue; CTxIndex txindex; bool fUpdated = false; if (txdb.ReadTxIndex(wtx.GetHash(), txindex)) { // Update fSpent if a tx got spent somewhere else by a copy of wallet.dat if (txindex.vSpent.size() != wtx.vout.size()) { printf("ERROR: ReacceptWalletTransactions() : txindex.vSpent.size() %" PRIszu " != wtx.vout.size() %" PRIszu "\n", txindex.vSpent.size(), wtx.vout.size()); continue; } for (unsigned int i = 0; i < txindex.vSpent.size(); i++) { if (wtx.IsSpent(i)) continue; if (!txindex.vSpent[i].IsNull() && IsMine(wtx.vout[i])) { wtx.MarkSpent(i); fUpdated = true; vMissingTx.push_back(txindex.vSpent[i]); } } if (fUpdated) { printf("ReacceptWalletTransactions found spent coin %s BC %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str()); wtx.MarkDirty(); wtx.WriteToDisk(); } } else { // Re-accept any txes of ours that aren't already in a block if (!(wtx.IsCoinBase() || wtx.IsCoinStake())) wtx.AcceptWalletTransaction(txdb); } } if (!vMissingTx.empty()) { // TODO: optimize this to scan just part of the block chain? if (ScanForWalletTransactions(pindexGenesisBlock)) fRepeat = true; // Found missing transactions: re-do re-accept. } } } void CWalletTx::RelayWalletTransaction(CTxDB& txdb) { BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) { if (!(tx.IsCoinBase() || tx.IsCoinStake())) { uint256 hash = tx.GetHash(); if (!txdb.ContainsTx(hash)) RelayTransaction((CTransaction)tx, hash); } } if (!(IsCoinBase() || IsCoinStake())) { uint256 hash = GetHash(); if (!txdb.ContainsTx(hash)) { printf("Relaying wtx %s\n", hash.ToString().substr(0,10).c_str()); RelayTransaction((CTransaction)*this, hash); } } } void CWalletTx::RelayWalletTransaction() { CTxDB txdb("r"); RelayWalletTransaction(txdb); } void CWallet::ResendWalletTransactions(bool fForce) { if (!fForce) { // Do this infrequently and randomly to avoid giving away // that these are our transactions. static int64_t nNextTime; if (GetTime() < nNextTime) return; bool fFirst = (nNextTime == 0); nNextTime = GetTime() + GetRand(30 * 60); if (fFirst) return; // Only do it if there's been a new block since last time static int64_t nLastTime; if (nTimeBestReceived < nLastTime) return; nLastTime = GetTime(); } // Rebroadcast any of our txes that aren't in a block yet printf("ResendWalletTransactions()\n"); CTxDB txdb("r"); { LOCK(cs_wallet); // Sort them in chronological order multimap<unsigned int, CWalletTx*> mapSorted; BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet) { CWalletTx& wtx = item.second; // Don't rebroadcast until it's had plenty of time that // it should have gotten in already by now. if (fForce || nTimeBestReceived - (int64_t)wtx.nTimeReceived > 5 * 60) mapSorted.insert(make_pair(wtx.nTimeReceived, &wtx)); } BOOST_FOREACH(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted) { CWalletTx& wtx = *item.second; if (wtx.CheckTransaction()) wtx.RelayWalletTransaction(txdb); else printf("ResendWalletTransactions() : CheckTransaction failed for transaction %s\n", wtx.GetHash().ToString().c_str()); } } } ////////////////////////////////////////////////////////////////////////////// // // Actions // int64_t CWallet::GetBalance() const { int64_t nTotal = 0; { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (pcoin->IsTrusted()) nTotal += pcoin->GetAvailableCredit(); } } return nTotal; } int64_t CWallet::GetUnconfirmedBalance() const { int64_t nTotal = 0; { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (!pcoin->IsFinal() || !pcoin->IsTrusted()) nTotal += pcoin->GetAvailableCredit(); } } return nTotal; } int64_t CWallet::GetImmatureBalance() const { int64_t nTotal = 0; { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx& pcoin = (*it).second; if (pcoin.IsCoinBase() && pcoin.GetBlocksToMaturity() > 0 && pcoin.IsInMainChain()) nTotal += GetCredit(pcoin); } } return nTotal; } // populate vCoins with vector of spendable COutputs void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl) const { vCoins.clear(); { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (!pcoin->IsFinal()) continue; if (fOnlyConfirmed && !pcoin->IsTrusted()) continue; if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0) continue; if(pcoin->IsCoinStake() && pcoin->GetBlocksToMaturity() > 0) continue; int nDepth = pcoin->GetDepthInMainChain(); if (nDepth < 0) continue; for (unsigned int i = 0; i < pcoin->vout.size(); i++) if (!(pcoin->IsSpent(i)) && IsMine(pcoin->vout[i]) && pcoin->vout[i].nValue >= nMinimumInputValue && (!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i))) vCoins.push_back(COutput(pcoin, i, nDepth)); } } } void CWallet::AvailableCoinsMinConf(vector<COutput>& vCoins, int nConf) const { vCoins.clear(); { LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (!pcoin->IsFinal()) continue; if(pcoin->GetDepthInMainChain() < nConf) continue; for (unsigned int i = 0; i < pcoin->vout.size(); i++) if (!(pcoin->IsSpent(i)) && IsMine(pcoin->vout[i]) && pcoin->vout[i].nValue >= nMinimumInputValue) vCoins.push_back(COutput(pcoin, i, pcoin->GetDepthInMainChain())); } } } static void ApproximateBestSubset(vector<pair<int64_t, pair<const CWalletTx*,unsigned int> > >vValue, int64_t nTotalLower, int64_t nTargetValue, vector<char>& vfBest, int64_t& nBest, int iterations = 1000) { vector<char> vfIncluded; vfBest.assign(vValue.size(), true); nBest = nTotalLower; for (int nRep = 0; nRep < iterations && nBest != nTargetValue; nRep++) { vfIncluded.assign(vValue.size(), false); int64_t nTotal = 0; bool fReachedTarget = false; for (int nPass = 0; nPass < 2 && !fReachedTarget; nPass++) { for (unsigned int i = 0; i < vValue.size(); i++) { if (nPass == 0 ? rand() % 2 : !vfIncluded[i]) { nTotal += vValue[i].first; vfIncluded[i] = true; if (nTotal >= nTargetValue) { fReachedTarget = true; if (nTotal < nBest) { nBest = nTotal; vfBest = vfIncluded; } nTotal -= vValue[i].first; vfIncluded[i] = false; } } } } } } // ppcoin: total coins staked (non-spendable until maturity) int64_t CWallet::GetStake() const { int64_t nTotal = 0; LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (pcoin->IsCoinStake() && pcoin->GetBlocksToMaturity() > 0 && pcoin->GetDepthInMainChain() > 0) nTotal += CWallet::GetCredit(*pcoin); } return nTotal; } int64_t CWallet::GetNewMint() const { int64_t nTotal = 0; LOCK(cs_wallet); for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0 && pcoin->GetDepthInMainChain() > 0) nTotal += CWallet::GetCredit(*pcoin); } return nTotal; } bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, unsigned int nSpendTime, int nConfMine, int nConfTheirs, vector<COutput> vCoins, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const { setCoinsRet.clear(); nValueRet = 0; // List of values less than target pair<int64_t, pair<const CWalletTx*,unsigned int> > coinLowestLarger; coinLowestLarger.first = std::numeric_limits<int64_t>::max(); coinLowestLarger.second.first = NULL; vector<pair<int64_t, pair<const CWalletTx*,unsigned int> > > vValue; int64_t nTotalLower = 0; random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt); BOOST_FOREACH(COutput output, vCoins) { const CWalletTx *pcoin = output.tx; if (output.nDepth < (pcoin->IsFromMe() ? nConfMine : nConfTheirs)) continue; int i = output.i; // Follow the timestamp rules if (pcoin->nTime > nSpendTime) continue; int64_t n = pcoin->vout[i].nValue; pair<int64_t,pair<const CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin, i)); if (n == nTargetValue) { setCoinsRet.insert(coin.second); nValueRet += coin.first; return true; } else if (n < nTargetValue + CENT) { vValue.push_back(coin); nTotalLower += n; } else if (n < coinLowestLarger.first) { coinLowestLarger = coin; } } if (nTotalLower == nTargetValue) { for (unsigned int i = 0; i < vValue.size(); ++i) { setCoinsRet.insert(vValue[i].second); nValueRet += vValue[i].first; } return true; } if (nTotalLower < nTargetValue) { if (coinLowestLarger.second.first == NULL) return false; setCoinsRet.insert(coinLowestLarger.second); nValueRet += coinLowestLarger.first; return true; } // Solve subset sum by stochastic approximation sort(vValue.rbegin(), vValue.rend(), CompareValueOnly()); vector<char> vfBest; int64_t nBest; ApproximateBestSubset(vValue, nTotalLower, nTargetValue, vfBest, nBest, 1000); if (nBest != nTargetValue && nTotalLower >= nTargetValue + CENT) ApproximateBestSubset(vValue, nTotalLower, nTargetValue + CENT, vfBest, nBest, 1000); // If we have a bigger coin and (either the stochastic approximation didn't find a good solution, // or the next bigger coin is closer), return the bigger coin if (coinLowestLarger.second.first && ((nBest != nTargetValue && nBest < nTargetValue + CENT) || coinLowestLarger.first <= nBest)) { setCoinsRet.insert(coinLowestLarger.second); nValueRet += coinLowestLarger.first; } else { for (unsigned int i = 0; i < vValue.size(); i++) if (vfBest[i]) { setCoinsRet.insert(vValue[i].second); nValueRet += vValue[i].first; } if (fDebug && GetBoolArg("-printpriority")) { //// debug print printf("SelectCoins() best subset: "); for (unsigned int i = 0; i < vValue.size(); i++) if (vfBest[i]) printf("%s ", FormatMoney(vValue[i].first).c_str()); printf("total %s\n", FormatMoney(nBest).c_str()); } } return true; } bool CWallet::SelectCoins(int64_t nTargetValue, unsigned int nSpendTime, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet, const CCoinControl* coinControl) const { vector<COutput> vCoins; AvailableCoins(vCoins, true, coinControl); // coin control -> return all selected outputs (we want all selected to go into the transaction for sure) if (coinControl && coinControl->HasSelected()) { BOOST_FOREACH(const COutput& out, vCoins) { nValueRet += out.tx->vout[out.i].nValue; setCoinsRet.insert(make_pair(out.tx, out.i)); } return (nValueRet >= nTargetValue); } return (SelectCoinsMinConf(nTargetValue, nSpendTime, 1, 6, vCoins, setCoinsRet, nValueRet) || SelectCoinsMinConf(nTargetValue, nSpendTime, 1, 1, vCoins, setCoinsRet, nValueRet) || SelectCoinsMinConf(nTargetValue, nSpendTime, 0, 1, vCoins, setCoinsRet, nValueRet)); } // Select some coins without random shuffle or best subset approximation bool CWallet::SelectCoinsSimple(int64_t nTargetValue, unsigned int nSpendTime, int nMinConf, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const { vector<COutput> vCoins; AvailableCoinsMinConf(vCoins, nMinConf); setCoinsRet.clear(); nValueRet = 0; BOOST_FOREACH(COutput output, vCoins) { const CWalletTx *pcoin = output.tx; int i = output.i; // Stop if we've chosen enough inputs if (nValueRet >= nTargetValue) break; // Follow the timestamp rules if (pcoin->nTime > nSpendTime) continue; int64_t n = pcoin->vout[i].nValue; pair<int64_t,pair<const CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin, i)); if (n >= nTargetValue) { // If input value is greater or equal to target then simply insert // it into the current subset and exit setCoinsRet.insert(coin.second); nValueRet += coin.first; break; } else if (n < nTargetValue + CENT) { setCoinsRet.insert(coin.second); nValueRet += coin.first; } } return true; } bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64_t& nFeeRet, int nSplitBlock, const CCoinControl* coinControl) { int64_t nValue = 0; BOOST_FOREACH (const PAIRTYPE(CScript, int64_t)& s, vecSend) { if (nValue < 0) return false; nValue += s.second; } if (vecSend.empty() || nValue < 0) return false; wtxNew.BindWallet(this); { LOCK2(cs_main, cs_wallet); // txdb must be opened before the mapWallet lock CTxDB txdb("r"); { nFeeRet = nTransactionFee; if(fSplitBlock) nFeeRet = 1 * COIN; while (true) { wtxNew.vin.clear(); wtxNew.vout.clear(); wtxNew.fFromMe = true; int64_t nTotalValue = nValue + nFeeRet; double dPriority = 0; if( nSplitBlock < 1 ) nSplitBlock = 1; // vouts to the payees if (!fSplitBlock) { BOOST_FOREACH (const PAIRTYPE(CScript, int64_t)& s, vecSend) wtxNew.vout.push_back(CTxOut(s.second, s.first)); } else BOOST_FOREACH (const PAIRTYPE(CScript, int64_t)& s, vecSend) { for(int nCount = 0; nCount < nSplitBlock; nCount++) { if(nCount == nSplitBlock -1) { uint64_t nRemainder = s.second % nSplitBlock; wtxNew.vout.push_back(CTxOut((s.second / nSplitBlock) + nRemainder, s.first)); } else wtxNew.vout.push_back(CTxOut(s.second / nSplitBlock, s.first)); } } // Choose coins to use set<pair<const CWalletTx*,unsigned int> > setCoins; int64_t nValueIn = 0; if (!SelectCoins(nTotalValue, wtxNew.nTime, setCoins, nValueIn, coinControl)) return false; CTxDestination utxoAddress; BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { int64_t nCredit = pcoin.first->vout[pcoin.second].nValue; dPriority += (double)nCredit * pcoin.first->GetDepthInMainChain(); ExtractDestination(pcoin.first->vout[pcoin.second].scriptPubKey, utxoAddress); } int64_t nChange = nValueIn - nValue - nFeeRet; // if sub-cent change is required, the fee must be raised to at least MIN_TX_FEE // or until nChange becomes zero // NOTE: this depends on the exact behaviour of GetMinFee if (nFeeRet < MIN_TX_FEE && nChange > 0 && nChange < CENT) { int64_t nMoveToFee = min(nChange, MIN_TX_FEE - nFeeRet); nChange -= nMoveToFee; nFeeRet += nMoveToFee; } if (nChange > 0) { // Fill a vout to ourself // TODO: pass in scriptChange instead of reservekey so // change transaction isn't always pay-to-bitcoin-address CScript scriptChange; // coin control: send change to custom address if (coinControl && coinControl->fReturnChange == true) scriptChange.SetDestination(utxoAddress); else if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange)) scriptChange.SetDestination(coinControl->destChange); // no coin control: send change to newly generated address else { // Note: We use a new key here to keep it from being obvious which side is the change. // The drawback is that by not reusing a previous key, the change may be lost if a // backup is restored, if the backup doesn't have the new private key for the change. // If we reused the old key, it would be possible to add code to look for and // rediscover unknown transactions that were written with keys of ours to recover // post-backup change. // Reserve a new key pair from key pool CPubKey vchPubKey; assert(reservekey.GetReservedKey(vchPubKey)); // should never fail, as we just unlocked scriptChange.SetDestination(vchPubKey.GetID()); } // Insert change txn at random position: vector<CTxOut>::iterator position = wtxNew.vout.begin()+GetRandInt(wtxNew.vout.size()); wtxNew.vout.insert(position, CTxOut(nChange, scriptChange)); } else reservekey.ReturnKey(); // Fill vin BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins) wtxNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second)); // Sign int nIn = 0; BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins) if (!SignSignature(*this, *coin.first, wtxNew, nIn++)) return false; // Limit size unsigned int nBytes = ::GetSerializeSize(*(CTransaction*)&wtxNew, SER_NETWORK, PROTOCOL_VERSION); if (nBytes >= MAX_BLOCK_SIZE_GEN/5) return false; dPriority /= nBytes; // Check that enough fee is included int64_t nPayFee = nTransactionFee * (1 + (int64_t)nBytes / 1000); int64_t nMinFee = wtxNew.GetMinFee(1, GMF_SEND, nBytes); if (nFeeRet < max(nPayFee, nMinFee)) { nFeeRet = max(nPayFee, nMinFee); continue; } // Fill vtxPrev by copying from previous transactions vtxPrev wtxNew.AddSupportingTransactions(txdb); wtxNew.fTimeReceivedIsTxTime = true; break; } } } return true; } bool CWallet::CreateTransaction(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64_t& nFeeRet, const CCoinControl* coinControl) { vector< pair<CScript, int64_t> > vecSend; vecSend.push_back(make_pair(scriptPubKey, nValue)); return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, 1, coinControl); } // NovaCoin: get current stake weight bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64_t& nMinWeight, uint64_t& nMaxWeight, uint64_t& nWeight) { // Choose coins to use int64_t nBalance = GetBalance(); if (nBalance <= nReserveBalance) return false; vector<const CWalletTx*> vwtxPrev; set<pair<const CWalletTx*,unsigned int> > setCoins; int64_t nValueIn = 0; if (!SelectCoinsSimple(nBalance - nReserveBalance, GetTime(), nCoinbaseMaturity + 10, setCoins, nValueIn)) return false; if (setCoins.empty()) return false; CTxDB txdb("r"); BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { CTxIndex txindex; { LOCK2(cs_main, cs_wallet); if (!txdb.ReadTxIndex(pcoin.first->GetHash(), txindex)) continue; } int64_t nTimeWeight = GetWeight((int64_t)pcoin.first->nTime, (int64_t)GetTime()); CBigNum bnCoinDayWeight = CBigNum(pcoin.first->vout[pcoin.second].nValue) * nTimeWeight / COIN / (24 * 60 * 60); // Weight is greater than zero if (nTimeWeight > 0) { nWeight += bnCoinDayWeight.getuint64(); } // Weight is greater than zero, but the maximum value isn't reached yet if (nTimeWeight > 0 && nTimeWeight < nStakeMaxAge) { nMinWeight += bnCoinDayWeight.getuint64(); } // Maximum weight was reached if (nTimeWeight == nStakeMaxAge) { nMaxWeight += bnCoinDayWeight.getuint64(); } } return true; } bool CWallet::GetStakeWeightFromValue(const int64_t& nTime, const int64_t& nValue, uint64_t& nWeight) { // This is a negative value when there is no weight. But set it to zero // so the user is not confused. Used in reporting in Coin Control. // Descisions based on this function should be used with care. int64_t nTimeWeight = GetWeight(nTime, (int64_t)GetTime()); if (nTimeWeight < 0 ) nTimeWeight=0; CBigNum bnCoinDayWeight = CBigNum(nValue) * nTimeWeight / COIN / (24 * 60 * 60); nWeight = bnCoinDayWeight.getuint64(); return true; } bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64_t nSearchInterval, int64_t nFees, CTransaction& txNew, CKey& key) { CBlockIndex* pindexPrev = pindexBest; CBigNum bnTargetPerCoinDay; bnTargetPerCoinDay.SetCompact(nBits); txNew.vin.clear(); txNew.vout.clear(); // Mark coin stake transaction CScript scriptEmpty; scriptEmpty.clear(); txNew.vout.push_back(CTxOut(0, scriptEmpty)); // Choose coins to use int64_t nBalance = GetBalance(); if (nBalance <= nReserveBalance) return false; vector<const CWalletTx*> vwtxPrev; set<pair<const CWalletTx*,unsigned int> > setCoins; int64_t nValueIn = 0; // Select coins with suitable depth if (!SelectCoinsSimple(nBalance - nReserveBalance, txNew.nTime, nCoinbaseMaturity + 10, setCoins, nValueIn)) return false; if (setCoins.empty()) return false; int64_t nCredit = 0; CScript scriptPubKeyKernel; CTxDB txdb("r"); BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { CTxIndex txindex; { LOCK2(cs_main, cs_wallet); if (!txdb.ReadTxIndex(pcoin.first->GetHash(), txindex)) continue; } // Read block header CBlock block; { LOCK2(cs_main, cs_wallet); if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false)) continue; } static int nMaxStakeSearchInterval = 60; if (block.GetBlockTime() + nStakeMinAge > txNew.nTime - nMaxStakeSearchInterval) continue; // only count coins meeting min age requirement bool fKernelFound = false; for (unsigned int n=0; n<min(nSearchInterval,(int64_t)nMaxStakeSearchInterval) && !fKernelFound && !fShutdown && pindexPrev == pindexBest; n++) { // Search backward in time from the given txNew timestamp // Search nSearchInterval seconds back up to nMaxStakeSearchInterval uint256 hashProofOfStake = 0, targetProofOfStake = 0; COutPoint prevoutStake = COutPoint(pcoin.first->GetHash(), pcoin.second); if (CheckStakeKernelHash(nBits, block, txindex.pos.nTxPos - txindex.pos.nBlockPos, *pcoin.first, prevoutStake, txNew.nTime - n, hashProofOfStake, targetProofOfStake)) { // Found a kernel if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : kernel found\n"); vector<valtype> vSolutions; txnouttype whichType; CScript scriptPubKeyOut; scriptPubKeyKernel = pcoin.first->vout[pcoin.second].scriptPubKey; if (!Solver(scriptPubKeyKernel, whichType, vSolutions)) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : failed to parse kernel\n"); break; } if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : parsed kernel type=%d\n", whichType); if (whichType != TX_PUBKEY && whichType != TX_PUBKEYHASH) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : no support for kernel type=%d\n", whichType); break; // only support pay to public key and pay to address } if (whichType == TX_PUBKEYHASH) // pay to address type { // convert to pay to public key type if (!keystore.GetKey(uint160(vSolutions[0]), key)) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : failed to get key for kernel type=%d\n", whichType); break; // unable to find corresponding public key } scriptPubKeyOut << key.GetPubKey() << OP_CHECKSIG; } if (whichType == TX_PUBKEY) { valtype& vchPubKey = vSolutions[0]; if (!keystore.GetKey(Hash160(vchPubKey), key)) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : failed to get key for kernel type=%d\n", whichType); break; // unable to find corresponding public key } if (key.GetPubKey() != vchPubKey) { if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : invalid key for kernel type=%d\n", whichType); break; // keys mismatch } scriptPubKeyOut = scriptPubKeyKernel; } txNew.nTime -= n; txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second)); nCredit += pcoin.first->vout[pcoin.second].nValue; vwtxPrev.push_back(pcoin.first); txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); uint64_t nCoinAge; CTxDB txdb("r"); if (txNew.GetCoinAge(txdb, nCoinAge)) { uint64_t nTotalSize = pcoin.first->vout[pcoin.second].nValue + GetProofOfStakeReward(nCoinAge, 0, txNew.nTime); if (nTotalSize / 2 > nStakeSplitThreshold * COIN) txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); //split stake } if (fDebug && GetBoolArg("-printcoinstake")) printf("CreateCoinStake : added kernel type=%d\n", whichType); fKernelFound = true; break; } } if (fKernelFound || fShutdown) break; // if kernel is found stop searching } if (nCredit == 0 || nCredit > nBalance - nReserveBalance) return false; BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { // Attempt to add more inputs // Only add coins of the same key/address as kernel if (txNew.vout.size() == 2 && ((pcoin.first->vout[pcoin.second].scriptPubKey == scriptPubKeyKernel || pcoin.first->vout[pcoin.second].scriptPubKey == txNew.vout[1].scriptPubKey)) && pcoin.first->GetHash() != txNew.vin[0].prevout.hash) { int64_t nTimeWeight = GetWeight((int64_t)pcoin.first->nTime, (int64_t)txNew.nTime); // Stop adding more inputs if already too many inputs if (txNew.vin.size() >= 100) break; // Stop adding more inputs if value is already pretty significant if (nCredit >= nStakeCombineThreshold) break; // Stop adding inputs if reached reserve limit if (nCredit + pcoin.first->vout[pcoin.second].nValue > nBalance - nReserveBalance) break; // Do not add additional significant input if (pcoin.first->vout[pcoin.second].nValue >= nStakeCombineThreshold) continue; // Do not add input that is still too young if (nTimeWeight < nStakeMinAge) continue; txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second)); nCredit += pcoin.first->vout[pcoin.second].nValue; vwtxPrev.push_back(pcoin.first); } } // Calculate coin age reward { uint64_t nCoinAge; CTxDB txdb("r"); if (!txNew.GetCoinAge(txdb, nCoinAge)) return error("CreateCoinStake : failed to calculate coin age"); int64_t nReward = GetProofOfStakeReward(nCoinAge, nFees, txNew.nTime); if (nReward <= 0) return false; nCredit += nReward; } // Set output amount if (txNew.vout.size() == 3) { txNew.vout[1].nValue = (nCredit / 2 / CENT) * CENT; txNew.vout[2].nValue = nCredit - txNew.vout[1].nValue; } else txNew.vout[1].nValue = nCredit; // Sign int nIn = 0; BOOST_FOREACH(const CWalletTx* pcoin, vwtxPrev) { if (!SignSignature(*this, *pcoin, txNew, nIn++)) return error("CreateCoinStake : failed to sign coinstake"); } // Limit size unsigned int nBytes = ::GetSerializeSize(txNew, SER_NETWORK, PROTOCOL_VERSION); if (nBytes >= MAX_BLOCK_SIZE_GEN/5) return error("CreateCoinStake : exceeded coinstake size limit"); // Successfully generated coinstake return true; } // Call after CreateTransaction unless you want to abort bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) { { LOCK2(cs_main, cs_wallet); printf("CommitTransaction:\n%s", wtxNew.ToString().c_str()); { // This is only to keep the database open to defeat the auto-flush for the // duration of this scope. This is the only place where this optimization // maybe makes sense; please don't do it anywhere else. CWalletDB* pwalletdb = fFileBacked ? new CWalletDB(strWalletFile,"r") : NULL; // Take key pair from key pool so it won't be used again reservekey.KeepKey(); // Add tx to wallet, because if it has change it's also ours, // otherwise just for transaction history. AddToWallet(wtxNew); // Mark old coins as spent set<CWalletTx*> setCoins; BOOST_FOREACH(const CTxIn& txin, wtxNew.vin) { CWalletTx &coin = mapWallet[txin.prevout.hash]; coin.BindWallet(this); coin.MarkSpent(txin.prevout.n); coin.WriteToDisk(); NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED); } if (fFileBacked) delete pwalletdb; } // Track how many getdata requests our transaction gets mapRequestCount[wtxNew.GetHash()] = 0; // Broadcast if (!wtxNew.AcceptToMemoryPool()) { // This must not fail. The transaction has already been signed and recorded. printf("CommitTransaction() : Error: Transaction not valid\n"); return false; } wtxNew.RelayWalletTransaction(); } return true; } string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee) { CReserveKey reservekey(this); int64_t nFeeRequired; if (IsLocked()) { string strError = _("Error: Wallet locked, unable to create transaction "); printf("SendMoney() : %s", strError.c_str()); return strError; } if (fWalletUnlockStakingOnly) { string strError = _("Error: Wallet unlocked for staking only, unable to create transaction."); printf("SendMoney() : %s", strError.c_str()); return strError; } if (!CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired)) { string strError; if (nValue + nFeeRequired > GetBalance()) strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds "), FormatMoney(nFeeRequired).c_str()); else strError = _("Error: Transaction creation failed "); printf("SendMoney() : %s", strError.c_str()); return strError; } if (fAskFee && !uiInterface.ThreadSafeAskFee(nFeeRequired, _("Sending..."))) return "ABORTED"; if (!CommitTransaction(wtxNew, reservekey)) return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); return ""; } string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee) { // Check amount if (nValue <= 0) return _("Invalid amount"); if (nValue + nTransactionFee > GetBalance()) return _("Insufficient funds"); // Parse Bitcoin address CScript scriptPubKey; scriptPubKey.SetDestination(address); return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee); } DBErrors CWallet::LoadWallet(bool& fFirstRunRet) { if (!fFileBacked) return DB_LOAD_OK; fFirstRunRet = false; DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); if (nLoadWalletRet == DB_NEED_REWRITE) { if (CDB::Rewrite(strWalletFile, "\x04pool")) { setKeyPool.clear(); // Note: can't top-up keypool here, because wallet is locked. // User will be prompted to unlock wallet the next operation // the requires a new key. } } if (nLoadWalletRet != DB_LOAD_OK) return nLoadWalletRet; fFirstRunRet = !vchDefaultKey.IsValid(); NewThread(ThreadFlushWalletDB, &strWalletFile); return DB_LOAD_OK; } bool CWallet::SetAddressBookName(const CTxDestination& address, const string& strName) { std::map<CTxDestination, std::string>::iterator mi = mapAddressBook.find(address); mapAddressBook[address] = strName; NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED); if (!fFileBacked) return false; return CWalletDB(strWalletFile).WriteName(CBitcoinAddress(address).ToString(), strName); } bool CWallet::DelAddressBookName(const CTxDestination& address) { mapAddressBook.erase(address); NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED); if (!fFileBacked) return false; return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString()); } void CWallet::PrintWallet(const CBlock& block) { { LOCK(cs_wallet); if (block.IsProofOfWork() && mapWallet.count(block.vtx[0].GetHash())) { CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()]; printf(" mine: %d %d %" PRId64 "", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); } if (block.IsProofOfStake() && mapWallet.count(block.vtx[1].GetHash())) { CWalletTx& wtx = mapWallet[block.vtx[1].GetHash()]; printf(" stake: %d %d %" PRId64 "", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); } } printf("\n"); } bool CWallet::GetTransaction(const uint256 &hashTx, CWalletTx& wtx) { { LOCK(cs_wallet); map<uint256, CWalletTx>::iterator mi = mapWallet.find(hashTx); if (mi != mapWallet.end()) { wtx = (*mi).second; return true; } } return false; } bool CWallet::SetDefaultKey(const CPubKey &vchPubKey) { if (fFileBacked) { if (!CWalletDB(strWalletFile).WriteDefaultKey(vchPubKey)) return false; } vchDefaultKey = vchPubKey; return true; } bool GetWalletFile(CWallet* pwallet, string &strWalletFileOut) { if (!pwallet->fFileBacked) return false; strWalletFileOut = pwallet->strWalletFile; return true; } // // Mark old keypool keys as used, // and generate all new keys // bool CWallet::NewKeyPool() { { LOCK(cs_wallet); CWalletDB walletdb(strWalletFile); BOOST_FOREACH(int64_t nIndex, setKeyPool) walletdb.ErasePool(nIndex); setKeyPool.clear(); if (IsLocked()) return false; int64_t nKeys = max(GetArg("-keypool", 100), (int64_t)0); for (int i = 0; i < nKeys; i++) { int64_t nIndex = i+1; walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey())); setKeyPool.insert(nIndex); } printf("CWallet::NewKeyPool wrote %" PRId64 " new keys\n", nKeys); } return true; } bool CWallet::TopUpKeyPool(unsigned int nSize) { { LOCK(cs_wallet); if (IsLocked()) return false; CWalletDB walletdb(strWalletFile); // Top up key pool unsigned int nTargetSize; if (nSize > 0) nTargetSize = nSize; else nTargetSize = max(GetArg("-keypool", 100), (int64_t)0); while (setKeyPool.size() < (nTargetSize + 1)) { int64_t nEnd = 1; if (!setKeyPool.empty()) nEnd = *(--setKeyPool.end()) + 1; if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey()))) throw runtime_error("TopUpKeyPool() : writing generated key failed"); setKeyPool.insert(nEnd); printf("keypool added key %" PRId64 ", size=%" PRIszu "\n", nEnd, setKeyPool.size()); } } return true; } void CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool) { nIndex = -1; keypool.vchPubKey = CPubKey(); { LOCK(cs_wallet); if (!IsLocked()) TopUpKeyPool(); // Get the oldest key if(setKeyPool.empty()) return; CWalletDB walletdb(strWalletFile); nIndex = *(setKeyPool.begin()); setKeyPool.erase(setKeyPool.begin()); if (!walletdb.ReadPool(nIndex, keypool)) throw runtime_error("ReserveKeyFromKeyPool() : read failed"); if (!HaveKey(keypool.vchPubKey.GetID())) throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); assert(keypool.vchPubKey.IsValid()); if (fDebug && GetBoolArg("-printkeypool")) printf("keypool reserve %" PRId64 "\n", nIndex); } } int64_t CWallet::AddReserveKey(const CKeyPool& keypool) { { LOCK2(cs_main, cs_wallet); CWalletDB walletdb(strWalletFile); int64_t nIndex = 1 + *(--setKeyPool.end()); if (!walletdb.WritePool(nIndex, keypool)) throw runtime_error("AddReserveKey() : writing added key failed"); setKeyPool.insert(nIndex); return nIndex; } return -1; } void CWallet::KeepKey(int64_t nIndex) { // Remove from key pool if (fFileBacked) { CWalletDB walletdb(strWalletFile); walletdb.ErasePool(nIndex); } if(fDebug) printf("keypool keep %" PRId64 "\n", nIndex); } void CWallet::ReturnKey(int64_t nIndex) { // Return to key pool { LOCK(cs_wallet); setKeyPool.insert(nIndex); } if(fDebug) printf("keypool return %" PRId64 "\n", nIndex); } bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) { int64_t nIndex = 0; CKeyPool keypool; { LOCK(cs_wallet); ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex == -1) { if (fAllowReuse && vchDefaultKey.IsValid()) { result = vchDefaultKey; return true; } if (IsLocked()) return false; result = GenerateNewKey(); return true; } KeepKey(nIndex); result = keypool.vchPubKey; } return true; } int64_t CWallet::GetOldestKeyPoolTime() { int64_t nIndex = 0; CKeyPool keypool; ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex == -1) return GetTime(); ReturnKey(nIndex); return keypool.nTime; } std::map<CTxDestination, int64_t> CWallet::GetAddressBalances() { map<CTxDestination, int64_t> balances; { LOCK(cs_wallet); BOOST_FOREACH(PAIRTYPE(uint256, CWalletTx) walletEntry, mapWallet) { CWalletTx *pcoin = &walletEntry.second; if (!pcoin->IsFinal() || !pcoin->IsTrusted()) continue; if ((pcoin->IsCoinBase() || pcoin->IsCoinStake()) && pcoin->GetBlocksToMaturity() > 0) continue; int nDepth = pcoin->GetDepthInMainChain(); if (nDepth < (pcoin->IsFromMe() ? 0 : 1)) continue; for (unsigned int i = 0; i < pcoin->vout.size(); i++) { CTxDestination addr; if (!IsMine(pcoin->vout[i])) continue; if(!ExtractDestination(pcoin->vout[i].scriptPubKey, addr)) continue; int64_t n = pcoin->IsSpent(i) ? 0 : pcoin->vout[i].nValue; if (!balances.count(addr)) balances[addr] = 0; balances[addr] += n; } } } return balances; } set< set<CTxDestination> > CWallet::GetAddressGroupings() { set< set<CTxDestination> > groupings; set<CTxDestination> grouping; BOOST_FOREACH(PAIRTYPE(uint256, CWalletTx) walletEntry, mapWallet) { CWalletTx *pcoin = &walletEntry.second; if (pcoin->vin.size() > 0 && IsMine(pcoin->vin[0])) { // group all input addresses with each other BOOST_FOREACH(CTxIn txin, pcoin->vin) { CTxDestination address; if(!ExtractDestination(mapWallet[txin.prevout.hash].vout[txin.prevout.n].scriptPubKey, address)) continue; grouping.insert(address); } // group change with input addresses BOOST_FOREACH(CTxOut txout, pcoin->vout) if (IsChange(txout)) { CWalletTx tx = mapWallet[pcoin->vin[0].prevout.hash]; CTxDestination txoutAddr; if(!ExtractDestination(txout.scriptPubKey, txoutAddr)) continue; grouping.insert(txoutAddr); } groupings.insert(grouping); grouping.clear(); } // group lone addrs by themselves for (unsigned int i = 0; i < pcoin->vout.size(); i++) if (IsMine(pcoin->vout[i])) { CTxDestination address; if(!ExtractDestination(pcoin->vout[i].scriptPubKey, address)) continue; grouping.insert(address); groupings.insert(grouping); grouping.clear(); } } set< set<CTxDestination>* > uniqueGroupings; // a set of pointers to groups of addresses map< CTxDestination, set<CTxDestination>* > setmap; // map addresses to the unique group containing it BOOST_FOREACH(set<CTxDestination> grouping, groupings) { // make a set of all the groups hit by this new group set< set<CTxDestination>* > hits; map< CTxDestination, set<CTxDestination>* >::iterator it; BOOST_FOREACH(CTxDestination address, grouping) if ((it = setmap.find(address)) != setmap.end()) hits.insert((*it).second); // merge all hit groups into a new single group and delete old groups set<CTxDestination>* merged = new set<CTxDestination>(grouping); BOOST_FOREACH(set<CTxDestination>* hit, hits) { merged->insert(hit->begin(), hit->end()); uniqueGroupings.erase(hit); delete hit; } uniqueGroupings.insert(merged); // update setmap BOOST_FOREACH(CTxDestination element, *merged) setmap[element] = merged; } set< set<CTxDestination> > ret; BOOST_FOREACH(set<CTxDestination>* uniqueGrouping, uniqueGroupings) { ret.insert(*uniqueGrouping); delete uniqueGrouping; } return ret; } // ppcoin: check 'spent' consistency between wallet and txindex // ppcoin: fix wallet spent state according to txindex void CWallet::FixSpentCoins(int& nMismatchFound, int64_t& nBalanceInQuestion, bool fCheckOnly) { nMismatchFound = 0; nBalanceInQuestion = 0; LOCK(cs_wallet); vector<CWalletTx*> vCoins; vCoins.reserve(mapWallet.size()); for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) vCoins.push_back(&(*it).second); CTxDB txdb("r"); BOOST_FOREACH(CWalletTx* pcoin, vCoins) { // Find the corresponding transaction index CTxIndex txindex; if (!txdb.ReadTxIndex(pcoin->GetHash(), txindex)) continue; for (unsigned int n=0; n < pcoin->vout.size(); n++) { if (IsMine(pcoin->vout[n]) && pcoin->IsSpent(n) && (txindex.vSpent.size() <= n || txindex.vSpent[n].IsNull())) { printf("FixSpentCoins found lost coin %s bitvier %s[%d], %s\n", FormatMoney(pcoin->vout[n].nValue).c_str(), pcoin->GetHash().ToString().c_str(), n, fCheckOnly? "repair not attempted" : "repairing"); nMismatchFound++; nBalanceInQuestion += pcoin->vout[n].nValue; if (!fCheckOnly) { pcoin->MarkUnspent(n); pcoin->WriteToDisk(); } } else if (IsMine(pcoin->vout[n]) && !pcoin->IsSpent(n) && (txindex.vSpent.size() > n && !txindex.vSpent[n].IsNull())) { printf("FixSpentCoins found spent coin %s bitvier %s[%d], %s\n", FormatMoney(pcoin->vout[n].nValue).c_str(), pcoin->GetHash().ToString().c_str(), n, fCheckOnly? "repair not attempted" : "repairing"); nMismatchFound++; nBalanceInQuestion += pcoin->vout[n].nValue; if (!fCheckOnly) { pcoin->MarkSpent(n); pcoin->WriteToDisk(); } } } } } // ppcoin: disable transaction (only for coinstake) void CWallet::DisableTransaction(const CTransaction &tx) { if (!tx.IsCoinStake() || !IsFromMe(tx)) return; // only disconnecting coinstake requires marking input unspent LOCK(cs_wallet); BOOST_FOREACH(const CTxIn& txin, tx.vin) { map<uint256, CWalletTx>::iterator mi = mapWallet.find(txin.prevout.hash); if (mi != mapWallet.end()) { CWalletTx& prev = (*mi).second; if (txin.prevout.n < prev.vout.size() && IsMine(prev.vout[txin.prevout.n])) { prev.MarkUnspent(txin.prevout.n); prev.WriteToDisk(); } } } } bool CReserveKey::GetReservedKey(CPubKey& pubkey) { if (nIndex == -1) { CKeyPool keypool; pwallet->ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex != -1) vchPubKey = keypool.vchPubKey; else { if (pwallet->vchDefaultKey.IsValid()) { printf("CReserveKey::GetReservedKey(): Warning: Using default key instead of a new key, top up your keypool!"); vchPubKey = pwallet->vchDefaultKey; } else return false; } } assert(vchPubKey.IsValid()); pubkey = vchPubKey; return true; } void CReserveKey::KeepKey() { if (nIndex != -1) pwallet->KeepKey(nIndex); nIndex = -1; vchPubKey = CPubKey(); } void CReserveKey::ReturnKey() { if (nIndex != -1) pwallet->ReturnKey(nIndex); nIndex = -1; vchPubKey = CPubKey(); } void CWallet::GetAllReserveKeys(set<CKeyID>& setAddress) const { setAddress.clear(); CWalletDB walletdb(strWalletFile); LOCK2(cs_main, cs_wallet); BOOST_FOREACH(const int64_t& id, setKeyPool) { CKeyPool keypool; if (!walletdb.ReadPool(id, keypool)) throw runtime_error("GetAllReserveKeyHashes() : read failed"); assert(keypool.vchPubKey.IsValid()); CKeyID keyID = keypool.vchPubKey.GetID(); if (!HaveKey(keyID)) throw runtime_error("GetAllReserveKeyHashes() : unknown key in key pool"); setAddress.insert(keyID); } } void CWallet::UpdatedTransaction(const uint256 &hashTx) { { LOCK(cs_wallet); // Only notify UI if this transaction is in this wallet map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(hashTx); if (mi != mapWallet.end()) NotifyTransactionChanged(this, hashTx, CT_UPDATED); } } void CWallet::GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth) const { mapKeyBirth.clear(); // get birth times for keys with metadata for (std::map<CKeyID, CKeyMetadata>::const_iterator it = mapKeyMetadata.begin(); it != mapKeyMetadata.end(); it++) if (it->second.nCreateTime) mapKeyBirth[it->first] = it->second.nCreateTime; // map in which we'll infer heights of other keys CBlockIndex *pindexMax = FindBlockByHeight(std::max(0, nBestHeight - 144)); // the tip can be reorganised; use a 144-block safety margin std::map<CKeyID, CBlockIndex*> mapKeyFirstBlock; std::set<CKeyID> setKeys; GetKeys(setKeys); BOOST_FOREACH(const CKeyID &keyid, setKeys) { if (mapKeyBirth.count(keyid) == 0) mapKeyFirstBlock[keyid] = pindexMax; } setKeys.clear(); // if there are no such keys, we're done if (mapKeyFirstBlock.empty()) return; // find first block that affects those keys, if there are any left std::vector<CKeyID> vAffected; for (std::map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); it++) { // iterate over all wallet transactions... const CWalletTx &wtx = (*it).second; std::map<uint256, CBlockIndex*>::const_iterator blit = mapBlockIndex.find(wtx.hashBlock); if (blit != mapBlockIndex.end() && blit->second->IsInMainChain()) { // ... which are already in a block int nHeight = blit->second->nHeight; BOOST_FOREACH(const CTxOut &txout, wtx.vout) { // iterate over all their outputs ::ExtractAffectedKeys(*this, txout.scriptPubKey, vAffected); BOOST_FOREACH(const CKeyID &keyid, vAffected) { // ... and all their affected keys std::map<CKeyID, CBlockIndex*>::iterator rit = mapKeyFirstBlock.find(keyid); if (rit != mapKeyFirstBlock.end() && nHeight < rit->second->nHeight) rit->second = blit->second; } vAffected.clear(); } } } // Extract block timestamps for those keys for (std::map<CKeyID, CBlockIndex*>::const_iterator it = mapKeyFirstBlock.begin(); it != mapKeyFirstBlock.end(); it++) mapKeyBirth[it->first] = it->second->nTime - 7200; // block times can be 2h off } bool CWallet::MultiSend() { if ( IsInitialBlockDownload() || IsLocked() ) return false; int64_t nAmount = 0; { LOCK(cs_wallet); std::vector<COutput> vCoins; AvailableCoins(vCoins); BOOST_FOREACH(const COutput& out, vCoins) { CTxDestination address; if(!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) continue; if (nBestHeight <= nLastMultiSendHeight ) return false; if (out.tx->IsCoinStake() && out.tx->GetBlocksToMaturity() == 0 && out.tx->GetDepthInMainChain() == nCoinbaseMaturity+20) { //Disabled Addresses won't send MultiSend transactions if(vDisabledAddresses.size() > 0) { for(unsigned int i = 0; i < vDisabledAddresses.size(); i++) { if(vDisabledAddresses[i] == CBitcoinAddress(address).ToString()) { return false; } } } // create new coin control, populate it with the selected utxo, create sending vector CCoinControl* cControl = new CCoinControl(); uint256 txhash = out.tx->GetHash(); COutPoint outpt(txhash, out.i); cControl->Select(outpt); CWalletTx wtx; cControl->fReturnChange = true; CReserveKey keyChange(this); // this change address does not end up being used, because change is returned with coin control switch int64_t nFeeRet = 0; vector<pair<CScript, int64_t> > vecSend; // loop through multisend vector and add amounts and addresses to the sending vector for(unsigned int i = 0; i < vMultiSend.size(); i++) { // MultiSend vector is a pair of 1)Address as a std::string 2) Percent of stake to send as an int nAmount = ( ( out.tx->GetCredit() - out.tx->GetDebit() ) * vMultiSend[i].second )/100; CBitcoinAddress strAddSend(vMultiSend[i].first); CScript scriptPubKey; scriptPubKey.SetDestination(strAddSend.Get()); vecSend.push_back(make_pair(scriptPubKey, nAmount)); } //make sure splitblock is off fSplitBlock = false; // Create the transaction and commit it to the network bool fCreated = CreateTransaction(vecSend, wtx, keyChange, nFeeRet, 1, cControl); if (!fCreated) printf("MultiSend createtransaction failed"); if(!CommitTransaction(wtx, keyChange)) printf("MultiSend transaction commit failed"); else fMultiSendNotify = true; delete cControl; //write nLastMultiSendHeight to DB CWalletDB walletdb(strWalletFile); nLastMultiSendHeight = nBestHeight; if(!walletdb.WriteMSettings(fMultiSend, nLastMultiSendHeight)) printf("Failed to write MultiSend setting to DB"); } } } return true; }
[ "support@bitvier.tech" ]
support@bitvier.tech