blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
โŒ€
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
473fce196877905232d829b67c0a16532ad98ec8
fc7d9bbe049114ad5a94a6107321bdc09d3ccf53
/.history/Maze_20210920163319.cpp
9dba8d61fb5de9c047db82a2f365482f78248051
[]
no_license
xich4932/3010_maze
2dbf7bb0f2be75d014a384cbefc4095779d525b5
72be8a7d9911efed5bc78be681486b2532c08ad8
refs/heads/main
2023-08-11T00:42:18.085853
2021-09-22T03:29:40
2021-09-22T03:29:40
408,272,071
0
0
null
null
null
null
UTF-8
C++
false
false
6,244
cpp
#include<iostream> #include<vector> #include<cstdlib> #include<array> #include"Maze.h" #include<time.h> #include<cstring> //using namespace std; //return true when the path is in the vector bool checkInPath(const int num, const std::vector<int> &vec){ for(int d =0; d < vec.size(); d++){ if(vec[d] == num) return true; } return false; } Board::Board(){ rows_ = 4; cols_ = 4; generate(); } Board::Board(int r, int c){ rows_ = r; cols_ = c; generate(); } void Board::displayUpdated(){ for(int i = 0; i < rows_; i++){ for(int d = 0; d < cols_; d++){ if(checkInPath(4*i +d, path)){ std::cout<< "*"; }else{ std::cout << "+" ; } } std::cout << std::endl; } } Maze::Maze(int r, int c, std::string name){ //generate (board_); board_ = new Board(r, c); players_.push_back(new Player(name ,1)); players_.push_back(new Player("clown_face1" ,0)); players_.push_back(new Player("clown_face2" ,0)); players_.push_back(new Player("pear_1" ,0)); players_.push_back(new Player("pear_2" ,0)); players_.push_back(new Player("wall_1",0)); players_.push_back(new Player("wall_2" ,0)); players_.push_back(new Player("wall_3" ,0)); //set the position of wall that's is in not the expected solution path std::vector<int> path = board_->getPath(); for(int d = 5; d < 8; d++){ int temp_r = 0, temp_c=0; while(checkInPath(4*temp_c + temp_r, path)){ int s = rand() % (r * c); temp_r = s % r; temp_c = s / r; } players_[d]->set_position(temp_r, temp_c); } } Maze::~Maze(){ delete board_; } std::vector<int> getDirection(int point, int max_r, int max_c){ //{col,row} up left down right //int direction[4][2] ={{1,0},{0,1},{-1,0},{0,-1}}; std::vector< int > ret; ret.push_back(point - max_r); //up ret.push_back(point + 1); //right ret.push_back(point + max_r); //down ret.push_back(point - 1); //left int r = point % max_r; int c = point / max_r; if(r == 0){ ret.erase(ret.begin()+3); }else if(r == max_r - 1){ ret.erase(ret.begin()+1); } if(c == 0){ ret.erase(ret.begin()); }else if(c == max_c - 1){ ret.erase(ret.begin()+2); } std::cout << "ret: " << point << std::endl; for(int i = 0; i < ret.size() ; i++) std::cout << ret[i] << " "; std::cout << std::endl; return ret; } void printer(std::vector<int> pri){ for(int i =0 ; i< pri.size(); i++){ std::cout << pri[i] <<" "; } std::cout << std::endl; } void printer1(std::vector<std::array<int, 2>> pri){ for(int d =0; d < pri.size(); d++){ std::cout<<pri[d][0] <<" " << pri[d][1] <<std::endl; } } bool Maze::IsGameOver(){ } bool Board::generate(){ int max_step = 1; //max step to reach exit is 8 int visited[cols_][rows_] ; //visited[0][0] = 0; memset(visited, 0, sizeof(visited)); for(int d =0 ;d < cols_; d++){ for(int f = 0; f < rows_; f++){ std::cout << visited[d][f] << " "; } std::cout << std::endl; } //vector<int> path; path.push_back(0); srand((unsigned ) time(NULL)); int max = rows_ * cols_; visited[0][0] = 1; int start_r = 0; int start_c = 0; int end_c = cols_ - 1; int end_r = rows_ - 1; while( path[path.size()-1] != 15 && path.size() < 13 && max_step < 16){ std::vector<int> direction = getDirection(path[path.size()-1], rows_, cols_); //printer1(direction); int curr = rand()%direction.size(); int temp_r = direction[curr] % rows_; int temp_c = direction[curr] / rows_; //std::cout << direction[curr][0] << " " << direction[curr][1] << std::endl; if(visited[temp_c][temp_r]) continue; std::cout << "tmp_point " << temp_r << " " << temp_c << std::endl; //std::cout << "tmp_c " << temp_c << std::endl; std::cout <<"-------------"<<std::endl; for(int t =0; t < cols_; t++){ for(int y =0; y < rows_; y++){ if(t == temp_c && y == temp_r){ std::cout << 2 << " "; }else{ std::cout << visited[t][y] << " "; } //std::cout << visited[t][y] << " "; } std::cout << std::endl; } std::cout <<"-------------"<<std::endl; path.push_back(direction[curr]); max_step ++; //start_c += direction[curr][0]; //start_r += direction[curr][1]; visited[temp_c][temp_r] = 1; direction.clear(); //displayUpdated(); } printer(path); if(start_r == end_r && start_c == end_c) return true; return false; } SquareType get_square_value(Position pos){ }; // TODO: you MUST implement the following functions // set the value of a square to the given SquareType void Board::SetSquareValue(Position pos, SquareType value){ arr_[pos.col][pos.col] = value; } // get the possible Positions that a Player could move to // (not off the board or into a wall) std::vector<Position> Board::GetMoves(Player *p){ } // Move a player to a new position on the board. Return // true if they moved successfully, false otherwise. bool Board::MovePlayer(Player *p, Position pos){ } // Get the square type of the exit squareโˆ SquareType Board::GetExitOccupant(){ } // You probably want to implement this std::ostream& operator<<(std::ostream& os, const Board &b){ for(int i = 0; i < b.cols_; i++){ for(int e = 0; e < b.rows_; e++){ std::string temp_str = SquareTypeStringify(b.arr_[i][e]); if(temp_str == "Wall"){ }else if(temp_str == "Exit"){ }else if(temp_str == "Empty"){ }else if(temp_str == "Human"){ }else if(temp_str == "Enemy"){ std::cout << \U+1F921 << std::endl; }else{ } } std::cout << std::endl; } }
[ "70279863+xich4932@users.noreply.github.com" ]
70279863+xich4932@users.noreply.github.com
aa3b4c0a16032e5bb58de74e92e7409c343c7cb6
1712b9f265ab1f120a7490d13277066a2c8aee26
/Exercises/6_ITBB/3_Count/count.cpp
cf749e9b922be9077361486ff0bfa5956d924bc0
[]
no_license
marcelbra/TSP_vectorized
4e884f68227a4514331f83dbf13b644ef4e7fb95
bd48ecde1798386d7c6c40b3674dece0c6a5c800
refs/heads/master
2022-12-20T19:38:47.194709
2020-09-25T13:02:04
2020-09-25T13:02:04
273,537,812
1
0
null
null
null
null
UTF-8
C++
false
false
2,246
cpp
/// Counts number of 0 entries in a random array /// /// Authors: I.Kulakov; M.Zyzak /// use "g++ count.cpp -O3 -ltbb; ./a.out" to run /// TODO parallelize using two methods: via atomic operations and via spin_mutex #include <stdio.h> #include "tbb/parallel_for.h" #include "tbb/blocked_range.h" #include "tbb/task_scheduler_init.h" #include "tbb/atomic.h" #include "tbb/spin_mutex.h" using namespace tbb; #include "../../../TStopwatch.h" #include <cmath> #include <stdlib.h> // rand const int N = 2000000; int counter = 0; int counterParM; // parallelization using mutex TODO int counterParA; // parallelization using atomic TODO int ComplicatedFunction( float x ){ // just to simulate some time-consuming calculations, which can be parallelized return (int)( cos(sin(x*3.14)) * 10 - 5 ); } class ApplyTBBA{ const float * const a; public: void operator()(const blocked_range<long unsigned int> &range, int cpuId = -1) const { // TODO parallelization via atomic } ApplyTBBA(const float * const a_):a(a_){} ~ApplyTBBA(){} }; class ApplyTBBM{ const float * const a; public: void operator()(const blocked_range<long unsigned int> &range, int cpuId = -1) const { for(int i = range.begin(); i != range.end(); ++i){ // TODO parallelization via mutex } } ApplyTBBM(const float * const a_):a(a_){} ~ApplyTBBM(){} }; int main () { float a[N]; // fill classes by random numbers for( int i = 0; i < N; i++ ) { a[i] = (float(rand())/float(RAND_MAX)); // put a random value, from 0 to 1 } TStopwatch timer; for(int i = 0; i != N; ++i){ if (ComplicatedFunction(a[i]) == 0) counter++; } timer.Stop(); float timeScalar = timer.RealTime()*1000; // task_scheduler_init init(1); // run 1 thread only // parallelization via atomic timer.Start(); timer.Stop(); float timeParA = timer.RealTime()*1000; // parallelization via mutex timer.Start(); timer.Stop(); float timeParM = timer.RealTime()*1000; printf( " Scalar counter: %d Time: %f ms. \n TBB atomic counter: %d Time: %f ms. \n TBB mutex counter: %d Time: %f ms. \n ",counter, timeScalar, counterParA, timeParA, counterParM, timeParM ); }
[ "marcelbraasch@gmail.com" ]
marcelbraasch@gmail.com
9c15e5198275b80a348908b175362a55b47ce5cb
5e3787377f8a095ebd94c677d4062208ec556b2d
/dilbert.h
38055bb5180f986d7ff97389b944f9148e325a12
[ "LicenseRef-scancode-chicken-dl-0.2", "BSD-2-Clause" ]
permissive
dhruvbhutani/komedia
8b421fd36f9233a9844dec1f632807adca3362f9
f64ef05f65f78867545ead1c589f2ac9c3619da0
refs/heads/master
2016-09-06T01:57:27.356327
2011-06-29T09:40:01
2011-06-29T09:40:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
511
h
#ifndef DILBERT_H #define DILBERT_H #include <QWidget> #include <QtWebKit/QWebView> #include <QDate> namespace Ui { class dilbert; } class dilbert : public QWidget { Q_OBJECT public: explicit dilbert(QWidget *parent = 0); ~dilbert(); private: Ui::dilbert *ui; QDate comicid; QDate latest; QWebView *view; private slots: void next(); void prev(); void randComic(); void scrap(bool); void progress(int); void unhideProgress(); }; #endif // DILBERT_H
[ "hiemanshu@gmail.com" ]
hiemanshu@gmail.com
c9bb9516fc57905ccdddcd0b8ce085fa66ae0bd2
da1f94b2ffd45b9da8959db4a3a997f5403a4a17
/lab3/ex_1/ILoggable.cpp
0a97dca0725b3f01c402048d607ac26626c2ee8e
[]
no_license
T71M/cpp_labs
2fba47bec11020905535025e541956f64140e338
74e6c6559e8fb3a01893dd7fd0b700dd4b9ce6b3
refs/heads/main
2023-08-19T12:38:38.272319
2021-10-17T17:40:41
2021-10-17T17:40:41
408,398,858
0
0
null
null
null
null
UTF-8
C++
false
false
96
cpp
// // ILoggable.cpp // ex_1 // // Created by 71M on 30.08.2021. // #include "ILoggable.hpp"
[ "timurbragin35@gmail.com" ]
timurbragin35@gmail.com
56dc03988880a0b03b33de7b95493e096c3f17b5
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/agc024/B/3229447.cpp
b673668e8f0bcaba70947c9bcbdd6a0c6cd78ba5
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
C++
false
false
1,070
cpp
#include <iostream> #include <climits> #include <cmath> #include <algorithm> #include <vector> #include <map> #include <set> #include <queue> #include <string> #include <deque> #define INF_INT (INT_MAX / 2) #define INF_LONG (LONG_MAX / 2) //#define DEBUG true #define DEBUG false using namespace std; typedef long long ll; typedef pair< int, int > pii; typedef pair< ll, ll > pll; typedef pair< ll, int > pli; typedef pair< int, ll > pil; int ceil(int x, int y){ return (x % y == 0) ? x / y : x / y + 1; } int gcd(int x, int y){ return y ? gcd(y, x % y) : x; } int lcm(int x, int y){ return x / gcd(x, y) * y; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int p[n]; for(int i = 0; i < n; i++) cin >> p[i]; int a[n + 1]; for(int i = 0; i < n; i++){ a[p[i]] = i; } int mx = 1, c = 1; for(int i = 1; i + 1 <= n; i++){ if(a[i] < a[i + 1]) ++c; else c = 1; mx = max(mx, c); } int ans = n - mx; cout << ans << endl; return 0; }
[ "kwnafi@yahoo.com" ]
kwnafi@yahoo.com
b014d8c99c4b9b4aa710ab2f13ba109687e53204
0998de8daafc28c97ad10b53ff72f2cd6a60ae9f
/Exercicios1/resp-usuario.cpp
e9b8af416fd5aa9b973b872cea916ccc0169cfa1
[ "MIT" ]
permissive
leandro-araujo-silva/Aprendendo-Cpp
6711f33c05ccb0d653acb684f6caad20805f83e1
09c5eb038ca62f46a694c4386b6d9e1e7d2cb8fc
refs/heads/main
2023-07-03T21:16:31.061108
2021-08-07T02:35:59
2021-08-07T02:35:59
381,132,078
0
0
null
null
null
null
UTF-8
C++
false
false
190
cpp
#include <iostream> using namespace std; int main () { int idade; cout << "Qual a sua idade?" << endl; cin >> idade; cout << "Vc tem " << idade << " anos!" << endl; return 0; }
[ "leandro.arauj047.edu@gmail.com" ]
leandro.arauj047.edu@gmail.com
62c937ab4ad700526154f65d9f5c5ab4533709a6
4efc9b3494ca74c8c737a54991712c78da1a7003
/matrix/matrix_hpoint.cpp
c952049e567610b40c68f243d637a9d429a7c9b3
[]
no_license
leonshen33/freesurface_mesh
b104a47c288e2f2433e3d6f688aef2d9695c9e84
069c56e8e46f16595496af948c2a3ddfe216f88d
refs/heads/main
2023-08-25T20:45:05.385483
2021-10-14T06:21:48
2021-10-14T06:21:48
416,989,775
0
0
null
null
null
null
UTF-8
C++
false
false
6,786
cpp
/*============================================================================= File: matrix.cpp Purpose: Revision: $Id: matrix_hpoint.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ Created by: Philippe Lavoie (3 Oct, 1996) Modified by: Copyright notice: Copyright (C) 1996-1998 Philippe Lavoie 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; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. =============================================================================*/ #ifndef matrix_hpoint_h__ #define matrix_hpoint_h__ #include "matrix.h" #include "dv_hpoint_nd.h" namespace PLib { double Matrix<HPoint3Df>::norm(void) { int i,j ; double sumX, sumY, sumZ, sumW, maxsum; int init=0 ; HPoint3Df *ptr ; ptr = m-1 ; maxsum = -1 ; // shuts up the warning messages for(i=0;i<rows();++i){ sumX = 0.0 ; sumY = 0.0 ; sumZ = 0.0 ; sumW = 0.0 ; for ( j = 0; j < cols(); ++j) { sumX += (*ptr).x() * (*ptr).x() ; sumY += (*ptr).y() * (*ptr).y() ; sumZ += (*ptr).z() * (*ptr).z() ; sumW += (*ptr).w() * (*ptr).w() ; } if(init) maxsum = (maxsum>(sumX+sumY+sumZ+sumW)) ? maxsum : (sumX+sumY+sumZ+sumW); else{ maxsum = (sumX+sumY+sumZ+sumW) ; init = 1; } ++ptr ; } return sqrt(maxsum); } double Matrix<HPoint3Dd>::norm(void) { int i,j ; double sumX, sumY, sumZ, sumW, maxsum; int init=0 ; HPoint3Dd *ptr ; ptr = m-1 ; maxsum = -1 ; // shuts up the warning messages for(i=0;i<rows();++i){ sumX = 0.0 ; sumY = 0.0 ; sumZ = 0.0 ; sumW = 0.0 ; for ( j = 0; j < cols(); ++j) { sumX += (*ptr).x() * (*ptr).x() ; sumY += (*ptr).y() * (*ptr).y() ; sumZ += (*ptr).z() * (*ptr).z() ; sumW += (*ptr).w() * (*ptr).w() ; } if(init) maxsum = (maxsum>(sumX+sumY+sumZ+sumW)) ? maxsum : (sumX+sumY+sumZ+sumW); else{ maxsum = (sumX+sumY+sumZ+sumW) ; init = 1; } ++ptr ; } return sqrt(maxsum); } double Matrix<HPoint2Df>::norm(void) { int i,j ; double sumX, sumY, sumZ, sumW, maxsum; int init=0 ; HPoint2Df *ptr ; ptr = m-1 ; maxsum = -1 ; // shuts up the warning messages for(i=0;i<rows();++i){ sumX = 0.0 ; sumY = 0.0 ; sumZ = 0.0 ; sumW = 0.0 ; for ( j = 0; j < cols(); ++j) { sumX += (*ptr).x() * (*ptr).x() ; sumY += (*ptr).y() * (*ptr).y() ; sumZ += (*ptr).z() * (*ptr).z() ; sumW += (*ptr).w() * (*ptr).w() ; } if(init) maxsum = (maxsum>(sumX+sumY+sumZ+sumW)) ? maxsum : (sumX+sumY+sumZ+sumW); else{ maxsum = (sumX+sumY+sumZ+sumW) ; init = 1; } ++ptr ; } return sqrt(maxsum); } double Matrix<HPoint2Dd>::norm(void) { int i,j ; double sumX, sumY, sumZ, sumW, maxsum; int init=0 ; HPoint2Dd *ptr ; ptr = m-1 ; maxsum = -1 ; // shuts up the warning messages for(i=0;i<rows();++i){ sumX = 0.0 ; sumY = 0.0 ; sumZ = 0.0 ; sumW = 0.0 ; for ( j = 0; j < cols(); ++j) { sumX += (*ptr).x() * (*ptr).x() ; sumY += (*ptr).y() * (*ptr).y() ; sumZ += (*ptr).z() * (*ptr).z() ; sumW += (*ptr).w() * (*ptr).w() ; } if(init) maxsum = (maxsum>(sumX+sumY+sumZ+sumW)) ? maxsum : (sumX+sumY+sumZ+sumW); else{ maxsum = (sumX+sumY+sumZ+sumW) ; init = 1; } ++ptr ; } return sqrt(maxsum); } #ifdef NO_IMPLICIT_TEMPLATES // HPoint3D instantiation template class Matrix<HPoint3Df> ; template Matrix<HPoint3Df> operator+(const Matrix<HPoint3Df>&,const Matrix<HPoint3Df>&); template Matrix<HPoint3Df> operator-(const Matrix<HPoint3Df>&,const Matrix<HPoint3Df>&); template Matrix<HPoint3Df> operator*(const Matrix<HPoint3Df>&,const Matrix<HPoint3Df>&); template Matrix<HPoint3Df> operator*(const double,const Matrix<HPoint3Df>&); template int operator==(const Matrix<HPoint3Df>&,const Matrix<HPoint3Df>&); // template int operator!=(const Matrix<HPoint3Df>&,const Matrix<HPoint3Df>&); template Matrix<HPoint3Df> comm(const Matrix<HPoint3Df>&,const Matrix<HPoint3Df>&); template class Matrix<HPoint3Dd> ; template Matrix<HPoint3Dd> operator+(const Matrix<HPoint3Dd>&,const Matrix<HPoint3Dd>&); template Matrix<HPoint3Dd> operator-(const Matrix<HPoint3Dd>&,const Matrix<HPoint3Dd>&); template Matrix<HPoint3Dd> operator*(const Matrix<HPoint3Dd>&,const Matrix<HPoint3Dd>&); template Matrix<HPoint3Dd> operator*(const double,const Matrix<HPoint3Dd>&); template int operator==(const Matrix<HPoint3Dd>&,const Matrix<HPoint3Dd>&); //template int operator!=(const Matrix<HPoint3Dd>&,const Matrix<HPoint3Dd>&); template Matrix<HPoint3Dd> comm(const Matrix<HPoint3Dd>&,const Matrix<HPoint3Dd>&); // HPoint2D instantiation template class Matrix<HPoint2Df> ; template Matrix<HPoint2Df> operator+(const Matrix<HPoint2Df>&,const Matrix<HPoint2Df>&); template Matrix<HPoint2Df> operator-(const Matrix<HPoint2Df>&,const Matrix<HPoint2Df>&); template Matrix<HPoint2Df> operator*(const Matrix<HPoint2Df>&,const Matrix<HPoint2Df>&); template Matrix<HPoint2Df> operator*(const double,const Matrix<HPoint2Df>&); template int operator==(const Matrix<HPoint2Df>&,const Matrix<HPoint2Df>&); //template int operator!=(const Matrix<HPoint2Df>&,const Matrix<HPoint2Df>&); template Matrix<HPoint2Df> comm(const Matrix<HPoint2Df>&,const Matrix<HPoint2Df>&); template class Matrix<HPoint2Dd> ; template Matrix<HPoint2Dd> operator+(const Matrix<HPoint2Dd>&,const Matrix<HPoint2Dd>&); template Matrix<HPoint2Dd> operator-(const Matrix<HPoint2Dd>&,const Matrix<HPoint2Dd>&); template Matrix<HPoint2Dd> operator*(const Matrix<HPoint2Dd>&,const Matrix<HPoint2Dd>&); template Matrix<HPoint2Dd> operator*(const double,const Matrix<HPoint2Dd>&); template int operator==(const Matrix<HPoint2Dd>&,const Matrix<HPoint2Dd>&); //template int operator!=(const Matrix<HPoint2Dd>&,const Matrix<HPoint2Dd>&); template Matrix<HPoint2Dd> comm(const Matrix<HPoint2Dd>&,const Matrix<HPoint2Dd>&); #endif } #endif // matrix_hpoint_h__
[ "leon.shen@okstate.edu" ]
leon.shen@okstate.edu
0813eb6f545dc3c6b12d1c3aa24230e9c02c9c8d
157e898bea95943cf42a73e40af3759280e73f19
/app/controllers/CourseEditController.h
43b623d9e4cc95861af528d003ac428e1539c4bb
[]
no_license
Rexagon/methodist
1f46f163875c6aeaed4caf64285af2519b4d22c7
0410d29c0add7dc231716ccc6072e84322b21dbe
refs/heads/master
2021-03-27T10:45:22.261549
2018-02-01T09:08:24
2018-02-01T09:08:24
111,196,247
0
0
null
null
null
null
UTF-8
C++
false
false
824
h
#ifndef COURSEEDITCONTROLLER_H #define COURSEEDITCONTROLLER_H #include <functional> #include "Controller.h" #include "../objects/Course.h" class CourseEditController : public Controller { Q_OBJECT public: CourseEditController(Ui::MainWindow* ui, QObject* parent = nullptr); ~CourseEditController(); void propose() override; void setEditable(bool editable); bool isEditable() const; void saveCurrentCourse(); void setCourse(Course* course); Course* getCurrentCourse() const; signals: void addSectionButtonPressed(); void editButtonPressed(); void deleteButtonPressed(); void saveChangesButtonPressed(); void cancelChangesButtonPressed(); private: Course* m_currentCourse; bool m_isEditable; }; #endif // COURSEEDITCONTROLLER_H
[ "reide740@gmail.com" ]
reide740@gmail.com
dc9f356ac93caaabd1e76af30087e2a41e28da49
153a117a89ba736402faf7cae5ce5526319fbd31
/src/Socket.h
6f1df8a801864f2cb34dbf1c1cec2ae6b204be5d
[ "MIT" ]
permissive
hoathienvu8x/tincanphone
fe57e5a2847512540d416ca57e2f5b9b7ff3e368
fcdfdca99247328ca2907c80e24da0ff0c1579e9
refs/heads/master
2023-03-26T16:02:19.560827
2016-04-23T23:59:13
2016-04-23T23:59:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,247
h
/* (C) 2016 Gary Sinitsin. See LICENSE file (MIT license). */ #pragma once #include "PhoneCommon.h" #ifdef _WIN32 # define UNICODE # define WIN32_LEAN_AND_MEAN # define NOMINMAX # include <Windows.h> # include <WinSock2.h> # include <WS2tcpip.h> // Bring back the standard error constants that we use # define EWOULDBLOCK WSAEWOULDBLOCK # define EADDRINUSE WSAEADDRINUSE # define ECONNABORTED WSAECONNABORTED # define ECONNRESET WSAECONNRESET #else # include <unistd.h> # include <errno.h> # include <sys/types.h> # include <sys/socket.h> # include <netdb.h> typedef int SOCKET; //Since Winsock requires SOCKET type for socket fds #endif namespace tincan { // A super-thin wrapper around the stuff Winsock messes up class Socket { public: static int getError(); static string getErrorString(); static int close(SOCKET s); static void setBlocking(SOCKET s, bool blocking); }; // Conveniences for using socket structs with C++ std::ostream& operator << (std::ostream& os, const sockaddr_storage& rhs); bool operator == (const sockaddr_storage& lhs, const sockaddr_storage& rhs); inline bool operator != (const sockaddr_storage& lhs, const sockaddr_storage& rhs) {return !(lhs == rhs);} }
[ "garynull@users.noreply.github.com" ]
garynull@users.noreply.github.com
e7d7de9b3a7c834906b465169fe1c8e5d9bbf1f1
69528096408c3ecfb5777299faaf95f2873e0916
/19.4/arithmeticExpression.h
9c72eef2e7cf3803d05cad8422bc0e768c4bc952
[]
no_license
Maxine100/CS014
e4bb6c68387aa3dd96fe9edd34bb7fd4a2b110a1
26ba438ee3f58cd40673ff3f89dc6ca2ace299a9
refs/heads/master
2023-04-07T20:52:41.225382
2021-04-07T21:14:43
2021-04-07T21:14:43
346,841,853
0
0
null
null
null
null
UTF-8
C++
false
false
888
h
#ifndef ARITHMETICEXPRESSION_H #define ARITHMETICEXPRESSION_H #include <iostream> #include <cstdlib> using namespace std; struct TreeNode{ char data; char key; TreeNode* left; TreeNode* right; TreeNode(char data, char key):data(data),key(key),left(0),right(0){} }; class arithmeticExpression{ private: string infixExpression; TreeNode* root; public: arithmeticExpression(const string &ex); void buildTree(); void infix(); void prefix(); void postfix(); void visualizeTree(const string & filename); private: int priority(char op); string infix_to_postfix(); void infix(TreeNode *node); void prefix(TreeNode *node); void postfix(TreeNode *node); void visualizeTree(ofstream &name, TreeNode *node); }; #endif
[ "maxine.wu00@gmail.com" ]
maxine.wu00@gmail.com
ce6a73ed24c0e6381718d28082f8b9035f0f461c
56a1c483618758b6a493d8e6fa6cb380e251a0bb
/test_c_fotran/1/Foo.hpp
5590cceab54b1dc11acfe7d81c0fa9fada339f48
[]
no_license
gaofrank1986/module_lib
84305276d8a3df26b3733a71aded06ba175fb83d
6025d7fc16f1d03409cea9f7f923ca089bbd4b51
refs/heads/master
2020-04-06T07:11:27.213584
2016-09-15T05:34:13
2016-09-15T05:34:13
63,519,141
0
0
null
null
null
null
UTF-8
C++
false
false
201
hpp
#include <string> class Foo { public: Foo(int a, int b); ~Foo(); int bar(int c) const; double baz(double d) const; private: int a; int b; }; void foo_speaker(std::string s);
[ "home@homedeMacBook-Pro.local" ]
home@homedeMacBook-Pro.local
2ac8237dc9ae5ab38a1db442d308fdd5aeb917d6
8ed7b2cb70c6e33b01679c17d0e340f11c733520
/international-trade/currency.h
20fe6c0020a3e0e38fb8afe539bfab5deb061986
[]
no_license
saibi/qt
6528b727bd73da82f513f2f54c067a669f394c9a
a3066b90cbc1ac6b9c82af5c75c40ce9e845f9a2
refs/heads/master
2022-06-26T20:08:07.960786
2022-06-10T06:49:28
2022-06-10T06:49:28
88,221,337
0
0
null
null
null
null
UTF-8
C++
false
false
950
h
#ifndef CURRENCY_H #define CURRENCY_H #include <QHash> #include <QString> #include <QStringList> class Currency { public: static Currency *get(const QString name); QString name() const; bool hasRate(const QString currency) const; double to(const QString currency); static void addRate(const QString from, const QString to, double rate); static void addRate(const QString from, const QString to, const QString rate); void insert(const QString name, double conversion); static void printMap(); static void fillInTable(); static QStringList currencies(); private: QString _name; QHash<QString, double> rates; static QHash<QString, Currency *> map; Currency(const QString name) : _name(name) { rates[name] = 1.0; } Currency(const Currency &) {} void fillInCurrency(QStringList currencies, bool tryReverse = false); void findRate(const QString currency); }; #endif // CURRENCY_H
[ "ymkim@huvitz.com" ]
ymkim@huvitz.com
729cee78ea0c381bd103cd20a664ac0f1df7cb42
5baca5b28b502c1097061cd760b664dad0bb29a9
/GEDatacache/Datacache.cpp
fa0cbbf1c2db65403d0a9747b030a40ef56b27b1
[]
no_license
hujinqi/GELibs
948908ca2de9a7e022c92400426b66b047e86117
48278444bb9482a38190af08bc3d09581eaf6210
refs/heads/master
2022-09-01T14:32:13.573025
2020-05-27T07:54:43
2020-05-27T07:54:43
267,236,993
1
0
null
null
null
null
UTF-8
C++
false
false
1,223
cpp
/* * Datacache.cpp * * Created on: 2018ๅนด3ๆœˆ19ๆ—ฅ * Author: carlos Hu */ #include "Datacache.h" #include "GEThread/ThreadPool.h" Datacache::Datacache(): CThread() { Connections = NULL; mConnectionCount = 0; } Datacache::~Datacache() { } void Datacache::_Initialize() { //run ThreadPool.ExecuteTask(this); } DatacacheConnection * Datacache::GetFreeConnection() { uint32 i = 0; for(;;) { DatacacheConnection * con = Connections[ ((i++) % mConnectionCount) ]; if(con->Busy.AttemptAcquire()) return con; } // shouldn't be reached return NULL; } bool Datacache::run() { //SetThreadName("Database Execute Thread"); SetThreadState(THREADSTATE_BUSY); char * query = taskQueue.pop(); DatacacheConnection * con = GetFreeConnection(); while (query) { _SendQuery(con, query, false); if (ThreadState == THREADSTATE_TERMINATE) break; query = taskQueue.pop(); } con->Busy.Release(); if (taskQueue.get_size() > 0) { // execute all the remaining queries query = taskQueue.pop_nowait(); while (query) { DatacacheConnection * con = GetFreeConnection(); _SendQuery(con, query, false); con->Busy.Release(); query = taskQueue.pop_nowait(); } } return false; }
[ "410124939@qq.com" ]
410124939@qq.com
9e00f8f8c1356ab431e6d78c1e1654c63fc0b489
cc6a3542ebb9fe3b61ecc0b05d7132d22efe63f7
/Snake-game/Cell.hpp
4db760197560b99496a08ba5f14570e5ad052d1e
[ "MIT" ]
permissive
EndL11/snake-fugas
79b0c06c98ee09075ae2b2825054ab0b66a1601d
fed344c3eb672e0f086de3c8d2e6ecc00426089f
refs/heads/master
2023-03-08T23:32:28.112130
2021-02-25T12:59:54
2021-02-25T12:59:54
341,157,828
0
0
MIT
2021-02-25T12:59:54
2021-02-22T10:12:52
C
UTF-8
C++
false
false
671
hpp
#pragma once #include <SDL.h> #include "CustomTexture.hpp" class Cell { private: CustomTexture m_texture; bool m_free; char m_dir = ' '; int m_row; int m_col; public: Cell(); Cell(SDL_Rect t_rect, SDL_Texture* t_texture, int r, int c); ~Cell(); bool free(); char dir(); void changeDirection(char dir); void render(SDL_Renderer* t_renderer); CustomTexture texture(); int col(); int row(); void changeFree(bool is_free); friend bool operator==(Cell lcell, Cell rcell) { return lcell.m_row == rcell.m_row && lcell.m_col == rcell.m_col; } friend bool operator!=(Cell lcell, Cell rcell) { return lcell.m_row != rcell.m_row && lcell.m_col != rcell.m_col; } };
[ "podobailo.andriy@gmail.com" ]
podobailo.andriy@gmail.com
faaa20751a9905f7c9605858873b82fdf8b7ddf5
8a003111a29ace0c59273b56e045dc1068cde164
/Extract_C_keywords.cpp
34a9b3ed5fc93fdfd857f355de1c491984320b43
[]
no_license
qiunoyi/Extract-C-keywords
3eede73f83b8f5e234e0e09eac48c83acab9ef9a
19d20cb38550ffbc3d430bf1aff687b78cd636b9
refs/heads/master
2023-08-10T09:34:28.144388
2021-09-20T05:48:10
2021-09-20T05:48:10
407,374,072
1
0
null
2021-09-19T15:23:18
2021-09-17T02:09:00
C++
UTF-8
C++
false
false
740
cpp
#include "rank12.h" #include "rank34.h" int main() { cout << "่ฏท่พ“ๅ…ฅๆ‚จ้œ€่ฆ็š„ๅ…ณ้”ฎๅญ—ๆŸฅๆ‰พ็ญ‰็บง" << endl; int rank = 1; cin >> rank; if (rank > 4 || rank < 1) { cout << "่ฏท่พ“ๅ…ฅ[1,4]็š„ๆ•ฐๅญ—" << endl; } Input_KeyWords key("key.txt"); auto key_set = key.read(); cout << "่ฏท่พ“ๅ…ฅๆ‚จ่ฆๆๅ–็š„cppๆ–‡ไปถ่ทฏๅพ„" << endl; string address; cin >> address; Count code(address); code.count_total(key_set); code.output(rank); if (rank >= 3) { ifstream input2(address); if_else(input2); cout << "if-else num: " << if_else_num << endl; if (rank == 4) cout << "if-elseif-else num: " << if_else_if_else_num << endl; } }
[ "18359778223@163.com" ]
18359778223@163.com
dcb2a254ca3383d7ea790f28e53ece9e2f4ab22e
ba326b3752bd6029c66f07848c98771a3b5a50b3
/libmemcached-1.0.10/libmemcached/hash.hpp
8fb41c16aef9a9cd8135e1bb9cd41fe1a67e6c02
[ "BSD-3-Clause" ]
permissive
jinho10/dht-sched
e43458f8d5cdb7545d1726e94b7b7e118d8b1722
d0a75ecf093818dc27d0dd92849c1523ec647a55
refs/heads/master
2021-01-25T03:49:27.084975
2014-06-09T13:07:41
2014-06-09T13:07:41
8,658,556
2
0
null
null
null
null
UTF-8
C++
false
false
1,857
hpp
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libmemcached library * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ * Copyright (C) 2006-2009 Brian Aker 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. * */ #pragma once uint32_t memcached_generate_hash_with_redistribution(memcached_st *ptr, const char *key, size_t key_length, uint32_t cmd);
[ "jinho@nimbus.seas.gwu.edu" ]
jinho@nimbus.seas.gwu.edu
90c2379f678e6e1c32b8ab62858ed6f909588366
82b788176c45b596980ae178884e7a055c625715
/Codeforces/816/A [Karen and Morning].cpp
c50e641d1af09e636448112dc820c43a05930440
[]
no_license
RanadevVarma/CP
ebf1afa5895cfa461c920a1a93939b28242b5b88
752b89e68296a337d1cc3845c991e8a80522a5fa
refs/heads/master
2020-03-25T06:53:06.954666
2018-08-04T13:12:23
2018-08-04T13:12:23
143,530,105
0
0
null
null
null
null
UTF-8
C++
false
false
967
cpp
#include<iostream> #include<algorithm> #include<cstring> #include<cmath> using namespace std ; int main() { char in[2]; char inp[2]; char temp ; scanf("%c%c%c%c%c",&in[0],&in[1],&temp,&inp[0],&inp[1]); int h[2] ; int m[2] ; h[0] = in[0] - '0' ; h[1] = in[1] - '0' ; m[0] = inp[0] - '0' ; m[1] = inp[1] - '0' ; if(h[0]==m[1] && h[1]==m[0]) { printf("0"); return 0; } for(int t = 1 ; t <= 3600 ; t++) { m[1] = m[1] + 1 ; if(m[1]==10) { m[0]++; m[1] = 0; } if(m[0]==6) { m[0] = 0 ; h[1]++; } if(h[1]==10) { h[0]++; h[1] = 0; } if(h[0] == 2 && h[1]==4) { h[0] = 0 ; h[1] = 0 ; } if(h[0]==m[1] && h[1]==m[0]) { printf("%d",t); return 0 ; } } }
[ "me16btech11020@iith.ac.in" ]
me16btech11020@iith.ac.in
fc5cebab69dcb52f18781b2eed7ff149c952c63f
7c1598d9a80f38ee30ed4b2ff6d1d36aef927b17
/BIN/sudoku.cpp
f9977bf2341cf8637b1be0653df39f273e412b95
[]
no_license
1120161891/sudoku
c9d19857b32214414faa5020bccb7dc6bc59f351
39ae209a01c26f5d6bf9779d2ca73c6ff3f8dfe6
refs/heads/master
2020-03-09T19:07:02.304037
2018-04-11T04:54:27
2018-04-11T04:54:27
128,949,760
0
0
null
null
null
null
UTF-8
C++
false
false
3,472
cpp
// homework1.cpp: ๅฎšไน‰ๆŽงๅˆถๅฐๅบ”็”จ็จ‹ๅบ็š„ๅ…ฅๅฃ็‚นใ€‚ // //ไธ€ๅผ€ๅง‹้‡ๅˆฐๆ˜Žๆ˜Žๅทฒ็ปๅฎšไน‰ไบ†ๆ•ฐ็ป„๏ผŒไฝ†ๆ˜ฏ่ฟ˜ๆ˜ฏ่ฏด่ฟ™ไธชๆ•ฐ็ป„ๆฒกๅฎšไน‰ๆˆ–่€…ๅ…ถไป–ๅพˆๅฅ‡ๆ€ช็š„ //้—ฎ้ข˜ๆ˜ฏๅ› ไธบไธญๆ–‡ๆณจ้‡Š #include "stdafx.h" #include <iostream> #include <fstream> #include "sudoCreate.h" #include "sudoSolver.h" #define MAX 1000000 int *matrixarray[MAX]; int count = 0; int array[8] = { 1, 2, 4, 5, 6, 7, 8, 9 }; /*ๅญ˜ๅ‚จๆœ€ๅŽ้œ€่ฆๅพ€ๆ–‡ไปถไธญๅ†™็š„ๆ‰€ๆœ‰็ปˆๅฑ€*/ int rowarray[9][9] = { 0 }; int colarray[9][9] = { 0 }; /*ไธ็Ÿฅ้“่ตทไป€ไนˆๅๅญ—ๅฅฝ...*/ /*ไปŽ๏ผˆ่กŒ๏ผŒๅˆ—๏ผ‰ๅˆฐ๏ผˆๆ‰€ๅœจไนๅฎซๆ ผๆ˜ฏ็ฌฌๅ‡ ไธช๏ผŒไนๅฎซๆ ผๅ†…็š„็ฌฌๅ‡ ไธชไฝ็ฝฎ๏ผ‰็š„่ฝฌๆข๏ผˆๅŽ่€…ๅ‘ๅ‰่€…่ฝฌๆข ๆ˜ฏ็›ธๅŒ็š„่ฎก็ฎ—ๅผๅญ๏ผ‰๏ผŒๆๅ‰่ฎฐๅฝ•ๅฏนๅบ”็š„่ฝฌๆขๅ€ผ๏ผŒๅœจ็”จ็š„ๆ—ถๅ€™ๅฐฑไธ็”จๅ†่ฎก็ฎ—ไบ†*/ void init(); /*่ฟ™ไธชๅ‡ฝๆ•ฐๅฐฑๆ˜ฏ่ฎก็ฎ—ไธŠ้ข่ฟ™ไธคไธชๆ•ฐ็ป„็š„*/ void readAndSolve(char* filepath); void print(int *matrix); int main(int argc,char* argv[]) { int num=0; char c; init(); /*็”จไบŽ็”Ÿๆˆๅ…จๆŽ’ๅˆ—็š„ๆ•ฐ็ป„*/ while (*++argv != NULL&&**argv == '-') { switch (*++*argv) { case'c': argv++; if (*argv == NULL) { std::cout << "please input a number" << std::endl; exit(0); } while ((c=*((*argv)++)) != '\0') { if (c >= '0'&&c <= '9') { num = num * 10 + c - '0'; if (num > MAX) { std::cout << "too big number" << std::endl; break; } } else { std::cout << "input error" << std::endl; exit(0); } } { if (num == 0) { std::cout << "cannot smaller than 1" << std::endl; break; } FILE* fp = fopen("sudoku.txt", "w"); sudoCreate creater = sudoCreate(num,matrixarray); //creater.choose(0,0,fp); creater.generateMatrix(array, 0, 8); sudo::print(matrixarray, num); fclose(fp); } break; case's': argv++; if (*argv == NULL) { std::cout << "please input a filepath" << std::endl; } readAndSolve(*argv); break; default: break; } } /* TODO:ๆต‹่ฏ•getline()ๅ‡ฝๆ•ฐ็š„็”จๆณ•ใ€‚ }*/ return 0; } /***************************************************** Description: ๆ นๆฎ่ฏปๅ…ฅ็š„ๆ–‡ไปถ่ทฏๅพ„๏ผŒ่ฏปๅ–่ฏฅๆ–‡ไปถๅ†…็š„ๆ•ฐ็‹ฌ้—ฎ้ข˜๏ผŒๅนถ่งฃๅ†ณ Input: ๆ–‡ไปถ่ทฏๅพ„็š„ๅญ—็ฌฆๆŒ‡้’ˆ Output: None Require: None Concrete Function: 1.ๅฆ‚ๆžœ่ฏฅ่ทฏๅพ„ไธ‹ๆ‰“ๅผ€ๆ–‡ไปถๅคฑ่ดฅ๏ผŒๅˆ™่พ“ๅ‡บ้”™่ฏฏไฟกๆฏๅนถ็ป“ๆŸ็จ‹ๅบ 2.ๆ นๆฎ่ทฏๅพ„ๆ‰“ๅผ€ๆ–‡ไปถ-ใ€‹่ฏปๅ–ๅฅฝไธ€ไธช็Ÿฉ้˜ต-ใ€‹่งฃๅ†ณๅฎƒ ็›ดๅˆฐๆ–‡ไปถ็ป“ๆŸ ******************************************************/ void readAndSolve(char *filepath) { FILE* f; FILE *fp; if ((f = fopen(filepath, "r")) == NULL || (fp = fopen("sudoku.txt", "w")) == NULL) { printf("cannot open file\n"); exit(0); } int matrix[9][9] = { 0 }; int temp; int i = 0; while (fscanf(f,"%d",&temp)!=EOF) { matrix[i / 9][i % 9] = temp; i++; if (i == 81) { sudoSolver* solver = new sudoSolver(matrix,matrixarray); solver->solve(0); if (!solver->getSolved()) { std::cout << "no solution" << std::endl; } delete solver; i = 0; } } sudo::print(matrixarray,count); fclose(fp); fclose(f); } void print(int *matrix) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { std::cout << matrix[i*9+j] << " "; } std::cout << std::endl; } std::cout << std::endl; } void init() { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { rowarray[i][j] = (i / 3) * 3 + j / 3; colarray[i][j] = (i % 3) * 3 + j % 3; } } }
[ "noreply@github.com" ]
noreply@github.com
ab2cbdb02c016fa681dd2d91705b6d7991487abd
e6769524d7a8776f19df0c78e62c7357609695e8
/branches/v0.5-new_cache_system/retroshare-gui/src/gui/Posted/PostedComments.cpp
4e1f73bab25f9fe509aa370c2ce351ea0ac89446
[]
no_license
autoscatto/retroshare
025020d92084f9bc1ca24da97379242886277779
e0d85c7aac0a590d5839512af8a1e3abce97ca6f
refs/heads/master
2020-04-09T11:14:01.836308
2013-06-30T13:58:17
2013-06-30T13:58:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,575
cpp
/* * Retroshare Posted Comments * * Copyright 2012-2012 by Robert Fernie. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License Version 2.1 as published by the Free Software Foundation. * * 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; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. * * Please report all bugs and problems to "retroshare@lunamutt.com". * */ #include "PostedComments.h" //#include <retroshare/rspeers.h> #include <retroshare/rsposted.h> #include <iostream> #include <sstream> #include <QTimer> #include <QMessageBox> /****** * #define PHOTO_DEBUG 1 *****/ /**************************************************************** * New Photo Display Widget. * * This has two 'lists'. * Top list shows Albums. * Lower list is photos from the selected Album. * * Notes: * Each Item will be an AlbumItem, which contains a thumbnail & random details. * We will limit Items to < 100. With a 'Filter to see more message. * * Thumbnails will come from Service. * Option to Share albums / pictures onward (if permissions allow). * Option to Download the albums to a specified directory. (is this required if sharing an album?) * * Will introduce a FullScreen SlideShow later... first get basics happening. */ /** Constructor */ PostedComments::PostedComments(QWidget *parent) :QWidget(parent) { ui.setupUi(this); #if 0 mAddDialog = NULL; mAlbumSelected = NULL; mPhotoSelected = NULL; mSlideShow = NULL; connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog())); connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog())); connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow())); QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); timer->start(1000); #endif /* setup TokenQueue */ //mPhotoQueue = new TokenQueue(rsPhoto, this); } #if 0 void PhotoDialog::notifySelection(PhotoItem *item, int ptype) { std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item; std::cerr << std::endl; switch(ptype) { default: case PHOTO_ITEM_TYPE_ALBUM: notifyAlbumSelection(item); break; case PHOTO_ITEM_TYPE_PHOTO: notifyPhotoSelection(item); break; } } void PhotoDialog::notifyAlbumSelection(PhotoItem *item) { std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item; std::cerr << std::endl; if (mAlbumSelected) { std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected; std::cerr << std::endl; mAlbumSelected->setSelected(false); } mAlbumSelected = item; insertPhotosForSelectedAlbum(); } void PhotoDialog::notifyPhotoSelection(PhotoItem *item) { std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item; std::cerr << std::endl; if (mPhotoSelected) { std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected; std::cerr << std::endl; mPhotoSelected->setSelected(false); } mPhotoSelected = item; } void PhotoDialog::checkUpdate() { /* update */ if (!rsPhoto) return; if (rsPhoto->updated()) { //insertAlbums(); requestAlbumList(); } return; } /*************** New Photo Dialog ***************/ void PhotoDialog::OpenSlideShow() { // TODO. if (!mAlbumSelected) { // ALERT. int ret = QMessageBox::information(this, tr("PhotoShare"), tr("Please select an album before\n" "requesting to edit it!"), QMessageBox::Ok); return; } if (mAlbumSelected->mIsPhoto) { std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!"; std::cerr << std::endl; return; } std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId; if (mSlideShow) { mSlideShow->show(); } else { mSlideShow = new PhotoSlideShow(NULL); mSlideShow->show(); } mSlideShow->loadAlbum(albumId); } /*************** New Photo Dialog ***************/ void PhotoDialog::OpenOrShowPhotoAddDialog() { if (mAddDialog) { mAddDialog->show(); } else { mAddDialog = new PhotoAddDialog(NULL); mAddDialog->show(); } mAddDialog->clearDialog(); } /*************** Edit Photo Dialog ***************/ void PhotoDialog::OpenPhotoEditDialog() { /* check if we have an album selected */ // THE TWO MessageBoxes - should be handled by disabling the Button!. // TODO. if (!mAlbumSelected) { // ALERT. int ret = QMessageBox::information(this, tr("PhotoShare"), tr("Please select an album before\n" "requesting to edit it!"), QMessageBox::Ok); return; } if (mAlbumSelected->mIsPhoto) { std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!"; std::cerr << std::endl; } std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId; #if 0 uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags; if (!(flags & OWN)) { // ALERT. int ret = QMessageBox::information(this, tr("PhotoShare"), tr("Cannot Edit Someone Else's Album"), QMessageBox::Ok); return; } #endif OpenOrShowPhotoAddDialog(); mAddDialog->loadAlbum(albumId); } bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album) { return true; } double PhotoDialog::AlbumScore(const RsPhotoAlbum &album) { return 1; } bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo) { return true; } double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo) { return 1; } void PhotoDialog::insertPhotosForSelectedAlbum() { std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()"; std::cerr << std::endl; clearPhotos(); //std::list<std::string> albumIds; if (mAlbumSelected) { if (mAlbumSelected->mIsPhoto) { std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!"; std::cerr << std::endl; } std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId; //albumIds.push_back(albumId); std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId; std::cerr << std::endl; requestPhotoList(albumId); } //requestPhotoList(albumIds); } void PhotoDialog::clearAlbums() { std::cerr << "PhotoDialog::clearAlbums()" << std::endl; std::list<PhotoItem *> photoItems; std::list<PhotoItem *>::iterator pit; QLayout *alayout = ui.scrollAreaWidgetContents->layout(); int count = alayout->count(); for(int i = 0; i < count; i++) { QLayoutItem *litem = alayout->itemAt(i); if (!litem) { std::cerr << "PhotoDialog::clearAlbums() missing litem"; std::cerr << std::endl; continue; } PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget()); if (item) { std::cerr << "PhotoDialog::clearAlbums() item: " << item; std::cerr << std::endl; photoItems.push_back(item); } else { std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???"; std::cerr << std::endl; } } for(pit = photoItems.begin(); pit != photoItems.end(); pit++) { PhotoItem *item = *pit; alayout->removeWidget(item); delete item; } mAlbumSelected = NULL; } void PhotoDialog::clearPhotos() { std::cerr << "PhotoDialog::clearPhotos()" << std::endl; std::list<PhotoItem *> photoItems; std::list<PhotoItem *>::iterator pit; QLayout *alayout = ui.scrollAreaWidgetContents_2->layout(); int count = alayout->count(); for(int i = 0; i < count; i++) { QLayoutItem *litem = alayout->itemAt(i); if (!litem) { std::cerr << "PhotoDialog::clearPhotos() missing litem"; std::cerr << std::endl; continue; } PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget()); if (item) { std::cerr << "PhotoDialog::clearPhotos() item: " << item; std::cerr << std::endl; photoItems.push_back(item); } else { std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???"; std::cerr << std::endl; } } for(pit = photoItems.begin(); pit != photoItems.end(); pit++) { PhotoItem *item = *pit; alayout->removeWidget(item); delete item; } mPhotoSelected = NULL; } void PhotoDialog::addAlbum(const RsPhotoAlbum &album) { std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl; PhotoItem *item = new PhotoItem(this, album); QLayout *alayout = ui.scrollAreaWidgetContents->layout(); alayout->addWidget(item); } void PhotoDialog::addPhoto(const RsPhotoPhoto &photo) { std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId; std::cerr << " PhotoId: " << photo.mMeta.mMsgId; std::cerr << std::endl; RsPhotoAlbum dummyAlbum; dummyAlbum.mSetFlags = 0; PhotoItem *item = new PhotoItem(this, photo, dummyAlbum); QLayout *alayout = ui.scrollAreaWidgetContents_2->layout(); alayout->addWidget(item); } void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type) { return; } /**************************** Request / Response Filling of Data ************************/ void PhotoDialog::requestAlbumList() { std::list<std::string> ids; RsTokReqOptions opts; uint32_t token; mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0); } void PhotoDialog::loadAlbumList(const uint32_t &token) { std::cerr << "PhotoDialog::loadAlbumList()"; std::cerr << std::endl; std::list<std::string> albumIds; rsPhoto->getGroupList(token, albumIds); requestAlbumData(albumIds); clearPhotos(); std::list<std::string>::iterator it; for(it = albumIds.begin(); it != albumIds.end(); it++) { requestPhotoList(*it); } } void PhotoDialog::requestAlbumData(const std::list<std::string> &ids) { RsTokReqOptions opts; uint32_t token; mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0); } bool PhotoDialog::loadAlbumData(const uint32_t &token) { std::cerr << "PhotoDialog::loadAlbumData()"; std::cerr << std::endl; clearAlbums(); bool moreData = true; while(moreData) { RsPhotoAlbum album; if (rsPhoto->getAlbum(token, album)) { std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl; PhotoItem *item = new PhotoItem(this, album); QLayout *alayout = ui.scrollAreaWidgetContents->layout(); alayout->addWidget(item); } else { moreData = false; } } return true; } void PhotoDialog::requestPhotoList(const std::string &albumId) { std::list<std::string> ids; ids.push_back(albumId); RsTokReqOptions opts; opts.mOptions = RS_TOKREQOPT_MSG_LATEST; uint32_t token; mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0); } void PhotoDialog::loadPhotoList(const uint32_t &token) { std::cerr << "PhotoDialog::loadPhotoList()"; std::cerr << std::endl; std::list<std::string> photoIds; rsPhoto->getMsgList(token, photoIds); requestPhotoData(photoIds); } void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds) { RsTokReqOptions opts; uint32_t token; mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0); } void PhotoDialog::loadPhotoData(const uint32_t &token) { std::cerr << "PhotoDialog::loadPhotoData()"; std::cerr << std::endl; bool moreData = true; while(moreData) { RsPhotoPhoto photo; if (rsPhoto->getPhoto(token, photo)) { std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId; std::cerr << " PhotoId: " << photo.mMeta.mMsgId; std::cerr << std::endl; addPhoto(photo); } else { moreData = false; } } } /********************************/ void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req) { std::cerr << "PhotoDialog::loadRequest()"; std::cerr << std::endl; if (queue == mPhotoQueue) { /* now switch on req */ switch(req.mType) { case TOKENREQ_GROUPINFO: switch(req.mAnsType) { case RS_TOKREQ_ANSTYPE_LIST: loadAlbumList(req.mToken); break; case RS_TOKREQ_ANSTYPE_DATA: loadAlbumData(req.mToken); break; default: std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE"; std::cerr << std::endl; break; } break; case TOKENREQ_MSGINFO: switch(req.mAnsType) { case RS_TOKREQ_ANSTYPE_LIST: loadPhotoList(req.mToken); break; //case RS_TOKREQ_ANSTYPE_DATA: // loadPhotoData(req.mToken); // break; default: std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE"; std::cerr << std::endl; break; } break; case TOKENREQ_MSGRELATEDINFO: switch(req.mAnsType) { case RS_TOKREQ_ANSTYPE_DATA: loadPhotoData(req.mToken); break; default: std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE"; std::cerr << std::endl; break; } break; default: std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE"; std::cerr << std::endl; break; } } } #endif
[ "drbob7@b45a01b8-16f6-495d-af2f-9b41ad6348cc" ]
drbob7@b45a01b8-16f6-495d-af2f-9b41ad6348cc
5c0ea989061cf8905182c1f9d7854ec4a114fe8b
6faec993cf6bfe80d57d078d4fb4bc568bb8f0bf
/libnd4j/include/graph/impl/FlatUtils.cpp
a186fec79d549da566633833741e5c4cc07929d4
[ "Apache-2.0" ]
permissive
CyberAMS/deeplearning4j
fac11f912e80d1c5979b23975ac23c4ec8a60c89
cd39da09c5ed0ad75c92271a727ca1be9238af02
refs/heads/master
2020-03-23T03:28:17.039984
2018-12-30T03:09:18
2018-12-30T03:09:18
141,032,332
0
0
null
2018-07-15T14:06:24
2018-07-15T14:06:24
null
UTF-8
C++
false
false
1,944
cpp
// // Created by raver119 on 22.11.2017. // #include <graph/FlatUtils.h> #include <array/DataTypeConversions.h> #include <array/DataTypeUtils.h> #include <array/ByteOrderUtils.h> namespace nd4j { namespace graph { std::pair<int, int> FlatUtils::fromIntPair(IntPair *pair) { return std::pair<int, int>(pair->first(), pair->second()); } std::pair<Nd4jLong, Nd4jLong> FlatUtils::fromLongPair(LongPair *pair) { return std::pair<Nd4jLong, Nd4jLong>(pair->first(), pair->second()); } template<typename T> NDArray<T> *FlatUtils::fromFlatArray(const nd4j::graph::FlatArray *flatArray) { auto rank = static_cast<int>(flatArray->shape()->Get(0)); auto newShape = new Nd4jLong[shape::shapeInfoLength(rank)]; memcpy(newShape, flatArray->shape()->data(), shape::shapeInfoByteLength(rank)); // empty arrays is special case, nothing to restore here if (shape::isEmpty(newShape)) { delete[] newShape; return NDArray<T>::createEmpty(); } auto length = shape::length(newShape); auto newBuffer = new T[length]; auto dtype = DataTypeUtils::fromFlatDataType(flatArray->dtype()); DataTypeConversions<T>::convertType(newBuffer, (void *)flatArray->buffer()->data(), dtype, ByteOrderUtils::fromFlatByteOrder(flatArray->byteOrder()), length); auto array = new NDArray<T>(newBuffer, newShape); array->triggerAllocationFlag(true, true); return array; } template NDArray<float> *FlatUtils::fromFlatArray<float>(const nd4j::graph::FlatArray *flatArray); template NDArray<float16> *FlatUtils::fromFlatArray<float16>(const nd4j::graph::FlatArray *flatArray); template NDArray<double> *FlatUtils::fromFlatArray<double>(const nd4j::graph::FlatArray *flatArray); } }
[ "noreply@github.com" ]
noreply@github.com
25b28684a577fc9a1b47968cf36d5d1959a6c3e3
a28b980552034505c6d1c0b00ea4c4fab27ea070
/Queue/Queue/Queue.cpp
35d0dac77730458895a83e93ed4e775cc7424f86
[]
no_license
pawel927/Algorithms_and_Data_Structures
18508743bb50ec7b493e2bbecefc1af72aee918c
20d3a65684363a03e1c5de0a8268dfff2d6e3293
refs/heads/master
2020-04-21T22:14:11.832921
2019-02-09T19:45:21
2019-02-09T19:45:21
169,904,352
0
0
null
null
null
null
UTF-8
C++
false
false
899
cpp
๏ปฟ#include "pch.h" #include <iostream> using namespace std; struct Queue { int data; Queue *next; Queue *prev; public: void Enque(int); void Deque(); void Print(Queue*); }*head, *tail; void Queue::Enque(int data) { Queue *temp; temp = new Queue; temp->data = data; temp->next = NULL; if (head == NULL) { head = temp; tail = temp; } else { tail->next = temp; tail = temp; } } void Queue::Deque() { if (head == NULL) return; else { Queue *temp; temp = head->next; head = NULL; head = temp; } } void Queue::Print(Queue *head) { cout << "Your queue: " << endl; while (head) { cout << head->data << endl; head = head->next; } } int main() { Queue *q = new Queue; q->Enque(4); q->Enque(5); q->Enque(4); q->Enque(2); q->Enque(9); q->Print(head); q->Deque(); q->Deque(); q->Deque(); q->Print(head); system("PAUSE"); return 0; }
[ "oledzkip@student.mini.pw.edu.pl" ]
oledzkip@student.mini.pw.edu.pl
4d2f39af0f8a52ddbd1aea4400e062a12046837c
d09945668f19bb4bc17087c0cb8ccbab2b2dd688
/2012-2016/2014/k4pc/d.cpp
fa4492496192d791c9e73e35ab7c10d6026fba3b
[]
no_license
kmjp/procon
27270f605f3ae5d80fbdb28708318a6557273a57
8083028ece4be1460150aa3f0e69bdb57e510b53
refs/heads/master
2023-09-04T11:01:09.452170
2023-09-03T15:25:21
2023-09-03T15:25:21
30,825,508
23
2
null
2023-08-18T14:02:07
2015-02-15T11:25:23
C++
UTF-8
C++
false
false
1,392
cpp
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<to;x++) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll N,C; ll A[100020],B[100020],F[100020]; pair<ll,int> P[1000050]; ll ma=0; vector<pair<ll,ll> > V; void solve() { int i,j,k,l,r,y; string s; cin>>N>>C; FOR(i,N) { cin>>A[i]>>B[i]>>F[i]; P[i]=make_pair(B[i],i); } V.push_back(make_pair(0,0)); sort(P,P+N); FOR(j,N) { i=P[j].second; ll x=F[i]-C*(B[i]-A[i]); // first vector<pair<ll,ll> >::iterator it=lower_bound(V.begin(),V.end(),make_pair(A[i]+1,0LL)); it--; x=max(x,it->second + F[i] - C*(B[i]-it->first)); while(V.size() && V.back().first==B[i] && V.back().second<x) V.pop_back(); int ng=0; if(V.size() && V.back().second-C*(B[i]-V.back().first)>=x) ng=1; if(ng==0) V.push_back(make_pair(B[i],x)); ma=max(ma,x); } cout<<ma<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }
[ "kmjp" ]
kmjp
53e409fab186566f8eba838536d61dfff49cef11
eb65408619e25e4bfcf94487167679c252325f29
/tags/4.0.2/source/ngc/input.cpp
a4023e8d42fff730d9b2e6523596f3abf10d80ee
[]
no_license
feraligatr/snes9xgx
7fde45a7b3accc44e12665a724e1c9364b9b81d4
82ef1aa724b6eadc3414b0dda845711c99c57940
refs/heads/master
2021-01-22T10:07:33.584185
2012-11-10T05:52:23
2012-11-10T05:52:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
21,644
cpp
/**************************************************************************** * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May-June 2007 * Michniewski 2008 * Tantric 2008-2009 * * input.cpp * * Wii/Gamecube controller management ***************************************************************************/ #include <gccore.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <ogcsys.h> #include <unistd.h> #include <wiiuse/wpad.h> #include "snes9x.h" #include "memmap.h" #include "controls.h" #include "snes9xGX.h" #include "button_mapping.h" #include "s9xconfig.h" #include "menu.h" #include "video.h" #include "input.h" #include "gui/gui.h" int rumbleRequest[4] = {0,0,0,0}; GuiTrigger userInput[4]; #ifdef HW_RVL static int rumbleCount[4] = {0,0,0,0}; #endif // hold superscope/mouse/justifier cursor positions static int cursor_x[5] = {0,0,0,0,0}; static int cursor_y[5] = {0,0,0,0,0}; /**************************************************************************** * Controller Functions * * The following map the Wii controls to the Snes9x controller system ***************************************************************************/ #define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \ S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), true) #define ASSIGN_BUTTON_FALSE( keycode, snescmd ) \ S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), false) int scopeTurbo = 0; // tracks whether superscope turbo is on or off u32 btnmap[4][4][12]; // button mapping void ResetControls() { memset(btnmap, 0, sizeof(btnmap)); int i; /*** Gamecube controller Padmap ***/ i=0; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_R; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT; /*** Wiimote Padmap ***/ i=0; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_RIGHT; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN; /*** Classic Controller Padmap ***/ i=0; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_A; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_B; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_X; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_R; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT; /*** Nunchuk + wiimote Padmap ***/ i=0; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_B; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_C; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_Z; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_2; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_1; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_UP; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_LEFT; btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT; /*** Superscope : GC controller button mapping ***/ i=0; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_A; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_B; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_Y; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START; /*** Superscope : wiimote button mapping ***/ i=0; btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS; btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN; btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; /*** Mouse : GC controller button mapping ***/ i=0; btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_A; btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_B; /*** Mouse : wiimote button mapping ***/ i=0; btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; /*** Justifier : GC controller button mapping ***/ i=0; btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_B; btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_A; btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_START; /*** Justifier : wiimote button mapping ***/ i=0; btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B; btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; } #ifdef HW_RVL /**************************************************************************** * ShutoffRumble ***************************************************************************/ void ShutoffRumble() { for(int i=0;i<4;i++) { WPAD_Rumble(i, 0); rumbleCount[i] = 0; } } /**************************************************************************** * DoRumble ***************************************************************************/ void DoRumble(int i) { if(rumbleRequest[i] && rumbleCount[i] < 3) { WPAD_Rumble(i, 1); // rumble on rumbleCount[i]++; } else if(rumbleRequest[i]) { rumbleCount[i] = 12; rumbleRequest[i] = 0; } else { if(rumbleCount[i]) rumbleCount[i]--; WPAD_Rumble(i, 0); // rumble off } } /**************************************************************************** * WPAD_Stick * * Get X/Y value from Wii Joystick (classic, nunchuk) input ***************************************************************************/ s8 WPAD_Stick(u8 chan, u8 right, int axis) { float mag = 0.0; float ang = 0.0; WPADData *data = WPAD_Data(chan); switch (data->exp.type) { case WPAD_EXP_NUNCHUK: case WPAD_EXP_GUITARHERO3: if (right == 0) { mag = data->exp.nunchuk.js.mag; ang = data->exp.nunchuk.js.ang; } break; case WPAD_EXP_CLASSIC: if (right == 0) { mag = data->exp.classic.ljs.mag; ang = data->exp.classic.ljs.ang; } else { mag = data->exp.classic.rjs.mag; ang = data->exp.classic.rjs.ang; } break; default: break; } /* calculate x/y value (angle need to be converted into radian) */ if (mag > 1.0) mag = 1.0; else if (mag < -1.0) mag = -1.0; double val; if(axis == 0) // x-axis val = mag * sin((PI * ang)/180.0f); else // y-axis val = mag * cos((PI * ang)/180.0f); return (s8)(val * 128.0f); } #endif /**************************************************************************** * UpdateCursorPosition * * Updates X/Y coordinates for Superscope/mouse/justifier position ***************************************************************************/ void UpdateCursorPosition (int pad, int &pos_x, int &pos_y) { #define SCOPEPADCAL 20 // gc left joystick signed char pad_x = PAD_StickX (pad); signed char pad_y = PAD_StickY (pad); if (pad_x > SCOPEPADCAL){ pos_x += (pad_x*1.0)/SCOPEPADCAL; if (pos_x > 256) pos_x = 256; } if (pad_x < -SCOPEPADCAL){ pos_x -= (pad_x*-1.0)/SCOPEPADCAL; if (pos_x < 0) pos_x = 0; } if (pad_y < -SCOPEPADCAL){ pos_y += (pad_y*-1.0)/SCOPEPADCAL; if (pos_y > 224) pos_y = 224; } if (pad_y > SCOPEPADCAL){ pos_y -= (pad_y*1.0)/SCOPEPADCAL; if (pos_y < 0) pos_y = 0; } #ifdef HW_RVL struct ir_t ir; // wiimote ir WPAD_IR(pad, &ir); if (ir.valid) { pos_x = (ir.x * 256) / 640; pos_y = (ir.y * 224) / 480; } else { signed char wm_ax = WPAD_Stick (pad, 0, 0); signed char wm_ay = WPAD_Stick (pad, 0, 1); if (wm_ax > SCOPEPADCAL){ pos_x += (wm_ax*1.0)/SCOPEPADCAL; if (pos_x > 256) pos_x = 256; } if (wm_ax < -SCOPEPADCAL){ pos_x -= (wm_ax*-1.0)/SCOPEPADCAL; if (pos_x < 0) pos_x = 0; } if (wm_ay < -SCOPEPADCAL){ pos_y += (wm_ay*-1.0)/SCOPEPADCAL; if (pos_y > 224) pos_y = 224; } if (wm_ay > SCOPEPADCAL){ pos_y -= (wm_ay*1.0)/SCOPEPADCAL; if (pos_y < 0) pos_y = 0; } } #endif } /**************************************************************************** * decodepad * * Reads the changes (buttons pressed, etc) from a controller and reports * these changes to Snes9x ***************************************************************************/ void decodepad (int pad) { int i, offset; float t; signed char pad_x = PAD_StickX (pad); signed char pad_y = PAD_StickY (pad); u32 jp = PAD_ButtonsHeld (pad); #ifdef HW_RVL signed char wm_ax = 0; signed char wm_ay = 0; u32 wp = 0; wm_ax = WPAD_Stick ((u8)pad, 0, 0); wm_ay = WPAD_Stick ((u8)pad, 0, 1); wp = WPAD_ButtonsHeld (pad); u32 exp_type; if ( WPAD_Probe(pad, &exp_type) != 0 ) exp_type = WPAD_EXP_NONE; #endif /*** Gamecube Joystick input ***/ // Is XY inside the "zone"? if (pad_x * pad_x + pad_y * pad_y > PADCAL * PADCAL) { /*** we don't want division by zero ***/ if (pad_x > 0 && pad_y == 0) jp |= PAD_BUTTON_RIGHT; if (pad_x < 0 && pad_y == 0) jp |= PAD_BUTTON_LEFT; if (pad_x == 0 && pad_y > 0) jp |= PAD_BUTTON_UP; if (pad_x == 0 && pad_y < 0) jp |= PAD_BUTTON_DOWN; if (pad_x != 0 && pad_y != 0) { /*** Recalc left / right ***/ t = (float) pad_y / pad_x; if (t >= -2.41421356237 && t < 2.41421356237) { if (pad_x >= 0) jp |= PAD_BUTTON_RIGHT; else jp |= PAD_BUTTON_LEFT; } /*** Recalc up / down ***/ t = (float) pad_x / pad_y; if (t >= -2.41421356237 && t < 2.41421356237) { if (pad_y >= 0) jp |= PAD_BUTTON_UP; else jp |= PAD_BUTTON_DOWN; } } } #ifdef HW_RVL /*** Wii Joystick (classic, nunchuk) input ***/ // Is XY inside the "zone"? if (wm_ax * wm_ax + wm_ay * wm_ay > PADCAL * PADCAL) { if (wm_ax > 0 && wm_ay == 0) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_RIGHT : WPAD_BUTTON_RIGHT; if (wm_ax < 0 && wm_ay == 0) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_LEFT : WPAD_BUTTON_LEFT; if (wm_ax == 0 && wm_ay > 0) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_UP : WPAD_BUTTON_UP; if (wm_ax == 0 && wm_ay < 0) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_DOWN : WPAD_BUTTON_DOWN; if (wm_ax != 0 && wm_ay != 0) { /*** Recalc left / right ***/ t = (float) wm_ay / wm_ax; if (t >= -2.41421356237 && t < 2.41421356237) { if (wm_ax >= 0) { wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_RIGHT : WPAD_BUTTON_RIGHT; } else { wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_LEFT : WPAD_BUTTON_LEFT; } } /*** Recalc up / down ***/ t = (float) wm_ax / wm_ay; if (t >= -2.41421356237 && t < 2.41421356237) { if (wm_ay >= 0) { wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_UP : WPAD_BUTTON_UP; } else { wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_DOWN : WPAD_BUTTON_DOWN; } } } } #endif /*** Fix offset to pad ***/ offset = ((pad + 1) << 4); /*** Report pressed buttons (gamepads) ***/ for (i = 0; i < MAXJP; i++) { if ( (jp & btnmap[CTRL_PAD][CTRLR_GCPAD][i]) // gamecube controller #ifdef HW_RVL || ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_PAD][CTRLR_WIIMOTE][i]) ) // wiimote || ( (exp_type == WPAD_EXP_CLASSIC) && (wp & btnmap[CTRL_PAD][CTRLR_CLASSIC][i]) ) // classic controller || ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & btnmap[CTRL_PAD][CTRLR_NUNCHUK][i]) ) // nunchuk + wiimote #endif ) S9xReportButton (offset + i, true); else S9xReportButton (offset + i, false); } /*** Superscope ***/ if (Settings.SuperScopeMaster && pad == 0) // report only once { // buttons offset = 0x50; for (i = 0; i < 5; i++) { if (jp & btnmap[CTRL_SCOPE][CTRLR_GCPAD][i] #ifdef HW_RVL || wp & btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i] #endif ) { if(i == 3) // if turbo button pressed, turn turbo on Settings.TurboMode |= 1; else S9xReportButton(offset + i, true); } else if (i == 3) Settings.TurboMode |= 0; else S9xReportButton(offset + i, false); } // pointer offset = 0x80; UpdateCursorPosition(pad, cursor_x[0], cursor_y[0]); S9xReportPointer(offset, (u16) cursor_x[0], (u16) cursor_y[0]); } /*** Mouse ***/ else if (Settings.MouseMaster && pad == 0) { // buttons offset = 0x60 + (2 * pad); for (i = 0; i < 2; i++) { if (jp & btnmap[CTRL_MOUSE][CTRLR_GCPAD][i] #ifdef HW_RVL || wp & btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i] #endif ) S9xReportButton(offset + i, true); else S9xReportButton(offset + i, false); } // pointer offset = 0x81; UpdateCursorPosition(pad, cursor_x[1 + pad], cursor_y[1 + pad]); S9xReportPointer(offset + pad, (u16) cursor_x[1 + pad], (u16) cursor_y[1 + pad]); } /*** Justifier ***/ else if (Settings.JustifierMaster && pad < 2) { // buttons offset = 0x70 + (3 * pad); for (i = 0; i < 3; i++) { if (jp & btnmap[CTRL_JUST][CTRLR_GCPAD][i] #ifdef HW_RVL || wp & btnmap[CTRL_JUST][CTRLR_WIIMOTE][i] #endif ) S9xReportButton(offset + i, true); else S9xReportButton(offset + i, false); } // pointer offset = 0x83; UpdateCursorPosition(pad, cursor_x[3 + pad], cursor_y[3 + pad]); S9xReportPointer(offset + pad, (u16) cursor_x[3 + pad], (u16) cursor_y[3 + pad]); } #ifdef HW_RVL // screenshot (temp) if (wp & CLASSIC_CTRL_BUTTON_ZR) S9xReportButton(0x90, true); else S9xReportButton(0x90, false); #endif } /**************************************************************************** * NGCReportButtons * * Called on each rendered frame * Our way of putting controller input into Snes9x ***************************************************************************/ void NGCReportButtons () { int i, j; Settings.TurboMode = ( userInput[0].pad.substickX > 70 || userInput[0].WPAD_Stick(1,0) > 70 ); // RIGHT on c-stick and on classic controller right joystick /* Check for menu: * CStick left * OR "L+R+X+Y" (eg. Hombrew/Adapted SNES controllers) * OR "Home" on the wiimote or classic controller * OR LEFT on classic right analog stick */ for(i=0; i<4; i++) { if ( (userInput[i].pad.substickX < -70) || (userInput[i].pad.btns_h & PAD_TRIGGER_L && userInput[i].pad.btns_h & PAD_TRIGGER_R && userInput[i].pad.btns_h & PAD_BUTTON_X && userInput[i].pad.btns_h & PAD_BUTTON_Y ) || (userInput[i].wpad.btns_d & WPAD_BUTTON_HOME) || (userInput[i].wpad.btns_d & WPAD_CLASSIC_BUTTON_HOME) ) { ConfigRequested = 1; // go to the menu } } j = (Settings.MultiPlayer5Master == true ? 4 : 2); for (i = 0; i < j; i++) decodepad (i); } void SetControllers() { if (Settings.MultiPlayer5Master == true) { S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0); S9xSetController (1, CTL_MP5, 1, 2, 3, -1); } else if (Settings.SuperScopeMaster == true) { S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0); S9xSetController (1, CTL_SUPERSCOPE, 0, 0, 0, 0); } else if (Settings.MouseMaster == true) { S9xSetController (0, CTL_MOUSE, 0, 0, 0, 0); S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0); } else if (Settings.JustifierMaster == true) { S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0); S9xSetController(1, CTL_JUSTIFIER, 1, 0, 0, 0); } else { // Plugin 2 Joypads by default S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0); S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0); } } /**************************************************************************** * Set the default mapping for NGC ***************************************************************************/ void SetDefaultButtonMap () { int maxcode = 0x10; s9xcommand_t cmd; /*** Joypad 1 ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 A"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 B"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 X"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Y"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 L"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 R"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Start"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Select"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Up"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Down"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Left"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Right"); maxcode = 0x20; /*** Joypad 2 ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 A"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 B"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 X"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Y"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 L"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 R"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Start"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Select"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Up"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Down"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Left"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Right"); maxcode = 0x30; /*** Joypad 3 ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 A"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 B"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 X"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Y"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 L"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 R"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Start"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Select"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Up"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Down"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Left"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Right"); maxcode = 0x40; /*** Joypad 4 ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 A"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 B"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 X"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Y"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 L"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 R"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Start"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Select"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Up"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Down"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Left"); ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Right"); maxcode = 0x50; /*** Superscope ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Fire"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope AimOffscreen"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Pause"); maxcode = 0x60; /*** Mouse ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Mouse1 L"); ASSIGN_BUTTON_FALSE (maxcode++, "Mouse1 R"); ASSIGN_BUTTON_FALSE (maxcode++, "Mouse2 L"); ASSIGN_BUTTON_FALSE (maxcode++, "Mouse2 R"); maxcode = 0x70; /*** Justifier ***/ ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 Trigger"); ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 AimOffscreen"); ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 Start"); ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 Trigger"); ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 AimOffscreen"); ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 Start"); maxcode = 0x80; S9xMapPointer(maxcode++, S9xGetCommandT("Pointer Superscope"), false); S9xMapPointer(maxcode++, S9xGetCommandT("Pointer Mouse1"), false); S9xMapPointer(maxcode++, S9xGetCommandT("Pointer Mouse2"), false); S9xMapPointer(maxcode++, S9xGetCommandT("Pointer Justifier1"), false); S9xMapPointer(maxcode++, S9xGetCommandT("Pointer Justifier2"), false); maxcode = 0x90; ASSIGN_BUTTON_FALSE (maxcode++, "Screenshot"); SetControllers(); }
[ "dborth@d154fe42-be53-0410-aac0-356034171556" ]
dborth@d154fe42-be53-0410-aac0-356034171556
2d89fd11b4895fc7c6451975b78e378e7200066c
0fed3d6c4a6dbdb49029913b6ce96a9ede9eac6c
/Spring2019/Week04/B.cpp
d1924d2c441376de5bf1cb74128913815db75a65
[]
no_license
87ouo/The-road-to-ACMer
72df2e834027dcfab04b02ba0ddd350e5078dfc0
0a39a9708a0e7fd0e3b2ffff5d1f4a793b031df5
refs/heads/master
2021-02-18T17:44:29.937434
2019-07-31T11:30:27
2019-07-31T11:30:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,503
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define ENABLE_FREAD namespace io_impl { inline bool maybe_digit(char c) { return c >= '0' && c <= '9'; } inline bool maybe_decimal(char c) { return (c >= '0' && c <= '9') || (c == '.'); } struct io_s { bool negative; bool ok = true; char ch = next_char(); int precious = 6; long double epslion = 1e-6; #ifdef ENABLE_FREAD inline char next_char() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } #else inline char next_char() const { return getchar(); } #endif /// read int template <typename T> inline bool rn(T& _v) { negative = false; _v = 0; while (!maybe_digit(ch) && ch != EOF) { negative = ch == '-'; ch = next_char(); }; if (ch == EOF) return ok = false; do { _v = (_v << 1) + (_v << 3) + ch - '0'; } while (maybe_digit(ch = next_char())); if (negative) _v = -_v; return true; } template <typename T> inline void rn_unsafe(T& _v) { negative = false; _v = 0; while (!maybe_digit(ch)) { negative = ch == '-'; ch = next_char(); }; do { _v = (_v << 1) + (_v << 3) + ch - '0'; } while (maybe_digit(ch = next_char())); if (negative) _v = -_v; } template <typename T> inline T rn() { T v = T(); rn_unsafe(v); return v; } inline int ri() { return rn<int>(); } inline ll rll() { return rn<ll>(); } /// read unsigned template <typename T> inline bool run(T& _v) { _v = 0; while (!maybe_digit(ch) && ch != EOF) ch = next_char(); if (ch == EOF) return ok = false; do { _v = (_v << 1) + (_v << 3) + ch - '0'; } while (maybe_digit(ch = next_char())); return true; } template <typename T> inline void run_unsafe(T& _v) { _v = 0; while (!maybe_digit(ch)) ch = next_char(); do { _v = (_v << 1) + (_v << 3) + ch - '0'; } while (maybe_digit(ch = next_char())); } template <typename T> inline T run() { T v = T(); run_unsafe(v); return v; } /// read double template <typename T> inline bool rd(T& _v) { negative = false; _v = 0; while (!maybe_digit(ch) && ch != EOF) { negative = ch == '-'; ch = next_char(); }; if (ch == EOF) return ok = false; do { _v = (_v * 10) + (ch - '0'); } while (maybe_digit(ch = next_char())); static int stk[70], tp; if (ch == '.') { tp = 0; T _v2 = 0; while (maybe_digit(ch = next_char())) { stk[tp++] = ch - '0'; } while (tp--) { _v2 = _v2 / 10 + stk[tp]; } _v += _v2 / 10; } if (ch == 'e' || ch == 'E') { ch = next_char(); static bool _neg = false; if (ch == '+') ch = next_char(); else if (ch == '-') _neg = true, ch = next_char(); if (maybe_digit(ch)) { _v *= pow(10, run<ll>() * (_neg ? -1 : 1)); } } if (negative) _v = -_v; return true; } template <typename T> inline T rd() { T v = T(); rd(v); return v; } /// read string inline int gets(char* s) { char* c = s; while (ch == '\n' || ch == '\r' || ch == ' ') ch = next_char(); if (ch == EOF) return (ok = false), *c = 0; do { *(c++) = ch; ch = next_char(); } while (ch != '\n' && ch != '\r' && ch != ' ' && ch != EOF); *(c++) = '\0'; return static_cast<int>(c - s - 1); } inline int getline(char* s) { char* c = s; while (ch == '\n' || ch == '\r') ch = next_char(); if (ch == EOF) return (ok = false), *c = 0; do { *(c++) = ch; ch = next_char(); } while (ch != '\n' && ch != '\r' && ch != EOF); *(c++) = '\0'; return static_cast<int>(c - s - 1); } inline char get_alpha() { while (!isalpha(ch)) ch = next_char(); const char ret = ch; ch = next_char(); return ret; } inline char get_nonblank() { while (isblank(ch)) ch = next_char(); const char ret = ch; ch = next_char(); return ret; } inline char get_char() { const char ret = ch; ch = next_char(); return ret; } template <typename T> inline void o(T p) { static int stk[70], tp; if (p == 0) { putchar('0'); return; } if (p < 0) { p = -p; putchar('-'); } while (p) stk[++tp] = p % 10, p /= 10; while (tp) putchar(stk[tp--] + '0'); } template <typename T> inline void od(T v) { static int stk[70], tp; tp = 0; if (fabs(v) < epslion / 10) { putchar('0'); if (precious > 0) { putchar('.'); for (int i = 0; i < precious; ++i) putchar('0'); } return; } else { if (v < 0) { v = -v; putchar('-'); } v += epslion / 2; T p = floor(v) + epslion / 10; while (fabs(p) > 1 - epslion) { stk[++tp] = fmod(p, 10), p /= 10; } while (tp) putchar(stk[tp--] + '0'); } if (precious == 0) return; putchar('.'); v -= floor(v); for (int i = 0; i < precious; ++i) { v *= 10; putchar((int)floor(v) + '0'); v = fmod(v, 1); } } /// Enhancement typedef void io_operator(io_s& v); typedef char* charptr; template <typename T> inline io_s& operator>>(T& x) { if (numeric_limits<T>::is_signed) rn(x); else run(x); return *this; } template <typename T> inline io_s& operator<<(const T& x); inline io_s& operator<<(io_operator* v) { v(*this); return *this; } operator bool() const { return ok; } void set_precious(int x) { precious = x; epslion = pow(10, -x); } }; template <> inline io_s& io_s::operator>>(char*& x) { gets(x); return *this; } template <> inline io_s& io_s::operator>>(float& x) { rd(x); return *this; } template <> inline io_s& io_s::operator>>(double& x) { rd(x); return *this; } template <> inline io_s& io_s::operator>>(long double& x) { rd(x); return *this; } template <> inline void io_s::o(const char* p) { printf(p); } template <> inline void io_s::o(const char p) { putchar(p); } template <> inline void io_s::o(float p) { od(p); } template <> inline void io_s::o(double p) { od(p); } template <> inline void io_s::o(long double p) { od(p); } template <typename T> inline io_s& io_s::operator<<(const T& x) { o(x); return *this; } inline void new_line(io_s& v) { v.o('\n'); } io_s::io_operator* nl = new_line; } // namespace io_impl using namespace io_impl; io_s io; namespace solution { const int N = 5e6 + 5; int arr[N]; int main() { int n; while (io >> n) { for (int i = 0; i < n; ++i) io >> arr[i]; std::sort(arr, arr + n); bool ok = false; for (int i = 0; i <= n - 3; ++i) { if (ll(arr[i]) + arr[i + 1] > arr[i + 2]) { ok = true; break; } } if (ok) io << "YES" << nl; else io << "NO" << nl; } return 0; } } // namespace solution int main() { return solution::main(); }
[ "cubercsl@163.com" ]
cubercsl@163.com
6b5350ba12ffb39633a2c5f226d70b6c610b1c82
af0ecafb5428bd556d49575da2a72f6f80d3d14b
/CodeJamCrawler/dataset/14_23047_90.cpp
2bc41763ba7b2332cd46071e6a6b72a3f011f4fd
[]
no_license
gbrlas/AVSP
0a2a08be5661c1b4a2238e875b6cdc88b4ee0997
e259090bf282694676b2568023745f9ffb6d73fd
refs/heads/master
2021-06-16T22:25:41.585830
2017-06-09T06:32:01
2017-06-09T06:32:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,809
cpp
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cmath> #include <cstring> #include <cstdlib> #include <ctime> #include <cassert> #include <iostream> #include <fstream> #include <sstream> #include <algorithm> #include <string> #include <vector> #include <set> #include <map> #include <list> #include <complex> #pragma comment(linker, "/STACK:266777216") using namespace std; #define assert(f) { if(!(f)) { fprintf(stderr,"Assertion failed: "); fprintf(stderr,#f); fprintf(stderr,"\n"); exit(1); } } typedef long long LL; typedef unsigned long long ULL; typedef vector<int> VI; typedef vector<VI> VVI; typedef pair<int,int> PII; typedef vector<PII> VPII; typedef vector<double> VD; typedef pair<double,double> PDD; const int inf=1000000000; const LL INF=LL(inf)*inf; const double eps=1e-9; const double PI=2*acos(0.0); #define bit(n) (1<<(n)) #define bit64(n) ((LL(1))<<(n)) #define pb push_back #define sz size() #define mp make_pair #define cl clear() #define all(a) (a).begin(),(a).end() #define fill(ar,val) memset((ar),(val),sizeof (ar)) #define MIN(a,b) {if((a)>(b)) (a)=(b);} #define MAX(a,b) {if((a)<(b)) (a)=(b);} #define sqr(x) ((x)*(x)) #define X first #define Y second clock_t start=clock(); int main() { freopen("1.in","r",stdin); freopen("1.out","w",stdout); int TST,tst=0; for(scanf("%d",&TST);TST--;) { printf("Case #%d: ",++tst); fprintf(stderr,"Case #%d:\n",tst); double ans = 1e20; double C,F,X; cin >> C >> F >> X; double T=0; double V=2; while(ans > T) { double tX = X/V; MIN(ans, T + tX); double tC = C/V; T += tC; V += F; } printf("%.8lf\n",ans); } fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start)); return 0; }
[ "nikola.mrzljak@fer.hr" ]
nikola.mrzljak@fer.hr
ac6ef47b46a5f074d154f50c81046cfb522f3deb
25ef8052a5097a5b3e5f362c69267b2482c34956
/stop_watch_v2.h
0932110994ee52e352b1157cf1dc3d68210e5438
[ "MIT" ]
permissive
shines77/RtlStringMatch
1f1dbd820ca85d3b3904e600b56bdee1188be870
3ef1d0073907ba89d1ad691404ec9ac662020cae
refs/heads/master
2021-07-14T16:08:09.780932
2020-07-19T17:37:49
2020-07-19T17:37:49
84,928,662
2
1
null
null
null
null
UTF-8
C++
false
false
14,073
h
#pragma once #if defined(_WIN32) || defined(WIN32) || defined(OS_WINDOWS) || defined(__WINDOWS__) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #include <windows.h> #endif // WIN32_LEAN_AND_MEAN #include <mmsystem.h> #pragma comment(lib, "winmm.lib") #endif // _WIN32 #include <chrono> #include <mutex> #ifndef __COMPILER_BARRIER #if defined(_MSC_VER) || defined(__INTEL_COMPILER) || defined(__ICL) #define __COMPILER_BARRIER() _ReadWriteBarrier() #else #define __COMPILER_BARRIER() asm volatile ("" : : : "memory") #endif #endif using namespace std::chrono; class StopWatch { private: std::chrono::time_point<high_resolution_clock> start_time_; std::chrono::time_point<high_resolution_clock> stop_time_; double elapsed_time_; double total_elapsed_time_; bool running_; static std::chrono::time_point<high_resolution_clock> base_time_; public: StopWatch() : elapsed_time_(0.0), total_elapsed_time_(0.0), running_(false) { start_time_ = std::chrono::high_resolution_clock::now(); }; ~StopWatch() {}; void reset() { __COMPILER_BARRIER(); elapsed_time_ = 0.0; total_elapsed_time_ = 0.0; start_time_ = std::chrono::high_resolution_clock::now(); running_ = false; __COMPILER_BARRIER(); } void restart() { __COMPILER_BARRIER(); running_ = false; elapsed_time_ = 0.0; total_elapsed_time_ = 0.0; start_time_ = std::chrono::high_resolution_clock::now(); running_ = true; __COMPILER_BARRIER(); } void start() { if (!running_) { elapsed_time_ = 0.0; start_time_ = std::chrono::high_resolution_clock::now(); running_ = true; } __COMPILER_BARRIER(); } void stop() { __COMPILER_BARRIER(); if (running_) { stop_time_ = std::chrono::high_resolution_clock::now(); running_ = false; } } void mark_start() { start_time_ = std::chrono::high_resolution_clock::now(); running_ = true; __COMPILER_BARRIER(); } void mark_stop() { __COMPILER_BARRIER(); stop_time_ = std::chrono::high_resolution_clock::now(); running_ = false; } double getIntervalSecond() { __COMPILER_BARRIER(); if (!running_) { std::chrono::duration<double> interval_time = std::chrono::duration_cast< std::chrono::duration<double> >(stop_time_ - start_time_); elapsed_time_ = interval_time.count(); } return elapsed_time_; } double getIntervalMillisec() { return getIntervalSecond() * 1000.0; } void continues() { start(); } void pause() { __COMPILER_BARRIER(); stop(); __COMPILER_BARRIER(); double elapsed_time = getIntervalSecond(); __COMPILER_BARRIER(); total_elapsed_time_ += elapsed_time; } static double now() { __COMPILER_BARRIER(); std::chrono::duration<double> _now = std::chrono::duration_cast< std::chrono::duration<double> > (std::chrono::high_resolution_clock::now() - base_time_); __COMPILER_BARRIER(); return _now.count(); } double peekElapsedSecond() { __COMPILER_BARRIER(); std::chrono::time_point<high_resolution_clock> now_time = std::chrono::high_resolution_clock::now(); __COMPILER_BARRIER(); std::chrono::duration<double> interval_time = std::chrono::duration_cast< std::chrono::duration<double> >(now_time - start_time_); return interval_time.count(); } double peekElapsedMillisec() { return peekElapsedSecond() * 1000.0; } double getElapsedSecond() { __COMPILER_BARRIER(); stop(); __COMPILER_BARRIER(); return getIntervalSecond(); } double getElapsedMillisec() { return getElapsedMillisec() * 1000.0; } double getTotalSecond() const { __COMPILER_BARRIER(); return total_elapsed_time_; } double getTotalMillisec() const { __COMPILER_BARRIER(); return total_elapsed_time_ * 1000.0; } }; std::chrono::time_point<high_resolution_clock> StopWatch::base_time_ = std::chrono::high_resolution_clock::now(); #if defined(_WIN32) || defined(WIN32) || defined(OS_WINDOWS) || defined(__WINDOWS__) class StopWatch_v2 { private: size_t start_time_; size_t stop_time_; double elapsed_time_; double total_elapsed_time_; bool running_; public: StopWatch_v2() : start_time_(0), stop_time_(0), elapsed_time_(0.0), total_elapsed_time_(0.0), running_(false) {}; ~StopWatch_v2() {}; void reset() { __COMPILER_BARRIER(); elapsed_time_ = 0.0; total_elapsed_time_ = 0.0; start_time_ = timeGetTime(); running_ = false; __COMPILER_BARRIER(); } void restart() { __COMPILER_BARRIER(); running_ = false; elapsed_time_ = 0.0; total_elapsed_time_ = 0.0; start_time_ = timeGetTime(); running_ = true; __COMPILER_BARRIER(); } void start() { if (!running_) { elapsed_time_ = 0.0; start_time_ = timeGetTime(); running_ = true; } __COMPILER_BARRIER(); } void stop() { __COMPILER_BARRIER(); if (running_) { stop_time_ = timeGetTime(); running_ = false; } } void mark_start() { start_time_ = timeGetTime(); running_ = true; __COMPILER_BARRIER(); } void mark_stop() { __COMPILER_BARRIER(); stop_time_ = timeGetTime(); running_ = false; } double getIntervalSecond() { __COMPILER_BARRIER(); if (!running_) { elapsed_time_ = (double)(stop_time_ - start_time_) / 1000.0; } return elapsed_time_; } double getIntervalMillisec() { return getIntervalSecond() * 1000.0; } void continues() { start(); } void pause() { __COMPILER_BARRIER(); stop(); __COMPILER_BARRIER(); double elapsed_time = getIntervalSecond(); __COMPILER_BARRIER(); total_elapsed_time_ += elapsed_time; } static double now() { __COMPILER_BARRIER(); double _now = static_cast<double>(timeGetTime()) / 1000.0; __COMPILER_BARRIER(); return _now; } double peekElapsedSecond() { __COMPILER_BARRIER(); size_t now_time = timeGetTime(); __COMPILER_BARRIER(); double interval_time = (double)(now_time - start_time_) / 1000.0; return interval_time; } double peekElapsedMillisec() { return peekElapsedSecond() * 1000.0; } double getElapsedSecond() { __COMPILER_BARRIER(); stop(); __COMPILER_BARRIER(); return getIntervalSecond(); } double getElapsedMillisec() { return getElapsedSecond() * 1000.0; } double getTotalSecond() const { __COMPILER_BARRIER(); return total_elapsed_time_; } double getTotalMillisec() const { __COMPILER_BARRIER(); return total_elapsed_time_ * 1000.0; } }; #else typedef StopWatch StopWatch_v2; #endif // _WIN32 #if defined(_WIN32) || defined(WIN32) || defined(OS_WINDOWS) || defined(__WINDOWS__) typedef StopWatch stop_watch; #else typedef StopWatch stop_watch; #endif // _WIN32 template <typename T> class StopWatchBase { public: typedef T impl_type; typedef typename impl_type::time_float_t time_float_t; typedef typename impl_type::time_stamp_t time_stamp_t; typedef typename impl_type::time_point_t time_point_t; typedef typename impl_type::duration_type duration_type; // The zero value time. const time_float_t kTimeZero = static_cast<time_float_t>(0.0); // 1 second = 1000 millisec const time_float_t kMillisecCoff = static_cast<time_float_t>(1000.0);; private: time_point_t start_time_; time_point_t stop_time_; time_float_t elapsed_time_; time_float_t total_elapsed_time_; bool running_; static time_point_t base_time_; public: StopWatchBase() : elapsed_time_(kTimeZero), total_elapsed_time_(kTimeZero), running_(false) { start_time_ = impl_type::get_now(); }; ~StopWatchBase() {}; void reset() { __COMPILER_BARRIER(); elapsed_time_ = kTimeZero; total_elapsed_time_ = kTimeZero; start_time_ = impl_type::get_now(); running_ = false; __COMPILER_BARRIER(); } void restart() { __COMPILER_BARRIER(); running_ = false; elapsed_time_ = kTimeZero; total_elapsed_time_ = kTimeZero; start_time_ = impl_type::get_now(); running_ = true; __COMPILER_BARRIER(); } void start() { if (!running_) { elapsed_time_ = kTimeZero; start_time_ = impl_type::get_now(); running_ = true; } __COMPILER_BARRIER(); } void stop() { __COMPILER_BARRIER(); if (running_) { stop_time_ = impl_type::get_now(); running_ = false; __COMPILER_BARRIER(); elapsed_time_ = this->getIntervalTime(); } } void mark_start() { start_time_ = impl_type::get_now(); running_ = true; __COMPILER_BARRIER(); } void mark_stop() { __COMPILER_BARRIER(); stop_time_ = impl_type::get_now(); running_ = false; } void continues() { this->start(); } void pause() { __COMPILER_BARRIER(); if (running_) { stop_time_ = impl_type::get_now(); running_ = false; __COMPILER_BARRIER(); elapsed_time_ = this->getIntervalTime(); total_elapsed_time_ += elapsed_time_; } __COMPILER_BARRIER(); } void again() { __COMPILER_BARRIER(); stop(); __COMPILER_BARRIER(); if (elapsed_time_ != kTimeZero) { total_elapsed_time_ += elapsed_time_; elapsed_time_ = kTimeZero; } } static time_stamp_t now() { __COMPILER_BARRIER(); time_stamp_t _now = impl_type::now(impl_type::get_now(), base_time_); __COMPILER_BARRIER(); return _now; } time_float_t getIntervalTime() const { __COMPILER_BARRIER(); return impl_type::get_interval_time(stop_time_, start_time_); } time_float_t getIntervalSecond() { __COMPILER_BARRIER(); if (!running_) { elapsed_time_ = this->getIntervalTime(); } return elapsed_time_; } time_float_t getIntervalMillisec() { return this->getIntervalSecond() * kMillisecCoff; } time_float_t peekElapsedSecond() const { __COMPILER_BARRIER(); time_float_t elapsed_time = impl_type::get_interval_time(impl_type::get_now(), start_time_); __COMPILER_BARRIER(); return elapsed_time; } time_float_t peekElapsedMillisec() const { return this->peekElapsedSecond() * kMillisecCoff; } time_float_t getElapsedSecond() { __COMPILER_BARRIER(); stop(); __COMPILER_BARRIER(); return elapsed_time_; } time_float_t getElapsedMillisec() { return getElapsedSecond() * kMillisecCoff; } time_float_t getTotalSecond() const { __COMPILER_BARRIER(); return total_elapsed_time_; } time_float_t getTotalMillisec() const { __COMPILER_BARRIER(); return total_elapsed_time_ * kMillisecCoff; } }; template <typename T> typename StopWatchBase<T>::time_point_t StopWatchBase<T>::base_time_ = StopWatchBase<T>::impl_type::get_now(); template <typename TimeFloatType> class StdStopWatchImpl { public: typedef TimeFloatType time_float_t; typedef double time_stamp_t; typedef std::chrono::time_point<high_resolution_clock> time_point_t; typedef std::chrono::duration<time_stamp_t> duration_type; public: StdStopWatchImpl() {} ~StdStopWatchImpl() {} static time_point_t get_now() { return std::chrono::high_resolution_clock::now(); } static time_float_t get_interval_time(time_point_t now_time, time_point_t old_time) { duration_type interval_time = std::chrono::duration_cast<duration_type>(now_time - old_time); return interval_time.count(); } static time_stamp_t now(time_point_t now_time, time_point_t base_time) { duration_type interval_time = std::chrono::duration_cast<duration_type>(now_time - base_time); return static_cast<time_stamp_t>(interval_time.count()); } }; typedef StopWatchBase<StdStopWatchImpl<double>> StdStopWatch; #if defined(_WIN32) || defined(WIN32) || defined(OS_WINDOWS) || defined(__WINDOWS__) template <typename TimeFloatType> class timeGetTimeStopWatchImpl { public: typedef TimeFloatType time_float_t; typedef DWORD time_stamp_t; typedef DWORD time_point_t; typedef time_float_t duration_type; public: timeGetTimeStopWatchImpl() {} ~timeGetTimeStopWatchImpl() {} static time_point_t get_now() { return ::timeGetTime(); } static time_float_t get_interval_time(time_point_t now_time, time_point_t old_time) { time_point_t interval_time = now_time - old_time; return (static_cast<time_float_t>(interval_time) / static_cast<time_float_t>(1000)); } static time_stamp_t now(time_point_t now_time, time_point_t base_time) { return now_time; } }; typedef StopWatchBase<timeGetTimeStopWatchImpl<double>> timeGetTimeStopWatch; #else typedef StdStopWatch timeGetTimeStopWatch; #endif // _WIN32 #undef __COMPILER_BARRIER
[ "gz_shines@msn.com" ]
gz_shines@msn.com
3bcb21c646fe22a3b4eb9cf03e60996ce02d3cfb
9f677e0c52a34fa233a5ca2de8fd9b920096088b
/examples/cmake_integration/resources/cxtpl/example_includes.hpp
97d2d45fa2c4c189434c4fd9df690294fb7b0f45
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
blockspacer/CXTPL
86ec73d4e69de0e0b951d94da17321cfc62b538f
586b146c6a68b79a310ba20d133a0ca6211f22cc
refs/heads/master
2022-04-18T19:18:52.237072
2020-04-17T14:06:34
2020-04-17T14:06:34
208,968,178
13
22
MIT
2019-10-31T05:21:38
2019-09-17T05:41:29
Python
UTF-8
C++
false
false
183
hpp
๏ปฟ/// \file That file includes files required for /// code generation based on template `.cxtpl`, /// such as template parameters. #pragma once #include <string> #include <vector>
[ "trofimov_d_a@magnit.ru" ]
trofimov_d_a@magnit.ru
d100225d1253557b1ad1263fee0b6a7243dd2a0e
4c1c784d9e76c55945138b17f40c9b999d2efa34
/Firmware/O2minipop.ino
b429b72b5689ab2e0e130b57976a9a71a143f32d
[]
no_license
nandino/DrumSeq
e56036da062811dbbf220e1dd61ff666a5f2eee6
2fc2dd796d8c20bb03774fc35eb11786f810aee8
refs/heads/master
2021-07-15T10:51:58.488045
2017-10-10T16:38:41
2017-10-10T16:38:41
106,442,966
0
0
null
null
null
null
UTF-8
C++
false
false
109,300
ino
#include <Arduino.h> #include <avr/interrupt.h> #include <avr/io.h> #include <avr/pgmspace.h> #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif // Standard Arduino Pins #define digitalPinToPortReg(P) \ (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) #define digitalPinToDDRReg(P) \ (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) #define digitalPinToPINReg(P) \ (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) #define digitalPinToBit(P) \ (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (P) - 14)) #define digitalReadFast(P) bitRead(*digitalPinToPINReg(P), digitalPinToBit(P)) #define digitalWriteFast(P, V) bitWrite(*digitalPinToPortReg(P), digitalPinToBit(P), (V)) const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); //--------- Ringbuf parameters ---------- uint8_t Ringbuffer[256]; uint8_t RingWrite=0; uint8_t RingRead=0; volatile uint8_t RingCount=0; volatile uint16_t SFREQ; //----------------------------------------- //Patterns GU BG2 BD CL CW MA CY QU /* 16 steps ------------ Hard rock Disco Reggae Rock Samba Rumba Cha-Cha Swing Bossa Nova Beguine Synthpop 12-steps --------- Boogie Waltz Jazz rock Slow rock Oxygen */ const unsigned char patlen[16] PROGMEM = {15,15,15,15,15,15,15,15,15,15,15,11,11,11,11,11}; const unsigned char pattern[256] PROGMEM = { B00101100, //Hard rock16 B00000000, B00000100, B00000000, B00101110, B00000000, B00100100, B00000000, B00101100, B00000000, B00000100, B00000000, B00101110, B00000000, B00000100, B00000000, B00100100, //Disco16 B00000000, B00000100, B00010100, B00100110, B00000000, B00000001, B00000100, B00100100, B00000000, B00000100, B00000100, B01100110, B00000100, B01000001, B00000000, B01000001, //Reegae16 B00000100, B10000000, B00000000, B00010110, B00000000, B10010000, B00000000, B00100000, B00000000, B10010000, B00000000, B00000110, B00000000, B10000100, B00000000, B00100100, //Rock16 B00000000, B00000100, B00000000, B00000110, B00000000, B00100100, B00000000, B00100100, B00000000, B00000100, B00000000, B00000110, B00000000, B00000110, B00000000, B10110101, //Samba16 B00010100, B10000100, B00010100, B10110100, B00000100, B01000100, B10010100, B00100100, B10010100, B01000100, B10010100, B10110101, B00000100, B10010100, B00000100, B00100110, //Rumba16 B00000100, B00000001, B00110100, B00100100, B00000001, B00010110, B00000100, B00100100, B00000100, B00010001, B00100100, B00110100, B00000100, B01000001, B00000100, B00100100, //Cha-Cha16 B00000000, B00000000, B00000000, B00000110, B00000000, B01000000, B00000000, B00100100, B00000000, B00000010, B00000000, B01000101, B00000000, B00000010, B00000000, B00100100, //Swing16 B00000000, B00000000, B00000000, B00000100, B00000000, B00000000, B00000100, B00000100, B00000000, B00000000, B00000000, B00000100, B00000000, B00000000, B00000100, B00100001, //Bossa Nova16 B00000100, B00000100, B00100100, B00100001, B00000100, B01000100, B00000100, B00100001, B00000100, B00000100, B00100000, B00100001, B01000101, B00000100, B00000100, B00100110, //Beguine16 B00000000, B00000001, B00000000, B00000100, B00000000, B01100110, B00000000, B00100100, B00000000, B01000100, B00000100, B00100110, B00000000, B00000100, B00000000, B10100000, //Synthpop16 B00000000, B10100010, B00000000, B00100000, B00000000, B00100110, B00000100, B01100000, B00000000, B01100110, B00000100, B00100000, B00000000, B00100010, B10001000, B00100000, //Boogie12 B00000000, B00100100, B00000110, B00000000, B00100100, B00100100, B00000000, B00100100, B00000110, B00000000, B00100100, B00000000, B00000000, B00000000, B00000000, B00100100, //Waltz12 B00000000, B00000000, B00000000, B00010010, B00000000, B00000000, B00000000, B00010010, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00100110, //Jazz rock12 B00000000, B00000100, B00000000, B00000110, B00000000, B00000100, B00000000, B00000110, B00000000, B01100000, B00000000, B00000000, B00000000, B00000000, B00000000, B00100100, //Slow rock12 B00000000, B00000100, B00000000, B00000100, B00000000, B00000110, B00000000, B00000100, B00000000, B00100100, B00000000, B00000000, B00000000, B00000000, B00000000, B00100101, //Oxygen12 B00001100, B00000100, B00101110, B00000100, B00010100, B00100101, B00000100, B00000100, B00101100, B00000100, B11100100, B00000000, B00000000, B00000000, B00000000 }; const unsigned char BD[1076] PROGMEM = { 126,122,118,114,111,108,105,103,101,99,98,96,95,94,94,93,93,92,92,92,92,92,92,92,92,93,93,93,94,94,95,96,96,97,97,98,99,100,100,101,102,103,103,104,105,106,107,108,108,109,110,111,112,113,113,114,115,116,117,118,118,119,120,121,122,123,124,124,125,126,127,128,129,129,130,131,132,133,134,134,135,136,137,138,138,139,140,141,141,142,143,144,144,145,146,147, 147,148,149,149,150,151,151,152,153,153,154,154,155,156,156,157,157,158,158,159,159,160,160,161,161,162,162,162,163,163,164,164,164,165,165,165,165,166,166,166,166,167,167,167,167,167,167,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,167,167,167,167,167,167,166,166,166,166,165,165,165,165,164,164,164,163,163,163,162,162,161,161,161,160,160,159,159,158,158,157,157,156,156,155, 155,154,154,153,152,152,151,151,150,150,149,148,148,147,146,146,145,144,144,143,142,142,141,140,140,139,138,138,137,136,136,135,134,133,133,132,131,131,130,129,129,128,127,126,126,125,124,124,123,122,122,121,120,120,119,118,118,117,116,116,115,115,114,113,113,112,112,111,110,110,109,109,108,108,107,106,106,105,105,104,104,103,103,102,102,102,101,101,100,100,99,99,99,98,98,97,97,97,96,96, 96,96,95,95,95,94,94,94,94,93,93,93,93,93,93,92,92,92,92,92,92,92,92,92,92,91,91,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,94,94,94,94,95,95,95,95,96,96,96,97,97,97,97,98,98,99,99,99,100,100,100,101,101,102,102,102,103,103,104,104,105,105,106,106,107,107,108,108,109,109,110,110,111,111,112,112,113,113, 114,114,115,115,116,117,117,118,118,119,119,120,120,121,121,122,123,123,124,124,125,125,126,127,127,128,128,129,129,130,131,131,132,132,133,133,134,134,135,135,136,136,137,137,138,138,139,139,140,140,141,141,142,142,143,143,144,144,145,145,145,146,146,147,147,147,148,148,148,149,149,149,150,150,150,151,151,151,152,152,152,152,153,153,153,153,153,154,154,154,154,154,155,155,155,155,155,155,155,155, 156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,155,155,155,155,155,155,155,155,155,154,154,154,154,153,153,153,153,152,152,152,152,151,151,151,150,150,150,150,149,149,149,148,148,148,147,147,146,146,146,145,145,145,144,144,143,143,143,142,142,141,141,141,140,140,139,139,139,138,138,137,137,137,136,136,135,135,134,134,134,133,133,132,132,132,131,131,130,130,130,129,129,128, 128,128,127,127,126,126,126,125,125,125,124,124,124,123,123,123,122,122,122,121,121,121,120,120,120,119,119,119,119,118,118,118,118,117,117,117,117,116,116,116,116,115,115,115,115,115,115,114,114,114,114,114,114,114,113,113,113,113,113,113,113,113,113,113,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,113,113,113,113,113,113,113,113,113,113, 113,114,114,114,114,114,114,114,114,115,115,115,115,115,115,116,116,116,116,116,116,117,117,117,117,117,117,118,118,118,118,118,119,119,119,119,119,120,120,120,120,121,121,121,121,121,122,122,122,122,122,123,123,123,123,124,124,124,124,124,125,125,125,125,125,126,126,126,126,126,127,127,127,127,128,128,128,128,128,128,129,129,129,129,129,130,130,130,130,130,130,131,131,131,131,131,131,132,132,132, 132,132,132,132,133,133,133,133,133,133,133,133,134,134,134,134,134,134,134,134,134,134,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,136,136,136,136,136,136,136,136,136,136,136,136,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,134,134,134,134,134,134,134,134,134,134,134,134,134,133,133,133,133,133,133,133,133, 133,133,133,133,132,132,132,132,132,132,132,132,132,132,131,131,131,131,131,131,131,131,131,131,131,130,130,130,130,130,130,130,130,130,130,130,130,129,129,129,129,129,129,129,129,129,129,129,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, 127,127,127,127,126,126,126,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, }; const unsigned char BG2[1136] PROGMEM = { 128,122,108,96,86,80,78,79,82,89,98,108,119,131,143,155,167,178,188,198,206,212,217,220,222,221,219,215,210,203,195,185,174,162,149,136,122,108,94,80,67,54,42,32,23,15,9,5,2,1,2,5,11,16,23,32,43,54,67,80,95,109,124,138,153,166,179,192,203,213,221,228,234,238,240,240,239,236,232,226,219,211,201,191,179,167,155,142,129,117,104,92,81,71,62,54, 48,43,39,37,36,37,40,43,49,55,63,72,82,92,103,115,127,138,150,161,172,182,191,199,206,212,217,220,221,222,221,219,215,210,204,197,188,179,170,159,149,138,127,116,105,95,85,76,68,61,55,50,47,45,44,44,46,49,53,59,65,73,81,90,99,109,119,129,139,149,158,167,175,182,189,194,198,201,203,204,204,202,199,196,191,185,178,171,163,154,145,136,127,117,108,99,91,83,76,70, 65,61,57,55,54,54,55,58,61,66,71,77,84,91,99,108,116,125,134,142,150,158,165,172,178,182,186,190,192,193,193,192,190,187,183,178,173,167,160,153,146,138,130,122,115,107,100,93,87,81,77,73,70,67,66,66,66,68,71,74,78,83,88,95,101,108,115,123,130,137,144,151,157,163,168,173,177,180,182,183,184,184,182,180,178,174,170,165,159,154,147,141,134,128,121,115,109,103,97,92, 88,84,81,79,77,76,76,77,79,81,85,88,93,98,103,109,115,121,127,133,139,145,150,156,160,164,168,171,173,175,176,176,175,174,172,169,166,162,158,153,148,143,137,132,126,120,115,110,105,100,96,93,90,88,86,85,85,85,86,88,90,93,96,100,104,109,114,119,124,129,134,139,144,149,153,157,160,163,165,167,168,168,168,167,166,164,162,159,156,152,148,143,139,134,129,125,120,115,111,107, 103,100,97,95,93,92,92,91,92,93,95,97,99,102,106,109,113,118,122,126,131,135,139,143,147,150,153,156,158,160,161,162,162,162,161,160,158,156,153,150,147,143,139,136,131,128,124,120,116,112,109,106,104,101,100,98,98,97,97,98,99,100,102,105,107,110,113,117,120,124,128,131,135,139,142,145,148,150,152,154,155,156,157,157,156,155,154,153,151,148,146,143,140,136,133,130,126,123,120,117, 114,111,109,107,105,104,103,102,102,102,103,104,105,107,109,111,114,117,120,123,126,129,132,135,138,141,143,145,147,149,150,151,152,152,152,152,151,150,148,146,144,142,139,137,134,131,128,126,123,120,117,115,113,111,109,108,107,106,106,106,106,107,108,109,111,113,115,117,119,122,124,127,130,132,135,137,139,141,143,145,146,147,148,148,148,148,148,147,146,144,143,141,139,137,135,132,130,127,125,123, 120,118,116,115,113,112,111,110,110,109,109,110,110,111,113,114,116,117,119,121,124,126,128,130,132,134,136,138,140,141,142,144,144,145,145,145,145,144,144,143,141,140,138,137,135,133,131,129,127,125,123,121,119,118,116,115,114,113,113,112,112,112,113,113,114,115,116,118,119,121,123,125,127,128,130,132,134,135,137,138,139,140,141,142,142,142,142,142,141,141,140,139,137,136,135,133,131,130,128,126, 125,123,121,120,119,118,117,116,115,115,115,115,115,115,116,117,118,119,120,121,123,124,126,128,129,130,132,133,135,136,137,138,139,139,140,140,140,140,140,139,138,138,137,136,134,133,132,130,129,128,126,125,123,122,121,120,119,118,118,117,117,117,117,117,117,118,119,120,121,122,123,124,125,127,128,129,131,132,133,134,135,136,137,137,138,138,138,138,138,138,137,137,136,135,134,133,132,131,130,128, 127,126,125,124,123,122,121,120,120,119,119,119,119,119,119,119,120,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,135,136,136,136,137,137,136,136,136,135,134,134,133,132,131,130,129,128,127,126,125,124,123,122,122,121,121,120,120,120,120,120,120,121,121,122,122,123,124,125,126,127,128,129,129,130,131,132,133,133,134,134,135,135,135,135,135,135,135,134,134,133,132,132,131,130,129, 128,128,127,126,125,124,124,123,123,122,122,121,121,121,121,121,122,122,122,123,124,124,125,126,126,127,128,129,130,130,131,132,132,133,133,134,134,134,134,134,134,134,134,133,133,132,132,131,130,130,129,128,127,127,126,125,125,124,124,123,123,123,122,122,122,122,123,123,123,124,124,124,125,126,126,127,128,128,129,130,130,131,131,132,132,133,133,133,133,133,133,133,133,133,132,132,131,131,130,130, 129,129,128,127,127,126,126,125,125,124,124,124,123,123,123,123,123,123,124,124,124,125,125,126,126,127,127,128,128,129,130,130,130,131,131,132,132,132,132,132,132,132,132,132,132,131,131,131,130,130,129,129,128,128,127,127,126,126,125,125,125,125,124,124,124,124,124,124,125,125,125,125,126,126,126,127,127,128,128,128,129,129,129,130,130,130,130,130,131,131,131,131,131,130,130,130,130,130,129,129, 129,129,128,128,128,128,127,127,127,127,127,126,126,126,126,126,126,126,126,127,127,127,127,127,127,127,128,128,128,128,128,128,129,129,129,129,129,129,129,128, }; const unsigned char CL[752] PROGMEM = { 125,82,65,93,135,172,181,161,118,74,48,54,88,139,184,207,199,166,124,92,86,109,150,192,217,215,187,146,108,90,100,130,166,191,194,171,132,93,68,68,90,123,151,160,147,115,80,54,50,68,100,132,150,147,125,96,72,66,80,111,144,167,172,158,133,109,99,107,132,162,186,194,183,159,132,116,116,131,156,177,185,176,152,124,103,96,105,125,144,154,149,130,104,83,74,80, 98,119,134,135,123,103,84,76,81,99,122,141,148,142,127,111,102,105,121,142,161,171,168,154,137,125,123,133,149,166,175,172,158,139,123,116,119,131,145,153,151,138,120,104,94,95,105,119,129,130,123,108,94,86,87,98,113,126,132,130,120,109,102,103,113,129,143,152,152,144,134,126,125,131,143,156,164,164,156,144,133,127,130,137,147,153,152,144,131,119,111,110,115,124,130,131,125,115,103,96, 96,101,111,120,124,122,116,108,102,102,109,120,130,137,139,134,128,123,122,128,137,147,153,155,150,143,136,133,134,140,147,152,152,147,138,129,123,122,125,130,134,134,130,122,113,107,105,108,114,120,122,120,115,109,104,104,108,115,123,128,129,126,122,119,119,123,130,138,144,145,143,139,135,133,135,140,146,150,150,147,141,135,131,130,132,136,138,138,134,128,121,116,115,116,119,122,123,121,117,112, 108,107,110,114,119,123,123,121,118,116,116,119,125,131,135,137,136,133,131,131,133,137,142,145,146,145,141,137,135,135,136,139,141,141,138,133,128,124,123,123,125,127,127,124,121,116,113,112,113,116,119,120,120,119,116,114,115,117,121,125,129,130,130,128,127,127,130,133,137,140,142,141,139,137,135,136,138,140,142,141,140,136,133,130,129,129,130,131,130,128,125,121,118,117,117,119,120,121,120,118, 116,115,115,116,119,122,124,125,125,124,123,124,126,129,132,135,136,136,135,134,134,135,137,139,140,140,139,137,135,133,132,133,133,134,133,131,129,126,123,122,122,122,123,123,122,120,118,116,116,117,118,120,122,122,122,121,121,121,123,125,128,130,131,131,131,131,131,132,134,136,138,138,138,136,135,134,134,134,135,135,135,133,131,129,127,126,126,126,126,125,124,122,121,119,118,119,119,120,121,121, 120,120,119,120,121,122,124,126,127,127,127,127,128,129,131,133,134,135,135,134,134,134,134,135,135,136,135,135,133,132,130,129,129,129,129,128,127,125,124,122,121,121,121,122,122,121,121,120,119,119,120,121,122,123,124,124,124,125,125,127,128,130,131,132,132,132,132,132,133,134,135,135,135,135,134,133,132,132,131,131,131,130,129,128,127,125,125,124,124,124,124,123,122,121,120,120,121,121,122,122, 123,123,123,123,124,125,126,127,128,129,129,130,130,130,131,132,133,134,134,134,133,133,133,133,133,133,132,132,131,130,129,128,127,127,127,126,126,125,124,123,122,122,122,122,122,123,123,122,122,122,123,123,124,125,126,127,127,127,128,128,129,130,131,132,132,132,132,132,132,132,133,133,133,132,132,131,130,130,129,129,129,128,128,127,127,126,125,125,125,125,125,125,125,124,124,124,124,125,125,126, 126,126,126,127,127,127,128,128,129,129,129,129,129,129,129,130,130,130,130,130,130,130,129,129,129,129,129,129,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128,128, }; const unsigned char CW[830] PROGMEM = { 155,223,121,59,131,200,124,42,93,189,170,83,95,187,206,125,96,165,207,143,82,122,178,140,68,80,143,138,74,64,128,153,107,81,133,178,148,109,137,187,172,122,124,167,167,115,96,130,145,105,76,103,134,113,82,102,142,140,111,118,157,167,138,128,157,171,144,120,134,151,130,100,105,127,119,92,92,119,127,108,105,131,148,136,126,144,164,154,135,141,156,148,124,119,131,129, 108,98,111,119,106,98,112,128,125,117,128,147,149,138,141,155,157,142,134,141,142,127,114,117,122,112,100,104,115,115,108,113,128,134,130,132,145,152,146,141,147,151,142,131,130,132,124,112,110,114,113,105,105,114,120,118,120,130,139,139,138,144,151,149,142,141,143,138,128,122,123,120,112,107,110,113,111,110,116,124,127,128,134,142,145,143,144,147,147,141,135,134,132,124,117,116,115,112,108,109, 114,116,117,121,129,134,135,138,143,147,145,143,143,142,137,131,127,125,120,114,112,112,112,111,112,117,121,124,127,133,138,140,141,144,146,144,141,138,136,132,126,121,119,116,113,111,112,114,114,116,121,126,130,133,137,141,143,143,143,143,141,137,133,130,126,122,117,115,114,112,112,113,116,119,122,126,131,135,137,140,143,144,143,141,139,137,133,128,124,121,118,115,113,113,114,114,117,120,124,128, 131,135,139,141,142,142,142,141,138,135,131,128,123,120,117,115,114,113,114,116,118,121,125,129,133,135,138,141,142,142,141,139,137,133,130,126,123,120,117,115,114,114,115,117,120,123,126,130,134,137,139,140,141,141,140,138,135,132,129,125,122,119,117,115,114,115,116,118,121,124,128,131,134,137,139,140,141,140,139,137,134,131,128,124,121,119,117,116,115,116,117,119,122,125,129,132,135,137,139,140, 140,140,138,136,133,130,127,123,121,118,116,116,116,117,118,121,123,126,130,133,135,138,139,140,140,139,137,135,132,129,126,123,120,118,117,116,116,117,119,122,124,128,131,133,136,138,139,139,139,138,136,133,131,128,125,122,119,118,117,116,117,118,120,123,125,128,131,134,136,138,139,139,138,137,135,132,129,127,124,121,119,118,117,117,118,119,121,124,127,129,132,135,137,138,138,138,137,136,134,131, 128,126,123,121,119,118,117,118,119,120,122,125,128,130,133,135,137,138,138,138,137,135,133,130,127,125,122,120,119,118,118,118,119,121,123,126,129,131,134,135,137,138,138,137,136,134,132,129,126,124,122,120,119,118,118,119,120,122,124,127,129,132,134,136,137,137,137,136,135,133,131,128,126,123,121,120,119,118,119,120,121,123,125,128,130,132,134,136,137,137,136,135,134,132,129,127,125,123,121,119, 119,119,119,120,122,124,126,129,131,133,135,136,136,136,136,135,133,131,128,126,124,122,120,119,119,119,120,121,123,125,127,129,132,133,135,136,136,136,135,134,132,130,128,125,123,121,120,119,119,119,120,122,124,126,128,130,132,134,135,136,136,135,134,133,131,129,127,125,123,121,120,119,119,120,121,123,125,127,129,131,133,134,135,136,135,135,134,132,130,128,126,124,122,121,120,120,120,121,122,124, 126,128,130,132,133,134,135,135,135,134,133,131,129,127,125,123,122,121,120,120,121,122,123,125,127,128,130,132,133,134,134,134,134,133,131,130,128,127,125,124,123,122,122,122,123,124,125,126,127,129,130,131,132,133,133,132,132,131,130,129,128,127,126,125,124,124,124,124,125,125,126,127,128,129,130,131,131,131,131,131,130,130,129,128,128,127,126,126,125,125,125,126,126,127,127,128,128,129,129,130, 130,130,130,129,129,129,128,128,128,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, }; const unsigned char CY[9434] PROGMEM = { 131,129,125,124,129,127,123,129,124,135,117,146,124,118,111,148,145,72,145,119,91,95,159,112,70,130,135,120,95,159,154,83,143,158,90,129,162,123,108,159,90,104,164,137,126,139,155,92,124,165,138,106,152,116,90,198,134,110,111,169,110,135,141,106,127,146,121,122,165,129,111,142,139,124,142,126,123,106,139,133,146,127,115,126,152,116,133,139,131,128,133,112,139,140,91,143, 142,95,148,170,113,136,104,152,127,132,117,115,158,113,137,83,161,163,97,142,141,114,101,141,147,143,118,110,134,142,92,128,172,121,106,168,95,81,185,137,95,106,175,124,105,147,139,91,161,124,108,137,127,144,117,119,140,148,104,121,127,137,122,131,118,131,144,124,125,136,93,160,142,105,141,116,138,107,140,133,138,119,122,120,116,117,136,151,126,125,115,158,111,132,152,90,118,161,122,125, 123,126,128,148,99,112,170,110,121,108,155,127,122,135,121,153,118,120,101,127,150,103,148,160,94,125,149,108,135,139,110,129,137,127,147,111,127,126,134,117,142,132,100,148,130,131,104,137,133,120,126,138,124,147,115,118,145,124,97,159,113,108,154,140,123,116,144,131,112,115,140,124,154,122,115,111,131,160,126,91,155,124,113,141,140,128,117,147,111,119,132,138,128,121,132,100,145,140,114,135, 113,141,129,131,140,98,117,158,133,110,122,161,93,119,161,114,118,157,129,108,141,111,136,136,110,122,136,132,140,122,117,152,116,113,137,137,135,129,120,115,117,152,106,138,144,119,135,126,109,144,139,86,144,151,114,116,146,117,119,133,139,117,139,143,116,113,151,116,121,136,125,124,138,134,97,133,151,112,127,144,112,128,109,163,140,105,129,116,129,148,120,123,144,109,123,152,136,99,124,158, 120,120,138,125,102,134,152,123,130,127,121,120,124,139,120,129,139,142,109,114,145,128,117,138,128,118,127,131,141,119,115,149,142,98,129,153,104,110,167,114,124,142,107,129,136,130,125,133,122,136,137,117,120,123,132,129,129,125,142,121,112,144,123,136,140,123,125,129,128,123,119,133,122,129,136,139,119,112,146,122,121,130,123,120,146,133,118,125,125,131,133,137,119,121,130,141,114,120,155,100, 126,158,111,119,131,132,133,127,122,135,132,128,117,132,126,120,142,113,132,141,122,126,123,130,135,108,140,138,115,122,148,133,125,114,135,126,117,146,119,127,144,128,123,106,110,154,140,133,118,134,135,112,133,131,135,107,130,132,119,140,132,125,120,151,117,120,139,132,112,124,132,128,143,122,117,141,126,131,129,117,118,115,152,140,124,113,138,128,132,123,116,143,113,133,139,134,117,124,127,123, 141,133,122,114,132,140,125,129,108,134,148,119,123,119,147,123,125,136,121,125,129,132,132,135,115,121,130,134,117,152,132,108,131,133,117,127,137,129,129,122,129,110,140,143,124,127,121,132,126,120,149,110,127,146,110,125,143,123,112,135,147,128,115,117,142,136,114,128,134,128,112,127,144,113,132,145,126,121,123,135,137,119,125,133,106,144,137,110,125,137,136,115,125,137,126,133,134,109,126,135, 134,112,135,136,130,119,124,138,112,137,132,119,117,151,122,116,133,118,147,136,100,142,135,111,142,130,115,112,136,142,125,119,141,134,104,138,143,109,132,122,125,137,125,139,127,113,127,137,130,124,126,120,139,139,98,134,144,128,115,133,133,121,108,151,136,104,137,129,128,125,130,117,151,119,115,142,124,125,125,135,136,110,140,133,115,123,132,130,131,130,121,135,115,128,151,114,120,140,121,123, 130,138,123,121,137,122,134,132,100,138,150,123,107,142,135,108,148,129,98,148,138,127,126,126,126,120,133,127,125,136,118,132,137,125,117,129,147,111,130,125,134,121,126,126,142,130,119,127,138,119,115,139,128,135,121,117,151,121,123,136,109,130,154,121,106,147,124,122,136,134,97,143,152,108,121,137,131,130,128,124,136,133,105,135,141,123,126,127,128,128,131,120,136,125,124,127,127,128,142,118, 127,142,127,116,110,141,150,111,129,127,129,135,109,129,145,124,125,121,140,128,102,134,146,142,111,123,126,135,125,124,134,135,116,125,144,114,117,150,118,129,128,120,139,124,136,133,124,121,125,128,134,123,127,138,124,126,124,132,137,128,121,129,126,128,124,119,147,126,122,130,136,119,115,147,139,105,125,131,141,127,117,142,127,116,127,140,120,135,124,123,130,130,138,116,121,139,133,121,118,131, 146,123,122,127,114,157,125,108,144,112,131,153,113,115,147,125,111,137,129,124,140,132,124,120,128,139,110,136,138,118,130,123,130,128,139,116,117,142,116,135,138,120,134,118,122,135,129,134,127,133,124,121,124,143,126,121,136,115,133,144,105,131,137,125,121,129,135,134,133,122,131,110,143,118,133,136,121,131,139,119,112,140,132,130,128,116,122,150,135,93,135,152,124,115,134,135,118,133,123,128, 137,125,115,139,131,125,112,145,129,128,125,126,139,116,118,137,128,139,124,122,132,131,130,120,127,136,120,117,147,114,137,129,122,136,130,126,133,122,117,137,131,115,134,128,128,126,144,131,113,125,142,116,136,121,116,150,113,142,134,111,133,134,119,141,117,132,133,108,143,133,112,133,134,123,128,128,122,138,119,127,142,122,121,136,135,111,131,137,120,134,127,125,122,134,134,124,137,120,124,129, 124,136,117,138,126,118,148,118,119,138,141,119,118,130,140,125,128,127,124,128,136,124,118,135,135,128,114,131,147,117,120,137,131,125,119,139,123,131,119,126,140,128,122,131,134,127,122,116,156,121,108,138,144,113,128,141,117,119,137,126,133,127,128,125,120,137,133,128,114,136,133,129,128,123,129,125,134,121,121,143,129,119,119,149,124,113,147,126,112,123,146,130,112,144,123,132,126,121,134,133, 117,121,142,134,126,112,131,139,125,122,146,116,122,132,129,128,124,133,127,131,127,128,129,122,134,123,127,132,125,132,129,129,114,130,144,122,122,131,137,127,116,122,145,130,115,134,129,138,111,125,149,122,120,132,134,131,107,130,144,126,128,126,128,133,127,115,129,137,130,118,134,135,129,117,129,141,117,131,129,121,134,121,133,135,114,131,132,130,138,106,140,133,121,129,122,129,137,125,131,138, 112,132,126,126,138,130,116,135,123,131,128,125,136,130,115,138,135,116,131,133,124,131,114,132,150,119,123,134,135,121,116,132,138,106,143,140,113,121,136,130,131,123,125,125,137,142,120,121,132,128,126,130,118,129,143,123,120,136,140,113,118,148,116,122,148,115,131,130,125,131,123,131,127,134,131,119,127,140,119,126,133,125,120,139,133,115,139,129,104,148,137,113,121,141,127,127,139,120,120,138, 129,117,135,123,129,128,131,127,132,134,107,139,134,123,129,131,115,133,128,126,132,126,138,126,118,129,140,120,128,130,123,129,130,133,127,117,133,132,133,119,127,130,134,125,121,128,135,125,122,132,139,115,130,135,120,139,117,120,147,124,110,144,131,131,125,121,131,127,127,132,116,131,137,125,124,140,122,116,135,131,130,123,135,115,132,136,130,121,127,139,125,126,124,131,125,132,128,124,126,128, 138,123,118,134,138,126,120,126,131,131,131,124,125,136,122,134,129,118,143,130,113,133,125,133,130,124,122,134,141,127,110,128,139,129,129,110,148,132,107,137,138,108,135,140,120,129,131,123,126,146,111,129,139,121,127,132,122,131,131,126,126,122,131,136,133,125,126,118,141,123,131,125,125,139,127,121,130,129,121,135,126,125,139,125,124,129,132,135,119,125,138,119,132,130,124,132,120,127,131,137, 121,129,125,139,123,125,133,123,126,129,135,115,138,136,118,123,149,122,115,121,138,142,126,116,129,137,124,128,130,129,117,134,137,133,112,124,133,131,128,136,126,121,134,127,134,120,129,126,129,129,131,127,126,135,124,120,133,133,121,130,128,129,121,137,140,112,116,148,127,112,143,134,123,128,131,122,126,125,136,134,123,128,122,136,127,131,134,118,124,135,131,121,126,141,112,135,133,108,150,129, 114,140,137,110,139,126,124,131,124,131,124,133,130,120,133,131,135,132,111,127,137,127,108,156,129,115,140,116,120,150,129,118,125,134,138,116,137,126,122,126,133,127,126,127,132,133,116,127,141,123,128,127,127,139,127,116,135,133,123,131,127,128,131,117,123,148,125,119,134,130,116,128,135,138,113,134,141,113,127,132,123,133,140,113,128,128,127,139,123,125,137,120,117,144,123,125,137,122,119,141, 124,128,130,110,155,125,113,139,131,114,136,126,127,132,128,130,128,129,121,124,143,122,119,135,132,123,122,142,129,119,119,136,138,121,132,129,112,141,128,123,137,123,120,136,133,116,136,130,118,140,122,129,137,122,125,136,122,114,134,145,122,116,130,130,132,126,137,118,121,133,145,125,101,146,145,106,133,142,114,118,146,127,119,138,124,118,137,132,124,126,130,123,128,138,122,130,126,121,133,128, 127,126,134,135,122,121,135,122,132,124,126,130,130,133,118,133,126,126,128,139,127,121,129,123,141,119,126,138,121,137,120,131,123,131,123,132,141,114,128,133,123,129,129,122,140,130,117,135,136,121,118,133,132,118,139,138,117,122,131,137,114,124,146,121,128,132,119,125,141,135,115,130,130,121,141,123,123,132,130,114,136,125,128,148,109,129,138,120,127,127,132,127,132,124,128,140,120,129,128,120, 136,135,111,132,139,117,130,131,118,141,128,123,132,121,132,140,113,125,142,127,121,126,130,128,127,128,131,122,128,135,124,132,131,126,122,130,133,129,126,127,122,127,134,131,126,128,140,125,123,122,140,126,114,139,135,120,128,131,124,129,129,130,128,127,129,126,128,132,118,135,131,112,153,119,120,146,106,139,139,116,126,128,137,126,124,136,127,125,134,126,116,137,138,115,126,137,122,130,133,126, 130,125,134,124,124,129,132,127,129,133,121,133,134,121,128,124,127,130,137,123,123,138,123,127,132,125,122,143,131,120,133,122,127,129,126,133,131,121,121,140,133,120,129,127,132,130,122,135,128,122,126,140,111,127,143,135,118,124,132,136,120,124,135,122,137,123,127,128,136,114,138,126,125,136,121,132,140,105,127,151,115,128,133,126,119,130,136,123,128,128,132,131,113,135,135,123,127,126,135,126, 120,133,132,132,121,130,135,121,128,132,117,131,145,118,120,133,130,124,134,123,132,134,120,132,131,113,128,146,122,127,125,124,141,126,116,122,149,134,107,130,135,129,122,137,132,114,127,138,122,128,127,126,136,119,135,124,125,142,117,124,139,127,119,138,126,124,137,120,127,123,139,127,127,134,115,129,147,116,120,137,126,120,133,142,123,120,122,141,134,110,123,143,135,114,128,140,115,133,133,126, 129,119,133,121,128,145,126,114,129,137,122,129,135,115,129,137,129,127,133,128,125,118,141,122,119,147,118,123,136,125,123,136,124,134,129,118,128,131,131,133,117,124,142,130,114,138,135,118,125,126,137,133,122,125,129,138,123,121,138,127,128,128,131,121,125,131,135,129,126,123,125,137,123,121,132,132,123,135,130,128,122,121,146,130,117,129,136,122,134,124,119,141,132,119,129,133,121,128,128,132, 135,120,127,134,117,136,137,122,120,131,138,117,129,132,131,122,127,138,124,117,133,142,119,128,132,114,142,128,118,141,126,128,127,126,131,121,123,146,120,123,132,127,133,131,125,124,133,128,123,131,129,132,124,121,138,124,134,132,116,129,143,117,130,126,132,122,131,139,116,128,130,131,125,126,136,127,124,131,126,124,131,132,125,126,128,142,117,133,133,116,133,133,125,124,131,128,127,129,128,128, 124,133,126,134,129,115,136,132,132,121,125,131,127,127,131,128,131,120,129,141,117,131,136,115,132,134,121,127,139,126,117,131,138,125,118,140,127,122,131,125,131,138,120,115,140,142,110,131,130,128,127,130,129,120,131,136,122,127,126,122,151,118,120,128,138,130,120,135,125,128,126,131,133,122,124,132,132,124,127,130,128,122,133,134,123,127,132,126,131,123,124,136,128,126,129,129,132,120,124,145, 115,123,144,122,119,137,131,119,137,125,124,126,133,132,125,115,136,141,116,135,133,114,124,145,118,125,127,125,141,134,110,130,143,122,129,124,122,136,127,119,134,134,131,123,123,125,139,122,125,137,123,123,130,137,120,121,147,117,120,141,115,137,140,118,123,136,124,125,121,141,129,122,132,128,124,128,128,123,136,132,122,133,125,122,134,128,130,123,125,130,130,135,124,131,132,110,137,138,117,122, 145,122,123,132,128,129,125,123,134,137,117,121,139,134,113,132,137,127,122,126,126,130,130,129,130,131,127,126,124,133,126,127,134,119,136,130,121,128,138,119,123,133,128,130,127,129,132,124,124,136,132,122,126,124,137,129,124,129,128,129,126,134,118,132,131,131,125,127,128,129,133,125,121,133,135,123,121,133,131,130,124,123,140,127,117,136,130,126,133,124,125,127,129,129,133,124,126,140,115,124, 148,121,116,140,129,119,137,130,125,128,132,123,123,131,126,132,124,128,137,122,127,127,131,135,112,135,135,123,129,123,132,130,128,124,132,126,128,132,126,130,126,132,129,126,120,130,146,116,124,138,123,132,121,130,134,127,130,119,132,139,115,125,139,122,126,123,140,126,125,132,129,128,128,125,123,138,134,122,114,140,142,116,125,135,122,127,134,132,123,136,123,120,143,128,111,134,131,126,134,122, 129,128,130,127,120,137,135,118,123,139,128,127,132,121,129,135,123,124,135,120,136,128,124,127,128,136,127,124,123,138,128,117,137,133,125,124,127,127,131,140,113,129,137,125,126,123,131,136,120,129,129,124,132,129,124,126,138,124,125,131,128,126,133,123,127,131,129,127,123,138,118,128,139,129,113,128,143,125,121,128,135,127,122,134,126,121,134,134,125,123,125,127,142,125,123,133,125,123,137,122, 129,135,117,131,139,113,132,134,122,131,131,136,113,133,135,122,130,127,122,131,130,134,118,124,143,124,123,126,136,126,123,136,121,133,130,118,130,137,124,123,129,133,121,130,130,127,134,121,128,130,134,124,123,134,127,124,131,126,130,133,120,132,131,122,123,130,131,129,130,127,128,123,134,134,116,127,131,132,129,129,125,126,129,128,131,121,131,130,135,118,128,134,129,121,127,134,128,127,121,140, 131,115,126,139,126,123,127,143,115,129,134,121,132,121,136,130,120,136,128,111,137,133,127,121,134,133,120,131,133,122,122,137,129,123,129,132,129,116,128,139,130,119,132,129,130,134,119,126,131,132,125,130,122,131,129,123,137,123,129,126,131,135,120,129,129,127,125,136,126,118,138,124,123,132,132,126,119,138,130,127,129,122,131,134,122,121,139,130,123,124,131,128,127,138,117,128,136,126,126,133, 119,132,133,121,138,126,122,130,127,131,129,122,126,132,133,128,119,128,137,122,131,134,125,123,134,130,123,126,131,124,129,134,123,127,134,124,127,134,126,121,132,132,129,120,132,135,122,126,130,129,132,125,124,135,127,125,127,126,132,134,121,130,130,125,131,128,120,134,132,125,126,135,125,123,134,129,127,129,126,128,125,132,130,123,135,129,118,135,132,118,136,132,123,123,134,130,126,125,133,131, 118,138,134,121,121,134,134,122,129,129,130,127,129,124,130,126,127,143,120,116,134,136,125,131,129,126,125,129,130,128,133,123,123,132,136,123,125,127,134,128,121,136,128,122,129,137,124,122,132,127,127,127,129,133,130,125,128,129,125,125,131,131,129,127,125,132,129,127,128,119,135,136,117,131,132,122,129,129,130,125,130,131,124,126,131,133,124,125,129,135,124,126,133,123,127,135,124,127,126,127, 134,129,125,129,124,131,127,124,133,125,134,128,122,129,133,121,132,130,127,124,124,137,130,117,134,133,116,132,137,123,120,138,129,119,130,131,128,131,123,124,135,124,126,135,125,120,135,134,117,132,134,118,129,132,129,133,124,127,126,127,132,126,126,133,124,123,140,121,124,135,129,126,125,133,127,131,126,129,129,118,132,134,124,130,127,122,132,130,131,124,121,142,120,124,145,118,122,138,127,120, 127,136,131,119,127,134,125,128,135,122,127,133,123,126,137,124,126,129,131,124,126,138,123,128,129,122,127,139,129,124,125,136,124,123,129,132,129,126,129,125,132,124,128,132,130,121,131,133,127,122,131,132,125,124,134,132,120,129,134,125,128,123,133,132,126,127,133,125,125,129,128,124,134,135,117,129,130,136,124,124,129,130,129,132,124,128,129,132,122,126,134,125,120,133,137,123,119,141,132,116, 129,135,127,127,124,122,141,123,130,125,137,122,122,134,128,131,122,130,130,128,127,130,126,130,124,133,134,125,122,133,127,121,135,129,123,132,130,126,132,122,120,138,133,120,132,128,128,129,128,130,127,127,125,131,126,130,130,122,133,131,122,131,127,130,125,121,137,131,128,125,126,132,131,125,123,132,131,122,132,126,133,129,126,128,125,132,129,128,130,125,127,130,124,132,129,129,124,134,130,127, 126,129,132,122,132,125,130,126,129,133,125,126,131,129,124,132,129,130,124,130,127,123,133,130,126,128,124,124,143,129,122,129,126,129,128,131,126,125,135,127,119,135,132,125,123,128,136,121,130,135,126,128,124,132,128,116,138,134,120,130,129,122,132,130,128,127,129,127,131,128,125,129,126,130,126,129,133,125,122,129,131,128,128,132,126,127,125,136,129,124,127,130,125,129,132,126,129,130,120,128, 136,130,121,126,130,132,126,126,129,131,129,118,137,131,124,122,129,134,131,124,124,128,132,128,128,123,129,137,126,127,122,131,132,122,133,132,124,124,131,124,129,137,124,122,133,129,126,126,125,134,133,121,129,129,129,129,123,132,129,127,123,127,134,126,122,135,130,128,126,125,131,133,126,124,129,129,126,129,130,124,128,130,133,126,117,137,135,118,127,135,121,128,135,129,119,125,140,125,124,132, 123,134,128,124,129,131,124,128,133,122,131,131,124,124,132,122,137,133,121,124,129,134,128,125,128,131,127,125,131,126,129,130,125,132,127,126,129,123,133,130,126,127,130,125,129,132,123,131,126,129,132,122,124,140,126,128,127,129,124,128,132,124,130,130,126,128,134,126,126,129,127,126,131,128,129,123,134,133,117,131,135,126,128,122,130,131,126,128,128,130,127,129,125,125,137,128,127,123,132,130, 123,134,127,122,134,134,119,128,135,125,129,134,121,129,131,125,123,135,129,127,132,125,125,127,130,132,127,122,135,125,126,130,126,134,126,128,128,128,125,128,139,120,126,132,128,132,125,125,132,125,125,136,125,128,127,128,129,130,125,128,129,128,133,126,130,126,132,125,128,133,125,129,125,124,135,127,123,137,128,123,133,129,123,131,124,129,134,124,126,133,128,122,132,127,128,130,126,135,126,127, 131,124,131,132,119,133,128,124,136,126,122,133,131,120,132,133,124,126,133,130,122,126,134,124,128,129,132,128,122,131,133,126,121,131,133,125,129,125,131,129,129,122,124,141,125,128,129,126,132,124,125,135,131,117,131,137,119,126,132,135,123,124,125,136,131,123,127,132,129,123,126,132,135,122,126,129,131,124,130,130,126,126,130,135,123,124,133,133,120,124,138,129,119,128,136,127,120,137,126,127, 132,123,128,131,126,130,128,128,129,130,129,118,132,135,128,121,131,132,124,127,133,127,125,125,133,130,127,125,130,128,128,128,124,132,127,129,129,126,126,129,126,137,124,125,130,124,132,129,129,126,128,130,126,127,129,127,133,127,124,130,126,130,128,128,124,132,127,127,134,124,124,132,127,127,132,124,129,127,128,132,125,129,128,127,131,122,130,135,125,122,131,128,132,129,123,127,129,132,124,126, 128,129,128,129,129,130,128,122,133,129,125,128,130,130,126,122,134,130,125,129,127,131,126,122,128,134,126,122,135,132,119,132,132,120,133,130,123,132,130,125,127,131,128,123,129,133,127,129,123,129,134,126,122,133,130,125,128,129,126,126,131,127,136,123,121,135,131,119,128,138,124,121,132,134,124,128,129,128,130,124,131,129,125,130,130,124,131,126,128,130,119,136,128,125,130,132,125,123,130,128, 131,128,127,127,127,127,134,125,126,131,128,125,130,131,124,129,127,128,126,130,133,125,129,131,126,126,131,124,130,129,129,127,129,129,128,129,126,127,129,134,120,125,133,134,126,124,128,127,127,136,125,126,129,128,128,125,134,129,123,130,131,125,130,127,128,129,127,129,127,125,131,128,128,128,120,139,128,124,132,127,124,131,130,126,131,129,123,125,139,124,122,130,131,129,127,129,128,131,126,126, 129,128,130,126,127,129,128,131,128,124,131,128,126,127,132,128,128,125,129,133,126,130,128,124,133,126,126,135,123,125,132,132,125,126,126,128,132,126,127,129,133,123,128,131,126,132,127,126,126,128,132,129,124,129,130,129,124,128,134,124,127,131,130,127,126,124,130,139,124,123,134,125,125,130,132,124,130,127,127,130,124,129,130,132,125,128,131,123,130,134,124,128,131,125,129,127,124,133,130,125, 128,128,126,129,125,132,125,132,127,120,135,129,124,131,127,125,134,126,125,127,133,124,128,129,127,130,128,126,127,131,131,122,124,139,124,123,130,130,127,128,133,119,130,131,129,129,127,127,124,132,130,126,126,128,128,125,134,127,121,134,128,128,127,126,130,130,124,129,128,125,132,132,122,125,130,133,128,122,130,129,131,127,125,131,130,121,132,128,130,129,124,128,130,129,125,126,132,129,125,130, 129,124,131,129,125,129,132,123,127,132,128,126,129,134,124,123,130,133,124,128,129,126,130,129,125,129,125,133,124,127,132,129,125,126,134,124,128,131,127,128,129,127,126,132,127,126,133,128,124,126,135,124,126,132,130,122,127,136,125,123,129,134,130,120,126,138,126,125,127,130,128,126,122,132,135,125,128,130,128,126,128,129,125,131,131,122,133,126,127,127,129,134,123,128,130,124,123,139,130,121, 126,132,132,123,130,129,129,126,124,136,131,123,129,128,127,129,130,127,123,132,125,131,132,126,126,129,131,125,126,131,128,128,127,125,133,132,123,125,131,133,127,125,128,127,129,123,134,131,121,126,140,126,123,124,130,133,131,125,126,130,127,126,132,129,120,136,129,125,130,129,124,128,132,128,123,131,129,127,129,126,130,131,123,129,133,126,124,131,128,126,131,127,127,129,128,130,124,129,131,128, 127,126,132,130,125,126,134,127,123,127,126,137,131,119,126,136,128,123,132,129,127,124,133,128,123,131,129,129,129,125,130,126,131,130,124,130,129,126,129,126,126,130,131,126,126,131,128,128,127,130,124,129,133,126,126,129,127,128,127,130,129,129,128,125,128,132,128,123,126,135,127,125,130,130,128,124,131,130,127,129,125,131,131,123,129,128,125,132,133,123,129,125,129,129,128,127,132,129,125,127, 130,126,129,130,128,127,127,132,123,131,127,130,128,125,127,128,131,129,126,126,128,128,130,131,124,123,138,127,119,133,135,121,124,136,129,118,130,136,126,123,130,128,128,128,129,129,126,126,129,128,126,133,127,125,130,132,124,129,131,124,127,133,128,122,129,132,122,127,133,128,127,128,128,128,126,131,127,124,129,128,130,133,120,129,136,126,123,130,130,128,127,124,133,127,123,130,132,124,128,132, 128,126,126,130,129,125,131,126,128,131,128,126,124,135,128,124,131,126,130,127,130,128,124,130,131,124,126,131,129,127,131,129,122,130,133,123,125,136,126,124,129,130,125,129,129,130,127,126,126,128,132,127,129,124,129,129,129,129,122,125,138,130,120,126,133,128,124,132,127,127,128,130,127,127,127,128,131,126,128,131,127,126,128,129,129,127,129,125,129,129,128,124,125,138,128,119,130,136,126,126, 129,127,130,127,125,129,128,131,126,126,133,127,124,132,128,127,128,128,129,125,129,133,125,124,131,130,125,131,125,125,132,129,127,127,130,126,129,127,131,127,128,125,130,128,127,131,130,127,126,129,128,131,125,132,128,124,128,130,130,124,130,130,123,133,127,127,126,132,127,125,130,129,131,126,126,128,129,130,128,130,126,126,131,128,125,130,128,126,132,129,127,130,128,127,128,125,132,127,126,134, 127,128,132,123,128,130,127,130,127,128,126,130,129,127,130,126,130,128,130,126,129,129,128,126,126,129,129,127,130,133,126,123,132,131,125,127,128,128,134,125,125,132,127,128,128,127,126,135,125,125,128,130,127,128,130,126,127,129,129,129,126,124,135,125,126,134,127,122,130,131,125,130,129,128,127,125,132,130,126,126,129,126,130,130,124,130,130,126,127,127,130,130,125,129,129,124,130,129,126,131, 124,129,133,122,129,131,125,127,128,131,126,128,130,124,129,133,126,124,131,130,125,128,128,130,128,126,125,133,128,125,132,126,129,127,126,132,129,127,128,127,127,130,126,129,128,126,130,129,125,128,128,129,128,127,131,127,124,129,136,122,124,133,127,129,130,126,123,134,129,122,131,129,129,124,128,134,126,125,128,128,132,127,124,128,133,127,127,129,129,126,127,129,130,127,126,130,128,125,127,129, 131,128,123,129,131,125,127,131,129,127,125,131,127,128,127,130,130,124,125,131,131,128,123,129,131,128,127,128,128,127,130,125,132,129,125,128,129,127,129,131,122,132,130,126,128,129,128,128,124,132,127,123,133,127,128,129,128,126,128,129,127,128,133,123,126,135,126,124,131,129,129,124,129,129,129,128,124,131,130,125,130,129,127,129,128,128,128,129,127,126,129,127,131,127,127,130,128,129,126,126, 128,130,130,129,124,129,128,128,127,128,131,127,126,128,130,127,127,128,126,130,130,127,126,131,127,127,133,124,128,132,127,127,127,129,129,129,124,131,130,125,130,126,129,133,124,128,127,127,133,128,126,127,127,127,134,124,130,129,129,124,128,132,126,128,128,129,128,130,127,123,132,133,125,128,127,127,132,129,127,126,129,129,129,127,126,132,128,126,129,127,127,130,129,126,129,129,128,126,130,131, 125,127,130,129,127,129,128,128,129,128,124,132,129,124,131,128,125,131,126,131,129,126,127,131,130,124,131,124,129,134,124,127,130,125,130,128,129,125,128,133,126,128,131,123,131,130,122,132,129,125,127,131,131,125,128,129,128,131,125,126,133,127,124,130,129,131,120,132,137,122,125,130,129,127,129,128,127,129,128,126,130,126,130,130,127,128,127,129,127,127,129,128,129,127,126,128,131,128,126,129, 128,127,129,129,127,127,125,129,130,126,128,129,131,125,131,128,122,130,133,123,127,130,127,128,130,127,125,130,130,124,131,129,122,135,126,126,131,128,127,129,128,128,128,127,127,130,127,127,127,128,132,125,128,131,125,125,130,129,126,130,128,129,127,126,130,126,128,128,129,127,127,128,130,128,126,131,127,127,129,128,128,130,127,126,127,126,134,128,122,133,129,124,130,128,127,127,132,127,128,130, 127,124,129,131,127,128,126,128,131,127,126,129,128,128,127,130,126,130,129,123,131,132,125,128,128,126,129,129,131,124,129,129,126,130,127,127,133,127,123,132,127,128,126,129,131,129,124,128,133,125,127,129,129,125,130,129,127,129,127,127,128,130,126,124,134,127,126,132,126,124,131,131,125,129,127,128,130,124,129,134,123,126,133,128,128,126,130,129,125,131,128,127,128,130,127,126,131,128,126,130, 128,126,130,127,129,126,129,129,125,132,128,124,131,127,126,130,129,127,126,130,128,129,129,129,126,128,131,128,128,127,129,129,127,129,128,129,129,125,125,135,128,124,130,129,126,127,132,128,126,130,128,128,128,125,130,129,131,125,126,132,127,127,127,130,126,129,132,126,127,130,126,129,130,127,127,128,132,125,126,130,131,127,127,130,129,124,127,132,128,130,129,125,128,126,130,130,127,129,128,126, 128,131,127,125,132,128,128,127,125,133,124,130,132,125,125,129,130,128,129,127,127,129,128,129,125,129,128,127,130,130,125,127,130,129,127,127,130,124,131,133,124,126,134,125,124,128,131,127,125,132,128,126,127,132,127,125,128,129,129,129,127,127,128,128,126,130,131,127,125,131,130,122,130,132,126,126,131,128,127,129,125,130,132,124,128,131,128,125,129,129,127,126,129,128,129,128,128,128,127,130, 127,127,129,129,128,129,127,125,131,126,127,133,125,128,128,129,124,131,131,125,130,127,128,129,126,127,132,127,128,127,127,130,128,126,131,130,125,128,129,125,128,133,127,126,130,126,125,133,129,127,127,129,128,128,128,127,129,128,127,126,128,130,127,128,128,131,127,126,128,128,128,128,128,126,130,129,127,127,130,127,127,128,129,127,127,130,127,126,128,127,131,128,127,127,128,132,126,127,130,125, 129,129,127,130,126,128,128,127,126,130,129,126,131,128,124,130,129,127,129,128,128,128,129,127,128,126,128,131,126,130,128,126,129,131,128,126,127,129,130,127,127,127,130,130,124,126,134,126,126,129,129,129,126,128,128,128,128,129,128,127,126,132,128,127,128,129,130,124,128,132,126,126,128,128,128,130,129,128,129,127,125,130,133,124,128,128,130,128,125,130,130,128,128,129,128,127,128,124,129,132, 127,128,129,125,128,128,128,130,125,129,130,128,127,128,128,129,127,128,131,124,127,134,126,125,130,130,125,128,131,126,130,128,126,127,130,131,124,129,130,127,128,128,129,126,127,133,129,126,128,129,127,128,127,129,128,127,128,127,130,128,125,129,130,127,128,126,129,130,126,129,129,128,129,128,128,127,128,130,127,126,132,128,125,130,129,128,127,129,127,127,128,130,130,126,127,127,133,128,123,128, 131,130,125,128,128,131,127,126,129,128,128,127,129,129,127,127,129,128,123,133,129,124,130,130,128,125,129,130,125,129,131,123,129,132,127,127,128,126,130,129,126,130,125,128,132,125,127,128,126,133,128,125,129,130,127,128,129,126,130,127,127,130,128,129,126,128,131,127,128,129,125,128,130,128,129,126,129,129,126,126,129,131,126,127,129,129,127,124,133,131,123,129,130,127,126,128,129,127,127,129, 128,128,129,128,126,127,131,126,127,130,127,126,130,129,127,126,135,124,124,135,125,127,130,125,127,129,127,130,128,128,129,127,127,130,127,126,131,128,127,128,129,130,127,126,127,128,130,129,127,124,131,131,126,126,128,130,127,127,127,130,128,129,127,128,126,129,130,127,128,127,127,130,128,128,128,126,129,128,126,127,131,131,126,124,131,130,126,126,130,128,125,132,128,126,127,129,129,129,127,126, 129,128,127,128,129,129,127,125,132,129,123,129,129,127,128,127,129,130,123,130,131,125,130,129,128,128,127,129,129,127,128,128,128,128,126,129,130,129,126,128,129,128,128,130,128,126,129,128,127,128,131,127,127,130,127,125,132,128,124,129,130,127,127,128,130,126,128,129,127,130,126,128,130,128,127,128,128,129,128,125,129,130,127,128,128,130,128,125,128,131,126,129,128,127,128,129,127,128,128,128, 128,127,128,128,129,127,129,128,127,130,127,128,130,127,128,130,126,128,131,126,127,128,130,127,127,130,127,127,129,127,129,130,126,129,126,129,129,128,128,127,128,129,129,126,129,129,127,127,129,129,128,129,127,127,130,129,127,129,128,125,129,128,129,129,127,129,129,127,128,128,125,132,131,125,127,129,130,128,126,127,131,130,127,129,129,126,127,130,125,130,131,127,127,127,131,127,128,130,127,128, 127,128,129,130,128,126,129,129,127,129,130,126,127,131,125,128,130,127,129,128,128,130,128,126,128,130,127,128,131,125,129,128,127,129,128,128,130,129,127,127,128,129,128,128,128,128,129,130,125,127,131,128,126,129,128,127,130,128,127,127,130,128,128,129,127,127,131,128,125,130,130,124,130,131,126,129,127,129,128,128,127,128,130,127,128,129,128,127,127,129,129,129,126,127,129,130,128,125,129,129, 128,127,128,128,128,128,129,126,129,128,127,127,129,130,127,126,129,125,130,130,126,128,125,130,127,130,129,127,127,128,129,126,129,129,126,131,125,128,130,128,127,130,125,128,127,130,130,124,128,127,129,129,126,129,127,128,129,127,130,128,128,127,129,127,129,127,127,130,128,127,129,129,127,127,130,127,127,127,128,128,129,129,127,126,127,132,126,128,128,128,127,130,127,126,130,128,127,127,128,129, 128,127,129,126,128,128,129,126,127,134,126,126,130,129,128,127,128,131,125,128,129,126,130,126,128,128,129,129,126,127,130,129,126,128,130,127,129,127,128,129,126,127,131,129,126,129,129,127,128,128,128,128,127,129,127,128,131,125,127,133,125,127,131,125,129,129,127,128,129,128,127,128,127,132,127,124,129,131,126,127,128,130,128,126,128,129,129,126,129,128,129,127,128,127,128,130,128,129,128,126, 129,126,130,129,127,127,128,129,129,127,127,131,127,128,128,130,126,128,130,126,129,126,130,130,125,129,129,129,128,127,126,131,129,125,130,129,127,129,126,129,132,126,127,128,129,129,128,128,127,130,129,125,129,130,124,129,133,128,126,127,128,130,128,128,130,126,129,130,125,129,128,127,131,128,126,130,128,128,129,127,129,127,127,130,128,128,129,128,127,129,128,127,128,130,127,127,131,126,127,130, 130,126,128,131,125,128,129,129,127,127,129,128,129,127,128,127,131,130,125,129,130,127,126,129,129,128,128,127,128,130,127,127,130,128,126,128,131,126,127,127,129,129,127,126,130,129,126,127,130,129,127,127,128,131,126,128,129,129,127,128,129,127,127,131,128,125,128,130,128,127,128,128,130,128,125,130,130,127,127,128,127,129,131,127,128,127,127,131,128,126,128,130,127,129,128,127,127,128,127,130, 128,127,128,128,129,126,127,130,128,129,129,128,125,129,130,124,130,131,128,127,127,129,128,127,129,128,126,129,129,127,128,129,129,127,128,128,128,129,128,127,129,129,127,128,128,130,128,126,129,127,127,127,130,128,127,129,127,129,128,127,125,131,127,128,130,126,129,127,127,130,128,127,127,129,129,126,128,129,128,127,129,129,127,128,128,128,126,128,131,128,127,128,128,128,128,128,127,127,129,128, 127,129,127,129,129,128,128,128,128,128,128,128,128,130,128,127,127,128,129,127,127,129,128,128,129,127,128,127,128,127,130,130,126,126,129,129,128,127,127,129,128,128,127,129,128,129,128,126,129,130,126,127,127,131,127,127,131,126,128,128,129,128,128,127,129,130,126,128,130,127,128,128,128,128,127,129,128,126,128,132,124,128,131,126,129,127,129,126,126,132,128,127,129,128,128,128,129,127,128,129, 127,126,130,127,126,132,129,125,128,129,127,129,128,129,128,127,128,128,129,128,127,129,128,126,129,128,127,129,126,129,129,127,129,128,128,128,127,129,127,129,129,126,130,127,127,126,129,130,128,127,127,129,129,127,128,127,128,129,128,127,127,130,128,127,128,130,127,127,129,129,128,128,125,129,131,127,128,127,130,128,125,131,128,124,131,131,125,127,131,128,125,129,132,126,126,129,130,126,127,132, 128,127,129,128,128,127,128,129,126,129,131,126,127,130,128,127,127,130,128,126,129,129,128,128,129,127,128,130,128,127,129,129,126,129,128,127,129,127,127,131,127,128,129,128,129,127,127,129,130,127,128,127,128,130,128,127,127,130,128,126,128,129,129,127,128,129,127,127,129,128,128,129,126,128,130,126,128,129,126,129,129,126,129,129,128,129,127,128,127,126,130,130,127,127,129,126,128,131,126,128, 129,128,127,128,126,130,129,126,128,129,128,126,128,129,126,128,130,128,128,126,127,130,129,126,128,129,127,129,129,126,129,128,128,128,129,126,129,130,126,126,131,128,127,127,127,130,129,126,128,130,125,129,129,127,127,128,129,127,128,129,126,129,128,129,127,128,128,127,129,127,129,127,127,129,128,127,128,128,128,129,128,128,126,129,129,125,128,131,127,128,126,129,130,126,128,128,129,126,128,129, 128,126,128,131,128,126,128,128,128,127,128,128,128,128,128,128,129,128,127,128,129,128,128,128,127,128,128,127,129,129,127,128,128,129,127,128,127,129,128,127,130,127,127,128,130,128,126,128,130,129,125,130,128,128,128,127,128,129,129,127,128,128,127,128,128,129,127,129,129,127,129,127,129,126,128,130,127,128,128,128,130,127,128,129,129,128,128,127,129,129,127,128,129,128,127,128,129,128,129,128, 128,129,126,129,130,128,128,127,129,128,127,128,129,128,127,129,128,128,128,128,128,128,129,128,128,128,129,128,127,127,130,129,125,130,129,125,130,130,127,126,128,129,129,129,126,130,128,128,128,127,129,129,127,128,128,128,128,129,128,128,128,128,128,128,129,126,129,128,128,130,127,127,129,128,128,129,126,130,129,126,127,131,128,126,128,129,127,128,129,127,129,128,129,127,128,129,128,128,127,129, 129,127,128,129,129,127,130,128,127,128,129,128,128,128,129,129,127,129,128,128,128,128,128,129,128,127,128,128,129,128,128,128,127,128,129,128,128,127,129,128,128,128,128,128,129,128,128,128,128,127,128,127,128,130,127,129,128,128,129,128,128,128,128,128,128,126,129,128,128,129,127,128,129,129,128,128,126,128,130,128,125,130,129,126,128,130,127,127,129,128,128,129,127,128,128,127,129,127,128,127, 129,128,127,129,127,128,129,127,128,128,127,129,127,127,129,128,129,128,126,130,129,126,127,129,127,128,130,126,128,128,128,127,128,127,129,130,127,126,129,128,127,129,129,127,129,128,126,129,128,128,128,128,128,126,129,131,127,125,129,129,126,128,128,126,130,130,125,128,129,129,125,130,127,127,131,126,127,129,128,128,128,128,128,127,129,128,127,129,128,127,129,127,128,129,128,127,128,128,128,129, 127,127,129,128,126,128,128,129,128,126,129,128,128,127,128,129,127,128,128,127,128,130,128,127,128,129,127,127,128,129,128,127,130,128,126,129,128,127,128,128,128,129,129,127,128,129,127,129,128,127,128,128,128,127,128,129,127,128,129,127,128,128,128,127,128,129,128,127,129,129,127,127,127,129,127,128,128,129,130,126,127,131,126,127,130,127,128,128,128,129,129,126,129,129,127,127,130,129,126,130, 127,127,129,127,127,128,128,128,128,130,127,127,130,129,127,128,128,128,130,127,127,129,128,127,128,129,128,127,128,128,128,128,128,129,128,127,128,129,129,127,127,129,128,127,129,129,127,127,129,128,128,129,128,128,128,128,127,128,128,129,127,128,129,127,128,130,127,128,130,127,128,129,127,128,129,127,128,129,128,128,128,128,128,128,128,128,129,128,128,129,127,129,128,128,128,129,128,128,129,128, 127,129,129,127,129,129,127,128,129,128,128,127,128,129,127,129,127,130,129,127,129,127,129,128,127,127,131,129,127,126,130,128,127,130,128,127,128,127,129,128,128,128,126,130,129,126,130,129,125,129,129,127,128,129,127,128,129,127,128,129,128,127,128,129,128,127,128,129,127,128,129,127,127,130,129,127,127,128,128,128,127,129,128,128,128,127,127,130,128,125,130,129,126,127,128,128,129,127,129,128, 128,128,128,129,127,128,128,128,128,128,127,128,130,127,127,128,127,130,128,126,129,128,127,128,128,128,127,128,128,128,127,128,127,128,129,128,128,129,128,127,129,127,128,130,127,127,130,127,127,128,128,127,129,127,128,129,127,129,128,128,127,128,129,127,128,128,128,126,129,130,127,128,127,129,128,127,129,128,127,128,129,126,128,131,126,127,131,128,126,128,128,128,127,129,126,130,128,127,127,128, 130,127,127,128,128,129,128,129,128,127,129,128,129,127,128,128,129,128,127,127,129,128,127,127,128,129,128,126,128,130,128,128,127,128,128,129,127,128,129,128,127,128,129,127,128,128,128,128,129,127,129,128,128,128,129,128,128,127,128,129,127,128,129,127,128,128,128,128,129,128,128,129,128,128,129,127,128,128,128,129,127,128,129,128,128,127,129,130,126,128,128,129,128,127,129,128,127,129,128,127, 128,127,129,128,127,128,128,128,128,128,129,128,128,128,128,129,128,128,128,128,129,128,128,128,128,128,128,129,127,129,128,127,128,129,128,128,127,128,128,128,128,128,128,128,128,129,127,128,129,128,127,129,128,127,129,128,128,128,128,128,129,128,128,128,128,127,129,127,128,129,128,127,128,129,127,129,129,128,127,129,129,128,128,129,128,128,128,129,128,127,129,129,127,128,129,128,128,128,129,128, 128,128,128,128,128,129,127,128,128,127,129,128,128,128,128,129,128,128,128,129,127,127,130,129,127,128,128,128,128,129,128,128,128,128,127,128,129,128,128,128,128,128,128,129,128,127,128,128,128,129,128,127,128,129,128,128,128,127,128,128,128,127,129,129,127,128,129,127,128,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,128,128,127,128,129,128,128,129,127,128,129,128,128,128,129, 128,128,129,128,127,129,128,127,128,129,128,128,128,128,128,127,129,129,127,127,129,128,127,128,129,128,127,128,128,128,128,129,128,128,128,128,128,128,128,128,127,128,129,127,128,128,128,128,128,128,128,128,127,128,128,128,127,129,128,127,129,128,128,128,128,128,128,128,129,128,128,128,128,128,129,128,128,128,128,128,128,128,128,128,128,128,128,128,129,128,127,128,128,128,128,128,128,128,127,128, 129,128,127,128,128,128,128,128,128,128,128,128,128,128,128,127,129,129,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, }; const unsigned char GU[2816] PROGMEM = { 129,128,128,128,128,129,127,125,60,183,220,111,65,98,159,157,127,106,121,136,139,125,122,125,132,130,128,125,128,128,130,127,128,127,129,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,127,128,127,129,127,129,127,129,127,129,127, 129,127,129,127,129,127,129,126,129,126,130,126,130,125,133,112,60,206,200,99,63,110,162,153,120,106,125,138,137,124,122,126,132,130,128,125,128,128,129,127,128,127,129,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127, 128,127,128,127,129,127,129,127,129,126,130,126,130,125,132,124,133,120,142,77,106,232,156,76,70,137,162,142,108,112,130,140,131,122,122,129,131,129,126,126,128,129,128,127,127,128,128,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,127,128,127,129,127,129,127,129,126,129,126,131,125,131,124,133,119,141,77,111,235,153,76,72,138,162,142,109,113,130,141,131,122,122,130,131,129,126,126,128,129,128,127,127,128,128,128,128,127,128,128,128,127,128,128,128,128,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127, 128,127,128,127,128,127,128,127,129,127,129,127,129,127,129,126,129,126,130,126,130,125,131,124,133,122,137,96,76,225,182,88,65,123,163,149,115,109,127,140,134,123,122,127,132,129,127,126,128,129,129,127,128,127,129,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,128,128,127,128,127,128, 127,128,127,128,127,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,127,129,127,129,126,130,125,131,123,137,57,149,228,128,67,83,151,159,133,105,118,134,140,127,122,123,131,130,129,125,127,128,129,127,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127, 128,127,128,127,128,127,128,127,128,127,128,127,128,127,129,127,128,127,129,127,129,127,129,126,129,127,129,126,129,126,129,126,130,125,132,114,65,203,204,99,63,109,161,154,121,106,124,138,137,124,122,126,132,129,128,125,128,128,129,127,128,127,129,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,127,128,127,129,127,129,127,129,126,130,125,131,124,134,120,139,72,117,238,149,74,74,142,162,140,108,114,131,141,130,122,122,130,131,129,126,127,128,129,128,127,127,128,128,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,127,128,127,128,127,128,127,129,127,129,127,129,127,129,127,129,127,129,127,129,127,129,127,129,127,129,126,131,120,60,196,206,102,61,105,160,154,122,105,123,137,138,124,122,125,132,130,128,125,128,128,129,127,128,127,129,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,129,127,129,127,129,126,129,126,130,125,131,124,133,119,142,74,118,234,148,74,74,141,162,141,108,114,131,141,130,122,122,130,131,129,126,127,128,129,128,127,127,128,128,128,128,127,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, }; const unsigned char MA[568] PROGMEM = { 127,124,134,122,131,126,127,126,129,124,134,127,125,130,123,131,121,146,117,130,123,134,127,135,116,137,123,138,131,108,143,121,133,125,131,122,133,135,114,137,120,127,144,116,129,139,113,143,122,126,130,125,123,133,132,127,116,131,145,108,139,131,122,136,126,123,115,141,142,108,138,114,147,111,133,131,129,120,121,137,136,124,127,130,129,118,127,129,137,131,118,143,114,132,123,142, 121,116,140,122,125,132,134,124,129,128,110,145,143,108,135,131,121,128,118,146,125,122,129,127,127,128,137,127,124,132,123,140,111,130,129,127,138,121,124,132,139,119,130,128,136,119,130,127,126,137,125,126,124,125,125,134,130,127,131,124,119,138,131,122,126,126,146,113,126,132,129,130,121,132,128,133,119,133,136,120,132,121,128,133,130,119,136,134,111,146,108,139,140,116,136,126,129,123,130,125, 125,139,125,130,119,132,129,124,129,129,130,122,136,116,144,117,130,137,131,117,126,139,126,121,130,129,131,133,122,127,124,136,126,133,128,124,129,130,131,121,129,130,132,128,125,122,128,139,122,127,134,130,118,136,130,123,123,127,140,121,128,136,123,125,136,121,134,126,129,129,127,129,132,127,126,132,113,140,127,128,133,127,126,127,125,130,131,131,121,135,126,126,127,131,131,126,131,122,130,125, 136,124,129,129,126,129,128,127,129,129,128,125,133,128,127,122,137,126,126,128,125,134,128,129,125,133,123,125,138,125,125,133,128,125,130,129,124,130,124,134,130,128,127,127,125,134,124,131,129,127,133,120,129,132,126,129,129,129,128,126,130,127,128,127,130,127,132,126,125,133,127,127,130,129,126,127,130,128,130,130,128,125,129,128,130,125,131,130,124,130,128,130,126,131,126,130,123,131,128,131, 128,128,129,126,132,124,131,128,130,127,129,121,135,127,127,127,130,127,129,130,128,128,127,130,127,127,126,133,125,128,131,127,127,129,127,130,126,130,127,132,123,130,128,130,128,125,131,125,130,129,127,128,129,127,129,126,130,130,128,128,127,129,128,127,130,128,127,127,130,128,129,127,126,130,128,127,128,127,128,131,126,130,127,127,130,124,134,126,127,130,127,129,127,129,127,128,128,128,128,127, 129,130,126,127,129,127,129,130,125,129,127,129,127,129,128,127,129,125,128,129,130,127,129,127,128,128,129,126,130,127,127,128,127,130,126,126,131,128,126,130,127,130,126,127,129,128,128,127,128,128,128,127,128,128,129,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, }; const unsigned char QU[7712] PROGMEM = { 128,129,131,132,137,169,173,141,100,73,75,103,141,167,170,149,119,96,92,107,132,151,157,146,126,109,104,111,127,142,148,142,130,117,111,115,125,135,141,139,131,122,117,118,124,132,136,136,131,125,121,121,125,130,133,133,131,127,124,123,125,128,131,132,130,128,125,125,126,128,130,131,130,128,126,126,126,128,129,130,129,128,127,126,127,128,129,129,129,128,127,127,127,128,128,129, 129,128,128,127,127,128,128,128,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,128,129,127,129,127,130,126,173,207,141,59,15,41,112,182,210,187,134,87,74,97,138,168,172,150,135,135,122,110,104,110,123,137,144,142,132,121,115,116,124,133,139,138,133,125,120,120,124,130,135,135,132,127,123,122,125,129,132,133,131,128,125, 124,126,128,130,131,131,129,127,126,126,128,129,130,130,129,127,127,127,128,129,130,129,129,128,127,127,128,129,129,129,129,128,127,128,128,129,129,129,129,128,128,128,128,128,129,129,129,128,128,128,128,128,129,129,129,129,128,128,128,128,128,129,129,129,128,128,128,128,128,128,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,129,129,129,128,128,127,127,128,128,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,128,129,128,129,127,130,128,192,216,132,41,1,40,122,199,219,186,124,76,67,100,144,173,171,144,112,96,102,124,145,154,145,128,114,110,119,132,140,141,133,124,119,120,126,133,135,133,128,124,123,125,129,132,132,130,127,125,126,127,130,130,130,128,127,127,127,128,129,129,129,128, 128,127,128,128,129,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,119,115,127,140,147,142,130,118,115,119,129,136,137,133,126,121,121,125,130,133,132,129,126,124,125,128,130,131,130,128,126,126,127,129,130,130,129,128,127,127,128,129,129,129,128,128,127,128,128,129,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,131,174,176,120,67,50,82,134,176,183,157,118,93,94,117,143,157,152,134,115,108,114,129,141,144,136,126,118,118,124,132,136,135,130,124,122,124,128,132,132,130,127,125,125,127,129,130,130,129,127,126,127,128,129,129,129,128,127,127,127,128,129,129,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,124,124,129,133,135, 132,127,124,124,126,129,131,131,129,127,126,126,128,129,130,129,128,127,127,128,129,129,129,129,128,127,128,128,129,129,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,127,139,164,147,109,82,84,111,144,163,158,136,113,104,111,128,142,147,139,126,117,116,123,132,137,136,130,124,121,123,128,132,133,131,128,125,124,126,129,131,130,129,127,126,127,128,129,130,129,128,127,127,127,128,129,129,128,128,127,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,129,129,129,128,128,127,128,128,129,129,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,131,151,147,121,98,94,110,134,151,152,139,121,112,114,125,136,142,138,129,121,119,123,130,134,135,131,126,123,124,127,130,132,131,128,126,125,127,128,130,130,129,128,127,127,128,129,129,129,128,128,127,128,128,129,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,131,144,140, 122,108,106,117,133,144,144,134,123,117,119,127,134,137,134,128,123,122,125,130,132,133,130,127,125,125,127,130,131,130,128,127,126,127,128,129,129,129,128,127,127,128,129,129,129,128,128,128,128,128,129,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,132,140,133,121,113,115,124,134,139,137,130,123,121, 123,129,133,134,131,127,124,124,127,130,131,131,129,127,126,127,128,129,130,129,128,127,127,128,129,129,129,128,128,127,128,128,128,129,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,133,135,128,121,118,121,128,134,135,132,127,124,123,126,130,132,131,129,126,125,126,128,130, 130,129,128,127,127,127,128,129,129,128,128,127,127,128,128,129,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,130,133,130,125,122,122,126,130,133,132,129,126,125,126,128,130,130,129,128,126,126,127,129,129,129,128,127,127,127,128,129,129,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, }; ISR(TIMER1_COMPA_vect) { //------------------- Ringbuffer handler ------------------------- if (RingCount) { //If entry in FIFO.. OCR2A = Ringbuffer[(RingRead++)]; //Output LSB of 16-bit DAC RingCount--; } //----------------------------------------------------------------- } void setup() { OSCCAL=0xFF; //Drum mute inputs pinMode(2,INPUT_PULLUP); pinMode(3,INPUT_PULLUP); pinMode(4,INPUT_PULLUP); pinMode(5,INPUT_PULLUP); pinMode(6,INPUT_PULLUP); pinMode(7,INPUT_PULLUP); pinMode(8,INPUT_PULLUP); pinMode(9,INPUT_PULLUP); pinMode(10,INPUT_PULLUP); //RUN - Stop input pinMode(12,OUTPUT); //Reset output pinMode(13,OUTPUT); //Clock output pinMode(14,OUTPUT); //SEQ cnt output pinMode(15,OUTPUT); pinMode(16,OUTPUT); pinMode(17,OUTPUT); //8-bit PWM DAC pin pinMode(11,OUTPUT); // Set up Timer 1 to send a sample every interrupt. cli(); // Set CTC mode // Have to set OCR1A *after*, otherwise it gets reset to 0! TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12); TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10)); // No prescaler TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10); // Set the compare register (OCR1A). // OCR1A is a 16-bit register, so we have to do this with // interrupts disabled to be safe. //OCR1A = F_CPU / SAMPLE_RATE; // Enable interrupt when TCNT1 == OCR1A TIMSK1 |= _BV(OCIE1A); sei(); OCR1A = 800; //40KHz Samplefreq // Set up Timer 2 to do pulse width modulation on D11 // Use internal clock (datasheet p.160) ASSR &= ~(_BV(EXCLK) | _BV(AS2)); // Set fast PWM mode (p.157) TCCR2A |= _BV(WGM21) | _BV(WGM20); TCCR2B &= ~_BV(WGM22); // Do non-inverting PWM on pin OC2A (p.155) // On the Arduino this is pin 11. TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0); TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0)); // No prescaler (p.158) TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10); // Set initial pulse width to the first sample. OCR2A = 128; //set timer0 interrupt at 61Hz TCCR0A = 0;// set entire TCCR0A register to 0 TCCR0B = 0;// same for TCCR0B TCNT0 = 0;//initialize counter value to 0 // set compare match register for 62hz increments OCR0A = 255;// = 61Hz // turn on CTC mode TCCR0A |= (1 << WGM01); // Set CS01 and CS00 bits for prescaler 1024 TCCR0B |= (1 << CS02) | (0 << CS01) | (1 << CS00); //1024 prescaler TIMSK0=0; // set up the ADC SFREQ=analogRead(0); ADCSRA &= ~PS_128; // remove bits set by Arduino library // Choose prescaler PS_128. ADCSRA |= PS_128; ADMUX = 64; sbi(ADCSRA, ADSC); } void loop() { uint16_t samplecntBD,samplecntBG2,samplecntCL,samplecntCW,samplecntCY,samplecntGU,samplecntMA,samplecntQU; samplecntBD=0; samplecntBG2=0; samplecntCL=0; samplecntCW=0; samplecntCY=0; samplecntGU=0; samplecntMA=0; samplecntQU=0; uint16_t samplepntBD,samplepntBG2,samplepntCL,samplepntCW,samplepntCY,samplepntGU,samplepntMA,samplepntQU; int16_t total; uint8_t stepcnt=0; uint16_t tempo=3500; uint16_t tempocnt=1; uint8_t MUX=4; uint8_t patselect=13; uint8_t patlength=pgm_read_byte_near(patlen + patselect); while(1) { //------ Add current sample word to ringbuffer FIFO -------------------- if (RingCount<255) { //if space in ringbuffer total=0; if (samplecntBD) { total+=(pgm_read_byte_near(BD + samplepntBD++)-128); samplecntBD--; } if (samplecntBG2) { total+=(pgm_read_byte_near(BG2 + samplepntBG2++)-128); samplecntBG2--; } if (samplecntCL) { total+=(pgm_read_byte_near(CL + samplepntCL++)-128); samplecntCL--; } if (samplecntCW) { total+=(pgm_read_byte_near(CW + samplepntCW++)-128); samplecntCW--; } if (samplecntCY) { total+=(pgm_read_byte_near(CY + samplepntCY++)-128); samplecntCY--; } if (samplecntGU) { total+=(pgm_read_byte_near(GU + samplepntGU++)-128); samplecntGU--; } if (samplecntMA) { total+=(pgm_read_byte_near(MA + samplepntMA++)-128); samplecntMA--; } if (samplecntQU) { total+=(pgm_read_byte_near(QU + samplepntQU++)-128); samplecntQU--; } if (total<-127) total=-127; if (total>127) total=127; cli(); Ringbuffer[RingWrite]=total+128; RingWrite++; RingCount++; sei(); //---------------------------------------------------------------------------- //--------- sequencer block ---------------------------------------------- if (digitalReadFast(10)) { if (!(tempocnt--)) { tempocnt=tempo; digitalWriteFast(13,HIGH); //Clock out Hi uint8_t trig=pgm_read_byte_near(pattern + (patselect<<4) + stepcnt++); PORTC=stepcnt; uint8_t mask=(PIND>>2)|((PINB&3)<<6); trig&=mask; if (stepcnt>patlength) stepcnt=0; if (stepcnt==0) digitalWriteFast(12,HIGH); //Reset out Hi if (stepcnt!=0) digitalWriteFast(12,LOW); //Reset out Lo if (trig & 1) { samplepntQU=0; samplecntQU=7712; } if (trig & 2) { samplepntCY=0; samplecntCY=9434; } if (trig & 4) { samplepntMA=0; samplecntMA=568; } if (trig & 8) { samplepntCW=0; samplecntCW=830; } if (trig & 16) { samplepntCL=0; samplecntCL=752; } if (trig & 32) { samplepntBD=0; samplecntBD=1076; } if (trig & 64) { samplepntBG2=0; samplecntBG2=1136; } if (trig & 128) { samplepntGU=0; samplecntGU=2816; } } digitalWriteFast(13,LOW); //Clock out Lo } } if (!(digitalReadFast(10))) { digitalWriteFast(13,LOW); //Clock out Lo digitalWriteFast(12,LOW); //Reset out Lo PORTC=0; stepcnt=0; tempocnt=1; } //------------------------------------------------------------------------ //--------------- ADC block ------------------------------------- if (!(ADCSRA & 64)) { uint16_t value=((ADCL+(ADCH<<8))>>3)+1; if (MUX==5) tempo=(value<<4)+1250; //17633-1250 if (MUX==4) patselect=(value-1)>>3; if (MUX==4) patlength=pgm_read_byte_near(patlen + patselect); MUX++; if (MUX==8) MUX=4; ADMUX = 64 | MUX; //Select MUX sbi(ADCSRA, ADSC); //start next conversation }; //--------------------------------------------------------------- } }
[ "nicolasberan@hotmail.com" ]
nicolasberan@hotmail.com
a40acb7248138a233631744456da21023ea2aa85
727c574f0b5d84ae485b852ccf318063cc51772e
/LeetCode/0400-0499/0422. Valid Word Square.cpp
c6634e3eb0434a5a998c4c40fa8c14b7f3a6e18c
[]
no_license
cowtony/ACM
36cf2202e3878a3dac1f15265ba8f902f9f67ac8
307707b2b2a37c58bc2632ef872dfccdee3264ce
refs/heads/master
2023-09-01T01:21:28.777542
2023-08-04T03:10:23
2023-08-04T03:10:23
245,681,952
7
3
null
null
null
null
UTF-8
C++
false
false
381
cpp
class Solution { public: bool validWordSquare(vector<string>& words) { for (int i = 0; i < words.size(); i++) { for (int j = 0; j < words[i].size(); j++) { if (j >= words.size() or i >= words[j].size() or words[i][j] != words[j][i]) { return false; } } } return true; } };
[ "noreply@github.com" ]
noreply@github.com
760463869bedc4afda124ad05f0245b447c89ff4
7f13b3020b8e0d73dd200b5c73c88e176d96ac03
/src/compiler/intern.h
c595a36b1b6558c82c74a1c7e852f525179fb244
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
Imarok/verona
6bbf6fd6c6ddb41260734d91185c4832ce53f83d
d54cd5c6239e3ba6436250ffa701414ad72c9a83
refs/heads/master
2020-12-13T20:39:21.486893
2020-01-17T10:33:29
2020-01-17T10:33:29
234,525,912
0
0
MIT
2020-01-17T10:27:16
2020-01-17T10:27:15
null
UTF-8
C++
false
false
5,878
h
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include "compiler/type.h" #include <optional> #include <set> /** * Type interner. * * To allow for fast equality checks between two Type objects, we intern all of * them in a single TypeInterner. The interner uses shallow comparison, through * the operator< method defined by each kind of Type, to check if a type had * already been interned. After interning, comparison and hashing can be done * directly on the pointer value. * * Type objects are never created manually. The various mk_* methods of the * interner should be used instead. * * Interning does perform some amount of normalization on the types. For * instance unions and intersections will be flattened, such that * ((A & B) & C) becomes (A & B & C) for example. * * In general, mk_foo methods return a FooPtr. Methods that do perform * normalization may however return a TypePtr, since the normalization could * have changed the head constructor. * * All mk_ methods require their arguments to already be normalized. This is * enforced with debug-mode assertions. */ namespace verona::compiler { class TypeInterner { public: TypeInterner() {} EntityTypePtr mk_entity_type(const Entity* definition, TypeList arguments); StaticTypePtr mk_static_type(const Entity* definition, TypeList arguments); CapabilityTypePtr mk_capability(CapabilityKind kind, Region region); CapabilityTypePtr mk_mutable(Region region); CapabilityTypePtr mk_subregion(Region region); CapabilityTypePtr mk_isolated(Region region); CapabilityTypePtr mk_immutable(); TypeParameterPtr mk_type_parameter( const TypeParameterDef* definition, TypeParameter::Expanded expanded); TypePtr mk_apply_region(ApplyRegionType::Mode mode, Region region, TypePtr type); TypePtr mk_unapply_region(TypePtr type); TypePtr mk_bottom(); TypePtr mk_union(TypeSet elements); TypePtr mk_union(TypePtr first, TypePtr second); TypePtr mk_top(); TypePtr mk_intersection(TypeSet elements); TypePtr mk_intersection(TypePtr first, TypePtr second); // Generic method to create either a UnionType or IntersectionType. template<typename T> TypePtr mk_connective(TypeSet elements); TypePtr mk_viewpoint(TypePtr left, TypePtr right); TypePtr mk_cown(TypePtr contents); template<typename T> TypePtr mk_viewpoint( std::optional<CapabilityKind> capability, const std::set<std::shared_ptr<const T>>& types, TypePtr right); InferTypePtr mk_infer( uint64_t index, std::optional<uint64_t> subindex, Polarity polarity); TypePtr mk_range(TypePtr lower, TypePtr upper); TypePtr mk_infer_range(uint64_t index, std::optional<uint64_t> subindex); HasFieldTypePtr mk_has_field( TypePtr view, std::string name, TypePtr read_type, TypePtr write_type); DelayedFieldViewTypePtr mk_delayed_field_view(std::string name, TypePtr type); HasMethodTypePtr mk_has_method(std::string name, TypeSignature signature); HasAppliedMethodTypePtr mk_has_applied_method( std::string name, InferableTypeSequence tyargs, TypeSignature signature); IsEntityTypePtr mk_is_entity(); UnitTypePtr mk_unit(); IntegerTypePtr mk_integer_type(); StringTypePtr mk_string_type(); FixpointTypePtr mk_fixpoint(TypePtr inner); FixpointVariableTypePtr mk_fixpoint_variable(uint64_t depth); TypePtr mk_entity_of(TypePtr inner); TypePtr mk_variable_renaming(VariableRenaming renaming, TypePtr type); TypePtr mk_path_compression(PathCompressionMap compression, TypePtr type); TypePtr mk_indirect_type(const BasicBlock* block, Variable variable); TypePtr mk_not_child_of(Region region); // It's important that we only have one interner, but C++ makes it easy // to accidentally make copies. Protect against that. TypeInterner(const TypeInterner&) = delete; TypeInterner& operator=(const TypeInterner&) = delete; private: bool is_interned(const TypePtr& ty); /** * Templated so it works on stuff like InferTypeSet in addition to TypeSet. */ template<typename T> bool is_interned(const std::set<std::shared_ptr<const T>>& tys) { return std::all_of( tys.begin(), tys.end(), [&](auto ty) { return is_interned(ty); }); } bool is_interned(const TypeList& tys); bool is_interned(const TypeSignature& signature); bool is_interned(const PathCompressionMap& signature); template<typename T> TypeSet flatten_connective(TypeSet elements); template<typename T> void flatten_connective( TypeSet elements, std::set<typename T::DualPtr>* duals, TypeSet* others); template<typename T> std::shared_ptr<const T> intern(T value); /** * Shallow by-value comparison of types. * * The set contains shared_ptr<Type>, but we don't want to allocate a * shared_ptr everytime we lookup something. For this we make LessTypes * a "transparent functor", allowing heterogenous lookup into the * interning set. * */ struct LessTypes { using is_transparent = void; // Main comparison operator. We define the others in term of this one. bool operator()(const Type& left, const Type& right) const; bool operator()(const TypePtr& left, const TypePtr& right) const; bool operator()(const TypePtr& left, const Type& right) const; bool operator()(const Type& left, const TypePtr& right) const; }; TypePtr unfold_compression( const PathCompressionMap& compression, const Region& region, TypePtr type); TypePtr unfold_compression( PathCompressionMap compression, Variable dead_variable, TypePtr type); std::set<TypePtr, LessTypes> types_; }; }
[ "mattpark@microsoft.com" ]
mattpark@microsoft.com
800ccf92cc1bbc87bbe499b36099607a08d772ed
1e58f86db88d590ce63110c885c52305d67f8136
/WorkWin/winoverviewgroupdelegate.h
a769a0b2102f9d943f34fb1ee13028fe4b1625a4
[]
no_license
urielyan/F270
32a9b87780b6b0bbbd8e072ca4305cd38dc975c1
c3d1eceead895ded12166eeb6748df111f46ef2d
refs/heads/master
2021-01-10T02:06:40.335370
2016-03-02T03:23:02
2016-03-02T03:23:02
52,927,128
1
1
null
null
null
null
UTF-8
C++
false
false
1,317
h
#ifndef WINOVERVIEWGROUPDELEGATE_H #define WINOVERVIEWGROUPDELEGATE_H #include <QAbstractItemDelegate> class WinOverviewGroupDelegate : public QAbstractItemDelegate { Q_OBJECT public: explicit WinOverviewGroupDelegate(QObject *parent = 0); virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const; virtual QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const; bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index); private: QStyleOptionViewItem setOptions(const QStyleOptionViewItem &option,const QModelIndex &index) const; void drawBackground(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void drawGroupNameRect(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void drawPressingRect(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QColor getBackgroundColor(const QStyleOptionViewItem &option, quint32 status) const; private: QMargins m_margins;//้€š้“้—ด้š” }; #endif // WINOVERVIEWGROUPDELEGATE_H
[ "urielyan@sina.com" ]
urielyan@sina.com
2fcfc4567254c3f00164b086908a259eb7043e30
d00f9a60842bf0ec519b9bd23a8e45b3fe3048f7
/pawno/include/YSI_inc/YSI/y_writemem.inc
d870a1faf3430b930575a0c00ab5f4f6108d0e37
[ "Apache-2.0" ]
permissive
shiva2410/SAMPBulletproof
83d3b3fbffd67b0e8a264143fa2208a53f6ecd2f
e09b69bc0ba4eabecaf98ea41cb0829f6a588641
refs/heads/master
2020-09-16T15:01:23.489919
2019-11-24T20:46:07
2019-11-24T20:46:07
223,807,576
0
0
Apache-2.0
2019-11-24T20:45:04
2019-11-24T20:45:04
null
UTF-8
C++
false
false
135
inc
#include "..\YSI_Internal\y_compilerpass" #if AUTO_INCLUDE_GUARD #undef _inc_y_writemem #endif #include "..\YSI_Internal\y_writemem"
[ "khalidahmed333@hotmail.com" ]
khalidahmed333@hotmail.com
782b1f1d6f377110675854a8fdc80fc7a3bde182
43a6cbfcba1d7ed9a85be32502390e08ab5adf60
/src/dyncall_v8.h
f2ab0fa9c962301b37f2c7218793bfedfe03ef02
[]
no_license
ochafik/BridJS
b268d65640a5ae8fc9a6f8f8df4b7e5aa4382994
ac5d1927f9c0a432a6898afe22d13f21509604a0
refs/heads/master
2020-05-30T03:45:26.129077
2013-03-29T23:59:36
2013-03-29T23:59:36
9,107,702
1
1
null
2015-03-10T14:43:43
2013-03-29T22:18:21
C++
UTF-8
C++
false
false
193
h
#ifndef _DYNCALL_V8_H #define _DYNCALL_V8_H #include <v8.h> namespace dyncall { v8::Handle<v8::Value> newCallVM(const v8::Arguments& args); } // namespace dyncall #endif // _DYNCALL_V8_H
[ "ochafik@google.com" ]
ochafik@google.com
5df2e526b01c8667b395a405b088535bcbe66600
f9bf3b106c5bfd9ab960e0779c1ea8f4fddcba9e
/host/streaming_free_running_kernel/src/host.cpp
100bb4b77a8e4f786a6a693d08bf060183bda63a
[ "BSD-3-Clause" ]
permissive
saitej25/Vitis_Accel_Examples
dba2f98f231f276208ab394a368aae17ba91fe99
d63a45785d951e84ca0adb00eb795a1ea9aab3a5
refs/heads/master
2022-04-11T22:42:20.605632
2020-03-26T05:20:35
2020-03-26T05:20:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,673
cpp
/********** Copyright (c) 2019, Xilinx, 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 the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **********/ /******************************************************************************* Description: Kernel to kernel streaming example consisting of three compute units in a linear hardware pipeline. 1) Memory read This Kernel reads the input vector from Global Memory and streams its output. 2) Increment This Kernel reads stream input, increments the value and streams to output. 3) Memory write This Kernel reads from its input stream and writes into Global Memory. _____________ | |<----- Global Memory | mem_read | |_____________|------+ _____________ | AXI4 Stream | |<-----+ | increment | |_____________|----->+ ______________ | AXI4 Stream | |<----+ | mem_write | |______________|-----> Global Memory *******************************************************************************/ #include <cstdio> #include <cstring> #include <iostream> #include <vector> #include <xcl2.hpp> int main(int argc, char **argv) { if (argc != 2) { std::cout << "Usage: " << argv[0] << " <XCLBIN File>" << std::endl; return EXIT_FAILURE; } std::string binaryFile = argv[1]; size_t data_size = 1024 * 1024; cl_int err; cl::CommandQueue q; cl::Context context; cl::Kernel krnl_increment, krnl_mem_read, krnl_mem_write; // Reducing the data size for emulation mode char *xcl_mode = getenv("XCL_EMULATION_MODE"); if (xcl_mode != NULL) { data_size = 1024; } //Allocate Memory in Host Memory size_t vector_size_bytes = sizeof(int) * data_size; std::vector<int, aligned_allocator<int>> source_input(data_size); std::vector<int, aligned_allocator<int>> source_hw_results(data_size); std::vector<int, aligned_allocator<int>> source_sw_results(data_size); // Create the test data and Software Result for (size_t i = 0; i < data_size; i++) { source_input[i] = i; source_sw_results[i] = i + 1; } //OPENCL HOST CODE AREA START // get_xil_devices() is a utility API which will find the Xilinx // platforms and will return list of devices connected to Xilinx platform std::vector<cl::Device> devices = xcl::get_xil_devices(); // read_binary_file() is a utility API which will load the binaryFile // and will return pointer to file buffer. auto fileBuf = xcl::read_binary_file(binaryFile); cl::Program::Binaries bins{{fileBuf.data(), fileBuf.size()}}; int valid_device = 0; for (unsigned int i = 0; i < devices.size(); i++) { auto device = devices[i]; // Creating Context and Command Queue for selected Device OCL_CHECK(err, context = cl::Context(device, NULL, NULL, NULL, &err)); OCL_CHECK(err, q = cl::CommandQueue(context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE, &err)); std::cout << "Trying to program device[" << i << "]: " << device.getInfo<CL_DEVICE_NAME>() << std::endl; cl::Program program(context, {device}, bins, NULL, &err); if (err != CL_SUCCESS) { std::cout << "Failed to program device[" << i << "] with xclbin file!\n"; } else { std::cout << "Device[" << i << "]: program successful!\n"; OCL_CHECK(err, krnl_increment = cl::Kernel(program, "increment", &err)); OCL_CHECK(err, krnl_mem_read = cl::Kernel(program, "mem_read", &err)); OCL_CHECK(err, krnl_mem_write = cl::Kernel(program, "mem_write", &err)); valid_device++; break; // we break because we found a valid device } } if (valid_device == 0) { std::cout << "Failed to program any device found, exit!\n"; exit(EXIT_FAILURE); } // Allocate Buffer in Global Memory // Buffers are allocated using CL_MEM_USE_HOST_PTR for efficient memory and // Device-to-host communication std::cout << "Creating Buffers..." << std::endl; OCL_CHECK( err, cl::Buffer buffer_input(context, CL_MEM_USE_HOST_PTR, // | CL_INCREMENT_ONLY, vector_size_bytes, source_input.data(), &err)); OCL_CHECK( err, cl::Buffer buffer_output(context, CL_MEM_USE_HOST_PTR, // | CL_MEM_WRITE_ONLY, vector_size_bytes, source_hw_results.data(), &err)); //Set the Kernel Arguments int size = data_size; OCL_CHECK(err, err = krnl_mem_read.setArg(0, buffer_input)); OCL_CHECK(err, err = krnl_mem_read.setArg(2, size)); OCL_CHECK(err, err = krnl_mem_write.setArg(1, buffer_output)); OCL_CHECK(err, err = krnl_mem_write.setArg(2, size)); // Copy input data to device global memory std::cout << "Copying data..." << std::endl; OCL_CHECK(err, err = q.enqueueMigrateMemObjects({buffer_input}, 0 /*0 means from host*/)); OCL_CHECK(err, err = q.finish()); // Launch the Kernel std::cout << "Launching Kernel..." << std::endl; OCL_CHECK(err, err = q.enqueueTask(krnl_mem_read)); OCL_CHECK(err, err = q.enqueueTask(krnl_mem_write)); //wait for all kernels to finish their operations OCL_CHECK(err, err = q.finish()); //Copy Result from Device Global Memory to Host Local Memory std::cout << "Getting Results..." << std::endl; OCL_CHECK(err, err = q.enqueueMigrateMemObjects({buffer_output}, CL_MIGRATE_MEM_OBJECT_HOST)); OCL_CHECK(err, err = q.finish()); //OPENCL HOST CODE AREA END // Compare the results of the Device to the simulation bool match = true; for (size_t i = 0; i < data_size; i++) { if (source_hw_results[i] != source_sw_results[i]) { std::cout << "Error: Result mismatch" << std::endl; std::cout << "i = " << i << " CPU result = " << source_sw_results[i] << " Device result = " << source_hw_results[i] << std::endl; match = false; break; } } std::cout << "TEST " << (match ? "PASSED" : "FAILED") << std::endl; return (match ? EXIT_SUCCESS : EXIT_FAILURE); }
[ "heeran@xilinx.com" ]
heeran@xilinx.com
6bccadea8d7cfbb61541690c8fc47c0d37646de4
3699ee70db05a390ce86e64e09e779263510df6f
/branches/World Server/player.cpp
5b375852a50610c4aea6e7a1737953cc7ebe215f
[]
no_license
trebor57/osprosedev
4fbe6616382ccd98e45c8c24034832850054a4fc
71852cac55df1dbe6e5d6f4264a2a2e6fd3bb506
refs/heads/master
2021-01-13T01:50:47.003277
2008-05-14T17:48:29
2008-05-14T17:48:29
32,129,756
0
0
null
null
null
null
UTF-8
C++
false
false
13,130
cpp
/* Rose Online Server Emulator Copyright (C) 2006,2007 OSRose Team http://www.osrose.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. developed with Main erose/hrose source server + some change from the original eich source */ #include "player.h" #include "worldserver.h" CPlayer::CPlayer( CClientSocket* CLIENT ) { client = CLIENT; // USED ITEM UsedItem = new USEDITEM; assert(UsedItem); UsedItem->lastRegTime = 0; UsedItem->usevalue = 0; UsedItem->usetype = 0; UsedItem->userate = 0; UsedItem->used = 0; // CHARINFO CharInfo = new INFO; assert(CharInfo); memset( &CharInfo->charname, '\0', 17 ); CharInfo->charid = 0; CharInfo->Sex = 0; CharInfo->Face = 0; CharInfo->Hair = 0; CharInfo->Exp = 0; CharInfo->Job = 0; CharInfo->Zulies = 0; CharInfo->Storage_Zulies = 0; CharInfo->LastGlobal = 0; CharInfo->StatPoints = 0; CharInfo->SkillPoints = 0; CharInfo->stamina = 0; // RIDE Ride = new RIDE; assert(Ride); Ride->Drive = false; Ride->Ride = false; Ride->charid = 0; // TRADE Trade = new TRADE; assert(Trade); for(int i=0;i<10;i++) Trade->trade_itemid[i] = 0; for(int i=0;i<11;i++) Trade->trade_count[i] = 0; Trade->trade_status = 0; Trade->trade_target = 0; //PARTY Party = new PARTY; assert(Party); Party->party = NULL; Party->IsMaster = true; // SHOP Shop = new SHOP; assert(Shop); Shop->open = false; memset( &Shop->name, '\0',64 ); for(int i=0;i<30;i++) { ClearItem(Shop->BuyingList[i].item); Shop->BuyingList[i].slot = 0; Shop->BuyingList[i].count = 0; Shop->BuyingList[i].price = 0; Shop->SellingList[i].slot = 0; Shop->SellingList[i].count = 0; Shop->SellingList[i].price = 0; } Shop->Buying = 0; Shop->Selling = 0; Shop->ShopType = 0; // SESSION Session = new SESSION; assert(Session); Session->userid = 0; memset( &Session->username, '\0', 17 ); memset( &Session->password, '\0', 33 ); Session->accesslevel = 0; Session->isLoggedIn = false; Session->inGame = false; // Inventory / storage for(unsigned int i=0;i<MAX_INVENTORY;i++) ClearItem( items[i] ); for(unsigned int i=0;i<MAX_STORAGE;i++) ClearItem( storageitems[i] ); // Clan Clan = new CLAN; assert(Clan); Clan->clanid = 0; Clan->clanrank = 0; Clan->grade = 0; Clan->CP = 0; Clan->logo = 0; Clan->back = 0; memset( &Clan->clanname, '\0', 17 ); // ATTRIBUTES Attr = new ATTRIBUTES; assert(Attr); Attr->Str = 0; Attr->Dex = 0; Attr->Int = 0; Attr->Con = 0; Attr->Cha = 0; Attr->Sen = 0; Attr->Estr = 0; Attr->Edex = 0; Attr->Eint = 0; Attr->Econ = 0; Attr->Echa = 0; Attr->Esen = 0; CharType = TPLAYER; questdebug = false; Saved = false; isInvisibleMode = false; Fairy = false; //FairyTime = 0; nstorageitems = 0; p_skills = 0; for(int i=0;i<MAX_SKILL;i++) { cskills[i].id = 0; cskills[i].level = 0; } for(int i=0;i<MAX_BASICSKILL;i++) bskills[i] = 0; for(int i=0;i<MAX_QUICKBAR;i++) quickbar[i] = 0; //MyQuest.clear( ); ActiveQuest = 0; lastRegenTime = 0; lastSaveTime = clock( ); lastGG = 0; VisiblePlayers.clear( ); VisibleDrops.clear( ); VisibleMonsters.clear( ); VisibleNPCs.clear( ); } CPlayer::~CPlayer( ) { if(client!=NULL) delete client; if(UsedItem!=NULL) delete UsedItem; if(CharInfo!=NULL) delete CharInfo; if(Ride!=NULL) delete Ride; if(Trade!=NULL) delete Trade; if(Party!=NULL) delete Party; if(Shop!=NULL) delete Shop; if(Session!=NULL) delete Session; if(Clan!=NULL) delete Clan; if(Attr!=NULL) delete Attr; //MyQuest.clear(); VisiblePlayers.clear(); VisibleDrops.clear(); VisibleMonsters.clear(); VisibleNPCs.clear(); } bool CPlayer::IsMonster( ) { return false; } bool CPlayer::UpdateValues( ) { if( Ride->Ride && !Ride->Drive ) { CPlayer* otherclient = GServer->GetClientByCID( Ride->charid, Position->Map ); if( otherclient!=NULL ) { if( otherclient->Status->Stance != 0x04 ) { otherclient->Ride->Drive = false; otherclient->Ride->Ride = false; otherclient->Ride->charid = 0; Ride->Drive = false; Ride->Ride = false; Ride->charid = 0; Position->destiny = Position->current; } else { Position->current = otherclient->Position->current; Position->destiny = otherclient->Position->destiny; Position->lastMoveTime = otherclient->Position->lastMoveTime; return false; // will not update the player position } } else { Ride->Drive = false; Ride->Ride = false; Ride->charid = 0; Position->destiny = Position->current; } } return true; } // Spawn Another User on the Screen bool CPlayer::SpawnToPlayer( CPlayer* player, CPlayer* otherclient ) { /* if( Party->party!=NULL && Party->party == player->Party->party) { BEGINPACKET( pak, 0x7d5 ); ADDDWORD ( pak, CharInfo->charid ); ADDWORD ( pak, clientid ); ADDWORD ( pak, GetMaxHP( ) ); ADDWORD ( pak, Stats->HP ); ADDDWORD ( pak, 0x01000000 ); ADDDWORD ( pak, 0x0000000f ); ADDWORD ( pak, 0x1388 ); player->client->SendPacket( &pak ); } */ /* if( Ride->Ride ) { CPlayer* rideclient = GServer->GetClientByCID( Ride->charid, Position->Map ); if(rideclient==NULL) { Ride->Ride = false; Ride->Drive= false; Ride->charid = 0; return true; } if( GServer->IsVisible( player, rideclient ) || player->CharInfo->charid == rideclient->CharInfo->charid ) { BEGINPACKET( pak, 0x796 ); if( Ride->Drive ) { ADDWORD ( pak, rideclient->clientid ); ADDFLOAT ( pak, rideclient->Position->current.x*100 ); ADDFLOAT ( pak, rideclient->Position->current.y*100 ); } else { ADDWORD ( pak, clientid ); ADDFLOAT ( pak, Position->current.x*100 ); ADDFLOAT ( pak, Position->current.y*100 ); } ADDWORD ( pak, 0x0000 ); player->client->SendPacket( &pak ); RESETPACKET( pak, 0x7dd ); ADDBYTE ( pak, 0x02 ); if( rideclient->Ride->Drive ) { ADDWORD ( pak, rideclient->clientid ); ADDWORD ( pak, clientid ); } else { ADDWORD ( pak, clientid ); ADDWORD ( pak, rideclient->clientid ); } player->client->SendPacket( &pak ); } } return true; */ BEGINPACKET( pak, 0x793 ); ADDWORD( pak, clientid); // USER ID ADDFLOAT( pak, Position->current.x*100 ); // POS X ADDFLOAT( pak, Position->current.y*100 ); // POS Y ADDFLOAT( pak, Position->destiny.x*100 ); // GOING TO X ADDFLOAT( pak, Position->destiny.y*100 ); // GOINT TO Y if(Shop->open) { ADDWORD( pak, 0x000b ); ADDWORD( pak, 0x0000 ); } else if(Stats->HP <= 0) { ADDWORD( pak, 0x0003 ); ADDWORD( pak, 0x0000 ); } else // if(Status->Stance == SITTING) // { // ADDWORD( pak, 0x000a ); // ADDWORD( pak, 0x0000 ); // } // else if (Battle->atktarget!=0) { ADDWORD( pak, 0x0002 ); ADDWORD( pak, Battle->atktarget ); } else if(Position->destiny.x != Position->current.x || Position->destiny.y != Position->current.y) { ADDWORD( pak, 0x0001 ); ADDWORD( pak, 0x0000 ); } else { ADDWORD( pak, 0x0000 ); ADDWORD( pak, 0x0000 ); } ADDWORD( pak, 0x6401 ); //?? ADDWORD( pak, 0x0000 ); ADDWORD( pak, 0x0200 ); ADDWORD( pak, 0x0000 ); ADDBYTE( pak, 0x00 ); ADDDWORD( pak, GServer->BuildBuffs( this ) ); // BUFFS ADDBYTE( pak, CharInfo->Sex ); // GENDER ADDWORD( pak, Stats->Move_Speed ); // WALK SPEED MAYBE? ADDBYTE( pak, 0x00 ); // ?? ADDBYTE( pak, 0x00 ); // ?? ADDBYTE( pak, 0x01 ); // ?? ADDDWORD( pak, CharInfo->Face ); // FACE TYPE ADDDWORD( pak, CharInfo->Hair ); // HAIR TYPE ADDDWORD( pak, GServer->BuildItemShow( items[2] )); // CAP ADDDWORD( pak, GServer->BuildItemShow( items[3] )); // BODY ADDDWORD( pak, GServer->BuildItemShow( items[5] )); // GLOVES ADDDWORD( pak, GServer->BuildItemShow( items[6] )); // BOOTS ADDDWORD( pak, GServer->BuildItemShow( items[1] )); // FACE ADDDWORD( pak, GServer->BuildItemShow( items[4] )); // BACK ADDDWORD( pak, GServer->BuildItemShow( items[7] )); // WEAPON ADDDWORD( pak, GServer->BuildItemShow( items[8] )); // SUBWEAPON ADDBYTE( pak, 0x00 ); ADDWORD( pak, 0x0000 ); ADDWORD( pak, 0x0100 ); ADDWORD( pak, items[135].itemnum ); // CART FRAME ADDWORD( pak, GServer->BuildItemRefine( items[135] ) ); ADDWORD( pak, items[136].itemnum ); // CART ENGINE ADDWORD( pak, GServer->BuildItemRefine( items[136] ) ); ADDWORD( pak, items[137].itemnum ); // CART WHEELS ADDWORD( pak, GServer->BuildItemRefine( items[137] ) ); ADDWORD( pak, items[138].itemnum ); // CART WEAPON ADDWORD( pak, GServer->BuildItemRefine( items[138] ) ); ADDWORD( pak, items[139].itemnum ); // CART ABILITY ADDWORD( pak, GServer->BuildItemRefine( items[139] ) ); ADDWORD( pak, (Stats->HP<=0)?0x0:0xea7b ); if(Shop->open) { ADDWORD( pak, 0x0002 ); } else { ADDWORD( pak, 0x0000 ); } ADDWORD( pak, 0x0000 ); ADDDWORD( pak, 0x00000000 ); ADDSTRING( pak, CharInfo->charname ); ADDBYTE( pak, 0x00 ); if(Status->Dash_up != 0xff) ADDWORD ( pak, (MagicStatus[Status->Dash_up].Value)); if(Status->Haste_up!= 0xff) ADDWORD ( pak, (MagicStatus[Status->Haste_up].Value)); if(Shop->open) { ADDBYTE( pak, Shop->ShopType); ADDBYTE( pak, 0x00); ADDSTRING(pak, Shop->name); ADDBYTE( pak, 0x00); } if(Clan->clanid!=0) { ADDWORD ( pak, Clan->clanid ); ADDWORD ( pak, 0x0000 ); ADDWORD ( pak, Clan->back ); ADDWORD ( pak, Clan->logo ); ADDBYTE ( pak, Clan->grade ); ADDBYTE ( pak, Clan->clanrank ); ADDSTRING ( pak, Clan->clanname ); } ADDWORD( pak, 0x0000 ); player->client->SendPacket(&pak); return true; } // ----------------------------------------------------------------------------------------- // Returns new skill slot //bskill askill pskill // ----------------------------------------------------------------------------------------- int CPlayer::GetNewSkillSlot(char skilltype) { switch (skilltype) { case 0: for(char s=0;s<30;s++) { if(bskills[s]==0)return s; } case 1: for(char t=0;t<30;t++) { if(askill[t]==0)return t; } case 2: for(char u=0;u<30;u++) { if(pskill[u]==0)return u; } } return 0xffff; }
[ "remichael@004419b5-314d-0410-88ab-2927961a341b" ]
remichael@004419b5-314d-0410-88ab-2927961a341b
b2630bc868ff8ec2978cf436d59ac010f7a5ef3b
343966f68798615621ed7f6a17ebe782b7738dea
/src/net/third_party/quiche/src/quic/qbone/mock_qbone_client.h
c5ec95bd2c70ca42f764db448c8d849408b48dd3
[ "BSD-3-Clause" ]
permissive
iuing/chromium.bb
57745cdda62a8b0097b7139f86422e74c331c937
e2c7771d2f79008f4c3b06b6cc024f3f1936156f
refs/heads/master
2023-04-09T10:12:54.306426
2021-04-22T14:26:20
2021-04-22T14:26:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
732
h
// Copyright (c) 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef QUICHE_QUIC_QBONE_MOCK_QBONE_CLIENT_H_ #define QUICHE_QUIC_QBONE_MOCK_QBONE_CLIENT_H_ #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/qbone/qbone_client_interface.h" namespace quic { class MockQboneClient : public QboneClientInterface { public: MOCK_METHOD(void, ProcessPacketFromNetwork, (absl::string_view packet), (override)); }; } // namespace quic #endif // QUICHE_QUIC_QBONE_MOCK_QBONE_CLIENT_H_
[ "copybara-worker@google.com" ]
copybara-worker@google.com
058329dc404517f853c78c01748b36ec6cbbdc15
4017374aabde4a7b9d938be37b0c4ade1c3c9b6e
/DLLReference/OtherDLL/OtherDLL.cpp
ba3ab7f77568b46812b180820b41674cd9efff4a
[]
no_license
vistaghoststudio108/VG-Tool
d194c5c6e0756a16cb8888d71362ccf6dc5e302d
cb25851ebe5f91b89a27814f91c1b7406716b9de
refs/heads/master
2021-01-02T08:56:37.520639
2015-07-31T00:28:56
2015-07-31T00:28:56
33,177,478
0
1
null
null
null
null
UTF-8
C++
false
false
100
cpp
// OtherDLL.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h"
[ "thuanpv3@fsoft.com.vn" ]
thuanpv3@fsoft.com.vn
a6d5cf8e94ca896d1219515d60726ee17a7a46c4
a1e9afa011a36f234d931450fcd9fcb7a06c0c81
/lonestar/scientific/cpu/longestedge/src/writers/TriangleFormatWriter.h
c4837ebaaa00a2f46a450d02191ab1266c8187ca
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
IntelligentSoftwareSystems/Galois
feba91d648f2610d64a85532b46511088265f38f
b67f94206a8c47fd414446621f6633a31c49fd98
refs/heads/master
2023-09-02T19:16:15.788567
2023-08-28T23:34:50
2023-08-28T23:34:50
137,784,875
288
130
NOASSERTION
2023-08-28T21:16:42
2018-06-18T17:33:03
C++
UTF-8
C++
false
false
801
h
#ifndef TRI_WRITER_H #define TRI_WRITER_H #include "../model/Coordinates.h" #include "../model/Graph.h" #include <cstddef> #include <string> #include <vector> struct TriNodeInfo { Coordinates coods; size_t mat; size_t id; }; struct TriConecInfo { std::vector<size_t> conec; size_t mat; }; struct TriSegmInfo { std::vector<size_t> points; bool border; }; void triangleFormatWriter(const std::string& filename, Graph& graph); void trProcessGraph(Graph& graph, std::vector<TriNodeInfo>& nodeVector, std::vector<TriSegmInfo>& segmVector, std::vector<TriConecInfo>& conecVector); void changeOrientationIfRequired(std::vector<unsigned long> element, std::vector<TriNodeInfo> nodeVector); #endif // TRI_WRITER_H
[ "podsiadl@agh.edu.pl" ]
podsiadl@agh.edu.pl
ef40a3b43ffc8069d7503da7298d2401ec94688f
81bf41b3e8e0e5a69dca4e4569912abd6605440d
/openthread-master/src/cores/thread/data_poll_manager.hpp
3731a855caca920edc6ef211631e177eded5ebcd
[]
no_license
bartvdenboom/Thread-state-machine-inference
572b10e1c740fd13af215e90e94f74b03510f73d
85147fa70438dafa276edd6bd8564eb490252a6a
refs/heads/master
2020-03-13T01:44:16.989936
2018-07-03T20:55:44
2018-07-03T20:55:44
130,910,074
0
0
null
null
null
null
UTF-8
C++
false
false
9,662
hpp
/* * Copyright (c) 2017, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @file * This file includes definitions for data poll (mac data request command) manager. */ #ifndef DATA_POLL_MANAGER_HPP_ #define DATA_POLL_MANAGER_HPP_ #include "openthread-core-config.h" #include <openthread/types.h> #include "common/code_utils.hpp" #include "common/locator.hpp" #include "common/timer.hpp" #include "mac/mac_frame.hpp" namespace ot { /** * @addtogroup core-data-poll-manager * * @brief * This module includes definitions for data poll manager. * * @{ */ /** * This class implements the data poll (mac data request command) manager. * */ class DataPollManager: public InstanceLocator { public: enum { kDefaultFastPolls = 8, ///< Default number of fast poll transmissions (@sa StartFastPolls). kMaxFastPolls = 15, ///< Maximum number of fast poll transmissions allowed. }; /** * This constructor initializes the data poll manager object. * * @param[in] aInstance A reference to the OpenThread instance. * */ explicit DataPollManager(otInstance &aInstance); /** * This method instructs the data poll manager to start sending periodic data polls. * * @retval OT_ERROR_NONE Successfully started sending periodic data polls. * @retval OT_ERROR_ALREADY Periodic data poll transmission is already started/enabled. * @retval OT_ERROR_INVALID_STATE Device is not in rx-off-when-idle mode. * */ otError StartPolling(void); /** * This method instructs the data poll manager to stop sending periodic data polls. * */ void StopPolling(void); /** * This method enqueues a data poll (an IEEE 802.15.4 Data Request) message. * * @retval OT_ERROR_NONE Successfully enqueued a data poll message * @retval OT_ERROR_ALREADY A data poll message is already enqueued. * @retval OT_ERROR_INVALID_STATE Device is not in rx-off-when-idle mode. * @retval OT_ERROR_NO_BUFS Insufficient message buffers available. * */ otError SendDataPoll(void); /** * This method sets a user-specified/external data poll period. * * If the user provides a non-zero poll period, the user value specifies the maximum period between data * request transmissions. Note that OpenThread may send data request transmissions more frequently when expecting * a control-message from a parent or in case of data poll transmission failures or timeouts. * * Default value for the external poll period is zero (i.e., no user-specified poll period). * * @param[in] aPeriod The data poll period in milliseconds, or zero to mean no user-specified poll period. * */ void SetExternalPollPeriod(uint32_t aPeriod); /** * This method gets the current user-specified/external data poll period. * * @returns The data poll period in milliseconds. * */ uint32_t GetExternalPollPeriod(void) const { return mExternalPollPeriod; } /** * This method informs the data poll manager of success/error status of a previously requested poll message * transmission. * * In case of transmit failure, the data poll manager may choose to send the next data poll more quickly (up to * some fixed number of attempts). * * @param[in] aError Error status of a data poll message transmission. * */ void HandlePollSent(otError aError); /** * This method informs the data poll manager that a data poll timeout happened, i.e., when the ack in response to * a data request command indicated that a frame was pending, but no frame was received after timeout interval. * * Data poll manager may choose to transmit another data poll immediately (up to some fixed number of attempts). * */ void HandlePollTimeout(void); /** * This method informs the data poll manager that a mac frame has been received. It checks the "frame pending" in * the received frame header and if it is set, data poll manager will send an immediate data poll to retrieve the * pending frame. * */ void CheckFramePending(Mac::Frame &aFrame); /** * This method asks the data poll manager to recalculate the poll period. * * This is mainly used to inform the poll manager that a parameter impacting the poll period (e.g., the child's * timeout value which is used to determine the default data poll period) is modified. * */ void RecalculatePollPeriod(void); /** * This method sets/clears the attach mode on data poll manager. * * When attach mode is enabled, the data poll manager will send data polls at a faster rate determined by * poll period configuration option `OPENTHREAD_CONFIG_ATTACH_DATA_POLL_PERIOD`. * * @param[in] aMode The mode value. * */ void SetAttachMode(bool aMode); /** * This method asks data poll manager to send the next given number of polls at a faster rate (poll period defined * by `kFastPollPeriod`). This is used by OpenThread stack when it expects a response from the parent/sender. * * If @p aNumFastPolls is zero the default value specified by `kDefaultFastPolls` is used instead. The number of * fast polls is clipped by maximum value specified by `kMaxFastPolls`. * * @param[in] aNumFastPolls If non-zero, number of fast polls to send, if zero, default value is used instead. * */ void SendFastPolls(uint8_t aNumFastPolls); /** * This method gets the maximum data polling period in use. * * @returns the maximum data polling period in use. * */ uint32_t GetKeepAlivePollPeriod(void) const; private: enum // Poll period under different conditions (in milliseconds). { kAttachDataPollPeriod = OPENTHREAD_CONFIG_ATTACH_DATA_POLL_PERIOD, ///< Poll period during attach. kRetxPollPeriod = 1000, ///< Poll retx period due to tx failure. kNoBufferRetxPollPeriod = 200, ///< Poll retx due to no buffer space. kFastPollPeriod = 188, ///< Period used for fast polls. kMinPollPeriod = 10, ///< Minimum allowed poll period. }; enum { kQuickPollsAfterTimeout = 5, ///< Maximum number of quick data poll tx in case of back-to-back poll timeouts. kMaxPollRetxAttempts = 5, ///< Maximum number of retransmit attempts of data poll (mac data request). }; enum PollPeriodSelector { kUsePreviousPollPeriod, kRecalculatePollPeriod, }; void ScheduleNextPoll(PollPeriodSelector aPollPeriodSelector); uint32_t CalculatePollPeriod(void) const; static void HandlePollTimer(Timer &aTimer); static DataPollManager &GetOwner(Context &aContext); uint32_t GetDefaultPollPeriod(void) const; uint32_t mTimerStartTime; uint32_t mExternalPollPeriod; uint32_t mPollPeriod; TimerMilli mTimer; bool mEnabled: 1; //< Indicates whether data polling is enabled/started. bool mAttachMode: 1; //< Indicates whether in attach mode (to use attach poll period). bool mRetxMode: 1; //< Indicates whether last poll tx failed at mac/radio layer (poll retx mode). bool mNoBufferRetxMode: 1; //< Indicates whether last poll tx failed due to insufficient buffer. uint8_t mPollTimeoutCounter: 4; //< Poll timeouts counter (0 to `kQuickPollsAfterTimout`). uint8_t mPollTxFailureCounter: 4; //< Poll tx failure counter (0 to `kMaxPollRetxAttempts`). uint8_t mRemainingFastPolls: 4; //< Number of remaining fast polls when in transient fast polling mode. }; /** * @} * */ } // namespace ot #endif // DATA_POLL_MANAGER_HPP_
[ "bartvandenboom@hotmail.com" ]
bartvandenboom@hotmail.com
268b9ed9a6b5db4731a8ded911488f673e6b7ca5
ef0378f718f10f37da0d1f6432c8be9e97011049
/common/a_cinema_line.cpp
d67d1effd32be90478dbd71f24b6df9a2211cf2c
[]
no_license
snandasena/cf-contests
13355fa211f90e2d77f352d1857385bdfa9a2a18
62df67dad8da6de7d0572d6ca3c04b54f8d1d151
refs/heads/master
2023-01-12T20:37:05.681906
2020-11-22T02:06:58
2020-11-22T02:06:58
280,200,591
2
0
null
2020-11-22T02:06:59
2020-07-16T16:15:52
C++
UTF-8
C++
false
false
874
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, tf = 0, ft = 0, hd = 0; cin >> n; vector<int> v(n); for (int &i: v) { cin >> i; } string ans = "YES"; for (int &i: v) { if (i == 25) { tf++; } else if (i == 50) { if (tf > 0) { tf--; ft++; } else { ans = "NO"; break; } } else { if (tf > 0 && ft > 0) { tf--; ft--; } else if (tf > 2) { tf -= 3; } else { ans = "NO"; break; } } } cout << ans; return 0; }
[ "sajith@digitalxlabs.com" ]
sajith@digitalxlabs.com
e81275e7f265a4bb42efa26477b36ffc9b4071f9
9ad254273a25c3c26845ab5fb8754478066c8c8d
/Arrows - Windows/Item.cpp
779ef4fb1c29ba5639b489621be8cb7933175dca
[]
no_license
CrazyRagdoll/Arrows-Windows
cde7a1bdf66d99a6a1b367acd26996a3f0293075
e6ba77a0a7f1ab3cdddbdc6af77c99f5e8bcf2de
refs/heads/master
2021-01-01T20:18:41.851540
2017-07-30T15:57:09
2017-07-30T15:57:09
98,807,484
0
0
null
null
null
null
UTF-8
C++
false
false
6,389
cpp
#include "Item.h" Item::Item(glm::vec3 pos, int value) : _width(0.5f), _depth(0.5f), _height(4.0f), _time(10000.0f), _collected(false) { _position = pos; _value = value; _vboID = 0; } Item::~Item() { //cleaing up the buffers when the sprite is destroyed. if(_vboID != 0) { glDeleteBuffers(1, &_vboID); } } bool Item::update(float time) { _time --; //Making the arrows all floaty like _position.y += sin(time/500)/4; if(_time <= 0 || _collected) { return true; } return false; } void Item::init() { // If the vertex buffer is 0, use OpenGL to set it. if( _vboID == 0 ) { glGenBuffers(1, &_vboID); } // Make a cube out of triangles (two triangles per side) Vertex vertexData[36]; // X Y Z U V // bottom vertexData[0].setPosUV(_position.x - _width, _position.y - _height, _position.z - _depth, 0.0f, 0.0f); vertexData[1].setPosUV(_position.x + _width, _position.y - _height, _position.z - _depth, 1.0f, 0.0f); vertexData[2].setPosUV(_position.x - _width, _position.y - _height, _position.z + _depth, 0.0f, 1.0f); vertexData[3].setPosUV(_position.x + _width, _position.y - _height, _position.z - _depth, 1.0f, 0.0f); vertexData[4].setPosUV(_position.x + _width, _position.y - _height, _position.z + _depth, 1.0f, 1.0f); vertexData[5].setPosUV(_position.x - _width, _position.y - _height, _position.z + _depth, 0.0f, 1.0f); // top vertexData[6].setPosUV(_position.x - _width, _position.y + _height, _position.z - _depth, 0.0f, 0.0f); vertexData[7].setPosUV(_position.x - _width, _position.y + _height, _position.z + _depth, 0.0f, 1.0f); vertexData[8].setPosUV(_position.x + _width, _position.y + _height, _position.z - _depth, 1.0f, 0.0f); vertexData[9].setPosUV(_position.x + _width, _position.y + _height, _position.z - _depth, 1.0f, 0.0f); vertexData[10].setPosUV(_position.x - _width, _position.y + _height, _position.z + _depth, 0.0f, 1.0f); vertexData[11].setPosUV(_position.x + _width, _position.y + _height, _position.z + _depth, 1.0f, 1.0f); // right vertexData[12].setPosUV(_position.x + _width, _position.y - _height, _position.z + _depth, 1.0f, 0.0f); vertexData[13].setPosUV(_position.x + _width, _position.y - _height, _position.z - _depth, 0.0f, 0.0f); vertexData[14].setPosUV(_position.x + _width, _position.y + _height, _position.z - _depth, 0.0f, 1.0f); vertexData[15].setPosUV(_position.x + _width, _position.y - _height, _position.z + _depth, 1.0f, 0.0f); vertexData[16].setPosUV(_position.x + _width, _position.y + _height, _position.z - _depth, 0.0f, 1.0f); vertexData[17].setPosUV(_position.x + _width, _position.y + _height, _position.z + _depth, 1.0f, 1.0f); // left vertexData[18].setPosUV(_position.x - _width, _position.y - _height, _position.z + _depth, 0.0f, 0.0f); vertexData[19].setPosUV(_position.x - _width, _position.y + _height, _position.z - _depth, 1.0f, 1.0f); vertexData[20].setPosUV(_position.x - _width, _position.y - _height, _position.z - _depth, 1.0f, 0.0f); vertexData[21].setPosUV(_position.x - _width, _position.y - _height, _position.z + _depth, 0.0f, 0.0f); vertexData[22].setPosUV(_position.x - _width, _position.y + _height, _position.z + _depth, 0.0f, 1.0f); vertexData[23].setPosUV(_position.x - _width, _position.y + _height, _position.z - _depth, 1.0f, 1.0f); // front vertexData[24].setPosUV(_position.x - _width, _position.y - _height, _position.z + _depth, 1.0f, 0.0f); vertexData[25].setPosUV(_position.x + _width, _position.y - _height, _position.z + _depth, 0.0f, 0.0f); vertexData[26].setPosUV(_position.x - _width, _position.y + _height, _position.z + _depth, 1.0f, 1.0f); vertexData[27].setPosUV(_position.x + _width, _position.y - _height, _position.z + _depth, 0.0f, 0.0f); vertexData[28].setPosUV(_position.x + _width, _position.y + _height, _position.z + _depth, 0.0f, 1.0f); vertexData[29].setPosUV(_position.x - _width, _position.y + _height, _position.z + _depth, 1.0f, 1.0f); // back vertexData[30].setPosUV(_position.x - _width, _position.y - _height, _position.z - _depth, 0.0f, 0.0f); vertexData[31].setPosUV(_position.x - _width, _position.y + _height, _position.z - _depth, 0.0f, 1.0f); vertexData[32].setPosUV(_position.x + _width, _position.y - _height, _position.z - _depth, 1.0f, 0.0f); vertexData[33].setPosUV(_position.x + _width, _position.y - _height, _position.z - _depth, 1.0f, 0.0f); vertexData[34].setPosUV(_position.x - _width, _position.y + _height, _position.z - _depth, 0.0f, 1.0f); vertexData[35].setPosUV(_position.x + _width, _position.y + _height, _position.z - _depth, 1.0f, 1.0f); for (int i = 0; i < 36; i++) { vertexData[i].setColor(255, 255, 255, 255); } _vertexSize = sizeof(vertexData); // Binding the buffer glBindBuffer(GL_ARRAY_BUFFER, _vboID); // Uploading the buffer data glBufferData(GL_ARRAY_BUFFER, _vertexSize, vertexData, GL_STATIC_DRAW); // Unbinding the buffer glBindBuffer(GL_ARRAY_BUFFER, 0); } void Item::draw() { //bind the buffer object glBindBuffer(GL_ARRAY_BUFFER, _vboID); //Activating and binding the texture glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, _texture.id); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); //tell opengl that we want to use the first arrribute array. glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); //This is the position attribute pointer glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position)); //This is the color attribute pointer glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, color)); //this is the UV attribute pointer glVertexAttribPointer(2, 2, GL_FLOAT, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, uv)); //Draw the 6 verticies to the screen glDrawArrays(GL_TRIANGLES, 0, _vertexSize); //disable the vertex attrib array. Not optional glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); glDisableVertexAttribArray(2); //unbind the texture glBindTexture(GL_TEXTURE_2D, 0); //unbind the vbo glBindBuffer(GL_ARRAY_BUFFER, 0); }
[ "Samuel_bowen_1994@hotmail.co.uk" ]
Samuel_bowen_1994@hotmail.co.uk
4a2aa8f83636ee4e1b1f2d8026ad3a93de690350
a7f07a52d03f38c8bbe4dd5ae85275427bb97470
/led_controller/DAO.h
cffc0de468e9915ca9ecb8c5798a7e7ae3d0a89c
[ "MIT" ]
permissive
cduignan/led-controller
c01385649a02c9ab26c6f0c67a047c117af0553a
d659a978d26067fa77e9400e2cf888859f4d2b2e
refs/heads/master
2021-08-23T08:15:40.131446
2017-12-04T08:20:40
2017-12-04T08:22:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
928
h
class Color; class AnimationSet; #define STATE_CONFIGURED 1 #define STATE_WIFISTATUS 2 #define STATE_SWITCH 4 class DAO { public: DAO(); String getSSID(); void storeSSID(String ssid); String getKey(); void storeKey(String key); String getPassword(); void storePassword(String password); int getMode(); void storeMode(int mode); /** * State of the controller. * Bitwise operations * STATE_CONFIGURED * STATE_WIFISTATUS * STATE_SWITCH */ bool getState(int bit); void storeState(int bit, bool set); Color* getColor(); void storeColor(Color* color); int getLoopTime(); void storeLoopTime(int loopTimeMs); AnimationSet* getAnimationSet(); void storeAnimationSet(AnimationSet* as); void clear(); private: String readString(int offset); void storeString(int offset, String content, int length); int readByte(int position); void storeByte(int position, int value); };
[ "ortola.loic@gmail.com" ]
ortola.loic@gmail.com
a823b94a013a3419a6b5bccad10f02c9cc0c30eb
11cefa76e3cd8b7dc64b0d797d653e68ad9157fd
/demos/choir/MusicSheetPlayer.h
69ea7d3f9aff394d1cf9311fe052a8dba5734603
[ "BSD-3-Clause" ]
permissive
jfriesne/zg_choir
984d38d3a0952c5926818c1587cfc10732534ff9
99ffe96c7289fe44244d0062e72b4a62be7d4d38
refs/heads/master
2023-08-22T19:30:38.449263
2023-08-13T05:23:09
2023-08-13T05:23:09
95,175,919
8
4
BSD-3-Clause
2021-12-18T21:27:14
2017-06-23T02:34:21
C++
UTF-8
C++
false
false
1,759
h
#ifndef MusicSheetPlayer_h #define MusicSheetPlayer_h #include <QObject> class QTimer; #include "zg/INetworkTimeProvider.h" #include "MusicSheet.h" #include "PlaybackState.h" #ifndef DOXYGEN_SHOULD_IGNORE_THIS Q_DECLARE_METATYPE(choir::ConstMusicSheetRef); Q_DECLARE_METATYPE(choir::PlaybackState); #endif namespace choir { /** This object is in charge of reading the music sheet and telling Quasimodo * when to ring the bells, based on the current time and settings. * This is done within a separate thread, so that the timing of the bell-ringing won't be affected GUI operations */ class MusicSheetPlayer : public QObject { Q_OBJECT public: /** Constructor */ MusicSheetPlayer(const INetworkTimeProvider * networkTimeProvider, QObject * parent = NULL); /** Destructor */ ~MusicSheetPlayer(); signals: /** Emitted when we want Quasimodo to ring a specified set of bells */ void RequestBells(quint64 chord, bool localNotesOnly); public slots: /** Received on startup */ void SetupTimer(); /** Received when the sheet music has changed */ void MusicSheetUpdated(const choir::ConstMusicSheetRef & newMusicSheet); /** Received when the playback state has changed */ void PlaybackStateUpdated(const choir::PlaybackState & newPlaybackState); /** Received on shutdown */ void DestroyTimer(); private slots: void Wakeup(); private: void RecalculateWakeupTime(); const INetworkTimeProvider * _networkTimeProvider; ConstMusicSheetRef _musicSheet; PlaybackState _playbackState; uint32 _nextChordIndex; // index of the next chord-position in the music sheet that we haven't played yet uint64 _nextWakeupTimeLocal; QTimer * _wakeupTimer; }; }; // end namespace choir #endif
[ "jaf@meyersound.com" ]
jaf@meyersound.com
031dafb99c4b45d0c4dade905f565fa79ed1380a
7bbc29dcd11bf93b301a043ee239dc17d395827a
/re2c/src/adfa/prepare.cc
c8202d97031ae4077b8a9559866b43cf667a1340
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain" ]
permissive
rossburton/re2c
29ce5593f2734f79590d0e066584bd0826e5a33b
5f7169690ae7e89f4fe0b106fbce324be0202f4d
refs/heads/master
2021-01-01T20:37:30.036790
2017-07-31T14:43:41
2017-08-01T09:19:15
98,899,751
0
0
null
2017-07-31T14:46:26
2017-07-31T14:46:26
null
UTF-8
C++
false
false
8,305
cc
#include "src/util/c99_stdint.h" #include <string.h> #include <map> #include "src/code/bitmap.h" #include "src/code/go.h" #include "src/conf/msg.h" #include "src/adfa/action.h" #include "src/adfa/adfa.h" #include "src/util/allocate.h" namespace re2c { void DFA::split(State *s) { State *move = new State; addState(move, s); move->action.set_move (); move->rule = s->rule; move->fill = s->fill; /* used by tunneling, ignored by codegen */ move->go = s->go; move->go.tags = TCID0; /* drop hoisted tags */ move->rule_tags = s->rule_tags; move->fall_tags = s->fall_tags; s->rule = Rule::NONE; s->go.nSpans = 1; s->go.span = allocate<Span> (1); s->go.span[0].ub = ubChar; s->go.span[0].to = move; s->go.span[0].tags = TCID0; } static uint32_t merge(Span *x, State *fg, State *bg) { Span *f = fg->go.span; Span *b = bg->go.span; Span *const fe = f + fg->go.nSpans; Span *const be = b + bg->go.nSpans; Span *const x0 = x; for (;!(f == fe && b == be);) { if (f->to == b->to && f->tags == b->tags) { x->to = bg; x->tags = TCID0; } else { x->to = f->to; x->tags = f->tags; } if (x == x0 || x[-1].to != x->to || x[-1].tags != x->tags) { ++x; } x[-1].ub = std::min(f->ub, b->ub); if (f->ub < b->ub) { ++f; } else if (f->ub > b->ub) { ++b; } else { ++f; ++b; } } return static_cast<uint32_t>(x - x0); } void DFA::findBaseState() { Span *span = allocate<Span> (ubChar - lbChar); for (State *s = head; s; s = s->next) { if (s->fill == 0) { for (uint32_t i = 0; i < s->go.nSpans; ++i) { State *to = s->go.span[i].to; if (to->isBase) { to = to->go.span[0].to; uint32_t nSpans = merge(span, s, to); if (nSpans < s->go.nSpans) { operator delete (s->go.span); s->go.nSpans = nSpans; s->go.span = allocate<Span> (nSpans); memcpy(s->go.span, span, nSpans*sizeof(Span)); break; } } } } } operator delete (span); } /* note [tag hoisting, skip hoisting and tunneling] * * Tag hoisting is simple: if all transitions have the same commands, * they can be hoisted out of conditional branches. * * Skip hoisting is only relevant with '--eager-skip' option. * Normally this option is off and skip is lazy: it happens after * transition to the next state, if this state is consuming. * However, with '--eager-skip' skip happens before transition to the next * state. Different transitions may disagree: some of them go to consuming * states, others don't. If they agree, skip can be hoisted (just like tags). * * '--eager-skip' makes tag hoisting more complicated, because now we have * to care about the type of automaton: lookahead TDFAs must skip after * writing tags, while non-lookahead TDFAs must skip before writing tags. * Therefore skip hoising cannot be done without tag hoisting in lookahead * TDFAs, and vice versa with non-lookahead TDFAs. * (Note that '--eager-skip' is implied by '--no-lookahead'). * * Tunneling splits base states in two parts: head and body. Body has all * the conditional branches (transitions on symbols), while head has just * one unconditional jump to body. * * Normally tag hoisting should go before tunneling: hoisting may add new * candidates to be merged by tunneling. However, with '--eager-skip' tag * hoisting is interwined with skip hoisting, and the latter needs to know * which states are consuming. This is not possible if tunneling is still * to be done, because it may turn consuming states into non-consuming ones. * Another option is to disallow splitting states with non-hoisted skip * in the presence of '--eager-skip' (this way skip hoisting wouldn't need * to know tunneling results), but it's much worse for tunneling. */ void DFA::prepare(const opt_t *opts) { // create rule states std::vector<State*> rule2state(rules.size()); for (State *s = head; s; s = s->next) { if (s->rule != Rule::NONE) { if (!rule2state[s->rule]) { State *n = new State; n->action.set_rule(s->rule); rule2state[s->rule] = n; addState(n, s); } for (uint32_t i = 0; i < s->go.nSpans; ++i) { if (!s->go.span[i].to) { s->go.span[i].to = rule2state[s->rule]; s->go.span[i].tags = s->rule_tags; } } } } // create default state (if needed) State * default_state = NULL; for (State * s = head; s; s = s->next) { for (uint32_t i = 0; i < s->go.nSpans; ++i) { if (!s->go.span[i].to) { if (!default_state) { default_state = new State; addState(default_state, s); } s->go.span[i].to = default_state; } } } // bind save actions to fallback states and create accept state (if needed) if (default_state) { for (State *s = head; s; s = s->next) { if (s->fallback) { const std::pair<const State*, tcid_t> acc(rule2state[s->rule], s->fall_tags); s->action.set_save(accepts.find_or_add(acc)); } } default_state->action.set_accept(&accepts); } // tag hoisting should be done after binding default arcs: // (which may introduce new tags) // see note [tag hoisting, skip hoisting and tunneling] if (!opts->eager_skip) { hoist_tags(); } // split ``base'' states into two parts for (State * s = head; s; s = s->next) { s->isBase = false; if (s->fill != 0) { for (uint32_t i = 0; i < s->go.nSpans; ++i) { if (s->go.span[i].to == s) { s->isBase = true; split(s); if (opts->bFlag) { bitmaps.insert(&s->next->go, s); } s = s->next; break; } } } } // find ``base'' state, if possible findBaseState(); // see note [tag hoisting, skip hoisting and tunneling] if (opts->eager_skip) { hoist_tags_and_skip(opts); } for (State *s = head; s; s = s->next) { s->go.init(s, opts, bitmaps); } } void DFA::calc_stats(uint32_t ln, bool explicit_tags) { // calculate 'YYMAXFILL' max_fill = 0; for (State * s = head; s; s = s->next) { if (max_fill < s->fill) { max_fill = s->fill; } } // determine if 'YYMARKER' or 'YYBACKUP'/'YYRESTORE' pair is used need_backup = accepts.size () > 0; // determine if 'yyaccept' variable is used need_accept = accepts.size () > 1; // determine if 'YYCTXMARKER' or 'YYBACKUPCTX'/'YYRESTORECTX' pair is used // If tags are not enabled explicitely and trailing contexts // don't overlap (single variable is enough for all of them), then // re2c should use old-style YYCTXMARKER for backwards compatibility. // Note that with generic API fixed-length contexts are forbidden, // which may cause additional overlaps. oldstyle_ctxmarker = !explicit_tags && maxtagver == 1; // error if tags are not enabled, but we need them if (!explicit_tags && maxtagver > 1) { fatal_l(ln, "overlapping trailing contexts need " "multiple context markers, use '-t, --tags' " "option and '/*!stags:re2c ... */' directive"); } } void DFA::hoist_tags() { for (State * s = head; s; s = s->next) { Span *span = s->go.span; const size_t nspan = s->go.nSpans; if (nspan == 0) continue; tcid_t ts = span[0].tags; for (uint32_t i = 1; i < nspan; ++i) { if (span[i].tags != ts) { ts = TCID0; break; } } if (ts != TCID0) { s->go.tags = ts; for (uint32_t i = 0; i < nspan; ++i) { span[i].tags = TCID0; } } } } void DFA::hoist_tags_and_skip(const opt_t *opts) { assert(opts->eager_skip); for (State * s = head; s; s = s->next) { Span *span = s->go.span; const size_t nspan = s->go.nSpans; if (nspan == 0) continue; bool hoist_tags = true, hoist_skip = true; // do all spans agree on tags? for (uint32_t i = 1; i < nspan; ++i) { if (span[i].tags != span[0].tags) { hoist_tags = false; break; } } // do all spans agree on skip? for (uint32_t i = 0; i < nspan; ++i) { if (consume(span[i].to) != consume(span[0].to)) { hoist_skip = false; break; } } if (opts->lookahead) { // skip must go after tags hoist_skip &= hoist_tags; } else { // skip must go before tags hoist_tags &= hoist_skip; } // hoisting tags is possible if (hoist_tags) { s->go.tags = span[0].tags; for (uint32_t i = 0; i < nspan; ++i) { span[i].tags = TCID0; } } // hoisting skip is possible s->go.skip = hoist_skip && consume(span[0].to); } } } // namespace re2c
[ "skvadrik@gmail.com" ]
skvadrik@gmail.com
dc62f3909ad36e2838e3ffd169df9233bb5aeec1
b426f81bc47223d79b374c0c6dc26d168e1e6e39
/include/ops_singleton_class.h
dbee2adff47f8f17a24ecf57f610affe17b9235e
[]
no_license
Yaoxin/ops
e129d8e87c34c0076015cd212a27961bdd76230d
7f3468df3d97ddcd7c373074fd863c8884e06d57
refs/heads/master
2020-06-02T13:02:58.620972
2018-11-27T03:01:53
2018-11-27T03:01:53
29,846,909
0
0
null
null
null
null
UTF-8
C++
false
false
590
h
/* * ops_singleton_class.h * * Created on: 2015-1-23 * Author: fyliu */ #ifndef OPS_SINGLETON_CLASS_H_ #define OPS_SINGLETON_CLASS_H_ template <class T> class SingletonClass { public: static T* GetInstance() { if(NULL == _instance) _instance = new T();//T() will call constructor return _instance; } static void ReleaseInstance() { if(NULL != _instance) delete _instance; _instance = NULL; } private: static T* _instance; }; template <class T> T* SingletonClass<T>::_instance = NULL; #endif /* OPS_SINGLETON_CLASS_H_ */
[ "7936511@qq.com" ]
7936511@qq.com
4c7abaa0598cedba7f248f4a695848d3ec490f03
762c1b45e9fd07d95b8ce13cd82fbd7cdf4e0b27
/Chess/Mause_control.h
f8c9afc30e5aab5dfab6eecb557889593452beb1
[]
no_license
AskarbekovBakyt03/Chess_game
c269e5f1ff503f08397315a416060456292564a5
182e868efc2689bfbdc5c8f817e5206b606897fb
refs/heads/master
2023-03-18T04:07:34.478251
2019-03-04T20:22:10
2019-03-04T20:22:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,105
h
#include <SFML/Graphics.hpp> #include <iostream> using namespace sf; class Mause_control { private: Vector2i mause_position; public: Vector2i get_mause_position() { return this->mause_position; } void set_mause_position(RenderWindow &_window) { this->mause_position = Mouse::getPosition(_window); } float get_x_position(RenderWindow &_window) { this->set_mause_position(_window); if (this->get_mause_position().x > 50 && this->get_mause_position().x <= 450) { cout << (float)this->get_mause_position().x << " "; return (float)this->get_mause_position().x; } else { if (this->get_mause_position().x < 50) return 50; if (this->get_mause_position().x > 450) return 450; } } float get_y_position(RenderWindow &_window) { this->set_mause_position(_window); if (this->get_mause_position().y > 50 && this->get_mause_position().x <= 450) { cout << (float)this->get_mause_position().y << endl; return (float)this->get_mause_position().y; } else { if (this->get_mause_position().y < 50) return 50; if (this->get_mause_position().y > 450) return 450; } } };
[ "79117346876@yandex.ru" ]
79117346876@yandex.ru
41f7f412d30ad4525bda5380f04297c2c245e3e5
cc79c5ddb26fa8a385d9e01c99865990efb48495
/camera.ino
4457d9667c6201ac9ea6a4b898521194cbff0d65
[]
no_license
legokor/UPRA_OBC.mega328
473b5879cced82f5dd37a62450efa1108e4c2515
a9d53aaa27d84fdb7af44c7e2bca740288135138
refs/heads/master
2021-10-25T01:38:46.475137
2019-03-29T23:55:23
2019-03-29T23:55:23
108,591,048
0
0
null
null
null
null
UTF-8
C++
false
false
3,144
ino
int processCMDTAmsg(void) { int i, j, k, IntegerPart; char tmp[3]; int pic=0; // $TMHKR,C,,,,*47 // COM // 1 IntegerPart = 1; for (i=0, j=0, k=0; (i<MSGindex) && (j<10); i++) // We start at 7 so we ignore the '$GPGGA,' { if (bus_msg[i] == ',') { j++; // Segment index k=0; // Index into target variable IntegerPart = 1; } else { if (j == 1) { tmp[k] = bus_msg[i]; k++; } } } if( tmp[0] == 'S') { //_Serial.println("save"); pic = savePICsd(); _Serial.println(F("")); if(pic == 0) { _Serial.println(F("Success")); delay(500); } else if(pic == 1) { _Serial.println(F("Data overflow")); } else if(pic == 2) { _Serial.println(F("CAM timeout")); } return 0; } if( tmp[0] == 'E') { _Serial.println(F("$TMCAM,,END*47")); return 0; } } int savePICsd(void) { char str[10]; byte buf[256]; static int i = 0; static int k = 0; uint8_t temp = 0,temp_last=0; bool is_data=false; volatile int cam_wtchdg=0; int nowtime=0; //itoa(picnum, str, 10); str[0]='\0'; strcat(str, GPS_time); strcat(str, ".jpg"); //Open the new dataFile //dataFile = SD.open(str, O_WRITE | O_CREAT | O_TRUNC); if(!dataFile.open(str, O_RDWR | O_CREAT )) { _Serial.println(F("open dataFile faild")); dataFile.close(); return 2; } //picnum++; i = 0; cam_wtchdg = millis(); while(!_Serial.available()) { nowtime=millis(); if(nowtime - cam_wtchdg >6000) { dataFile.close(); return 2; } } /* while (_Serial.available() > 0) { temp = _Serial.read(); }*/ temp=0; //Read JPEG data from FIFO cam_wtchdg = millis(); while ( (temp !=0xD9) | (temp_last !=0xFF)) { nowtime=millis(); if(nowtime - cam_wtchdg >3000) { dataFile.close(); return 2; } if (_Serial.available() > 0) { cam_wtchdg = millis(); temp_last = temp; temp = _Serial.read(); //Write image data to buffer if not full if( i < 256) buf[i++] = temp; else{ //Write 256 bytes image data to dataFile dataFile.write(buf ,256); i = 0; //timeout in case of corrupt dadaflow; picture data larger than 80kB -> must be tested and calibrated if(k>320) { dataFile.close(); //close dataFile return 1; } buf[i++] = temp; } _Serial.print(F("o")); delay(0); } } //Write the remain bytes in the buffer if(i > 0){ dataFile.write(buf,i); } //Close the dataFile dataFile.close(); return 0; } void getPICuart() { int timer=0; int nowtime=0; int getmsg=10; _Serial.listen(); //_Serial.println("d"); _Serial.println(F("$TMCAM,1,CAP*47")); timer=millis(); while(getmsg !=0) { getmsg=GetBusMSG(); nowtime=millis(); if(nowtime - timer >6000) { _Serial.println(F("timeout")); break; } // _Serial.print("."); } }
[ "32751776+Bgoczan@users.noreply.github.com" ]
32751776+Bgoczan@users.noreply.github.com
9649f13e7a93c4f0e5cd984717dc0f509d5b9b57
804b7c9046fa269bf1fe28b4cd88b726348d4661
/include/ComboBoxPopulator.h
2e48d7b963f8e24a96ade6815d79fa777d008904
[]
no_license
Romankivs/XmlQt
871712c6f0f48333ee5370a7000974c9ede49526
a6b6aa55307bc8d4e55913613c2f486c2428a12c
refs/heads/main
2023-09-03T09:16:27.653075
2021-11-13T18:30:00
2021-11-13T18:30:00
425,297,869
0
0
null
null
null
null
UTF-8
C++
false
false
456
h
#pragma once #include "Service.h" #include <QApplication> #include <QDebug> #include <QDomDocument> #include <QMessageBox> #include <QString> #include <QVector> class ComboBoxPopulator { public: ComboBoxPopulator() = default; void setData(const QString &input); QVector<QVector<QString>> getResult(); bool checkIfErrorOccured(); private: void error(const QString &msg); bool errorOccured; QVector<QVector<QString>> result; };
[ "romankiv1771@gmail.com" ]
romankiv1771@gmail.com
16ccc95dfb1a2798649ca93b590974d049fafa60
0d25a28b9fb40a5752e9cc54eed403007dbe8c3a
/word_break.cpp
1fcf0dd3f21616eef7cbbc9a720779d7a940029e
[]
no_license
houlonglong/js_Algorithm
e993445490152fde87cf63ff955cbd9446a8f741
61755f9126347a2ed0a7610ac2a1de4b84c700e1
refs/heads/master
2020-04-10T22:49:36.491012
2016-09-15T08:09:58
2016-09-15T08:09:58
68,272,726
0
0
null
null
null
null
UTF-8
C++
false
false
1,172
cpp
/* * @Author: Beinan * @Date: 2015-02-15 20:11:38 * @Last Modified by: Beinan * @Last Modified time: 2015-02-15 20:51:49 */ #include <iostream> #include <string> #include <vector> #include <unordered_set> using namespace std; void print_result(vector<string>& result, int length){ if(length == 0) return; string word = result[length]; print_result(result, length - word.length()); cout << " " << word; } void word_break(unordered_set<string> &dict, string str){ vector<string> result; result.resize(str.length() + 1, ""); for(int i = 0; i <= str.length(); i++){ string word = str.substr(0, i); if(dict.count(word) > 0){ result[i] = word; continue; } for(int j = 0; j < i; j++){ if(result[j] != ""){ string word = str.substr(j, i-j); if(dict.count(word) > 0){ result[i] = word; break; } } } } if(result[str.length()] != ""){ print_result(result, str.length()); } } int main(){ unordered_set<string> dict = {"word", "ord", "break", "problem", "lem", "pro", "db" , "wor"}; word_break(dict,"wordbreakproblem"); return 0; }
[ "31363537@qq.com" ]
31363537@qq.com
9b5ec190b7dd454e2bb55b6d87028c8418d04527
7507c364ebd96ec9a68b482293769cbf05e6da22
/src/demo_fake_gpio_counter.cpp
47f663747cee0bb88f85f1e1d06be1a5cd731da5
[]
no_license
IanMaHKG/hyped-2019-stm-test
9d0fbdfd6e02d2404802c11844df309a42d47e50
a9e9dfea78e4830892f3ebe1264c38be8cc134f0
refs/heads/master
2020-05-07T16:20:42.216632
2019-04-06T14:59:14
2019-04-06T14:59:14
180,678,261
0
0
null
null
null
null
UTF-8
C++
false
false
1,102
cpp
#include "utils/concurrent/thread.hpp" #include "sensors/fake_gpio_counter.hpp" #include "utils/logger.hpp" #include "utils/timer.hpp" #include "utils/system.hpp" #include "data/data.hpp" using hyped::utils::concurrent::Thread; using hyped::sensors::FakeGpioCounter; using hyped::utils::Logger; using hyped::utils::Timer; using hyped::data::StripeCounter; using hyped::data::Data; using hyped::data::State; uint8_t kStripeNum = 30; int main(int argc, char* argv[]) { hyped::utils::System::parseArgs(argc, argv); Logger log(true, 0); FakeGpioCounter fake_gpio(log, false, true, "data/in/gpio_counter_normal_run.txt"); Data& data = Data::getInstance(); uint32_t stripe_count = 0; auto state = data.getStateMachineData(); state.current_state = State::kAccelerating; data.setStateMachineData(state); while (stripe_count < kStripeNum){ StripeCounter stripe_counted = fake_gpio.getStripeCounter(); stripe_count = stripe_counted.count.value; log.DBG("FakeGpioCounter", "Stripe count = %u", stripe_count); Thread::sleep(50); } }
[ "jackhorse1000@gmail.com" ]
jackhorse1000@gmail.com
eb31501348c8ba14d96e021fdbe054b71fd6404c
2131ebbee9e8dfebba76412c3de6a564f4475b4c
/xme-0.6-rc1-src/examples/autopnp_gui/src/application/guiNode/mainwindow.h
e37353fd7b4db88bc4e69f2f06f4a8c9af5397b0
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
sebastianpinedaar/autopnp
64b02710e7591d66db7d36979bb43e0908a93e73
496e55409a2943c1e4e2213150628ea9415bc03c
refs/heads/master
2021-01-14T09:45:43.958364
2014-07-25T14:01:59
2014-07-25T14:01:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
705
h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <vector> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); void emitWriteTextSignal(char* text); void emitDisplayImage(unsigned int width, unsigned int height, unsigned int step, const std::vector<unsigned char>& data); signals: void writeTextSignal(QString text); void displayImageSignal(QImage image); private slots: void writeText(QString text); void buttonPushed(); void terminateApplication(); void displayImage(QImage image); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
[ "Richard.Bormann@ipa.fraunhofer.de" ]
Richard.Bormann@ipa.fraunhofer.de
6d3d9d3c3ed84b0cb2ac7b9b71e84498fff6cc2b
b23da53a580952391215d9fe623491ac1b968d49
/examples/arduino_keyestudio_scale/arduino_keyestudio_scale.ino
d667a30f777fdd92156679b9d770b974568d3966
[ "MIT" ]
permissive
ulno/ulnoiot
fb24c406c0c48878a130f935f2f02cfc329dea14
355f1a2f95389f1fe99a19a72933a5c95ee04445
refs/heads/master
2021-11-23T11:34:10.411559
2021-11-08T00:39:44
2021-11-08T00:39:44
140,750,990
12
5
MIT
2021-11-08T00:40:31
2018-07-12T18:32:49
C++
UTF-8
C++
false
false
3,245
ino
// Example for an i2c connector to communicate with ulnoiot-node via i2c // This example is optimized for the keyes-scale // // Based on Wire example by Nicholas Zambetti <http://www.zambetti.com> // // Author: ulno (http://ulno.net) // Created: 2017-10-21 // #include <HX711_ADC.h> // https://github.com/olkal/HX711_ADC #include <Wire.h> //#include <LiquidCrystal_PCF8574.h> // http://www.mathertel.de/Arduino/LiquidCrystal_PCF8574.aspx #include <math.h> #include <UlnoiotI2c.h> HX711_ADC hx(9, 10); bool taring = false; void trigger_tare( char *msg, int len ) { Serial.print("Received a message of length: "); Serial.println(len); Serial.print("Message:"); Serial.println(msg); // is properly 0 terminated - but len can be used to if(len==4 && !strncmp("tare",msg,4)) { Serial.println("Tare request received."); hx.tareNoDelay(); taring = true; } } UlnoiotI2c ui2c(1000, trigger_tare); // Must be initialized first (before other i2c) // doesn't work LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display long t=0; void setup() { Serial.begin(115200); /*Serial.println("Dose: check for LCD"); // See http://playground.arduino.cc/Main/I2cScanner Wire.begin(); Wire.beginTransmission(0x27); int error = Wire.endTransmission(); if (error == 0) { Serial.println("LCD found."); } else { Serial.print("Error: "); Serial.print(error); Serial.println(": LCD not found."); } lcd.setBacklight(255); lcd.begin(16,2); lcd.clear(); lcd.print("Wait, starting"); lcd.setCursor(0, 1); lcd.print("up for 5s ..."); */ Serial.println("Wait 5s to start up and stabilize ..."); hx.setGain(128); hx.begin(); long stabilisingtime = 5000; // tare preciscion can be improved by adding a few seconds of stabilising time hx.start(stabilisingtime); hx.setCalFactor(448.5); // user set calibration factor (float) Serial.println("Startup + tare is complete"); /*ui2c.suspend(1000); // let the lcd print some initial stuff lcd.clear(); lcd.print("Tare and start"); lcd.setCursor(0, 1); lcd.print("up complete."); delay(500); lcd.clear(); lcd.setCursor(0,0); lcd.print("UlnoIoT scale");*/ } void loop() { char mystr[20]; long newt; int w; hx.update(); if(digitalRead(0) == LOW) { hx.tareNoDelay(); taring = true; } //get smoothed value from data set + current calibration factor newt = millis(); if (newt > t + 500) { t = newt; // TODO: check overflow //float v = hx.getCalFactor(); w = round(hx.getData()); snprintf(mystr, 19, "%d", w); ui2c.write(mystr); Serial.print("Weight in g: "); Serial.println(w); /* ui2c.suspend(300); // Suspend ulnoiot i2c master to act myself as master lcd.setCursor(1, 1); lcd.print(w); lcd.print(" g");*/ //check if last tare operation is complete if (hx.getTareStatus() == true) { taring = false; Serial.println("Tare complete"); } /*ui2c.suspend(50); // Suspend ulnoiot i2c master to use act myself as master if (taring) { lcd.print(" taring "); } else { lcd.print(" "); } */ } delay(1); // prevent busy waiting }
[ "devel@mail.ulno.net" ]
devel@mail.ulno.net
1d498ea512153e051c717e2e516f26a583bf2d04
5393a08e99e417c91c5cbf292fc07a3c51cd2505
/UVa/UVA - 12015.cpp
5156b80e7135ef9f1fd1da312f0ae20f94c06cfd
[]
no_license
soaibsafi/Competitive-programming
083ec5d7c5c89f8415ef0828ffb6e511f072d7d3
0215b5175bbf1aeb2211a089401b575df02e5152
refs/heads/master
2023-02-15T15:18:53.449158
2021-01-12T20:20:50
2021-01-12T20:20:50
46,543,500
2
2
null
2020-10-04T14:06:12
2015-11-20T06:17:59
C++
UTF-8
C++
false
false
584
cpp
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { char a1[100],a2[100],a3[100],a4[100],a5[100],a6[100],a7[100],a8[100],a9[100],a0[100]; int num[10]; scanf("%s",a0); cin>>num[0]; scanf("%s",a1); cin>>num[1]; scanf("%s",a2); cin>>num[2]; scanf("%s",a3); cin>>num[3]; scanf("%s",a4); cin>>num[4]; scanf("%s",a5); cin>>num[5]; scanf("%s",a6); cin>>num[6]; scanf("%s",a7); cin>>num[7]; scanf("%s",a8); cin>>num[8]; scanf("%s",a9); cin>>num[9]; return 0; }
[ "soaib.safi@gmail.com" ]
soaib.safi@gmail.com
202a09ae033a05a4126020e2486fb4428f9ba87a
adac93040e53b50450d2770c2f7e81561633b0a6
/getline.h
b9d7ecdf2589ad651cd6e26b6b2ace53ce9f73ac
[]
no_license
samoletovp/RPM_9laba
3efe83ba8ae241ab166b869cd2718003477f43fc
63bddd396e809a9924e1162dbc9a53dac3deb385
refs/heads/master
2022-04-25T10:20:16.508487
2020-04-27T11:45:01
2020-04-27T11:45:01
259,296,545
0
0
null
null
null
null
UTF-8
C++
false
false
1,196
h
/** * @file getline.h * @author Samoletov Petr <samoletovp@gmail.com> * @brief ะงั‚ะตะฝะธะต ะฟั€ะตะดะปะพะถะตะฝะธะน ะธะท ั„ะฐะนะปะฐ */ #include <iostream> #include <cstring> using namespace std; char* getline(std::istream& _in, int q) { char c; size_t i, n = 3; char* t, *s = NULL; for(i = 0; _in.get(c) && !_in.fail(); ) { if((c == '.')||(c==';')||(c=='?')||(c=='!')||(c=='\n')) { if(q==0) { s[i++] = ' '; s[i++] = c; break; } else { s[i-1] = c; break; } } if(s == NULL) { s = new (std::nothrow) char[n]; if(s == NULL) { return NULL; } } else if((i + 1) >= n) { t = new (std::nothrow) char[i * 3 / 2]; if(t == NULL) break; std::memcpy(t, s, n * sizeof(char)); delete[] s; s = t; n = i * 3 / 2; } s[i++] = c; } if(s!= NULL) { s[i++] = '\0'; } return s; }
[ "samoletovp@gmail.com" ]
samoletovp@gmail.com
889e19f38663600ce34c12ee52d8bd00baa8285d
b6ee7d307e6eb7f15488526cf96bafbbc543b0ba
/src/qt/bitcoinstrings.cpp
ef3cbd9efa792cf9f3b60e1169f0fe08f47ed55d
[ "MIT" ]
permissive
Peersend-project/Peersend
9fc38cf45a535d3e6ab0f9ec852967bcf0e76720
e4386dc2327c1a8ddf588f90bf9d85ea50142ae9
refs/heads/master
2023-04-03T17:37:13.207094
2021-03-31T05:25:49
2021-03-31T05:25:49
353,198,993
1
0
null
null
null
null
UTF-8
C++
false
false
13,614
cpp
#include <QtGlobal> // Automatically generated by extract_strings.py #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif static const char UNUSED *bitcoin_strings[] = { QT_TRANSLATE_NOOP("bitcoin-core", "" "%s, you must set a rpcpassword in the configuration file:\n" "%s\n" "It is recommended you use the following random password:\n" "rpcuser=peersendrpc\n" "rpcpassword=%s\n" "(you do not need to remember this password)\n" "The username and password MUST NOT be the same.\n" "If the file does not exist, create it with owner-readable-only file " "permissions.\n" "It is also recommended to set alertnotify so you are notified of problems;\n" "for example: alertnotify=echo %%s | mail -s \"Peersend Alert\" admin@foo.com\n"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "@STRENGTH)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "An error occurred while setting up the RPC port %u for listening on IPv4: %s"), QT_TRANSLATE_NOOP("bitcoin-core", "" "An error occurred while setting up the RPC port %u for listening on IPv6, " "falling back to IPv4: %s"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Bind to given address and always listen on it. Use [host]:port notation for " "IPv6"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Cannot obtain a lock on data directory %s. Peersend is probably already " "running."), QT_TRANSLATE_NOOP("bitcoin-core", "" "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."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Error: This transaction requires a transaction fee of at least %s because of " "its amount, complexity, or use of recently received funds!"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when a relevant alert is received (%s in cmd is replaced by " "message)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when a wallet transaction changes (%s in cmd is replaced by " "TxID)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when the best block changes (%s in cmd is replaced by block " "hash)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Listen for JSON-RPC connections on <port> (default: 2121 or testnet: 12121)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: " "86400)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Set maximum size of high-priority/low-fee transactions in bytes (default: " "27000)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Set the number of script verification threads (up to 16, 0 = auto, <0 = " "leave that many cores free, default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "This is a pre-release test build - use at your own risk - do not use for " "mining or merchant applications"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Unable to bind to %s on this computer. Peersend is probably already running."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: -paytxfee is set very high! This is the transaction fee you will " "pay if you send a transaction."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Displayed transactions may not be correct! You may need to upgrade, " "or other nodes may need to upgrade."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Please check that your computer's date and time are correct! If " "your clock is wrong Peersend will not work properly."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: error reading wallet.dat! All keys read correctly, but transaction " "data or address book entries might be missing or incorrect."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as " "wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect " "you should restore from a backup."), QT_TRANSLATE_NOOP("bitcoin-core", "" "You must set rpcpassword=<password> in the configuration file:\n" "%s\n" "If the file does not exist, create it with owner-readable-only file " "permissions."), QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"), QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"), QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Peersend version"), QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks proxy"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"), QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"), QT_TRANSLATE_NOOP("bitcoin-core", "Discover own IP address (default: 1 when listening and no -externalip)"), QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"), QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"), QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Peersend"), QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: system error: "), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block info"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to sync block index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block info"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write file info"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write to coin database"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write transaction index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write undo data"), QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"), QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1 unless -connect)"), QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"), QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 288, 0 = all)"), QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-4, default: 3)"), QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"), QT_TRANSLATE_NOOP("bitcoin-core", "Information"), QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"), QT_TRANSLATE_NOOP("bitcoin-core", "List commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: 2122 or testnet: 12122)"), QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."), QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."), QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Maintain a full transaction index (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: 125)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."), QT_TRANSLATE_NOOP("bitcoin-core", "Only accept block chain matching built-in checkpoints (default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"), QT_TRANSLATE_NOOP("bitcoin-core", "Options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Output extra debugging information. Implies all other -debug* options"), QT_TRANSLATE_NOOP("bitcoin-core", "Output extra network debugging information"), QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Prepend debug output with timestamp"), QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000??.dat files"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."), QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"), QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Peersend Wiki for SSL setup instructions)"), QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or peersendd"), QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"), QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: server.cert)"), QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: 250000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"), QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: peersend.conf)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: peersendd.pid)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"), QT_TRANSLATE_NOOP("bitcoin-core", "System error: "), QT_TRANSLATE_NOOP("bitcoin-core", "This help message"), QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"), QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"), QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"), QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large"), QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"), QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"), QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"), QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"), QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 1 when listening)"), QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"), QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"), QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Peersend to complete"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"), QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"), QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"), };
[ "jupiterxxx11@gmail.com" ]
jupiterxxx11@gmail.com
951c21c3948bbf0739a69100ea4531f8b1c0a059
9d54a9e8a968a342246eedfbd33f0c468c648fc0
/src/recursive/Fibonacci.cpp
619fed9cedc1adaa3c52b5c2087428dd9d2b51b7
[]
no_license
Tan-Jerry/algorithm
206904c1d0281a16fe72bea20248551de8f710e2
3e08b87a2333fca554468b8f8f6dc6afe047279b
refs/heads/master
2023-08-17T09:58:05.134921
2021-09-25T14:45:50
2021-09-25T14:45:50
391,384,782
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
cpp
#include <iostream> #include "../../include/recursive.hpp" int fibonacci(int n) { if (n == 1) { return 1; } if (n == 2) { return 1; } return fibonacci(n - 1) + fibonacci(n - 2); } void printFibonacci(int n) { int f1 = 1; int f2 = 1; if (n < 1) { return; } int temp; for (int i = 0; i < n; i++) { if (i == 0) { cout << f1 << endl; } else //if (i == 1) { cout << f2 << endl; // } // else // { // cout << f1 + f2 << endl; temp = f1 + f2; f1 = f2; f2 = temp; } } } int fibonacci_DP(int n, vector<int>& vecResult) { if (vecResult[n - 1] != 0) { return vecResult[n - 1]; } if (n == 1 || n == 2) { vecResult[n - 1] = 1; } else { vecResult[n - 1] = fibonacci_DP(n - 1, vecResult) + fibonacci_DP(n - 2, vecResult); } cout << n << ": " << vecResult[n - 1] << endl; return vecResult[n - 1]; } // 1, 1, 2, 3, 5, 8, 13, 21, 34
[ "tp8810@126.com" ]
tp8810@126.com
6086ac376e6d05fb1a4fe057e1d02bc8bcdde605
5ebd5934d6793f311b686bda0d4305da7fe6e4e7
/ClasesProg/RNG-II/triangle.cpp
601a87531a950146297a7581ea97c98dd0c3396d
[]
no_license
kgomezo/Myfiles
6e8ba0ced83654130afce0bb7fa44ccc9465ead5
4573bc7f2fe442008d4258ec14b2417a72928928
refs/heads/master
2023-08-02T06:45:40.323679
2021-10-06T17:57:07
2021-10-06T17:57:07
291,197,213
0
0
null
null
null
null
UTF-8
C++
false
false
1,363
cpp
#include <iostream> #include <fstream> #include <cmath> #include <random> #include <cstdlib> #include <vector> //const double SQRT3 = 1; double f(double x) { if (-1 <= x && x <= 0) return (x+1); //SQRT3*x + SQRT3; else if (0 < x && x <= 1) return (-x+1); //-SQRT3*x + SQRT3; else return 0; } double h(double x){ if (-1 <= x && x <= 0) return (-x-1); else if (0 < x && x <= 1) return (x-1); else return 0; } int main(int argc, char **argv) { const int SEED = std::atoi(argv[1]);; const int SAMPLES = std::atoi(argv[2]); //los que quedan adentro. Hago n intentos y acepto n/2 std::mt19937 gen(SEED); std::uniform_real_distribution<double> xu(-1, 1); std::uniform_real_distribution<double> yu(-1, 1); //yu(-SQRT3, SQRT3); std::ofstream fout("data2.txt"); int samples = 0; int counter = 0; while (samples < SAMPLES) { double x = xu(gen); double y = yu(gen); if (y < f(x) && y > h(x)){ fout << x << "\t" << y << "\n"; samples ++; } /*if (std::fabs(y) < f(x)) { //pregunto si esta dentro de la region fout << x << "\t" << y << "\n"; //se acepta la muestra samples++; }*/ counter++; } fout.close(); std::cout << "Actual tries: " << counter << "\n"; return 0; }
[ "noreply@github.com" ]
noreply@github.com
db51bb7b30d2ff558681de40ad3d91654aa5d563
d72f082531e1d1a276d8cfea5e67e57bfe6b0888
/GraphColoring/Grafy/Grafy.cpp
94790cff9f5e7c31c2a7c2c917f474d81b239d0d
[]
no_license
Glifu/PG-Projects
400d257225d493eeb337f8389b5747c6eca2678b
ad4996808caf88f934580201d505c116980a5b76
refs/heads/main
2023-02-13T00:54:11.200743
2021-01-16T21:48:16
2021-01-16T21:48:16
330,261,152
0
0
null
null
null
null
UTF-8
C++
false
false
2,337
cpp
๏ปฟ// Grafy.cpp : Ten plik zawiera funkcjฤ™ โ€žmainโ€. W nim rozpoczyna siฤ™ i koล„czy wykonywanie programu. // #include <iostream> using namespace std; int main() { //Data Holder int graphSize = 0; char inputData; //For input int numberOfInputs; //For output int graphGradeCounter = 0; cin >> numberOfInputs; std::ios::sync_with_stdio(false); for (int programCyclces = 0; programCyclces < numberOfInputs; programCyclces++) { bool czyCykl = true; bool czyPelny = true; bool czyNieParzysty = true; cin >> graphSize; if (graphSize % 2 == 0) { czyNieParzysty = false; } int graphLongSize = graphSize * graphSize; for (int i = 0; i < graphLongSize; i++) { if (i % graphSize == 0) { graphGradeCounter = 0; } cin >> inputData; //cout << " | div: " << i / graphSize << " | mod: " << i % graphSize << endl; if ( /*((i/graphSize) <= (i % graphSize)) &&*/ inputData == '1') { graphGradeCounter = graphGradeCounter + 1; } if ((i % graphSize) == (graphSize - 1)) { // Jesli przedostatni element if (graphGradeCounter != graphSize - 1) { // Oraz stopien wierzcholka rowny ilosci wierzcholkow -1 : nie jest to Graf Pelny. czyPelny = false; } if (graphGradeCounter != 2) { // Oraz stopien wierzcholka mniejszy niz 2 to: nie jest to cykl. czyCykl = false; if (czyPelny == false) { cin.ignore(graphLongSize - i); goto TestowaEtykieta; } } } //if (i%graphSize == graphSize-1) { // cout << i << " | Czy jest cyklem: " << czyCykl << " Czy jest Pelny: " << czyPelny << " Czy jest nieparzysty: " << graphSize % 2 << endl; //} } TestowaEtykieta: if ((czyCykl == 1 && czyNieParzysty == 1) || czyPelny == 1) { cout << "True\n"; } else { cout << "False\n"; } } }
[ "glif.glif.glif@gmail.com" ]
glif.glif.glif@gmail.com
0df64044b23c65e756d2d9e1219888ddb005af80
9ff46553f987891d39dfbcb096e51e354b618c76
/fit/apply.h
fbce56b8e4b33bf9f94fd67423beeb8386e7a780
[]
no_license
gloinart/Fit
4dcc605b2344eca0e58a1ebb1506b2fe68d90c67
34dad9678ba28a417e1e3c8f732b09dc596ce8b3
refs/heads/master
2021-01-23T00:15:26.144851
2015-05-22T18:57:26
2015-05-22T18:57:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,404
h
/*============================================================================= Copyright (c) 2015 Paul Fultz II apply.h 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 FIT_GUARD_APPLY_H #define FIT_GUARD_APPLY_H /// apply /// ===== /// /// Description /// ----------- /// /// The `apply` function calls the function given to it with its arguments. /// /// Synopsis /// -------- /// /// template<class F, class... Ts> /// constexpr auto apply(F&& f, Ts&&... xs); /// /// Requirements /// ------------ /// /// F must be: /// /// FunctionObject /// /// Example /// ------- /// /// struct sum_f /// { /// template<class T, class U> /// T operator()(T x, U y) const /// { /// return x+y; /// } /// }; /// assert(fit::apply(sum_f(), 1, 2) == 3); /// #include <fit/returns.h> #include <fit/detail/forward.h> #include <fit/detail/static_constexpr.h> namespace fit { namespace detail { struct apply_f { template<class F, class... Ts> constexpr auto operator()(F&& f, Ts&&... xs) const FIT_RETURNS ( f(fit::forward<Ts>(xs)...) ); }; } FIT_STATIC_CONSTEXPR detail::apply_f apply = {}; } #endif
[ "pfultz2@yahoo.com" ]
pfultz2@yahoo.com
a24838bcb55612499f13a8388f198a185838ea65
08c2463d92b7422fd738deb9c856fe1511d79e14
/src/qt/serveur.cpp
d6dc4f1fdc3920c389b3c73a5e502cf83bb24f71
[ "MIT" ]
permissive
testfaucetcoin/testfaucetcoin
64d7e3ceaf9bcfcfc51dfe979a87af375147c75d
379dcc06211122c1c6ac7ae9678d636c0c731ca3
refs/heads/master
2021-01-20T11:49:50.235689
2014-12-07T20:26:56
2014-12-07T20:26:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,544
cpp
/*Copyright (C) 2009 Cleriot Simon * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ #include <QScrollBar> #include "serveur.h" QStringList users; bool delist = true; Serveur::Serveur() { connect(this, SIGNAL(readyRead()), this, SLOT(readServeur())); connect(this, SIGNAL(connected()), this, SLOT(connected())); connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(errorSocket(QAbstractSocket::SocketError))); updateUsers=false; } void Serveur::errorSocket(QAbstractSocket::SocketError error) { switch(error) { case QAbstractSocket::HostNotFoundError: affichage->append(tr("<em>ERROR : can't find freenode server.</em>")); break; case QAbstractSocket::ConnectionRefusedError: affichage->append(tr("<em>ERROR : server refused connection</em>")); break; case QAbstractSocket::RemoteHostClosedError: affichage->append(tr("<em>ERROR : server cut connection</em>")); break; default: affichage->append(tr("<em>ERROR : ") + this->errorString() + tr("</em>")); } } void Serveur::connected() { affichage->append("Connecting..."); sendData("USER "+pseudo+" localhost "+serveur+" :"+pseudo); sendData("NICK "+pseudo); affichage->append("Connected to irc.freenode.net"); } void Serveur::joins() { join("#testfaucetcoin"); } void Serveur::readServeur() { QString message=QString::fromUtf8(this->readAll()); QString currentChan=tab->tabText(tab->currentIndex()); if(message.startsWith("PING :")) { QStringList liste=message.split(" "); QString msg="PONG "+liste.at(1); sendData(msg); } else if(message.contains("Nickname is already in use.")) { pseudo=pseudo+"_2"; pseudo.remove("\r\n"); sendData("NICK "+pseudo); emit pseudoChanged(pseudo); ecrire("-> Name changed to "+pseudo); } else if(updateUsers==true) { updateUsersList("",message); } QStringList list=message.split("\r\n"); foreach(QString msg,list) { if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PRIVMSG ([a-zA-Z0-9\\#]+) :(.+)"))) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PRIVMSG ([a-zA-Z0-9\\#]+) :(.+)"); QString msg2=msg; ecrire(msg.replace(reg,"\\2 <b>&lt;\\1&gt;</b> \\3"),"",msg2.replace(reg,"\\2 <\\1> \\3")); } else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ JOIN ([a-zA-Z0-9\\#]+)"))) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ JOIN ([a-zA-Z0-9\\#]+)"); QString msg2=msg; ecrire(msg.replace(reg,"\\2 <i>-> \\1 join \\2</i><br />"),"",msg2.replace(reg,"-> \\1 join \\2")); updateUsersList(msg.replace(reg,"\\2")); } else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PART ([a-zA-Z0-9\\#]+)"))) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PART ([a-zA-Z0-9\\#]+) :(.+)"); QString msg2=msg; ecrire(msg.replace(reg,"\\2 <i>-> \\1 quit \\2 (\\3)</i><br />"),"",msg2.replace(reg,"-> \\1 quit \\2")); updateUsersList(msg.replace(reg,"\\2")); } else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ QUIT (.+)"))) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ QUIT (.+)"); QString msg2=msg; ecrire(msg.replace(reg,"\\2 <i>-> \\1 quit this server (\\2)</i><br />"),"",msg2.replace(reg,"-> \\1 left")); updateUsersList(msg.replace(reg,"\\2")); } else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NICK :(.+)"))) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NICK :(.+)"); QString msg2=msg; ecrire(msg.replace(reg,"<i>\\1 is now called \\2</i><br />"),"",msg2.replace(reg,"-> \\1 is now called \\2")); updateUsersList(currentChan); } else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ KICK ([a-zA-Z0-9\\#]+) ([a-zA-Z0-9]+) :(.+)"))) { QRegExp reg(":([a-zA-Z0-9]+)\\!~[a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ KICK ([a-zA-Z0-9\\#]+) ([a-zA-Z0-9]+) :(.+)"); QString msg2=msg; ecrire(msg.replace(reg,"\\2 <i>-> \\1 kicked \\3 (\\4)</i><br />"),"",msg2.replace(reg,"-> \\1 quit \\3")); updateUsersList(msg.replace(reg,"\\2")); } else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NOTICE ([a-zA-Z0-9]+) :(.+)"))) { if(conversations.contains(currentChan)) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NOTICE [a-zA-Z0-9]+ :(.+)"); ecrire(msg.replace(reg,"<b>[NOTICE] <i>\\1</i> : \\2 <br />"),currentChan); } else if(currentChan==serveur) { QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NOTICE [a-zA-Z0-9]+ :(.+)"); ecrire(msg.replace(reg,"<b>[NOTICE] <i>\\1</i> : \\2 <br />")); } } else if(msg.contains("/MOTD command.")) { joins(); } } //} } void Serveur::sendData(QString txt) { if(this->state()==QAbstractSocket::ConnectedState) { this->write((txt+"\r\n").toUtf8()); } } QString Serveur::parseCommande(QString comm,bool serveur) { if(comm.startsWith("/")) { comm.remove(0,1); QString pref=comm.split(" ").first(); QStringList args=comm.split(" "); args.removeFirst(); QString destChan=tab->tabText(tab->currentIndex()); QString msg=args.join(" "); if(pref=="me") return "PRIVMSG "+destChan+" ACTION " + msg + ""; else if(pref=="msg") return "MSG "+destChan+" ACTION " + msg + ""; else if(pref=="join") { join(msg); return " "; } else if(pref=="quit") { if(msg == "") return "QUIT "+msgQuit; else return "QUIT "+msg; } else if(pref=="part") { tab->removeTab(tab->currentIndex()); if(msg == "") { if(msg.startsWith("#")) destChan=msg.split(" ").first(); if(msgQuit=="") return "PART "+destChan+" using IrcLightClient"; else return "PART "+destChan+" "+msgQuit; } else return "PART "+destChan+" "+msg; conversations.remove(destChan); } else if(pref=="kick") { QStringList tableau=msg.split(" "); QString c1,c2,c3; if(tableau.count() > 0) c1=" "+tableau.first(); else c1=""; if(tableau.count() > 1) c2=" "+tableau.at(1); else c2=""; if(tableau.count() > 2) c3=" "+tableau.at(2); else c3=""; if(c1.startsWith("#")) return "KICK"+c1+c2+c3; else return "KICK "+destChan+c1+c2; } else if(pref=="update") { updateUsers=true; return "WHO "+destChan; } else if(pref=="ns") { return "NICKSERV "+msg; } else if(pref=="nick") { emit pseudoChanged(msg); ecrire("-> Nickname changed to "+msg); return "NICK "+msg; } else if(pref=="msg") { return "MSG "+msg; } else return pref+" "+msg; } else if(!serveur) { QString destChan=tab->tabText(tab->currentIndex()); if(comm.endsWith("<br />")) comm=comm.remove(QRegExp("<br />$")); ecrire("<b>&lt;"+pseudo+"&gt;</b> "+comm,destChan); if(comm.startsWith(":")) comm.insert(0,":"); return "PRIVMSG "+destChan+" "+comm.replace(" ","\t"); } else { return ""; } } void Serveur::join(QString chan) { affichage->append("Joining "+ chan +" channel"); emit joinTab(); QTextEdit *textEdit=new QTextEdit; int index=tab->insertTab(tab->currentIndex()+1,textEdit,chan); tab->setTabToolTip(index,serveur); tab->setCurrentIndex(index); textEdit->setReadOnly(true); conversations.insert(chan,textEdit); sendData("JOIN "+chan); emit tabJoined(); } void Serveur::leave(QString chan) { sendData(parseCommande("/part "+chan+ " "+msgQuit)); } void Serveur::ecrire(QString txt,QString destChan,QString msgTray) { if(destChan!="") { conversations[destChan]->setHtml(conversations[destChan]->toHtml()+txt); QScrollBar *sb = conversations[destChan]->verticalScrollBar(); sb->setValue(sb->maximum()); } else if(txt.startsWith("#")) { QString dest=txt.split(" ").first(); QStringList list=txt.split(" "); list.removeFirst(); txt=list.join(" "); conversations[dest]->setHtml(conversations[dest]->toHtml()+txt); QScrollBar *sb = conversations[dest]->verticalScrollBar(); sb->setValue(sb->maximum()); } else { txt.replace("\r\n","<br />"); affichage->setHtml(affichage->toHtml()+txt+"<br />"); QScrollBar *sb = affichage->verticalScrollBar(); sb->setValue(sb->maximum()); } } void Serveur::updateUsersList(QString chan,QString message) { message = message.replace("\r\n",""); message = message.replace("\r",""); if(chan!=serveur) { if(updateUsers==true || message != "") { QString liste2=message.replace(":",""); QStringList liste=liste2.split(" "); if (delist == true) users.clear(); for(int i=5; i < liste.count(); i++) { users.append(liste.at(i)); } updateUsers=false; if (liste.count() < 53) delist = true; else delist = false; QStringListModel *model = new QStringListModel(users); userList->setModel(model); userList->update(); } else { updateUsers=true; sendData("NAMES "+chan); } } else { QStringListModel model; userList->setModel(&model); userList->update(); } }
[ "test@test.com" ]
test@test.com
dd343ed761e7246364423bf187b2c10e723e7c8b
d838ae7d76241fa42d913592ef7c960e61ef5737
/FlieLogic.h
e0c481d2610c8ff253d3bcfeb69fdfc26b58457a
[]
no_license
PetrQ/Flies
72b4b2a31922bd0c9f4d161b1f3028e49ba89a3a
43ed5b22d221f0ca36bc79b665d7f138d8b303d1
refs/heads/main
2022-12-30T11:02:52.104581
2020-10-22T09:08:07
2020-10-22T09:08:07
301,475,575
0
0
null
null
null
null
UTF-8
C++
false
false
3,774
h
#ifndef FLIELOGIC_H #define FLIELOGIC_H #include <QElapsedTimer> #include <QObject> #include <QPoint> #include <QQuickItem> class FlieLogic : public QQuickItem { Q_OBJECT Q_PROPERTY(int cellId READ cellId NOTIFY cellIdChanged) Q_PROPERTY(int speed READ speed NOTIFY pathChanged) Q_PROPERTY(int path READ path NOTIFY pathChanged) Q_PROPERTY(int age READ age NOTIFY ageChanged) Q_PROPERTY(bool corpse READ corpse NOTIFY corpseChanged) Q_PROPERTY(int determination READ determination WRITE setDetermination NOTIFY determinationChanged) Q_PROPERTY(int scurryIntvl READ scurryIntvl NOTIFY scurryIntvlChanged) Q_PROPERTY(QPointF flieStartPos READ flieStartPos WRITE setFlieStartPos NOTIFY flieStartPosChanged) Q_PROPERTY(bool pause READ pause WRITE setPause NOTIFY pauseChanged) Q_PROPERTY(int fieldSize READ fieldSize WRITE setFieldSize NOTIFY fieldSizeChanged) Q_PROPERTY(QQuickItem* cell WRITE setCell NOTIFY cellChanged) Q_PROPERTY(QQuickItem* fliePic WRITE setFliePic NOTIFY fliePicChanged) public: explicit FlieLogic(QQuickItem *parent = nullptr); int scurryIntvl() const; int speed() const; int cellId() const { return m_cellIndex; } bool corpse() const { return m_corpse;} int path () const { return m_path;} int determination() const { return m_migratTimerInterval/1000; } int age() const { return (m_liveTimer->elapsed() - m_pausePeriod)/1000;} int fieldSize() const { return m_fieldSize; } bool pause() const { return m_pause;} QPointF flieStartPos() const { return m_flieStartPos; } void setCell(QQuickItem *obj); void setFliePic(QQuickItem *obj); void setFieldSize(int size); void setFlieStartPos(QPointF val); void setDetermination(int val); public slots: void setPause(bool pause); signals: void fieldSizeChanged(); void fliePicChanged(); void cellChanged(); void pauseChanged(); void flieStartPosChanged(); void scurryIntvlChanged(); void determinationChanged(); void ageChanged(); void pathChanged(); void corpseChanged(); void cellIdChanged(); void startMigrate(int oldCell, int newCell); void isDie(int Cell); protected: virtual void timerEvent(QTimerEvent*); private: void start(); void stop(); int rotateToCenter(const QPointF& flInCellPos); void makeMove(); void setMaxAge(); void checkAge(); void startMigration(QQuickItem* item , int newCell ); //ะฟะตั€ะตั…ะพะด "ะ’ะทะปะตั‚" ะฒ ะดะธะฐะณั€ะฐะผะผะต void finishMigration(); //ะฟะตั€ะตั…ะพะด "ะŸะพัะฐะดะบะฐ" ะฒ ะดะธะฐะณั€ะฐะผะผะต void scurry(); //ัะพัั‚ะพัะฝะธะต "ะŸะพะปะทะฐะฝะธะต" ะฒ ะดะธะฐะณั€ะฐะผะผะต void fly(); //ัะพัั‚ะพัะฝะธะต "ะŸะพะปะตั‚" ะฒ ะดะธะฐะณั€ะฐะผะผะต void die(); //ะฟะตั€ะตั…ะพะด "ะกะผะตั€ั‚ัŒ" ะฒ ะดะธะฐะณั€ะฐะผะผะต private: QScopedPointer<QElapsedTimer> m_liveTimer; int m_migrationTimerId = 0; int m_moveTimerId = 0; bool m_flFly = false; bool m_pause = true; bool m_corpse = false; int m_maxAge = 1000; //ะฝะตะพะฑั…ะพะดะธะผะพะต ะฒั€ะตะผั ะดะปั ะธะฝะธั†ะธะฐะปะธะทะฐั†ะธะธ ัะฒะพะนัั‚ะฒะฐ ะฒ QML int m_rotateSign = 1; double m_rotate = 0; double m_move = 0; double m_path = 0; double m_fieldSize = 0; int m_pausePeriod = 0; int m_startPause = 0; QPointF m_flieStartPos ; double m_flieW = 0; double m_flieH = 0; QQuickItem* m_fliePic = nullptr; QQuickItem* m_cell = nullptr; int m_cellIndex = -1; int m_migratTimerInterval = 15000; static int m_registrateVal; }; #endif // FLIELOGIC_H
[ "kusotskiy@gmail.com" ]
kusotskiy@gmail.com
905e5e0ba9f4de83c1419eaa353c0a9b598653ce
94ad1ce2e5f017a972d4764931e3224c258ba469
/OOP/Lab8/base.h
52f3c0c1e2efb6440cbbbf4e1058915647396cc2
[]
no_license
tokar-t-m/university_labs
1fa353ce9f1df04409e2c6779d4b9081c9aeb64f
bf7e58aec72c0ea085a7ac498d3425c6c964709f
refs/heads/master
2021-01-11T14:49:59.018361
2017-02-12T07:03:29
2017-02-12T07:03:29
80,226,148
2
0
null
null
null
null
UTF-8
C++
false
false
490
h
/* * Author: Tokar T. M. * E - mail: tokar.t.m@gmail.com * Title: Lab8 * Standard: C++0x */ #ifndef BASE_H #define BASE_H #include <string> #include <sstream> #include <iostream> using std::string; using std::ostringstream; using std::cout; using std::endl; class base{ protected: string name; string last_name; string second_name; string ranks; public: base(string, string, string); ~base(); virtual void rank(); }; #endif // BASE_H
[ "you@example.com" ]
you@example.com
4d5d6a3be78d25c856178a5c5e7a9c05a7d8f5f6
560090526e32e009e2e9331e8a2b4f1e7861a5e8
/Compiled/blaze-3.2/blazemark/src/boost/SVecSVecAdd.cpp
e18767323e00cc794bc5e45dad5527186a6d0b12
[ "BSD-3-Clause" ]
permissive
jcd1994/MatlabTools
9a4c1f8190b5ceda102201799cc6c483c0a7b6f7
2cc7eac920b8c066338b1a0ac495f0dbdb4c75c1
refs/heads/master
2021-01-18T03:05:19.351404
2018-02-14T02:17:07
2018-02-14T02:17:07
84,264,330
2
0
null
null
null
null
UTF-8
C++
false
false
4,383
cpp
//================================================================================================= /*! // \file src/boost/SVecSVecAdd.cpp // \brief Source file for the Boost sparse vector/sparse vector addition kernel // // Copyright (C) 2012-2017 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. 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 names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <iostream> #include <boost/numeric/ublas/io.hpp> #include <boost/numeric/ublas/vector_sparse.hpp> #include <blaze/util/Timing.h> #include <blazemark/boost/init/CompressedVector.h> #include <blazemark/boost/SVecSVecAdd.h> #include <blazemark/system/Config.h> namespace blazemark { namespace boost { //================================================================================================= // // KERNEL FUNCTIONS // //================================================================================================= //************************************************************************************************* /*!\brief Boost uBLAS sparse vector/sparse vector addition kernel. // // \param N The size of the vectors for the addition. // \param F The number of non-zero elements for the sparse vectors. // \param steps The number of iteration steps to perform. // \return Minimum runtime of the kernel function. // // This kernel function implements the sparse vector/sparse vector addition by means of the // Boost uBLAS functionality. */ double svecsvecadd( size_t N, size_t F, size_t steps ) { using ::blazemark::element_t; ::blaze::setSeed( seed ); ::boost::numeric::ublas::compressed_vector<element_t> a( N ), b( N ), c( N ); ::blaze::timing::WcTimer timer; init( a, F ); init( b, F ); noalias( c ) = a + b; for( size_t rep=0UL; rep<reps; ++rep ) { timer.start(); for( size_t step=0UL; step<steps; ++step ) { noalias( c ) = a + b; } timer.end(); if( c.size() != N ) std::cerr << " Line " << __LINE__ << ": ERROR detected!!!\n"; if( timer.last() > maxtime ) break; } const double minTime( timer.min() ); const double avgTime( timer.average() ); if( minTime * ( 1.0 + deviation*0.01 ) < avgTime ) std::cerr << " Boost uBLAS kernel 'svecsvecadd': Time deviation too large!!!\n"; return minTime; } //************************************************************************************************* } // namespace boost } // namespace blazemark
[ "jonathan.doucette@alumni.ubc.ca" ]
jonathan.doucette@alumni.ubc.ca
b2ff037eb03f0aa0daa53a8f231cc4e41c5a9b86
a735185747be07148c7d56808d0d14212bb32619
/Hub/Apps/SmartCam/SmartRecorder/AssemblyInfo.cpp
cc94c61066160ef1435ac6f73dc02ed76999698e
[]
no_license
jjhartmann/friendly-octo-computing-machine-home-os
cb1573f2dd28c68f0379777f92ab814cdfab1788
cfbeedf5ba940c0b7a4099284338e2dcddc788cb
refs/heads/master
2021-05-01T01:47:24.137163
2016-12-01T03:49:46
2016-12-01T03:49:46
71,390,457
3
1
null
null
null
null
UTF-8
C++
false
false
1,427
cpp
#include "stdafx.h" using namespace System; using namespace System::Reflection; using namespace System::Runtime::CompilerServices; using namespace System::Runtime::InteropServices; using namespace System::Security::Permissions; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly:AssemblyTitleAttribute("SmartRecorder")]; [assembly:AssemblyDescriptionAttribute("")]; [assembly:AssemblyConfigurationAttribute("")]; [assembly:AssemblyCompanyAttribute("Microsoft IT")]; [assembly:AssemblyProductAttribute("SmartRecorder")]; [assembly:AssemblyCopyrightAttribute("Copyright (c) Microsoft IT 2012")]; [assembly:AssemblyTrademarkAttribute("")]; [assembly:AssemblyCultureAttribute("")]; // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly:AssemblyVersionAttribute("1.0.*")]; [assembly:ComVisible(false)]; [assembly:CLSCompliantAttribute(true)]; [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; [assembly: InternalsVisibleTo("HomeOS.Hub.UnitTests")];
[ "ratul@cs.washington.edu" ]
ratul@cs.washington.edu
698c4e636054704881ecfbe6399bd2845b75c1ee
4725c914968b8f88e615fb0691281c59be5b2bda
/folly/experimental/coro/GmockHelpers.h
756e33adaf0688b9be6c54abbe9a8ea9ca75d2ba
[ "MIT", "Apache-2.0" ]
permissive
infancy/folly
aa6de207445baa3106a50bf0c57bae4d6d17d1da
42b8f101e6d9f571233879e0b5c6278a1c3481ca
refs/heads/master
2021-04-20T23:16:10.441745
2020-09-30T21:54:06
2020-09-30T21:55:22
249,724,673
0
0
Apache-2.0
2020-03-24T14:07:06
2020-03-24T14:07:05
null
UTF-8
C++
false
false
5,513
h
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <atomic> #include <type_traits> #include <folly/experimental/coro/Error.h> #include <folly/experimental/coro/Task.h> #include <folly/portability/GMock.h> namespace folly { namespace coro { namespace gmock_helpers { // This helper function is intended for use in GMock implementations where the // implementation of the method is a coroutine lambda. // // The GMock framework internally always takes a copy of an action/lambda // before invoking it to prevent cases where invoking the method might end // up destroying itself. // // However, this is problematic for coroutine-lambdas-with-captures as the // return-value from invoking a coroutine lambda will typically capture a // reference to the copy of the lambda which will immediately become a dangling // reference as soon as the mocking framework returns that value to the caller. // // Use this action-factory instead of Invoke() when passing coroutine-lambdas // to mock definitions to ensure that a copy of the lambda is kept alive until // the coroutine completes. It does this by invoking the lambda using the // folly::coro::co_invoke() helper instead of directly invoking the lambda. // // // Example: // using namespace ::testing // using namespace folly::coro::gmock_helpers; // // MockFoo mock; // int fooCallCount = 0; // // EXPECT_CALL(mock, foo(_)) // .WillRepeatedly(CoInvoke([&](int x) -> folly::coro::Task<int> { // ++fooCallCount; // co_return x + 1; // })); // template <typename F> auto CoInvoke(F&& f) { return ::testing::Invoke([f = static_cast<F&&>(f)](auto&&... a) { return co_invoke(f, static_cast<decltype(a)>(a)...); }); } namespace detail { template <typename Fn> auto makeCoAction(Fn&& fn) { static_assert( std::is_copy_constructible_v<remove_cvref_t<Fn>>, "Fn should be copyable to allow calling mocked call multiple times."); using Ret = std::invoke_result_t<remove_cvref_t<Fn>&&>; return ::testing::InvokeWithoutArgs( [fn = std::forward<Fn>(fn)]() mutable -> Ret { return co_invoke(fn); }); } // Helper class to capture a ByMove return value for mocked coroutine function. // Adds a test failure if it is moved twice like: // .WillRepeatedly(CoReturnByMove...) template <typename R> struct OnceForwarder { static_assert(std::is_reference_v<R>); using V = remove_cvref_t<R>; explicit OnceForwarder(R r) noexcept(std::is_nothrow_constructible_v<V>) : val_(static_cast<R>(r)) {} R operator()() noexcept { auto performedPreviously = performed_.exchange(true, std::memory_order_relaxed); if (performedPreviously) { terminate_with<std::runtime_error>( "a CoReturnByMove action must be performed only once"); } return static_cast<R>(val_); } private: V val_; std::atomic<bool> performed_ = false; }; } // namespace detail // Helper functions to adapt CoRoutines enabled functions to be mocked using // gMock. CoReturn and CoThrows are gMock Action types that mirror the Return // and Throws Action types used in EXPECT_CALL|ON_CALL invocations. // // Example: // using namespace ::testing // using namespace folly::coro::gmock_helpers; // // MockFoo mock; // std::string result = "abc"; // // EXPECT_CALL(mock, co_foo(_)) // .WillRepeatedly(CoReturn(result)); // // // For Task<void> return types. // EXPECT_CALL(mock, co_bar(_)) // .WillRepeatedly(CoReturn()); // // // For returning by move. // EXPECT_CALL(mock, co_bar(_)) // .WillRepeatedly(CoReturnByMove(std::move(result))); // // // For returning by move. // EXPECT_CALL(mock, co_bar(_)) // .WillRepeatedly(CoReturnByMove(std::make_unique(result))); // // // EXPECT_CALL(mock, co_foo(_)) // .WillRepeatedly(CoThrow<std::string>(std::runtime_error("error"))); template <typename T> auto CoReturn(T&& ret) { return detail::makeCoAction( [ret = std::forward<T>(ret)]() -> Task<remove_cvref_t<T>> { co_return ret; }); } inline auto CoReturn() { return ::testing::InvokeWithoutArgs([]() -> Task<> { co_return; }); } template <typename T> auto CoReturnByMove(T&& ret) { static_assert( !std::is_lvalue_reference_v<decltype(ret)>, "the argument must be passed as non-const rvalue-ref"); static_assert( !std::is_const_v<T>, "the argument must be passed as non-const rvalue-ref"); auto ptr = std::make_shared<detail::OnceForwarder<T&&>>(std::move(ret)); return detail::makeCoAction( [ptr = std::move(ptr)]() mutable -> Task<remove_cvref_t<T>> { co_return (*ptr)(); }); } template <typename T, typename Ex> auto CoThrow(Ex&& e) { return detail::makeCoAction( [ex = std::forward<Ex>(e)]() -> Task<T> { co_yield co_error(ex); }); } } // namespace gmock_helpers } // namespace coro } // namespace folly
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
1702a424ef362e225f9266355e6b202e25b4cd91
5de9994c037cd61dc6894cf5e3d78fe177db5805
/network-wfp-monitor-filter/string.h
0287a2c366a668a3a20331398005cb352df53e62
[ "Apache-2.0" ]
permissive
iamasbcx/windows-network-wfp-monitor
052721155f6cf989d4b62cf8674410963d635ce7
c4fcbb73e08d7aa73ea43cd9d3f07e6683eae38e
refs/heads/master
2022-04-08T17:05:43.802984
2020-03-13T20:55:06
2020-03-13T20:55:06
256,788,060
6
4
Apache-2.0
2020-04-18T15:30:49
2020-04-18T15:30:49
null
UTF-8
C++
false
false
727
h
// Copyright (c) 2020 Alexandr Shevchenko. (alexshev@live.com) // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once class string { public: private: };
[ "alexshev@live.com" ]
alexshev@live.com
cd0cbba3904cc0521f961a7ef5dcc5a1ec73f493
941b7f2a4b67fdb59c4fd4d70703151b9fd8d8ee
/player.h
15d8089dfd89196ca53cf03b8c02c0acd2584a28
[]
no_license
ZhangShimiao/UI_Player
2fa1b0f3098f25b912ece4aac9b2f4fdee72c2f1
603dde0113e03515a363031f9bd68e5139bc5b2b
refs/heads/main
2023-01-30T07:51:00.045909
2020-12-16T05:13:18
2020-12-16T05:13:18
322,021,644
1
0
null
2020-12-16T15:21:13
2020-12-16T15:21:12
null
UTF-8
C++
false
false
1,716
h
#ifndef PLAYER_H #define PLAYER_H #include <QMainWindow> #include <QWidget> #include <QMediaPlayer> #include <QMediaPlaylist> #include <QSlider> #include <QLabel> #include <string> #include "playlistmodel.h" QT_BEGIN_NAMESPACE namespace Ui { class Player; } QT_END_NAMESPACE class Player : public QMainWindow { Q_OBJECT public: Player(QWidget *parent = nullptr); ~Player(); void setPath(std::string fpath); private: std::string path=""; int volumn; int indexPlaylist; QMediaPlayer::State playerState = QMediaPlayer::StoppedState; bool playerMuted = false; Ui::Player *ui; QMediaPlayer* player; QMediaPlaylist *playlist = nullptr; //All QVector<QMediaPlaylist*>* playlistVector; QVector<int>* timeList; PlaylistModel *playlistModel = nullptr; qint64 duration; QSlider *slider = nullptr; QLabel *coverLabel = nullptr; void setMuted(bool muted); void addToPlaylist(const QList<QUrl> &urls); void updateDurationInfo(qint64 currentInfo); int volume() const; void initPlayLists(); signals: void changeMuting(bool muting); void changeVolume(int volume); private slots: void ClassChanged(int index); void setState(QMediaPlayer::State state); void muteClicked(); void playClicked(); void onVolumeSliderValueChanged(); void playlistPositionChanged(int currentItem); void open(); void add(); void remove(); void jump(const QModelIndex &index); void metaDataChanged(); void durationChanged(qint64 duration); void positionChanged(qint64 progress); void seek(int seconds); }; #endif // PLAYER_H
[ "noreply@github.com" ]
noreply@github.com
303b0bd118a2e5f22c0daa5bbcf075aad363500b
82bbd465986abe69898b7d632d758db900656694
/dedi-shooter-ue4-client/ShooterGame/Source/ShooterGame/Private/Bots/ShooterBot.cpp
38959a84f279824d5026872249d02a4d51092fa1
[]
no_license
iFunFactory/engine-dedicated-server-example
17d7016945506579922beb7a1ad78d11861faa67
5663a82df4c7cf7426d5142cf2585ebdb99d6d6e
refs/heads/master
2021-06-10T10:23:34.208769
2021-04-27T01:49:32
2021-04-30T00:09:13
159,611,254
5
2
null
null
null
null
UTF-8
C++
false
false
656
cpp
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "ShooterGame.h" #include "Bots/ShooterBot.h" #include "Bots/ShooterAIController.h" AShooterBot::AShooterBot(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { AIControllerClass = AShooterAIController::StaticClass(); UpdatePawnMeshes(); bUseControllerRotationYaw = true; } bool AShooterBot::IsFirstPerson() const { return false; } void AShooterBot::FaceRotation(FRotator NewRotation, float DeltaTime) { FRotator CurrentRotation = FMath::RInterpTo(GetActorRotation(), NewRotation, DeltaTime, 8.0f); Super::FaceRotation(CurrentRotation, DeltaTime); }
[ "sungjin.bae@ifunfactory.com" ]
sungjin.bae@ifunfactory.com
3bee8b9ee345f291602df750f1f0fa31d1352af6
dbc5fd6f0b741d07aca08cff31fe88d2f62e8483
/tools/clang/test/zapcc/multi/derived-requires-def/file1.cpp
198f86ffe18e463f4c2072beda224604dd92ffc5
[ "LicenseRef-scancode-unknown-license-reference", "NCSA" ]
permissive
yrnkrn/zapcc
647246a2ed860f73adb49fa1bd21333d972ff76b
c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50
refs/heads/master
2023-03-08T22:55:12.842122
2020-07-21T10:21:59
2020-07-21T10:21:59
137,340,494
1,255
88
NOASSERTION
2020-07-21T10:22:01
2018-06-14T10:00:31
C++
UTF-8
C++
false
false
115
cpp
#include "f.h" struct Bug331B {}; void Bug331C() { Bug331_Bind<Bug331B>(); Bug331Promise<int>().associate(); }
[ "yaron.keren@gmail.com" ]
yaron.keren@gmail.com
d0393fd3200716a48e0b81f5a528e7032f6e4121
76d45e4afec8185f2bb9a1ac1d7c7e56a82a022d
/Tcamera/Tcamera/catchfacetrack.h
e1c011c3985c3f1a42886d026f1e758ef2ad100f
[]
no_license
lizeyan/Athena
47532336cef27c9f2096f2daf0d34f5be7786733
54106eec5638c6f3aec802d0e3f169e1192e8b39
refs/heads/master
2021-01-20T01:11:07.718109
2018-04-23T04:38:19
2018-04-23T04:38:19
89,229,781
0
0
null
null
null
null
UTF-8
C++
false
false
568
h
#ifndef CATCHFACETRACK_H #define CATCHFACETRACK_H #include "cv.h" #include "highgui.h" #include "opencv.hpp" #include "cv_face.h" using namespace cv; class CatchFaceTrack { public: CatchFaceTrack(); int open(Mat&); int catchFace(Mat&,bool); ~CatchFaceTrack(); private: VideoCapture capture; int frame_width = capture.get(CV_CAP_PROP_FRAME_WIDTH); int frame_height = capture.get(CV_CAP_PROP_FRAME_HEIGHT); int point_size = 21; int config; cv_handle_t handle_track; cv_result_t cv_result; }; #endif // CATCHFACETRACK_H
[ "swj14@mails.tsinghua.edu.cn" ]
swj14@mails.tsinghua.edu.cn
48e33fe1bdfe3ff2e950097b91bc532e2381a4a4
153b2231887f1319a3edfbd3ee4c5a97016b4374
/analysis.hpp
c7c9e236327914001dcaa845cf08240ee42e0acb
[]
no_license
Alr-ksim/Riscv_cpu_1.8
ebe5ab7d375b20a4141a0a1919610fc2d42e18a6
88b3074e784d943ed54a8ab4edba436f8564bf47
refs/heads/main
2023-06-12T11:26:07.866007
2021-07-08T01:57:11
2021-07-08T01:57:11
383,972,524
0
0
null
null
null
null
UTF-8
C++
false
false
4,801
hpp
#include <cstdio> #include <iostream> #include <cstring> #include <cmath> #include "classes.hpp" using namespace std; using uint = unsigned; using cdptr = comd *; using daptr = data *; using drptr = data_R *; using diptr = data_I *; using dsptr = data_S *; using dbptr = data_B *; using duptr = data_U *; using djptr = data_J *; const uint table[6][4] = {{1, 51, 0, 0}, {3, 19, 3, 103}, {1, 35, 0, 0}, {1, 99, 0, 0}, {2, 55, 23, 0}, {1, 111, 0, 0}}; const uint branch_type[3] = {111, 103, 99}; commands anatype(const uint &cmd){ uint op = Binum(cmd).slice(0, 7); for (int i = 0;i < 6;i++){ int m = table[i][0]; for (int j = 1;j <= m;j++) if (op == table[i][j]) return commands(i); } return commands(6); } bool is_branch(const uint &cmd){ uint op = Binum(cmd).slice(0, 7); for (int i = 0;i < 3;i++) if (op == branch_type[i]) return 1; return 0; } daptr sol_R(const cdptr cdp, const uint *rg){ Binum bins(cdp->cmd); uint op = bins.slice(0, 7); uint rd = bins.slice(7, 12); uint fun1 = bins.slice(12, 15); uint rs1 = rg[bins.slice(15, 20)]; uint rs2 = rg[bins.slice(20, 25)]; uint fun2 = bins.slice(25, 32); return new data_R(cdp->pc, R, op, fun1, fun2, rs1, rs2, rd); } daptr sol_I(const cdptr cdp, const uint *rg){ Binum bins(cdp->cmd); uint op = bins.slice(0, 7); uint rd = bins.slice(7, 12); uint fun = bins.slice(12, 15); uint rs = rg[bins.slice(15, 20)]; uint imm = Binum(bins.slice(20, 32), 12).extended(); return new data_I(cdp->pc, I, op, fun, rs, rd, imm); } daptr sol_S(const cdptr cdp, const uint *rg){ Binum bins(cdp->cmd); uint op = bins.slice(0, 7); uint imm1 = bins.slice(7, 12); uint fun = bins.slice(12, 15); uint rs1 = rg[bins.slice(15, 20)]; uint rs2 = rg[bins.slice(20, 25)]; uint imm2 = bins.slice(25, 32); uint imm = imm1 + (imm2<<5); imm = Binum(imm, 12).extended(); return new data_S(cdp->pc, S, op, fun, rs1, rs2, imm); } daptr sol_B(const cdptr cdp, const uint *rg){ Binum bins(cdp->cmd); uint op = bins.slice(0, 7); uint imm1 = bins.slice(7, 8); uint imm2 = bins.slice(8, 12); uint fun = bins.slice(12, 15); uint rs1 = rg[bins.slice(15, 20)]; uint rs2 = rg[bins.slice(20, 25)]; uint imm3 = bins.slice(25, 31); uint imm4 = bins.slice(31, 32); uint imm = (imm1<<11) + (imm2<<1) + (imm3<<5) + (imm4<<12); imm = Binum(imm, 13).extended(); return new data_B(cdp->pc, B, op, fun, rs1, rs2, imm); } daptr sol_U(const cdptr cdp, const uint *rg){ Binum bins(cdp->cmd); uint op = bins.slice(0, 7); uint rd = bins.slice(7, 12); uint imm = bins.slice(12, 32); imm <<= 12; return new data_U(cdp->pc, U, op, rd, imm); } daptr sol_J(const cdptr cdp, const uint *rg){ Binum bins(cdp->cmd); uint op = bins.slice(0, 7); uint rd = bins.slice(7, 12); uint imm1 = bins.slice(12, 20); uint imm2 = bins.slice(20, 21); uint imm3 = bins.slice(21, 31); uint imm4 = bins.slice(31, 32); uint imm = (imm3<<1) + (imm2<<11) + (imm1<<12) + (imm4<<20); imm = Binum(imm, 21).extended(); return new data_J(cdp->pc, J, op, rd, imm); } daptr sol(const cdptr cdp, const uint *rg){ commands t(anatype(cdp->cmd)); switch (t) { case R: return sol_R(cdp, rg); case I: return sol_I(cdp, rg); case S: return sol_S(cdp, rg); case B: return sol_B(cdp, rg); case U: return sol_U(cdp, rg); case J: return sol_J(cdp, rg); default:{ cerr << "wrong type" << endl; return nullptr; break; } } } void des(daptr dat){ if (!dat) return; switch (dat->cd) { case R: { delete drptr(dat); return; } case I: { delete diptr(dat); return; } case S: { delete dsptr(dat); return; } case B: { delete dbptr(dat); return; } case U: { delete duptr(dat); return; } case J: { delete djptr(dat); return; } default:{ cerr << "wrong type" << endl; return; } } } void hazload(const uint &cmd, hazdata *haz, int &h){ commands t(anatype(cmd)); Binum bins(cmd); switch (t) { case R: { uint rs = bins.slice(15, 20); if (rs) haz[h++].rd = rs; rs = bins.slice(20, 25); if (rs) haz[h++].rd = rs; break; } case I: { uint rs = bins.slice(15, 20); if (rs) haz[h++].rd = rs; break; } case S: { uint rs = bins.slice(15, 20); if (rs) haz[h++].rd = rs; rs = bins.slice(20, 25); if (rs) haz[h++].rd = rs; break; } case B: { uint rs = bins.slice(15, 20); if (rs) haz[h++].rd = rs; rs = bins.slice(20, 25); if (rs) haz[h++].rd = rs; break; } default: return; } }
[ "liaoweixin@sjtu.edu.cn" ]
liaoweixin@sjtu.edu.cn
55009fcaeac3c9dcee6c78cc3bf5e24be9356f5f
797183a612a81f7acd261f1a42da0866c5896929
/Questions/SearchforaRange/SearchforaRange.cpp
34659de438d37e781802f6c4ce78203826602be7
[]
no_license
ArronLin/LeetCode
bd1812fc7b48f4872943c47c9869232a884987ce
b3de62cf63ff90eb567f70b6f7e9f32834ca5cc1
refs/heads/master
2016-09-06T00:53:08.317925
2015-05-07T09:58:01
2015-05-07T09:58:01
30,632,755
0
0
null
null
null
null
UTF-8
C++
false
false
1,307
cpp
#include "common.h" class SearchforaRange { public: int binary_search(int A[], int nLeftIdx, int nRightIdx, int target) { while (nLeftIdx <= nRightIdx) { int nMidIdx = (nLeftIdx+nRightIdx+1)/2; if (target == A[nMidIdx]) { return nMidIdx; } else if (target > A[nMidIdx]) { nLeftIdx = nMidIdx+1; } else { nRightIdx = nMidIdx-1; } } return -1; } int _searchRange(int A[], int nLeftIdx, int nRightIdx, int target, bool bSearchLeftRange) { int nFound = binary_search(A, nLeftIdx, nRightIdx, target); while (nFound != -1) { if (bSearchLeftRange) { if (nFound == nLeftIdx || A[nFound-1] != target) { return nFound; } else { nFound = binary_search(A, nLeftIdx, nFound-1, target); } } else { if (nFound == nRightIdx || A[nFound+1] != target) { return nFound; } else { nFound = binary_search(A, nFound+1, nRightIdx, target); } } } return nFound; } vector<int> searchRange(int A[], int n, int target) { vector<int> vRet; if (!A || n <= 0) { return vRet; } int nLeftIdx = _searchRange(A, 0, n-1, target, true); int nRightIdx = _searchRange(A, 0, n-1, target, false); vRet.push_back(nLeftIdx); vRet.push_back(nRightIdx); return vRet; } };
[ "linmartrix@gmail.com" ]
linmartrix@gmail.com
e48810a219107135c0bc8abf3ddea845f174ddf7
c0caed81b5b3e1498cbca4c1627513c456908e38
/src/core/import_pose/import_pose.hh
08bf1541fae049da9b2b42511fa0c1799248700c
[]
no_license
malaifa/source
5b34ac0a4e7777265b291fc824da8837ecc3ee84
fc0af245885de0fb82e0a1144422796a6674aeae
refs/heads/master
2021-01-19T22:10:22.942155
2017-04-19T14:13:07
2017-04-19T14:13:07
88,761,668
0
2
null
null
null
null
UTF-8
C++
false
false
9,057
hh
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*- // vi: set ts=2 noet: // // (c) Copyright Rosetta Commons Member Institutions. // (c) This file is part of the Rosetta software suite and is made available under license. // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. // (c) For more information, see http://www.rosettacommons.org. Questions about this can be // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu. /// @file core/import_pose/import_pose.hh /// /// @brief various functions to construct Pose object(s) from PDB(s) /// @author Sergey Lyskov #ifndef INCLUDED_core_import_pose_import_pose_hh #define INCLUDED_core_import_pose_import_pose_hh // Package headers #include <core/import_pose/import_pose_options.fwd.hh> // C++ headers #include <iosfwd> // Utility headers #include <basic/Tracer.fwd.hh> // Project headers #include <core/types.hh> #include <core/chemical/ResidueTypeSet.fwd.hh> #include <core/id/AtomID_Mask.fwd.hh> #include <core/io/StructFileRep.hh> #include <core/io/StructFileReaderOptions.fwd.hh> #include <core/pose/Pose.fwd.hh> #include <utility/vector1.hh> class CifFile; class CifParser; typedef utility::pointer::shared_ptr< CifFile > CifFileOP; typedef utility::pointer::shared_ptr< CifParser > CifParserOP; namespace core { namespace import_pose { enum FileType{ PDB_file, CIF_file, Unknown_file }; typedef std::string String; /// @brief special Tracer instance acting as special param for all traced_dump_pdb functions /// extern basic::Tracer TR_dump_pdb_dummy; void read_all_poses( const utility::vector1<std::string>& filenames, utility::vector1<core::pose::Pose>* poses ); void read_additional_pdb_data( std::string const & file, pose::Pose & pose, io::StructFileRepCOP fd, bool read_fold_tree = false ); void read_additional_pdb_data( std::string const & file, pose::Pose & pose, ImportPoseOptions const & options, bool read_fold_tree = false ); /// @brief Returns a PoseOP object from the Pose created from input /// PDB <filename> /// @note: in PyRosetta, this will return a Pose object /// /// example(s): /// pose = pose_from_file("YFP.pdb") /// See also: /// Pose /// PDBInfo /// make_pose_from_sequence /// pose_from_rcsb /// pose_from_sequence pose::PoseOP pose_from_file( std::string const & filename, bool read_fold_tree = false, FileType type = Unknown_file ); /// @brief Returns a PoseOP object from the Pose created from input /// PDB <filename>, taking a set of custom ImportPoseOptions parameters. /// @note: in PyRosetta, this will return a Pose object /// /// example(s): /// pose = pose_from_file("YFP.pdb") /// See also: /// Pose /// PDBInfo /// make_pose_from_sequence /// pose_from_rcsb /// pose_from_sequence pose::PoseOP pose_from_file( std::string const & filename, ImportPoseOptions const & options, bool read_fold_tree, FileType type ); /// @brief Returns a PoseOP object from the Pose created by reading the input /// PDB <filename>, this constructor allows for a non-default ResidueTypeSet /// <residue_set> pose::PoseOP pose_from_file( chemical::ResidueTypeSet const & residue_set, std::string const & filename, bool read_fold_tree = false, FileType type = Unknown_file ); /// @brief Determine what file type is passed to function /// there should only be one function that calls this, pose_from_file /// and only calls it when the filetype is unknown FileType determine_file_type( std::string const &contents_of_file); void pose_from_file( pose::Pose & pose, chemical::ResidueTypeSet const & residue_set, std::string const & filename, ImportPoseOptions const & options, bool read_fold_tree = false, FileType file_type = Unknown_file ); /// @brief Reads in data from input PDB <filename> and stores it in the Pose /// <pose>, this constructor allows for a non-default ResidueTypeSet /// <residue_set> void pose_from_file( pose::Pose & pose, chemical::ResidueTypeSet const & residue_set, std::string const & filename, bool read_fold_tree = false, FileType type = Unknown_file ); /// @brief Reads in data from input PDB <filename> and stores it in the Pose /// <pose>, uses the FA_STANDARD ResidueTypeSet (fullatom) by default /// @note: will use centroid if in::file::centroid_input is true /// /// example(s): /// pose_from_file(pose,"YFP.pdb") /// See also: /// Pose /// PDBInfo void pose_from_file( pose::Pose & pose, std::string const & filename, bool read_fold_tree = false, FileType type = Unknown_file ); void pose_from_file( pose::Pose & pose, std::string const & filename, ImportPoseOptions const & options, bool read_fold_tree = false, FileType type = Unknown_file ); /// @brief Reads data from an input PDB containing multiple models named /// <filename> and stores it in a vector of Pose objects named <poses> using /// ResidueTypeSet <residue_set> void pose_from_file( utility::vector1< pose::Pose > & poses, chemical::ResidueTypeSet const & residue_set, std::string const & filename, bool read_fold_tree = false, FileType type = Unknown_file ); void pose_from_file( utility::vector1< pose::Pose > & poses, chemical::ResidueTypeSet const & residue_set, std::string const & filename, ImportPoseOptions const & options, bool read_fold_tree = false, FileType type = Unknown_file ); utility::vector1< core::pose::PoseOP > poseOPs_from_files( utility::vector1< std::string > const & filenames, bool read_fold_tree = false, FileType type = Unknown_file ); utility::vector1< core::pose::PoseOP > poseOPs_from_files( utility::vector1< std::string > const & filenames, ImportPoseOptions const & options, bool read_fold_tree = false, FileType type = Unknown_file ); utility::vector1< core::pose::PoseOP > poseOPs_from_files( chemical::ResidueTypeSet const & residue_set, utility::vector1< std::string > const & filenames, ImportPoseOptions const & options, bool read_fold_tree, FileType type = Unknown_file ); utility::vector1< core::pose::Pose > poses_from_files( utility::vector1< std::string > const & filenames, bool read_fold_tree = false, FileType type = Unknown_file ); utility::vector1< core::pose::Pose > poses_from_files( chemical::ResidueTypeSet const & residue_set, utility::vector1< std::string > const & filenames, bool read_fold_tree, FileType type = Unknown_file ); // FA_STANDARD residue set /// @brief Reads data from an input PDB containing multiple models named /// <filename> and stores it in a vector of Pose objects named <poses> /// using the FA_STANDARD ResidueTypeSet (fullatom) void pose_from_file( utility::vector1< pose::Pose > & poses, std::string const & filename, bool read_fold_tree = false, FileType type = Unknown_file ); void pose_from_pdbstring( pose::Pose & pose, std::string const & pdbcontents, std::string const & filename = "" ); void pose_from_pdbstring( pose::Pose & pose, std::string const & pdbcontents, ImportPoseOptions const & options, std::string const & filename = "" ); void pose_from_pdbstring( pose::Pose & pose, std::string const & pdbcontents, chemical::ResidueTypeSet const & residue_set, std::string const & filename ); void pose_from_pdbstring( pose::Pose & pose, std::string const & pdbcontents, chemical::ResidueTypeSet const & residue_set, ImportPoseOptions const & options, std::string const & filename ); void pose_from_pdb_stream( pose::Pose & pose, std::istream & pdb_stream, std::string const & filename, ImportPoseOptions const & options ); // uses the CENTROID residue_set /// @brief Reads in data from input PDB <filename> and stores it in the Pose /// <pose> using the CENTROID ResidueTypeSet (centroid) void centroid_pose_from_pdb( pose::Pose & pose, std::string const & filename, bool read_fold_tree = false ); /// @brief Create pose object, using given StructFileRep object. /// If PDB cleanin specified - it will be applied first. /// Constructs a ImportPoseOptions object from the command line void build_pose( io::StructFileRepOP fd, // const? naaaaah pose::Pose & pose, chemical::ResidueTypeSet const & residue_set ); /// @brief Create pose object, using given StructFileRep object. /// If PDB cleanin specified - it will be applied first void build_pose( io::StructFileRepOP fd, // const? naaaaah pose::Pose & pose, chemical::ResidueTypeSet const & residue_set, ImportPoseOptions const & options ); /// @brief Create pose object, using given StructFileRep object. /// No PDB cleanin will be appliend. void build_pose_as_is( io::StructFileRepOP fd, pose::Pose & pose, chemical::ResidueTypeSet const & residue_set, ImportPoseOptions const & options ); void build_pose_as_is2( io::StructFileRepCOP fd, pose::Pose & pose, chemical::ResidueTypeSet const & residue_set, id::AtomID_Mask & missing, ImportPoseOptions const & options ); } // namespace import_pose } // namespace core #endif // INCLUDED_core_import_pose_import_pose_HH
[ "malaifa@yahoo.com" ]
malaifa@yahoo.com
e8dae29bc49f895f5d34b06fd4c738a536b4875c
0e5eeffd8ba52d5cc4fd92ca60e44f1c5886405f
/video-streamer/main.cpp
d7d6c6d0ae88b16e0dcbd30d9475839420423a84
[ "Apache-2.0" ]
permissive
stevefoy/solo-video
44f5cca1295666ea7e051beeef0c75b48a73bdae
2c424b0e062af318ed556a7db2084aae5c1b104b
refs/heads/master
2020-12-25T18:53:08.114666
2017-01-07T22:07:19
2017-01-07T22:07:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,024
cpp
๏ปฟ#include <glib.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "config.h" #include "face_detector_image_consumer.h" #include "image_consumer.h" #include "video_streamer.h" static bool stop = false; static FaceDetectorImageConsumer image_consumer(DISPLAY_GUI, SAVE_IMAGES); // TODO: avoid making this a global static void signal_handler(int sig) { TRACE("signal_handler()\n"); if (sig == SIGINT) { TRACE("signal_handler() -- sig is SIGINT; Stopping\n"); stop = true; image_consumer.stop(); } } #ifdef DAEMON static void process_exit() { TRACE("Closing log.\n"); CLOSELOG TRACE("Log closed.\n"); } static void become_daemon(void) { /* In the following, we will create/run as a daemon. To do this, we fork the parent to create a child process. * This allows the child process to run the program code without being attached to the shell from which it was launch. * This also allows the parent to terminate successfully, and, hence, report back that the daemon was successfully launched. */ pid_t pid; int pipefd[2]; // get the pipe's input/output file descriptors if (pipe(pipefd)) { fprintf(stderr, "Could not get the pipe file descriptors.\n"); exit(EXIT_FAILURE); } // create child process pid = fork(); // if successful, both child and parent return from here (with return values 0 and the child's ID, respectively) if (pid < (pid_t) 0) { // pid == -1 signals that fork failed fprintf(stderr, "Failed to fork the parent process.\n"); close(pipefd[0]); close(pipefd[1]); exit(EXIT_FAILURE); } else if (pid != (pid_t) 0) { // this is the parent process -- the pid is the child's pid close(pipefd[1]); // close the pipe's output printf("%d\n", pid); // print out the child's pid // FIXME: do I need to clear the input out of the input pipe (ie, read and discard it)? close(pipefd[0]); exit(EXIT_SUCCESS); } // only the child process will make it here close(pipefd[0]); // close the pipe's input close(pipefd[1]); // close the pipe's output // setup logging umask(0); OPENLOG atexit(process_exit); // create a session if (setsid() < (pid_t) 0) { ERROR("Could not create a new session.\n"); exit(EXIT_FAILURE); } // change to root dir if ((chdir("/")) < 0) { ERROR("Could not change to root directory.\n"); exit(EXIT_FAILURE); } // close standard in/out/err close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); } #endif int main(int argc, char *argv[]) { #ifdef DAEMON // become a daemon (i.e., become an unattached child process) become_daemon(); #endif // register the signal handler callback if (signal(SIGINT, signal_handler) == SIG_ERR) { ERROR("Could not register the signal handler.\n"); return EXIT_FAILURE; } // init the image consumer if (!image_consumer.init()) { ERROR("Failed to initialize the image consumer.\n"); return EXIT_FAILURE; } // init and run the video streamer VideoStreamer video_streamer(LOAD_MODULE, USE_TEST_STREAM, SEND_RTP_STREAM, &image_consumer); if (!video_streamer.init()) { ERROR("Failed to initialize the video streamer.\n"); return EXIT_FAILURE; } if (!video_streamer.run()) { ERROR("Failed to run the video streamer thread.\n"); return EXIT_FAILURE; } // start the main event loop DEBUG("Starting the main loop.\n"); while (!stop) { g_main_context_iteration(NULL, FALSE); image_consumer.iterate(); } // shut down DEBUG("Shutting down.\n"); TRACE("Calling video_streamer_stop()\n"); video_streamer.stop(); TRACE("Calling image_consumer.stop()\n"); image_consumer.stop(); DEBUG("Exiting main\n"); return EXIT_SUCCESS; }
[ "sweb@macrovert.com" ]
sweb@macrovert.com
788b27079a6bc4e13c40def853755fb346e52c5f
9802284a0f2f13a6a7ac93278f8efa09cc0ec26b
/SDK/BP_MK18_RemoveMagInsertBulletChamber_classes.h
ca37f1ddfc1b5f9110b8979e2e6725dd3b4720d3
[]
no_license
Berxz/Scum-SDK
05eb0a27eec71ce89988636f04224a81a12131d8
74887c5497b435f535bbf8608fcf1010ff5e948c
refs/heads/master
2021-05-17T15:38:25.915711
2020-03-31T06:32:10
2020-03-31T06:32:10
250,842,227
0
0
null
null
null
null
UTF-8
C++
false
false
815
h
#pragma once // Name: SCUM, Version: 3.75.21350 #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace SDK { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass BP_MK18_RemoveMagInsertBulletChamber.BP_MK18_RemoveMagInsertBulletChamber_C // 0x0000 (0x0088 - 0x0088) class UBP_MK18_RemoveMagInsertBulletChamber_C : public URemoveMagazineInsertCartridge { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_MK18_RemoveMagInsertBulletChamber.BP_MK18_RemoveMagInsertBulletChamber_C"); return ptr; } bool CanExecuteUsingData(struct FWeaponReloadData* Data); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "37065724+Berxz@users.noreply.github.com" ]
37065724+Berxz@users.noreply.github.com
d9237623475daaa4049a254ee07840c91c2d88a6
3c72b9af45eb00ed7cd730dafaace285c46276f5
/NearestNeighbor/src/main.cpp
1a206450b5b75d044c33f2a7ea9ee676a53dc620
[ "MIT" ]
permissive
jing-vision/opencv-portfolio
48fa23378342adb3961018d02a2232ce9a920658
759f24bad78975e8cc2f233a183ed4a48411d753
refs/heads/master
2022-05-16T03:08:47.215891
2022-05-05T14:05:59
2022-05-05T14:05:59
12,517,865
5
1
null
null
null
null
UTF-8
C++
false
false
1,739
cpp
#include "OpenCV/OpenCV.h" //CV_EXPORTS_W void batchDistance(InputArray src1, InputArray src2, // OutputArray dist, int dtype, OutputArray nidx, // int normType = NORM_L2, int K = 0, // InputArray mask = noArray(), int update = 0, // bool crosscheck = false); using namespace cv; using namespace std; int main(int argc, char** argv ) { namedWindow("nearest"); const int W = 400; const int H = 400; const int NA = 20; const int NB = 40; Mat3b canvas(H, W); Mat1f inA(NA, 2); Mat1f inB(NB, 2); while (true) { canvas.setTo(CV_BLACK); for (int i=0;i<NA;i++) { inA(i, 0) = rand() % W; inA(i, 1) = rand() % H; circle(canvas, Point(inA(i, 0), inA(i, 1)), 4, CV_RED); } for (int i=0;i<NB;i++) { inB(i, 0) = rand() % W; inB(i, 1) = rand() % H; circle(canvas, Point(inB(i, 0), inB(i, 1)), 4, CV_BLUE); } Mat dist; Mat nidx; batchDistance(inA, inB, dist, CV_32FC1, nidx, NORM_L2, 1, noArray(), 0, false); print(dist);printf("\n\n"); print(nidx);printf("\n\n"); for (int i=0;i<NA;i++) { int nn = nidx.at<int>(i); if (nn != -1) { line(canvas, Point(inA(i,0), inA(i, 1)), Point(inB(nn,0), inB(nn,1)), CV_WHITE); } } imshow("nearest", canvas); if (waitKey() == 0x1B) break; } return 0; }
[ "vinjn.z@gmail.com" ]
vinjn.z@gmail.com
3aad4ba880ef0a3bc8220cb018101ae2185db048
194b1fbad0bf04c976fe54816fc7da7a04d0e256
/GlobalPara.h
eac95969603ecf6cf43cd182f9bfceaa0f69c334
[]
no_license
qzfjw/D3DPointCloud
fab1f3da2ed217bc6f45bc40a345d5a70cc3a1b3
65fba246424259c0142e63ed7ee5f2824d9e54ce
refs/heads/master
2021-01-10T04:51:00.038129
2016-01-31T02:28:09
2016-01-31T02:28:09
50,484,057
0
1
null
null
null
null
UTF-8
C++
false
false
103
h
#pragma once class CGlobalPara { public: public: CGlobalPara(void); virtual ~CGlobalPara(void); };
[ "qzfjw@sohu.com" ]
qzfjw@sohu.com
29c8795a84fd30208c13c5008acc93f070da4a13
7a9c8c4181ee1226f025e9e42828068b1079deab
/acwing/ไบŒๅˆ†ๆตฎ็‚นๆ•ฐ็š„ๅนณๆ–นๆ น.cpp
c641a87ea03509ac77ac961aff849bb4d4c4b241
[]
no_license
ml-5/homework
f295810e27903e2c0975c093fef3356c4f49fd0f
a67005ca73ee032728424b23771b481a15805880
refs/heads/master
2021-06-25T15:36:22.539056
2021-03-30T07:09:59
2021-03-30T07:09:59
220,201,821
1
0
null
null
null
null
UTF-8
C++
false
false
354
cpp
#include <iostream> using namespace std; double x; int main() { cin >> x; doubel l = 0, r; if (x > 1) r = x; else r = 1; while (r - l > 1e-8) { double mid = (l + r) >> 1; if (mid * mid >= x) r = mid; else l = mid; } printf("%.6f %.6f", l, l); return 0; }
[ "1470350253@qq.com" ]
1470350253@qq.com
19d4fa5729b7ffd882681aa8c6054d6089732ec7
4d4ff131f863a51b111cde6b5e4bb43e803c7c19
/sdl_core/src/components/application_manager/src/commands/hmi/on_policy_update.cc
56c544888a5f3e0bfdd5a9d0e1a924c93b089da4
[]
no_license
lexoy/SDL
e6f695414e82bdbe7b89fb3557d0a1858ed5f247
8a46fc5fefa891484db00ebf567bfbd603b26079
refs/heads/master
2021-01-10T08:39:48.686320
2016-03-07T02:24:13
2016-03-07T02:24:13
47,313,013
1
1
null
null
null
null
UTF-8
C++
false
false
2,071
cc
/* * Copyright (c) 2014, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the * distribution. * * Neither the name of the Ford Motor Company nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "application_manager/commands/hmi/on_policy_update.h" #include "application_manager/policies/policy_handler.h" namespace application_manager { namespace commands { OnPolicyUpdate::OnPolicyUpdate(const MessageSharedPtr& message) : NotificationFromHMI(message) { } OnPolicyUpdate::~OnPolicyUpdate() { } void OnPolicyUpdate::Run() { LOG4CXX_AUTO_TRACE(logger_); policy::PolicyHandler::instance()->OnPTExchangeNeeded(); } } // namespace commands } // namespace application_manager
[ "xiny@kotei-info.com" ]
xiny@kotei-info.com
dbd1e7284418a99ccda627c9e8e73a980511a3d0
bff00d83288ccc4431cdfd78acc2467e646cd590
/google/cloud/storage/internal/curl_request.h
2b0e28ad008342a01951798b9baa69bb8da1dc64
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
saeta/google-cloud-cpp
0f31c7e859af5abd68debe658be287141ba1c6c5
81a28a4c92eab1b18c2d7e4b9cefa032e830f804
refs/heads/master
2020-03-21T04:19:02.542978
2018-06-20T12:53:00
2018-06-20T12:53:00
138,102,446
0
0
null
2018-06-21T01:07:35
2018-06-21T01:07:34
null
UTF-8
C++
false
false
3,382
h
// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_INTERNAL_CURL_REQUEST_H_ #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_INTERNAL_CURL_REQUEST_H_ #include "google/cloud/storage/internal/curl_wrappers.h" #include "google/cloud/storage/internal/http_response.h" #include "google/cloud/storage/internal/nljson.h" #include "google/cloud/storage/well_known_parameters.h" #include <curl/curl.h> #include <map> namespace storage { inline namespace STORAGE_CLIENT_NS { namespace internal { /// Hold a character string created by CURL use correct deleter. using CurlString = std::unique_ptr<char, decltype(&curl_free)>; /** * Automatically manage the resources associated with a libcurl HTTP request. * * The Google Cloud Storage Client library using libcurl to make http requests. * However, libcurl is a fairly low-level C library, where the application is * expected to manage all resources manually. This is a wrapper to prepare and * make synchronous HTTP requests. */ class CurlRequest { public: explicit CurlRequest(std::string base_url); ~CurlRequest(); /// Add request headers. void AddHeader(std::string const& header); /// Add a parameter for a POST request. void AddQueryParameter(std::string const& key, std::string const& value); /// URL-escape a string. CurlString MakeEscapedString(std::string const& s) { return CurlString( curl_easy_escape(curl_, s.data(), static_cast<int>(s.length())), &curl_free); } /** * Make a request with the given payload. * * @param payload The contents of the request. */ void PrepareRequest(std::string payload); /** * Make the prepared request. * * @return The response HTTP error code and the response payload. * * @throw std::runtime_error if the request cannot be made at all. */ HttpResponse MakeRequest(); CurlRequest(CurlRequest const&) = delete; CurlRequest& operator=(CurlRequest const&) = delete; CurlRequest(CurlRequest&&) = default; CurlRequest& operator=(CurlRequest&&) = default; template <typename P> void AddWellKnownParameter(WellKnownParameter<P, std::string> const& p) { if (p.has_value()) { AddQueryParameter(p.parameter_name(), p.value()); } } template <typename P> void AddWellKnownParameter(WellKnownParameter<P, std::int64_t> const& p) { if (p.has_value()) { AddQueryParameter(p.parameter_name(), std::to_string(p.value())); } } private: std::string url_; char const* query_parameter_separator_; CURL* curl_; curl_slist* headers_; std::string payload_; CurlBuffer response_payload_; CurlHeaders response_headers_; }; } // namespace internal } // namespace STORAGE_CLIENT_NS } // namespace storage #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_INTERNAL_CURL_REQUEST_H_
[ "noreply@github.com" ]
noreply@github.com
a73186fb4b981cd58b264d729d4c4b9a3f6a07f3
1893667a55bd570d28ccba6fea81a86cd0c69d73
/WebKit/gtk/webkit/webkitwebview.cpp
f5d0ef65a6a2d632bb38c0d32dc1e576b1011834
[ "BSD-2-Clause" ]
permissive
pelegri/WebKit-PlayBook
0abf47b5a48f58cc1d84f66ffa83b87fec547b0d
e52f66977fbc1f6a1a259feb0ff97bd68b2299b7
refs/heads/master
2021-01-17T23:07:26.330729
2012-01-16T23:35:57
2012-01-20T02:30:04
3,226,843
0
0
null
null
null
null
UTF-8
C++
false
false
176,669
cpp
/* * Copyright (C) 2007, 2008 Holger Hans Peter Freyther * Copyright (C) 2007, 2008, 2009 Christian Dywan <christian@imendio.com> * Copyright (C) 2007 Xan Lopez <xan@gnome.org> * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> * Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com> * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org> * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2008, 2009, 2010 Collabora Ltd. * Copyright (C) 2009, 2010 Igalia S.L. * Copyright (C) 2009 Movial Creative Technologies Inc. * Copyright (C) 2009 Bobby Powers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "webkitwebview.h" #include "webkitdownload.h" #include "webkitenumtypes.h" #include "webkitgeolocationpolicydecision.h" #include "webkitmarshal.h" #include "webkitnetworkrequest.h" #include "webkitnetworkresponse.h" #include "webkitprivate.h" #include "webkitwebinspector.h" #include "webkitwebbackforwardlist.h" #include "webkitwebhistoryitem.h" #include "AXObjectCache.h" #include "AbstractDatabase.h" #include "BackForwardList.h" #include "Cache.h" #include "ChromeClientGtk.h" #include "ClipboardUtilitiesGtk.h" #include "ContextMenuClientGtk.h" #include "ContextMenuController.h" #include "ContextMenu.h" #include "Cursor.h" #include "Document.h" #include "DocumentLoader.h" #include "DragActions.h" #include "DragClientGtk.h" #include "DragController.h" #include "DragData.h" #include "EditorClientGtk.h" #include "Editor.h" #include "EventHandler.h" #include "FloatQuad.h" #include "FocusController.h" #include "FrameLoader.h" #include "FrameLoaderTypes.h" #include "FrameView.h" #include <glib/gi18n-lib.h> #include <GOwnPtr.h> #include <GOwnPtrGtk.h> #include "GraphicsContext.h" #include "GtkVersioning.h" #include "HitTestRequest.h" #include "HitTestResult.h" #include "IconDatabase.h" #include "InspectorClientGtk.h" #include "MouseEventWithHitTestResults.h" #include "NotImplemented.h" #include "PageCache.h" #include "Pasteboard.h" #include "PasteboardHelperGtk.h" #include "PasteboardHelper.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" #include "ProgressTracker.h" #include "RenderView.h" #include "ResourceHandle.h" #include "ScriptValue.h" #include "Scrollbar.h" #include "webkit/WebKitDOMDocumentPrivate.h" #include <wtf/text/CString.h> #include <gdk/gdkkeysyms.h> /** * SECTION:webkitwebview * @short_description: The central class of the WebKitGTK+ API * @see_also: #WebKitWebSettings, #WebKitWebFrame * * #WebKitWebView is the central class of the WebKitGTK+ API. It is a * #GtkWidget implementing the scrolling interface which means you can * embed in a #GtkScrolledWindow. It is responsible for managing the * drawing of the content, forwarding of events. You can load any URI * into the #WebKitWebView or any kind of data string. With #WebKitWebSettings * you can control various aspects of the rendering and loading of the content. * Each #WebKitWebView has exactly one #WebKitWebFrame as main frame. A * #WebKitWebFrame can have n children. * * <programlisting> * /<!-- -->* Create the widgets *<!-- -->/ * GtkWidget *main_window = gtk_window_new (GTK_WIDGET_TOPLEVEL); * GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); * GtkWidget *web_view = webkit_web_view_new (); * * /<!-- -->* Place the WebKitWebView in the GtkScrolledWindow *<!-- -->/ * gtk_container_add (GTK_CONTAINER (scrolled_window), web_view); * gtk_container_add (GTK_CONTAINER (main_window), scrolled_window); * * /<!-- -->* Open a webpage *<!-- -->/ * webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org"); * * /<!-- -->* Show the result *<!-- -->/ * gtk_window_set_default_size (GTK_WINDOW (main_window), 800, 600); * gtk_widget_show_all (main_window); * </programlisting> */ static const double defaultDPI = 96.0; static WebKitCacheModel cacheModel; static IntPoint globalPointForClientPoint(GdkWindow* window, const IntPoint& clientPoint); using namespace WebKit; using namespace WebCore; enum { /* normal signals */ NAVIGATION_REQUESTED, NEW_WINDOW_POLICY_DECISION_REQUESTED, NAVIGATION_POLICY_DECISION_REQUESTED, MIME_TYPE_POLICY_DECISION_REQUESTED, CREATE_WEB_VIEW, WEB_VIEW_READY, WINDOW_OBJECT_CLEARED, LOAD_STARTED, LOAD_COMMITTED, LOAD_PROGRESS_CHANGED, LOAD_ERROR, LOAD_FINISHED, TITLE_CHANGED, HOVERING_OVER_LINK, POPULATE_POPUP, STATUS_BAR_TEXT_CHANGED, ICON_LOADED, SELECTION_CHANGED, CONSOLE_MESSAGE, SCRIPT_ALERT, SCRIPT_CONFIRM, SCRIPT_PROMPT, SELECT_ALL, COPY_CLIPBOARD, PASTE_CLIPBOARD, CUT_CLIPBOARD, DOWNLOAD_REQUESTED, MOVE_CURSOR, PRINT_REQUESTED, PLUGIN_WIDGET, CLOSE_WEB_VIEW, UNDO, REDO, DATABASE_QUOTA_EXCEEDED, RESOURCE_REQUEST_STARTING, DOCUMENT_LOAD_FINISHED, GEOLOCATION_POLICY_DECISION_REQUESTED, GEOLOCATION_POLICY_DECISION_CANCELLED, ONLOAD_EVENT, FRAME_CREATED, LAST_SIGNAL }; enum { PROP_0, PROP_TITLE, PROP_URI, PROP_COPY_TARGET_LIST, PROP_PASTE_TARGET_LIST, PROP_EDITABLE, PROP_SETTINGS, PROP_WEB_INSPECTOR, PROP_WINDOW_FEATURES, PROP_TRANSPARENT, PROP_ZOOM_LEVEL, PROP_FULL_CONTENT_ZOOM, PROP_LOAD_STATUS, PROP_PROGRESS, PROP_ENCODING, PROP_CUSTOM_ENCODING, PROP_ICON_URI, PROP_IM_CONTEXT, PROP_VIEW_MODE }; static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER) static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView); static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures); static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView*); static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData) { WebKitWebView* view = WEBKIT_WEB_VIEW(userData); WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(view); GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view)); GtkRequisition menuSize; #ifdef GTK_API_VERSION_2 gtk_widget_size_request(GTK_WIDGET(menu), &menuSize); #else gtk_widget_get_preferred_size(GTK_WIDGET(menu), &menuSize, NULL); #endif *x = priv->lastPopupXPosition; if ((*x + menuSize.width) >= gdk_screen_get_width(screen)) *x -= menuSize.width; *y = priv->lastPopupYPosition; if ((*y + menuSize.height) >= gdk_screen_get_height(screen)) *y -= menuSize.height; *pushIn = FALSE; } static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event) { Page* page = core(webView); page->contextMenuController()->clearContextMenu(); Frame* focusedFrame; Frame* mainFrame = page->mainFrame(); gboolean mousePressEventResult = FALSE; if (!mainFrame->view()) return FALSE; mainFrame->view()->setCursor(pointerCursor()); if (page->frameCount()) { HitTestRequest request(HitTestRequest::Active); IntPoint point = mainFrame->view()->windowToContents(event.pos()); MouseEventWithHitTestResults mev = mainFrame->document()->prepareMouseEvent(request, point, event); Frame* targetFrame = EventHandler::subframeForTargetNode(mev.targetNode()); if (!targetFrame) targetFrame = mainFrame; focusedFrame = page->focusController()->focusedOrMainFrame(); if (targetFrame != focusedFrame) { page->focusController()->setFocusedFrame(targetFrame); focusedFrame = targetFrame; } } else focusedFrame = mainFrame; if (focusedFrame->view() && focusedFrame->eventHandler()->handleMousePressEvent(event)) mousePressEventResult = TRUE; bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(event); if (!handledEvent) return FALSE; // If coreMenu is NULL, this means WebCore decided to not create // the default context menu; this may happen when the page is // handling the right-click for reasons other than the context menu. ContextMenu* coreMenu = page->contextMenuController()->contextMenu(); if (!coreMenu) return mousePressEventResult; // If we reach here, it's because WebCore is going to show the // default context menu. We check our setting to figure out // whether we want it or not. WebKitWebSettings* settings = webkit_web_view_get_settings(webView); gboolean enableDefaultContextMenu; g_object_get(settings, "enable-default-context-menu", &enableDefaultContextMenu, NULL); if (!enableDefaultContextMenu) return FALSE; GtkMenu* menu = GTK_MENU(coreMenu->platformDescription()); if (!menu) return FALSE; g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, menu); GList* items = gtk_container_get_children(GTK_CONTAINER(menu)); bool empty = !g_list_nth(items, 0); g_list_free(items); if (empty) return FALSE; WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); priv->currentMenu = menu; priv->lastPopupXPosition = event.globalX(); priv->lastPopupYPosition = event.globalY(); gtk_menu_popup(menu, NULL, NULL, &PopupMenuPositionFunc, webView, event.button() + 1, gtk_get_current_event_time()); return TRUE; } static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget) { static const int contextMenuMargin = 1; // The context menu event was generated from the keyboard, so show the context menu by the current selection. Page* page = core(WEBKIT_WEB_VIEW(widget)); Frame* frame = page->focusController()->focusedOrMainFrame(); FrameView* view = frame->view(); if (!view) return FALSE; Position start = frame->selection()->selection().start(); Position end = frame->selection()->selection().end(); int rightAligned = FALSE; IntPoint location; if (!start.node() || !end.node() || (frame->selection()->selection().isCaret() && !frame->selection()->selection().isContentEditable())) location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin); else { RenderObject* renderer = start.node()->renderer(); if (!renderer) return FALSE; // Calculate the rect of the first line of the selection (cribbed from -[WebCoreFrameBridge firstRectForDOMRange:], // now Frame::firstRectForRange(), which perhaps this should call). int extraWidthToEndOfLine = 0; InlineBox* startInlineBox; int startCaretOffset; start.getInlineBoxAndOffset(DOWNSTREAM, startInlineBox, startCaretOffset); IntRect startCaretRect = renderer->localCaretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine); if (startCaretRect != IntRect()) startCaretRect = renderer->localToAbsoluteQuad(FloatRect(startCaretRect)).enclosingBoundingBox(); InlineBox* endInlineBox; int endCaretOffset; end.getInlineBoxAndOffset(UPSTREAM, endInlineBox, endCaretOffset); IntRect endCaretRect = renderer->localCaretRect(endInlineBox, endCaretOffset); if (endCaretRect != IntRect()) endCaretRect = renderer->localToAbsoluteQuad(FloatRect(endCaretRect)).enclosingBoundingBox(); IntRect firstRect; if (startCaretRect.y() == endCaretRect.y()) firstRect = IntRect(MIN(startCaretRect.x(), endCaretRect.x()), startCaretRect.y(), abs(endCaretRect.x() - startCaretRect.x()), MAX(startCaretRect.height(), endCaretRect.height())); else firstRect = IntRect(startCaretRect.x(), startCaretRect.y(), startCaretRect.width() + extraWidthToEndOfLine, startCaretRect.height()); location = IntPoint(rightAligned ? firstRect.right() : firstRect.x(), firstRect.bottom()); } // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element. // Ideally we'd have the position of a context menu event be separate from its target node. location = view->contentsToWindow(location) + IntSize(0, -1); if (location.y() < 0) location.setY(contextMenuMargin); else if (location.y() > view->height()) location.setY(view->height() - contextMenuMargin); if (location.x() < 0) location.setX(contextMenuMargin); else if (location.x() > view->width()) location.setX(view->width() - contextMenuMargin); IntPoint global(globalPointForClientPoint(gtk_widget_get_window(widget), location)); PlatformMouseEvent event(location, global, RightButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time()); return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event); } static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); switch(prop_id) { case PROP_TITLE: g_value_set_string(value, webkit_web_view_get_title(webView)); break; case PROP_URI: g_value_set_string(value, webkit_web_view_get_uri(webView)); break; case PROP_COPY_TARGET_LIST: g_value_set_boxed(value, webkit_web_view_get_copy_target_list(webView)); break; case PROP_PASTE_TARGET_LIST: g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView)); break; case PROP_EDITABLE: g_value_set_boolean(value, webkit_web_view_get_editable(webView)); break; case PROP_SETTINGS: g_value_set_object(value, webkit_web_view_get_settings(webView)); break; case PROP_WEB_INSPECTOR: g_value_set_object(value, webkit_web_view_get_inspector(webView)); break; case PROP_WINDOW_FEATURES: g_value_set_object(value, webkit_web_view_get_window_features(webView)); break; case PROP_TRANSPARENT: g_value_set_boolean(value, webkit_web_view_get_transparent(webView)); break; case PROP_ZOOM_LEVEL: g_value_set_float(value, webkit_web_view_get_zoom_level(webView)); break; case PROP_FULL_CONTENT_ZOOM: g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView)); break; case PROP_ENCODING: g_value_set_string(value, webkit_web_view_get_encoding(webView)); break; case PROP_CUSTOM_ENCODING: g_value_set_string(value, webkit_web_view_get_custom_encoding(webView)); break; case PROP_LOAD_STATUS: g_value_set_enum(value, webkit_web_view_get_load_status(webView)); break; case PROP_PROGRESS: g_value_set_double(value, webkit_web_view_get_progress(webView)); break; case PROP_ICON_URI: g_value_set_string(value, webkit_web_view_get_icon_uri(webView)); break; case PROP_IM_CONTEXT: g_value_set_object(value, webkit_web_view_get_im_context(webView)); break; case PROP_VIEW_MODE: g_value_set_enum(value, webkit_web_view_get_view_mode(webView)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } } static void webkit_web_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); switch(prop_id) { case PROP_EDITABLE: webkit_web_view_set_editable(webView, g_value_get_boolean(value)); break; case PROP_SETTINGS: webkit_web_view_set_settings(webView, WEBKIT_WEB_SETTINGS(g_value_get_object(value))); break; case PROP_WINDOW_FEATURES: webkit_web_view_set_window_features(webView, WEBKIT_WEB_WINDOW_FEATURES(g_value_get_object(value))); break; case PROP_TRANSPARENT: webkit_web_view_set_transparent(webView, g_value_get_boolean(value)); break; case PROP_ZOOM_LEVEL: webkit_web_view_set_zoom_level(webView, g_value_get_float(value)); break; case PROP_FULL_CONTENT_ZOOM: webkit_web_view_set_full_content_zoom(webView, g_value_get_boolean(value)); break; case PROP_CUSTOM_ENCODING: webkit_web_view_set_custom_encoding(webView, g_value_get_string(value)); break; case PROP_VIEW_MODE: webkit_web_view_set_view_mode(webView, static_cast<WebKitWebViewViewMode>(g_value_get_enum(value))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } } static bool shouldCoalesce(const IntRect& rect, const Vector<IntRect>& rects) { const unsigned int cRectThreshold = 10; const float cWastedSpaceThreshold = 0.75f; bool useUnionedRect = (rects.size() <= 1) || (rects.size() > cRectThreshold); if (useUnionedRect) return true; // Attempt to guess whether or not we should use the unioned rect or the individual rects. // We do this by computing the percentage of "wasted space" in the union. If that wasted space // is too large, then we will do individual rect painting instead. float unionPixels = (rect.width() * rect.height()); float singlePixels = 0; for (size_t i = 0; i < rects.size(); ++i) singlePixels += rects[i].width() * rects[i].height(); float wastedSpace = 1 - (singlePixels / unionPixels); if (wastedSpace <= cWastedSpaceThreshold) useUnionedRect = true; return useUnionedRect; } static void paintWebView(Frame* frame, gboolean transparent, GraphicsContext& context, const IntRect& clipRect, const Vector<IntRect>& rects) { bool coalesce = true; if (rects.size() > 0) coalesce = shouldCoalesce(clipRect, rects); if (coalesce) { context.clip(clipRect); if (transparent) context.clearRect(clipRect); frame->view()->paint(&context, clipRect); } else { for (size_t i = 0; i < rects.size(); i++) { IntRect rect = rects[i]; context.save(); context.clip(rect); if (transparent) context.clearRect(rect); frame->view()->paint(&context, rect); context.restore(); } } context.save(); context.clip(clipRect); frame->page()->inspectorController()->drawNodeHighlight(context); context.restore(); } #ifdef GTK_API_VERSION_2 static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; Frame* frame = core(webView)->mainFrame(); if (frame->contentRenderer() && frame->view()) { frame->view()->updateLayoutAndStyleIfNeededRecursive(); cairo_t* cr = gdk_cairo_create(event->window); GraphicsContext ctx(cr); cairo_destroy(cr); ctx.setGdkExposeEvent(event); int rectCount; GOwnPtr<GdkRectangle> rects; gdk_region_get_rectangles(event->region, &rects.outPtr(), &rectCount); Vector<IntRect> paintRects; for (int i = 0; i < rectCount; i++) paintRects.append(IntRect(rects.get()[i])); paintWebView(frame, priv->transparent, ctx, static_cast<IntRect>(event->area), paintRects); } return FALSE; } #else static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; GdkRectangle clipRect; if (!gdk_cairo_get_clip_rectangle(cr, &clipRect)) return FALSE; Frame* frame = core(webView)->mainFrame(); if (frame->contentRenderer() && frame->view()) { GraphicsContext ctx(cr); IntRect rect = clipRect; cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr); frame->view()->updateLayoutAndStyleIfNeededRecursive(); Vector<IntRect> rects; if (!rectList->status && rectList->num_rectangles > 0) { for (int i = 0; i < rectList->num_rectangles; i++) rects.append(enclosingIntRect(FloatRect(rectList->rectangles[i]))); } paintWebView(frame, priv->transparent, ctx, rect, rects); cairo_rectangle_list_destroy(rectList); } return FALSE; } #endif // GTK_API_VERSION_2 static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); PlatformKeyboardEvent keyboardEvent(event); if (!frame->view()) return FALSE; if (frame->eventHandler()->keyEvent(keyboardEvent)) return TRUE; /* Chain up to our parent class for binding activation */ return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_press_event(widget, event); } static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); // GTK+ IM contexts often require us to filter key release events, which // WebCore does not do by default, so we filter the event here. We only block // the event if we don't have a pending composition, because that means we // are using a context like 'simple' which marks every keystroke as filtered. WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient()); if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition()) return TRUE; Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); if (!frame->view()) return FALSE; PlatformKeyboardEvent keyboardEvent(event); if (frame->eventHandler()->keyEvent(keyboardEvent)) return TRUE; /* Chain up to our parent class for binding activation */ return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_release_event(widget, event); } static guint32 getEventTime(GdkEvent* event) { guint32 time = gdk_event_get_time(event); if (time) return time; // Real events always have a non-zero time, but events synthesized // by the DRT do not and we must calculate a time manually. This time // is not calculated in the DRT, because GTK+ does not work well with // anything other than GDK_CURRENT_TIME on synthesized events. GTimeVal timeValue; g_get_current_time(&timeValue); return (timeValue.tv_sec * 1000) + (timeValue.tv_usec / 1000); } static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; // FIXME: need to keep track of subframe focus for key events gtk_widget_grab_focus(widget); // For double and triple clicks GDK sends both a normal button press event // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press // coming up, ignore this event as it certainly generated the double or triple // click. The consequence of not eating this event is two DOM button press events // are generated. GOwnPtr<GdkEvent> nextEvent(gdk_event_peek()); if (nextEvent && (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS)) return TRUE; gint doubleClickDistance = 250; gint doubleClickTime = 5; GtkSettings* settings = gtk_settings_get_for_screen(gtk_widget_get_screen(widget)); g_object_get(settings, "gtk-double-click-distance", &doubleClickDistance, "gtk-double-click-time", &doubleClickTime, NULL); // GTK+ only counts up to triple clicks, but WebCore wants to know about // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the // GDK logic for counting clicks. guint32 eventTime = getEventTime(reinterpret_cast<GdkEvent*>(event)); if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) || ((abs(event->x - priv->previousClickPoint.x()) < doubleClickDistance) && (abs(event->y - priv->previousClickPoint.y()) < doubleClickDistance) && (eventTime - priv->previousClickTime < static_cast<guint>(doubleClickTime)) && (event->button == priv->previousClickButton))) priv->currentClickCount++; else priv->currentClickCount = 1; PlatformMouseEvent platformEvent(event); platformEvent.setClickCount(priv->currentClickCount); priv->previousClickPoint = platformEvent.pos(); priv->previousClickButton = event->button; priv->previousClickTime = eventTime; if (event->button == 3) return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event)); Frame* frame = core(webView)->mainFrame(); if (!frame->view()) return FALSE; gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent); // Handle the IM context when a mouse press fires static_cast<WebKit::EditorClient*>(core(webView)->editorClient())->handleInputMethodMousePress(); #if PLATFORM(X11) /* Copy selection to the X11 selection clipboard */ if (event->button == 2) { bool primary = webView->priv->usePrimaryForPaste; webView->priv->usePrimaryForPaste = true; Editor* editor = webView->priv->corePage->focusController()->focusedOrMainFrame()->editor(); result = result || editor->canPaste() || editor->canDHTMLPaste(); editor->paste(); webView->priv->usePrimaryForPaste = primary; } #endif return result; } static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); Frame* focusedFrame = core(webView)->focusController()->focusedFrame(); if (focusedFrame && focusedFrame->editor()->canEdit()) { #ifdef MAEMO_CHANGES WebKitWebViewPrivate* priv = webView->priv; hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event); #endif } Frame* mainFrame = core(webView)->mainFrame(); if (mainFrame->view()) mainFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event)); /* We always return FALSE here because WebKit can, for the same click, decide * to not handle press-event but handle release-event, which can totally confuse * some GTK+ containers when there are no other events in between. This way we * guarantee that this case never happens, and that if press-event goes through * release-event also goes through. */ return FALSE; } static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); Frame* frame = core(webView)->mainFrame(); if (!frame->view()) return FALSE; return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event)); } static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); Frame* frame = core(webView)->mainFrame(); if (!frame->view()) return FALSE; PlatformWheelEvent wheelEvent(event); return frame->eventHandler()->handleWheelEvent(wheelEvent); } static void webkit_web_view_size_request(GtkWidget* widget, GtkRequisition* requisition) { WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget); Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view)); if (!coreFrame) return; FrameView* view = coreFrame->view(); if (!view) return; requisition->width = view->contentsWidth(); requisition->height = view->contentsHeight(); } static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) { GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget,allocation); WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); Frame* frame = core(webView)->mainFrame(); if (!frame->view()) return; frame->view()->resize(allocation->width, allocation->height); } static void webkit_web_view_grab_focus(GtkWidget* widget) { if (gtk_widget_is_sensitive(widget)) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); FocusController* focusController = core(webView)->focusController(); focusController->setActive(true); if (focusController->focusedFrame()) focusController->setFocused(true); else focusController->setFocusedFrame(core(webView)->mainFrame()); } return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget); } static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* event) { // TODO: Improve focus handling as suggested in // http://bugs.webkit.org/show_bug.cgi?id=16910 GtkWidget* toplevel = gtk_widget_get_toplevel(widget); if (gtk_widget_is_toplevel(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); FocusController* focusController = core(webView)->focusController(); focusController->setActive(true); if (focusController->focusedFrame()) focusController->setFocused(true); else focusController->setFocusedFrame(core(webView)->mainFrame()); if (focusController->focusedFrame()->editor()->canEdit()) gtk_im_context_focus_in(webView->priv->imContext.get()); } return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event); } static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); // We may hit this code while destroying the widget, and we might // no longer have a page, then. Page* page = core(webView); if (page) { page->focusController()->setActive(false); page->focusController()->setFocused(false); } if (webView->priv->imContext) gtk_im_context_focus_out(webView->priv->imContext.get()); return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event); } static void webkit_web_view_realize(GtkWidget* widget) { gtk_widget_set_realized(widget, TRUE); GtkAllocation allocation; #if GTK_CHECK_VERSION(2, 18, 0) gtk_widget_get_allocation(widget, &allocation); #else allocation = widget->allocation; #endif GdkWindowAttr attributes; attributes.window_type = GDK_WINDOW_CHILD; attributes.x = allocation.x; attributes.y = allocation.y; attributes.width = allocation.width; attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual(widget); #ifdef GTK_API_VERSION_2 attributes.colormap = gtk_widget_get_colormap(widget); #endif attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK; gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; #ifdef GTK_API_VERSION_2 attributes_mask |= GDK_WA_COLORMAP; #endif GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); gtk_widget_set_window(widget, window); gdk_window_set_user_data(window, widget); #if GTK_CHECK_VERSION(2, 20, 0) gtk_widget_style_attach(widget); #else widget->style = gtk_style_attach(gtk_widget_get_style(widget), window); #endif gtk_style_set_background(gtk_widget_get_style(widget), window, GTK_STATE_NORMAL); WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; gtk_im_context_set_client_window(priv->imContext.get(), window); } static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj) { if (!core(webView)) return; webView->priv->horizontalAdjustment = hadj; webView->priv->verticalAdjustment = vadj; FrameView* view = core(webkit_web_view_get_main_frame(webView))->view(); if (!view) return; view->setGtkAdjustments(hadj, vadj); } static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget) { WebKitWebView* webView = WEBKIT_WEB_VIEW(container); WebKitWebViewPrivate* priv = webView->priv; priv->children.add(widget); gtk_widget_set_parent(widget, GTK_WIDGET(container)); } static void webkit_web_view_container_remove(GtkContainer* container, GtkWidget* widget) { WebKitWebView* webView = WEBKIT_WEB_VIEW(container); WebKitWebViewPrivate* priv = webView->priv; if (priv->children.contains(widget)) { gtk_widget_unparent(widget); priv->children.remove(widget); } } static void webkit_web_view_container_forall(GtkContainer* container, gboolean, GtkCallback callback, gpointer callbackData) { WebKitWebView* webView = WEBKIT_WEB_VIEW(container); WebKitWebViewPrivate* priv = webView->priv; HashSet<GtkWidget*> children = priv->children; HashSet<GtkWidget*>::const_iterator end = children.end(); for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current) (*callback)(*current, callbackData); } static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*, WebKitWebFrame*) { return 0; } static gboolean webkit_web_view_real_web_view_ready(WebKitWebView*) { return FALSE; } static gboolean webkit_web_view_real_close_web_view(WebKitWebView*) { return FALSE; } static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame*, WebKitNetworkRequest*) { return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object) { notImplemented(); } static gchar* webkit_web_view_real_choose_file(WebKitWebView*, WebKitWebFrame*, const gchar* old_name) { notImplemented(); return g_strdup(old_name); } typedef enum { WEBKIT_SCRIPT_DIALOG_ALERT, WEBKIT_SCRIPT_DIALOG_CONFIRM, WEBKIT_SCRIPT_DIALOG_PROMPT } WebKitScriptDialogType; static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, WebKitScriptDialogType type, const gchar* defaultValue, gchar** value) { GtkMessageType messageType; GtkButtonsType buttons; gint defaultResponse; GtkWidget* window; GtkWidget* dialog; GtkWidget* entry = 0; gboolean didConfirm = FALSE; switch (type) { case WEBKIT_SCRIPT_DIALOG_ALERT: messageType = GTK_MESSAGE_WARNING; buttons = GTK_BUTTONS_CLOSE; defaultResponse = GTK_RESPONSE_CLOSE; break; case WEBKIT_SCRIPT_DIALOG_CONFIRM: messageType = GTK_MESSAGE_QUESTION; buttons = GTK_BUTTONS_OK_CANCEL; defaultResponse = GTK_RESPONSE_OK; break; case WEBKIT_SCRIPT_DIALOG_PROMPT: messageType = GTK_MESSAGE_QUESTION; buttons = GTK_BUTTONS_OK_CANCEL; defaultResponse = GTK_RESPONSE_OK; break; default: g_warning("Unknown value for WebKitScriptDialogType."); return FALSE; } window = gtk_widget_get_toplevel(GTK_WIDGET(webView)); dialog = gtk_message_dialog_new(gtk_widget_is_toplevel(window) ? GTK_WINDOW(window) : 0, GTK_DIALOG_DESTROY_WITH_PARENT, messageType, buttons, "%s", message); gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL); gtk_window_set_title(GTK_WINDOW(dialog), title); g_free(title); if (type == WEBKIT_SCRIPT_DIALOG_PROMPT) { entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(entry), defaultValue); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); gtk_widget_show(entry); } gtk_dialog_set_default_response(GTK_DIALOG(dialog), defaultResponse); gint response = gtk_dialog_run(GTK_DIALOG(dialog)); switch (response) { case GTK_RESPONSE_OK: didConfirm = TRUE; if (entry) *value = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); break; case GTK_RESPONSE_CANCEL: didConfirm = FALSE; break; } gtk_widget_destroy(GTK_WIDGET(dialog)); return didConfirm; } static gboolean webkit_web_view_real_script_alert(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message) { webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_ALERT, 0, 0); return TRUE; } static gboolean webkit_web_view_real_script_confirm(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm) { *didConfirm = webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_CONFIRM, 0, 0); return TRUE; } static gboolean webkit_web_view_real_script_prompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value) { if (!webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_PROMPT, defaultValue, value)) *value = NULL; return TRUE; } static gboolean webkit_web_view_real_console_message(WebKitWebView* webView, const gchar* message, unsigned int line, const gchar* sourceId) { g_message("console message: %s @%d: %s\n", sourceId, line, message); return TRUE; } static void webkit_web_view_real_select_all(WebKitWebView* webView) { Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->command("SelectAll").execute(); } static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView) { Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->command("Cut").execute(); } static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView) { Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->command("Copy").execute(); } static void webkit_web_view_real_undo(WebKitWebView* webView) { Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->command("Undo").execute(); } static void webkit_web_view_real_redo(WebKitWebView* webView) { Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->command("Redo").execute(); } static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMovementStep step, gint count) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW (webView), FALSE); g_return_val_if_fail(step == GTK_MOVEMENT_VISUAL_POSITIONS || step == GTK_MOVEMENT_DISPLAY_LINES || step == GTK_MOVEMENT_PAGES || step == GTK_MOVEMENT_BUFFER_ENDS, FALSE); g_return_val_if_fail(count == 1 || count == -1, FALSE); ScrollDirection direction; ScrollGranularity granularity; switch (step) { case GTK_MOVEMENT_DISPLAY_LINES: granularity = ScrollByLine; if (count == 1) direction = ScrollDown; else direction = ScrollUp; break; case GTK_MOVEMENT_VISUAL_POSITIONS: granularity = ScrollByLine; if (count == 1) direction = ScrollRight; else direction = ScrollLeft; break; case GTK_MOVEMENT_PAGES: granularity = ScrollByPage; if (count == 1) direction = ScrollDown; else direction = ScrollUp; break; case GTK_MOVEMENT_BUFFER_ENDS: granularity = ScrollByDocument; if (count == 1) direction = ScrollDown; else direction = ScrollUp; break; default: g_assert_not_reached(); return false; } Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); if (!frame->eventHandler()->scrollOverflow(direction, granularity)) frame->view()->scroll(direction, granularity); return true; } static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView) { Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->command("Paste").execute(); } static void webkit_web_view_dispose(GObject* object) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); WebKitWebViewPrivate* priv = webView->priv; priv->disposing = TRUE; // These smart pointers are cleared manually, because some cleanup operations are // very sensitive to their value. We may crash if these are done in the wrong order. priv->horizontalAdjustment.clear(); priv->verticalAdjustment.clear(); priv->backForwardList.clear(); if (priv->corePage) { webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object)); core(priv->mainFrame)->loader()->detachFromParent(); delete priv->corePage; priv->corePage = 0; } if (priv->webSettings) { g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); priv->webSettings.clear(); } priv->webInspector.clear(); priv->webWindowFeatures.clear(); priv->mainResource.clear(); priv->subResources.clear(); HashMap<GdkDragContext*, DroppingContext*>::iterator endDroppingContexts = priv->droppingContexts.end(); for (HashMap<GdkDragContext*, DroppingContext*>::iterator iter = priv->droppingContexts.begin(); iter != endDroppingContexts; ++iter) delete (iter->second); priv->droppingContexts.clear(); G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); } static void webkit_web_view_finalize(GObject* object) { // We need to manually call the destructor here, since this object's memory is managed // by GLib. This calls all C++ members' destructors and prevents memory leaks. WEBKIT_WEB_VIEW(object)->priv->~WebKitWebViewPrivate(); G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); } static gboolean webkit_signal_accumulator_object_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy) { gpointer newWebView = g_value_get_object(handlerReturn); g_value_set_object(returnAccu, newWebView); // Continue if we don't have a newWebView return !newWebView; } static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy) { WebKitNavigationResponse navigationResponse = (WebKitNavigationResponse)g_value_get_enum(handlerReturn); g_value_set_enum(returnAccu, navigationResponse); if (navigationResponse != WEBKIT_NAVIGATION_RESPONSE_ACCEPT) return FALSE; return TRUE; } static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); if (!core(webView)) return NULL; AXObjectCache::enableAccessibility(); Frame* coreFrame = core(webView)->mainFrame(); if (!coreFrame) return NULL; Document* doc = coreFrame->document(); if (!doc) return NULL; AccessibilityObject* coreAccessible = doc->axObjectCache()->getOrCreate(doc->renderer()); if (!coreAccessible || !coreAccessible->wrapper()) return NULL; return coreAccessible->wrapper(); } static gdouble webViewGetDPI(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; WebKitWebSettings* webSettings = priv->webSettings.get(); gboolean enforce96DPI; g_object_get(webSettings, "enforce-96-dpi", &enforce96DPI, NULL); if (enforce96DPI) return 96.0; gdouble DPI = defaultDPI; GdkScreen* screen = gtk_widget_has_screen(GTK_WIDGET(webView)) ? gtk_widget_get_screen(GTK_WIDGET(webView)) : gdk_screen_get_default(); if (screen) { DPI = gdk_screen_get_resolution(screen); // gdk_screen_get_resolution() returns -1 when no DPI is set. if (DPI == -1) DPI = defaultDPI; } ASSERT(DPI > 0); return DPI; } static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previousScreen) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; if (priv->disposing) return; WebKitWebSettings* webSettings = priv->webSettings.get(); Settings* settings = core(webView)->settings(); gdouble DPI = webViewGetDPI(webView); guint defaultFontSize, defaultMonospaceFontSize, minimumFontSize, minimumLogicalFontSize; g_object_get(webSettings, "default-font-size", &defaultFontSize, "default-monospace-font-size", &defaultMonospaceFontSize, "minimum-font-size", &minimumFontSize, "minimum-logical-font-size", &minimumLogicalFontSize, NULL); settings->setDefaultFontSize(defaultFontSize / 72.0 * DPI); settings->setDefaultFixedFontSize(defaultMonospaceFontSize / 72.0 * DPI); settings->setMinimumFontSize(minimumFontSize / 72.0 * DPI); settings->setMinimumLogicalFontSize(minimumLogicalFontSize / 72.0 * DPI); } static IntPoint globalPointForClientPoint(GdkWindow* window, const IntPoint& clientPoint) { int x, y; gdk_window_get_origin(window, &x, &y); return clientPoint + IntSize(x, y); } static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); // This might happen if a drag is still in progress after a WebKitWebView // is disposed and before it is finalized. if (!priv->draggingDataObjects.contains(context)) return; priv->draggingDataObjects.remove(context); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); if (!frame) return; GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE); int x, y, xRoot, yRoot; GdkModifierType modifiers; GdkDisplay* display = gdk_display_get_default(); gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers); GdkWindow* window = gdk_display_get_window_at_pointer(display, &x, &y); if (window) { g_object_ref(window); event->button.window = window; } event->button.x = x; event->button.y = y; event->button.x_root = xRoot; event->button.y_root = yRoot; event->button.state = modifiers; PlatformMouseEvent platformEvent(&event->button); frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context))); gdk_event_free(event); } static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint) { WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(WEBKIT_WEB_VIEW(widget)); // This might happen if a drag is still in progress after a WebKitWebView // is diposed and before it is finalized. if (!priv->draggingDataObjects.contains(context)) return; pasteboardHelperInstance()->fillSelectionData(selectionData, info, priv->draggingDataObjects.get(context).get()); } static gboolean doDragLeaveLater(DroppingContext* context) { WebKitWebView* webView = context->webView; WebKitWebViewPrivate* priv = webView->priv; if (!priv->droppingContexts.contains(context->gdkContext)) return FALSE; // If the view doesn't know about the drag yet (there are still pending data) // requests, don't update it with information about the drag. if (context->pendingDataRequests) return FALSE; // Don't call dragExited if we have just received a drag-drop signal. This // happens in the case of a successful drop onto the view. if (!context->dropHappened) { const IntPoint& position = context->lastMotionPosition; DragData dragData(context->dataObject.get(), position, globalPointForClientPoint(gtk_widget_get_window(GTK_WIDGET(webView)), position), DragOperationNone); core(webView)->dragController()->dragExited(&dragData); } core(webView)->dragController()->dragEnded(); priv->droppingContexts.remove(context->gdkContext); delete context; return FALSE; } static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* context, guint time) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; if (!priv->droppingContexts.contains(context)) return; // During a drop GTK+ will fire a drag-leave signal right before firing // the drag-drop signal. We want the actions for drag-leave to happen after // those for drag-drop, so schedule them to happen asynchronously here. g_timeout_add(0, reinterpret_cast<GSourceFunc>(doDragLeaveLater), priv->droppingContexts.get(context)); } static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; DroppingContext* droppingContext = 0; IntPoint position = IntPoint(x, y); if (!priv->droppingContexts.contains(context)) { droppingContext = new DroppingContext; droppingContext->webView = webView; droppingContext->gdkContext = context; droppingContext->dataObject = WebCore::DataObjectGtk::create(); droppingContext->dropHappened = false; droppingContext->lastMotionPosition = position; priv->droppingContexts.set(context, droppingContext); Vector<GdkAtom> acceptableTargets(pasteboardHelperInstance()->dropAtomsForContext(widget, context)); droppingContext->pendingDataRequests = acceptableTargets.size(); for (size_t i = 0; i < acceptableTargets.size(); i++) gtk_drag_get_data(widget, context, acceptableTargets.at(i), time); } else { droppingContext = priv->droppingContexts.get(context); droppingContext->lastMotionPosition = position; } // Don't send any drag information to WebCore until we've retrieved all // the data for this drag operation. Otherwise we'd have to block to wait // for the drag's data. ASSERT(droppingContext); if (droppingContext->pendingDataRequests > 0) return TRUE; DragData dragData(droppingContext->dataObject.get(), position, globalPointForClientPoint(gtk_widget_get_window(widget), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context))); DragOperation operation = core(webView)->dragController()->dragUpdated(&dragData); gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time); return TRUE; } static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; if (!priv->droppingContexts.contains(context)) return; DroppingContext* droppingContext = priv->droppingContexts.get(context); droppingContext->pendingDataRequests--; pasteboardHelperInstance()->fillDataObjectFromDropData(selectionData, info, droppingContext->dataObject.get()); if (droppingContext->pendingDataRequests) return; // The coordinates passed to drag-data-received signal are sometimes // inaccurate in DRT, so use the coordinates of the last motion event. const IntPoint& position = droppingContext->lastMotionPosition; // If there are no more pending requests, start sending dragging data to WebCore. DragData dragData(droppingContext->dataObject.get(), position, globalPointForClientPoint(gtk_widget_get_window(widget), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context))); DragOperation operation = core(webView)->dragController()->dragEntered(&dragData); gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time); } static gboolean webkit_web_view_drag_drop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; if (!priv->droppingContexts.contains(context)) return FALSE; DroppingContext* droppingContext = priv->droppingContexts.get(context); droppingContext->dropHappened = true; IntPoint position(x, y); DragData dragData(droppingContext->dataObject.get(), position, globalPointForClientPoint(gtk_widget_get_window(widget), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context))); core(webView)->dragController()->performDrag(&dragData); gtk_drag_finish(context, TRUE, FALSE, time); return TRUE; } #if GTK_CHECK_VERSION(2, 12, 0) static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip) { WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(widget); if (priv->tooltipText.length() > 0) { gtk_tooltip_set_text(tooltip, priv->tooltipText.data()); return TRUE; } return FALSE; } #endif static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); return GTK_IM_CONTEXT(webView->priv->imContext.get()); } static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) { GtkBindingSet* binding_set; webkit_init(); /* * Signals */ /** * WebKitWebView::create-web-view: * @webView: the object on which the signal is emitted * @frame: the #WebKitWebFrame * * Emitted when the creation of a new window is requested. * If this signal is handled the signal handler should return the * newly created #WebKitWebView. * * The new #WebKitWebView should not be displayed to the user * until the #WebKitWebView::web-view-ready signal is emitted. * * The signal handlers should not try to deal with the reference count for * the new #WebKitWebView. The widget to which the widget is added will * handle that. * * Return value: (transfer full): a newly allocated #WebKitWebView, or %NULL * * Since: 1.0.3 */ webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WebKitWebViewClass, create_web_view), webkit_signal_accumulator_object_handled, NULL, webkit_marshal_OBJECT__OBJECT, WEBKIT_TYPE_WEB_VIEW , 1, WEBKIT_TYPE_WEB_FRAME); /** * WebKitWebView::web-view-ready: * @webView: the object on which the signal is emitted * * Emitted after #WebKitWebView::create-web-view when the new #WebKitWebView * should be displayed to the user. When this signal is emitted * all the information about how the window should look, including * size, position, whether the location, status and scroll bars * should be displayed, is already set on the * #WebKitWebWindowFeatures object contained by the #WebKitWebView. * * Notice that some of that information may change during the life * time of the window, so you may want to connect to the ::notify * signal of the #WebKitWebWindowFeatures object to handle those. * * Return value: %TRUE to stop handlers from being invoked for the event or * %FALSE to propagate the event furter * * Since: 1.0.3 */ webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WebKitWebViewClass, web_view_ready), g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); /** * WebKitWebView::close-web-view: * @webView: the object on which the signal is emitted * * Emitted when closing a #WebKitWebView is requested. This occurs when a * call is made from JavaScript's window.close function. The default * signal handler does not do anything. It is the owner's responsibility * to hide or delete the web view, if necessary. * * Return value: %TRUE to stop handlers from being invoked for the event or * %FALSE to propagate the event furter * * Since: 1.1.11 */ webkit_web_view_signals[CLOSE_WEB_VIEW] = g_signal_new("close-web-view", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WebKitWebViewClass, close_web_view), g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); /** * WebKitWebView::navigation-requested: * @webView: the object on which the signal is emitted * @frame: the #WebKitWebFrame that required the navigation * @request: a #WebKitNetworkRequest * * Emitted when @frame requests a navigation to another page. * * Return value: a #WebKitNavigationResponse * * Deprecated: Use WebKitWebView::navigation-policy-decision-requested * instead */ webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested), webkit_navigation_request_handled, NULL, webkit_marshal_ENUM__OBJECT_OBJECT, WEBKIT_TYPE_NAVIGATION_RESPONSE, 2, WEBKIT_TYPE_WEB_FRAME, WEBKIT_TYPE_NETWORK_REQUEST); /** * WebKitWebView::new-window-policy-decision-requested: * @webView: the object on which the signal is emitted * @frame: the #WebKitWebFrame that required the navigation * @request: a #WebKitNetworkRequest * @navigation_action: a #WebKitWebNavigationAction * @policy_decision: a #WebKitWebPolicyDecision * * Emitted when @frame requests opening a new window. With this * signal the browser can use the context of the request to decide * about the new window. If the request is not handled the default * behavior is to allow opening the new window to load the URI, * which will cause a create-web-view signal emission where the * browser handles the new window action but without information * of the context that caused the navigation. The following * navigation-policy-decision-requested emissions will load the * page after the creation of the new window just with the * information of this new navigation context, without any * information about the action that made this new window to be * opened. * * Notice that if you return TRUE, meaning that you handled the * signal, you are expected to have decided what to do, by calling * webkit_web_policy_decision_ignore(), * webkit_web_policy_decision_use(), or * webkit_web_policy_decision_download() on the @policy_decision * object. * * Return value: %TRUE if a decision was made, %FALSE to have the * default behavior apply * * Since: 1.1.4 */ webkit_web_view_signals[NEW_WINDOW_POLICY_DECISION_REQUESTED] = g_signal_new("new-window-policy-decision-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT, G_TYPE_BOOLEAN, 4, WEBKIT_TYPE_WEB_FRAME, WEBKIT_TYPE_NETWORK_REQUEST, WEBKIT_TYPE_WEB_NAVIGATION_ACTION, WEBKIT_TYPE_WEB_POLICY_DECISION); /** * WebKitWebView::navigation-policy-decision-requested: * @webView: the object on which the signal is emitted * @frame: the #WebKitWebFrame that required the navigation * @request: a #WebKitNetworkRequest * @navigation_action: a #WebKitWebNavigationAction * @policy_decision: a #WebKitWebPolicyDecision * * Emitted when @frame requests a navigation to another page. * If this signal is not handled, the default behavior is to allow the * navigation. * * Notice that if you return TRUE, meaning that you handled the * signal, you are expected to have decided what to do, by calling * webkit_web_policy_decision_ignore(), * webkit_web_policy_decision_use(), or * webkit_web_policy_decision_download() on the @policy_decision * object. * * Return value: %TRUE if a decision was made, %FALSE to have the * default behavior apply * * Since: 1.0.3 */ webkit_web_view_signals[NAVIGATION_POLICY_DECISION_REQUESTED] = g_signal_new("navigation-policy-decision-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT, G_TYPE_BOOLEAN, 4, WEBKIT_TYPE_WEB_FRAME, WEBKIT_TYPE_NETWORK_REQUEST, WEBKIT_TYPE_WEB_NAVIGATION_ACTION, WEBKIT_TYPE_WEB_POLICY_DECISION); /** * WebKitWebView::mime-type-policy-decision-requested: * @webView: the object on which the signal is emitted * @frame: the #WebKitWebFrame that required the policy decision * @request: a WebKitNetworkRequest * @mimetype: the MIME type attempted to load * @policy_decision: a #WebKitWebPolicyDecision * * Decide whether or not to display the given MIME type. If this * signal is not handled, the default behavior is to show the * content of the requested URI if WebKit can show this MIME * type and the content disposition is not a download; if WebKit * is not able to show the MIME type nothing happens. * * Notice that if you return TRUE, meaning that you handled the * signal, you are expected to be aware of the "Content-Disposition" * header. A value of "attachment" usually indicates a download * regardless of the MIME type, see also * soup_message_headers_get_content_disposition(). And you must call * webkit_web_policy_decision_ignore(), * webkit_web_policy_decision_use(), or * webkit_web_policy_decision_download() on the @policy_decision * object. * * Return value: %TRUE if a decision was made, %FALSE to have the * default behavior apply * * Since: 1.0.3 */ webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING_OBJECT, G_TYPE_BOOLEAN, 4, WEBKIT_TYPE_WEB_FRAME, WEBKIT_TYPE_NETWORK_REQUEST, G_TYPE_STRING, WEBKIT_TYPE_WEB_POLICY_DECISION); /** * WebKitWebView::window-object-cleared: * @webView: the object on which the signal is emitted * @frame: the #WebKitWebFrame to which @window_object belongs * @context: the #JSGlobalContextRef holding the global object and other * execution state; equivalent to the return value of * webkit_web_frame_get_global_context(@frame) * @window_object: the #JSObjectRef representing the frame's JavaScript * window object * * Emitted when the JavaScript window object in a #WebKitWebFrame has been * cleared in preparation for a new load. This is the preferred place to * set custom properties on the window object using the JavaScriptCore API. */ webkit_web_view_signals[WINDOW_OBJECT_CLEARED] = g_signal_new("window-object-cleared", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (WebKitWebViewClass, window_object_cleared), NULL, NULL, webkit_marshal_VOID__OBJECT_POINTER_POINTER, G_TYPE_NONE, 3, WEBKIT_TYPE_WEB_FRAME, G_TYPE_POINTER, G_TYPE_POINTER); /** * WebKitWebView::download-requested: * @webView: the object on which the signal is emitted * @download: a #WebKitDownload object that lets you control the * download process * * A new Download is being requested. By default, if the signal is * not handled, the download is cancelled. If you handle the download * and call webkit_download_set_destination_uri(), it will be * started for you. If you need to set the destination asynchronously * you are responsible for starting or cancelling it yourself. * * If you intend to handle downloads yourself rather than using * the #WebKitDownload helper object you must handle this signal, * and return %FALSE. * * Also, keep in mind that the default policy for WebKitGTK+ is to * ignore files with a MIME type that it does not know how to * handle, which means this signal won't be emitted in the default * setup. One way to trigger downloads is to connect to * WebKitWebView::mime-type-policy-decision-requested and call * webkit_web_policy_decision_download() on the * #WebKitWebPolicyDecision in the parameter list for the kind of * files you want your application to download (a common solution * is to download anything that WebKit can't handle, which you can * figure out by using webkit_web_view_can_show_mime_type()). * * Return value: TRUE if the download should be performed, %FALSE to * cancel it * * Since: 1.1.2 */ webkit_web_view_signals[DOWNLOAD_REQUESTED] = g_signal_new("download-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT); /** * WebKitWebView::load-started: * @webView: the object on which the signal is emitted * @frame: the frame going to do the load * * When a #WebKitWebFrame begins to load this signal is emitted. * * Deprecated: Use the "load-status" property instead. */ webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /** * WebKitWebView::load-committed: * @webView: the object on which the signal is emitted * @frame: the main frame that received the first data * * When a #WebKitWebFrame loaded the first data this signal is emitted. * * Deprecated: Use the "load-status" property instead. */ webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /** * WebKitWebView::load-progress-changed: * @webView: the #WebKitWebView * @progress: the global progress * * Deprecated: Use the "progress" property instead. */ webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); /** * WebKitWebView::load-error * @webView: the object on which the signal is emitted * @web_frame: the #WebKitWebFrame * @uri: the URI that triggered the error * @web_error: the #GError that was triggered * * An error occurred while loading. By default, if the signal is not * handled, the @web_view will display a stock error page. You need to * handle the signal if you want to provide your own error page. * * Since: 1.1.6 * * Return value: %TRUE to stop other handlers from being invoked for the * event. %FALSE to propagate the event further. */ webkit_web_view_signals[LOAD_ERROR] = g_signal_new("load-error", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST), 0, g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_STRING_POINTER, G_TYPE_BOOLEAN, 3, WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_POINTER); /** * WebKitWebView::load-finished: * @webView: the #WebKitWebView * @frame: the #WebKitWebFrame * * Deprecated: Use the "load-status" property instead. */ webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /** * WebKitWebView::onload-event: * @webView: the object on which the signal is emitted * @frame: the frame * * When a #WebKitWebFrame receives an onload event this signal is emitted. */ webkit_web_view_signals[LOAD_STARTED] = g_signal_new("onload-event", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /** * WebKitWebView::title-changed: * @webView: the object on which the signal is emitted * @frame: the main frame * @title: the new title * * When a #WebKitWebFrame changes the document title this signal is emitted. * * Deprecated: 1.1.4: Use "notify::title" instead. */ webkit_web_view_signals[TITLE_CHANGED] = g_signal_new("title-changed", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, webkit_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING); /** * WebKitWebView::hovering-over-link: * @webView: the object on which the signal is emitted * @title: the link's title * @uri: the URI the link points to * * When the cursor is over a link, this signal is emitted. */ webkit_web_view_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, webkit_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); /** * WebKitWebView::populate-popup: * @webView: the object on which the signal is emitted * @menu: the context menu * * When a context menu is about to be displayed this signal is emitted. * * Add menu items to #menu to extend the context menu. */ webkit_web_view_signals[POPULATE_POPUP] = g_signal_new("populate-popup", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GTK_TYPE_MENU); /** * WebKitWebView::print-requested * @webView: the object in which the signal is emitted * @web_frame: the frame that is requesting to be printed * * Emitted when printing is requested by the frame, usually * because of a javascript call. When handling this signal you * should call webkit_web_frame_print_full() or * webkit_web_frame_print() to do the actual printing. * * The default handler will present a print dialog and carry a * print operation. Notice that this means that if you intend to * ignore a print request you must connect to this signal, and * return %TRUE. * * Return value: %TRUE if the print request has been handled, %FALSE if * the default handler should run * * Since: 1.1.5 */ webkit_web_view_signals[PRINT_REQUESTED] = g_signal_new("print-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_WEB_FRAME); webkit_web_view_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status-bar-text-changed", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); /** * WebKitWebView::icon-loaded: * @webView: the object on which the signal is emitted * @icon_uri: the URI for the icon * * This signal is emitted when the main frame has got a favicon. * * Since: 1.1.18 */ webkit_web_view_signals[ICON_LOADED] = g_signal_new("icon-loaded", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); webkit_web_view_signals[SELECTION_CHANGED] = g_signal_new("selection-changed", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::console-message: * @webView: the object on which the signal is emitted * @message: the message text * @line: the line where the error occured * @source_id: the source id * * A JavaScript console message was created. * * Return value: %TRUE to stop other handlers from being invoked for the * event. %FALSE to propagate the event further. */ webkit_web_view_signals[CONSOLE_MESSAGE] = g_signal_new("console-message", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(WebKitWebViewClass, console_message), g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__STRING_INT_STRING, G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING); /** * WebKitWebView::script-alert: * @webView: the object on which the signal is emitted * @frame: the relevant frame * @message: the message text * * A JavaScript alert dialog was created. * * Return value: %TRUE to stop other handlers from being invoked for the * event. %FALSE to propagate the event further. */ webkit_web_view_signals[SCRIPT_ALERT] = g_signal_new("script-alert", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(WebKitWebViewClass, script_alert), g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_STRING, G_TYPE_BOOLEAN, 2, WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING); /** * WebKitWebView::script-confirm: * @webView: the object on which the signal is emitted * @frame: the relevant frame * @message: the message text * @confirmed: whether the dialog has been confirmed * * A JavaScript confirm dialog was created, providing Yes and No buttons. * * Return value: %TRUE to stop other handlers from being invoked for the * event. %FALSE to propagate the event further. */ webkit_web_view_signals[SCRIPT_CONFIRM] = g_signal_new("script-confirm", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(WebKitWebViewClass, script_confirm), g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_STRING_POINTER, G_TYPE_BOOLEAN, 3, WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_POINTER); /** * WebKitWebView::script-prompt: * @webView: the object on which the signal is emitted * @frame: the relevant frame * @message: the message text * @default: the default value * @text: To be filled with the return value or NULL if the dialog was cancelled. * * A JavaScript prompt dialog was created, providing an entry to input text. * * Return value: %TRUE to stop other handlers from being invoked for the * event. %FALSE to propagate the event further. */ webkit_web_view_signals[SCRIPT_PROMPT] = g_signal_new("script-prompt", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(WebKitWebViewClass, script_prompt), g_signal_accumulator_true_handled, NULL, webkit_marshal_BOOLEAN__OBJECT_STRING_STRING_STRING, G_TYPE_BOOLEAN, 4, WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); /** * WebKitWebView::select-all: * @webView: the object which received the signal * * The #WebKitWebView::select-all signal is a keybinding signal which gets emitted to * select the complete contents of the text view. * * The default bindings for this signal is Ctrl-a. */ webkit_web_view_signals[SELECT_ALL] = g_signal_new("select-all", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, select_all), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::cut-clipboard: * @webView: the object which received the signal * * The #WebKitWebView::cut-clipboard signal is a keybinding signal which gets emitted to * cut the selection to the clipboard. * * The default bindings for this signal are Ctrl-x and Shift-Delete. */ webkit_web_view_signals[CUT_CLIPBOARD] = g_signal_new("cut-clipboard", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, cut_clipboard), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::copy-clipboard: * @webView: the object which received the signal * * The #WebKitWebView::copy-clipboard signal is a keybinding signal which gets emitted to * copy the selection to the clipboard. * * The default bindings for this signal are Ctrl-c and Ctrl-Insert. */ webkit_web_view_signals[COPY_CLIPBOARD] = g_signal_new("copy-clipboard", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, copy_clipboard), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::paste-clipboard: * @webView: the object which received the signal * * The #WebKitWebView::paste-clipboard signal is a keybinding signal which gets emitted to * paste the contents of the clipboard into the Web view. * * The default bindings for this signal are Ctrl-v and Shift-Insert. */ webkit_web_view_signals[PASTE_CLIPBOARD] = g_signal_new("paste-clipboard", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, paste_clipboard), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::undo * @webView: the object which received the signal * * The #WebKitWebView::undo signal is a keybinding signal which gets emitted to * undo the last editing command. * * The default binding for this signal is Ctrl-z * * Since: 1.1.14 */ webkit_web_view_signals[UNDO] = g_signal_new("undo", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, undo), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::redo * @webView: the object which received the signal * * The #WebKitWebView::redo signal is a keybinding signal which gets emitted to * redo the last editing command. * * The default binding for this signal is Ctrl-Shift-z * * Since: 1.1.14 */ webkit_web_view_signals[REDO] = g_signal_new("redo", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, redo), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** * WebKitWebView::move-cursor: * @webView: the object which received the signal * @step: the type of movement, one of #GtkMovementStep * @count: an integer indicating the subtype of movement. Currently * the permitted values are '1' = forward, '-1' = backwards. * * The #WebKitWebView::move-cursor will be emitted to apply the * cursor movement described by its parameters to the @view. * * Return value: %TRUE or %FALSE * * Since: 1.1.4 */ webkit_web_view_signals[MOVE_CURSOR] = g_signal_new("move-cursor", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, move_cursor), NULL, NULL, webkit_marshal_BOOLEAN__ENUM_INT, G_TYPE_BOOLEAN, 2, GTK_TYPE_MOVEMENT_STEP, G_TYPE_INT); /** * WebKitWebView::create-plugin-widget: * @webView: the object which received the signal * @mime_type: the mimetype of the requested object * @uri: the URI to load * @param: a #GHashTable with additional attributes (strings) * * The #WebKitWebView::create-plugin-widget signal will be emitted to * create a plugin widget for embed or object HTML tags. This * allows to embed a GtkWidget as a plugin into HTML content. In * case of a textual selection of the GtkWidget WebCore will attempt * to set the property value of "webkit-widget-is-selected". This can * be used to draw a visual indicator of the selection. * * Return value: (transfer full): a new #GtkWidget, or %NULL * * Since: 1.1.8 */ webkit_web_view_signals[PLUGIN_WIDGET] = g_signal_new("create-plugin-widget", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, webkit_signal_accumulator_object_handled, NULL, webkit_marshal_OBJECT__STRING_STRING_POINTER, GTK_TYPE_WIDGET, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_HASH_TABLE); /** * WebKitWebView::database-quota-exceeded * @webView: the object which received the signal * @frame: the relevant frame * @database: the #WebKitWebDatabase which exceeded the quota of its #WebKitSecurityOrigin * * The #WebKitWebView::database-quota-exceeded signal will be emitted when * a Web Database exceeds the quota of its security origin. This signal * may be used to increase the size of the quota before the originating * operation fails. * * Since: 1.1.14 */ webkit_web_view_signals[DATABASE_QUOTA_EXCEEDED] = g_signal_new("database-quota-exceeded", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, NULL, NULL, webkit_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_OBJECT); /** * WebKitWebView::resource-request-starting: * @webView: the object which received the signal * @web_frame: the #WebKitWebFrame whose load dispatched this request * @web_resource: an empty #WebKitWebResource object * @request: the #WebKitNetworkRequest that will be dispatched * @response: the #WebKitNetworkResponse representing the redirect * response, if any * * Emitted when a request is about to be sent. You can modify the * request while handling this signal. You can set the URI in the * #WebKitNetworkRequest object itself, and add/remove/replace * headers using the #SoupMessage object it carries, if it is * present. See webkit_network_request_get_message(). Setting the * request URI to "about:blank" will effectively cause the request * to load nothing, and can be used to disable the loading of * specific resources. * * Notice that information about an eventual redirect is available * in @response's #SoupMessage, not in the #SoupMessage carried by * the @request. If @response is %NULL, then this is not a * redirected request. * * The #WebKitWebResource object will be the same throughout all * the lifetime of the resource, but the contents may change from * inbetween signal emissions. * * Since: 1.1.14 */ webkit_web_view_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, NULL, NULL, webkit_marshal_VOID__OBJECT_OBJECT_OBJECT_OBJECT, G_TYPE_NONE, 4, WEBKIT_TYPE_WEB_FRAME, WEBKIT_TYPE_WEB_RESOURCE, WEBKIT_TYPE_NETWORK_REQUEST, WEBKIT_TYPE_NETWORK_RESPONSE); /** * WebKitWebView::geolocation-policy-decision-requested: * @webView: the object on which the signal is emitted * @frame: the frame that requests permission * @policy_decision: a WebKitGeolocationPolicyDecision * * This signal is emitted when a @frame wants to obtain the user's * location. The decision can be made asynchronously, but you must * call g_object_ref() the @policy_decision, and return %TRUE if * you are going to handle the request. To actually make the * decision you need to call webkit_geolocation_policy_allow() or * webkit_geolocation_policy_deny() on @policy_decision. * * Since: 1.1.23 */ webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_REQUESTED] = g_signal_new("geolocation-policy-decision-requested", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST), 0, NULL, NULL, webkit_marshal_BOOLEAN__OBJECT_OBJECT, G_TYPE_BOOLEAN, 2, WEBKIT_TYPE_WEB_FRAME, WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION); /** * WebKitWebView::geolocation-policy-decision-cancelled: * @webView: the object on which the signal is emitted * @frame: the frame that cancels geolocation request. * * When a @frame wants to cancel geolocation permission it had requested * before. * * Since: 1.1.23 */ webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_CANCELLED] = g_signal_new("geolocation-policy-decision-cancelled", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST), 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /* * DOM-related signals. These signals are experimental, for now, * and may change API and ABI. Their comments lack one * on * purpose, to make them not be catched by gtk-doc. */ /* * WebKitWebView::document-load-finished * @webView: the object which received the signal * @web_frame: the #WebKitWebFrame whose load dispatched this request * * Emitted when the DOM document object load is finished for the * given frame. */ webkit_web_view_signals[DOCUMENT_LOAD_FINISHED] = g_signal_new("document-load-finished", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /* * WebKitWebView::frame-created * @webView: the object which received the signal * @web_frame: the #WebKitWebFrame which was just created. * * Emitted when a WebKitWebView has created a new frame. This signal will * be emitted for all sub-frames created during page load. It will not be * emitted for the main frame, which originates in the WebKitWebView constructor * and may be accessed at any time using webkit_web_view_get_main_frame. * * Since: 1.3.4 */ webkit_web_view_signals[FRAME_CREATED] = g_signal_new("frame-created", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, WEBKIT_TYPE_WEB_FRAME); /* * implementations of virtual methods */ webViewClass->create_web_view = webkit_web_view_real_create_web_view; webViewClass->web_view_ready = webkit_web_view_real_web_view_ready; webViewClass->close_web_view = webkit_web_view_real_close_web_view; webViewClass->navigation_requested = webkit_web_view_real_navigation_requested; webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared; webViewClass->choose_file = webkit_web_view_real_choose_file; webViewClass->script_alert = webkit_web_view_real_script_alert; webViewClass->script_confirm = webkit_web_view_real_script_confirm; webViewClass->script_prompt = webkit_web_view_real_script_prompt; webViewClass->console_message = webkit_web_view_real_console_message; webViewClass->select_all = webkit_web_view_real_select_all; webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard; webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard; webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard; webViewClass->undo = webkit_web_view_real_undo; webViewClass->redo = webkit_web_view_real_redo; webViewClass->move_cursor = webkit_web_view_real_move_cursor; GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass); objectClass->dispose = webkit_web_view_dispose; objectClass->finalize = webkit_web_view_finalize; objectClass->get_property = webkit_web_view_get_property; objectClass->set_property = webkit_web_view_set_property; GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewClass); widgetClass->realize = webkit_web_view_realize; #ifdef GTK_API_VERSION_2 widgetClass->expose_event = webkit_web_view_expose_event; #else widgetClass->draw = webkit_web_view_draw; #endif widgetClass->key_press_event = webkit_web_view_key_press_event; widgetClass->key_release_event = webkit_web_view_key_release_event; widgetClass->button_press_event = webkit_web_view_button_press_event; widgetClass->button_release_event = webkit_web_view_button_release_event; widgetClass->motion_notify_event = webkit_web_view_motion_event; widgetClass->scroll_event = webkit_web_view_scroll_event; widgetClass->size_allocate = webkit_web_view_size_allocate; widgetClass->size_request = webkit_web_view_size_request; widgetClass->popup_menu = webkit_web_view_popup_menu_handler; widgetClass->grab_focus = webkit_web_view_grab_focus; widgetClass->focus_in_event = webkit_web_view_focus_in_event; widgetClass->focus_out_event = webkit_web_view_focus_out_event; widgetClass->get_accessible = webkit_web_view_get_accessible; widgetClass->screen_changed = webkit_web_view_screen_changed; widgetClass->drag_end = webkit_web_view_drag_end; widgetClass->drag_data_get = webkit_web_view_drag_data_get; widgetClass->drag_motion = webkit_web_view_drag_motion; widgetClass->drag_leave = webkit_web_view_drag_leave; widgetClass->drag_drop = webkit_web_view_drag_drop; widgetClass->drag_data_received = webkit_web_view_drag_data_received; #if GTK_CHECK_VERSION(2, 12, 0) widgetClass->query_tooltip = webkit_web_view_query_tooltip; #endif GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass); containerClass->add = webkit_web_view_container_add; containerClass->remove = webkit_web_view_container_remove; containerClass->forall = webkit_web_view_container_forall; /* * make us scrollable (e.g. addable to a GtkScrolledWindow) */ webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments; GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), G_STRUCT_OFFSET(WebKitWebViewClass, set_scroll_adjustments), NULL, NULL, webkit_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); /* * Key bindings */ binding_set = gtk_binding_set_by_class(webViewClass); gtk_binding_entry_add_signal(binding_set, GDK_a, GDK_CONTROL_MASK, "select_all", 0); /* Cut/copy/paste */ gtk_binding_entry_add_signal(binding_set, GDK_x, GDK_CONTROL_MASK, "cut_clipboard", 0); gtk_binding_entry_add_signal(binding_set, GDK_c, GDK_CONTROL_MASK, "copy_clipboard", 0); gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK, "paste_clipboard", 0); gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK, "undo", 0); gtk_binding_entry_add_signal(binding_set, GDK_z, static_cast<GdkModifierType>(GDK_CONTROL_MASK | GDK_SHIFT_MASK), "redo", 0); gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK, "cut_clipboard", 0); gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_CONTROL_MASK, "copy_clipboard", 0); gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK, "paste_clipboard", 0); /* Movement */ gtk_binding_entry_add_signal(binding_set, GDK_Down, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES, G_TYPE_INT, 1); gtk_binding_entry_add_signal(binding_set, GDK_Up, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES, G_TYPE_INT, -1); gtk_binding_entry_add_signal(binding_set, GDK_Right, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS, G_TYPE_INT, 1); gtk_binding_entry_add_signal(binding_set, GDK_Left, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS, G_TYPE_INT, -1); gtk_binding_entry_add_signal(binding_set, GDK_space, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_PAGES, G_TYPE_INT, 1); gtk_binding_entry_add_signal(binding_set, GDK_space, GDK_SHIFT_MASK, "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_PAGES, G_TYPE_INT, -1); gtk_binding_entry_add_signal(binding_set, GDK_Page_Down, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_PAGES, G_TYPE_INT, 1); gtk_binding_entry_add_signal(binding_set, GDK_Page_Up, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_PAGES, G_TYPE_INT, -1); gtk_binding_entry_add_signal(binding_set, GDK_End, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS, G_TYPE_INT, 1); gtk_binding_entry_add_signal(binding_set, GDK_Home, static_cast<GdkModifierType>(0), "move-cursor", 2, G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS, G_TYPE_INT, -1); /* * properties */ /** * WebKitWebView:title: * * Returns the @web_view's document title. * * Since: 1.1.4 */ g_object_class_install_property(objectClass, PROP_TITLE, g_param_spec_string("title", _("Title"), _("Returns the @web_view's document title"), NULL, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:uri: * * Returns the current URI of the contents displayed by the @web_view. * * Since: 1.1.4 */ g_object_class_install_property(objectClass, PROP_URI, g_param_spec_string("uri", _("URI"), _("Returns the current URI of the contents displayed by the @web_view"), NULL, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:copy-target-list: * * The list of targets this web view supports for clipboard copying. * * Since: 1.0.2 */ g_object_class_install_property(objectClass, PROP_COPY_TARGET_LIST, g_param_spec_boxed("copy-target-list", _("Copy target list"), _("The list of targets this web view supports for clipboard copying"), GTK_TYPE_TARGET_LIST, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:paste-target-list: * * The list of targets this web view supports for clipboard pasting. * * Since: 1.0.2 */ g_object_class_install_property(objectClass, PROP_PASTE_TARGET_LIST, g_param_spec_boxed("paste-target-list", _("Paste target list"), _("The list of targets this web view supports for clipboard pasting"), GTK_TYPE_TARGET_LIST, WEBKIT_PARAM_READABLE)); g_object_class_install_property(objectClass, PROP_SETTINGS, g_param_spec_object("settings", _("Settings"), _("An associated WebKitWebSettings instance"), WEBKIT_TYPE_WEB_SETTINGS, WEBKIT_PARAM_READWRITE)); /** * WebKitWebView:web-inspector: * * The associated WebKitWebInspector instance. * * Since: 1.0.3 */ g_object_class_install_property(objectClass, PROP_WEB_INSPECTOR, g_param_spec_object("web-inspector", _("Web Inspector"), _("The associated WebKitWebInspector instance"), WEBKIT_TYPE_WEB_INSPECTOR, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:window-features: * * An associated WebKitWebWindowFeatures instance. * * Since: 1.0.3 */ g_object_class_install_property(objectClass, PROP_WINDOW_FEATURES, g_param_spec_object("window-features", "Window Features", "An associated WebKitWebWindowFeatures instance", WEBKIT_TYPE_WEB_WINDOW_FEATURES, WEBKIT_PARAM_READWRITE)); g_object_class_install_property(objectClass, PROP_EDITABLE, g_param_spec_boolean("editable", _("Editable"), _("Whether content can be modified by the user"), FALSE, WEBKIT_PARAM_READWRITE)); g_object_class_install_property(objectClass, PROP_TRANSPARENT, g_param_spec_boolean("transparent", _("Transparent"), _("Whether content has a transparent background"), FALSE, WEBKIT_PARAM_READWRITE)); /** * WebKitWebView:zoom-level: * * The level of zoom of the content. * * Since: 1.0.1 */ g_object_class_install_property(objectClass, PROP_ZOOM_LEVEL, g_param_spec_float("zoom-level", _("Zoom level"), _("The level of zoom of the content"), G_MINFLOAT, G_MAXFLOAT, 1.0f, WEBKIT_PARAM_READWRITE)); /** * WebKitWebView:full-content-zoom: * * Whether the full content is scaled when zooming. * * Since: 1.0.1 */ g_object_class_install_property(objectClass, PROP_FULL_CONTENT_ZOOM, g_param_spec_boolean("full-content-zoom", _("Full content zoom"), _("Whether the full content is scaled when zooming"), FALSE, WEBKIT_PARAM_READWRITE)); /** * WebKitWebView:encoding: * * The default encoding of the web view. * * Since: 1.1.2 */ g_object_class_install_property(objectClass, PROP_ENCODING, g_param_spec_string("encoding", _("Encoding"), _("The default encoding of the web view"), NULL, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:custom-encoding: * * The custom encoding of the web view. * * Since: 1.1.2 */ g_object_class_install_property(objectClass, PROP_CUSTOM_ENCODING, g_param_spec_string("custom-encoding", _("Custom Encoding"), _("The custom encoding of the web view"), NULL, WEBKIT_PARAM_READWRITE)); /** * WebKitWebView:load-status: * * Determines the current status of the load. * * Connect to "notify::load-status" to monitor loading. * * Some versions of WebKitGTK+ emitted this signal for the default * error page, while loading it. This behavior was considered bad, * because it was essentially exposing an implementation * detail. From 1.1.19 onwards this signal is no longer emitted for * the default error pages, but keep in mind that if you override * the error pages by using webkit_web_frame_load_alternate_string() * the signals will be emitted. * * Since: 1.1.7 */ g_object_class_install_property(objectClass, PROP_LOAD_STATUS, g_param_spec_enum("load-status", "Load Status", "Determines the current status of the load", WEBKIT_TYPE_LOAD_STATUS, WEBKIT_LOAD_FINISHED, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:progress: * * Determines the current progress of the load. * * Since: 1.1.7 */ g_object_class_install_property(objectClass, PROP_PROGRESS, g_param_spec_double("progress", "Progress", "Determines the current progress of the load", 0.0, 1.0, 1.0, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:icon-uri: * * The URI for the favicon for the #WebKitWebView. * * Since: 1.1.18 */ g_object_class_install_property(objectClass, PROP_ICON_URI, g_param_spec_string("icon-uri", _("Icon URI"), _("The URI for the favicon for the #WebKitWebView."), NULL, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:im-context: * * The GtkIMMulticontext for the #WebKitWebView. * * This is the input method context used for all text entry widgets inside * the #WebKitWebView. It can be used to generate context menu items for * controlling the active input method. * * Since: 1.1.20 */ g_object_class_install_property(objectClass, PROP_IM_CONTEXT, g_param_spec_object("im-context", "IM Context", "The GtkIMMultiContext for the #WebKitWebView.", GTK_TYPE_IM_CONTEXT, WEBKIT_PARAM_READABLE)); /** * WebKitWebView:view-mode: * * The "view-mode" media feature for the #WebKitWebView. * * The "view-mode" media feature is additional information for web * applications about how the application is running, when it comes * to user experience. Whether the application is running inside a * regular browser window, in a dedicated window, fullscreen, for * instance. * * This property stores a %WebKitWebViewViewMode value that matches * the "view-mode" media feature the web application will see. * * See http://www.w3.org/TR/view-mode/ for more information. * * Since: 1.3.4 */ g_object_class_install_property(objectClass, PROP_VIEW_MODE, g_param_spec_enum("view-mode", "View Mode", "The view-mode media feature for the #WebKitWebView.", WEBKIT_TYPE_WEB_VIEW_VIEW_MODE, WEBKIT_WEB_VIEW_VIEW_MODE_WINDOWED, WEBKIT_PARAM_READWRITE)); g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate)); } static void webkit_web_view_update_settings(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; WebKitWebSettings* webSettings = priv->webSettings.get(); Settings* settings = core(webView)->settings(); gchar* defaultEncoding, *cursiveFontFamily, *defaultFontFamily, *fantasyFontFamily, *monospaceFontFamily, *sansSerifFontFamily, *serifFontFamily, *userStylesheetUri; gboolean autoLoadImages, autoShrinkImages, printBackgrounds, enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas, enablePrivateBrowsing, enableCaretBrowsing, enableHTML5Database, enableHTML5LocalStorage, enableXSSAuditor, enableSpatialNavigation, enableFrameFlattening, javascriptCanOpenWindows, javaScriptCanAccessClipboard, enableOfflineWebAppCache, enableUniversalAccessFromFileURI, enableFileAccessFromFileURI, enableDOMPaste, tabKeyCyclesThroughElements, enableSiteSpecificQuirks, usePageCache, enableJavaApplet, enableHyperlinkAuditing; WebKitEditingBehavior editingBehavior; g_object_get(webSettings, "default-encoding", &defaultEncoding, "cursive-font-family", &cursiveFontFamily, "default-font-family", &defaultFontFamily, "fantasy-font-family", &fantasyFontFamily, "monospace-font-family", &monospaceFontFamily, "sans-serif-font-family", &sansSerifFontFamily, "serif-font-family", &serifFontFamily, "auto-load-images", &autoLoadImages, "auto-shrink-images", &autoShrinkImages, "print-backgrounds", &printBackgrounds, "enable-scripts", &enableScripts, "enable-plugins", &enablePlugins, "resizable-text-areas", &resizableTextAreas, "user-stylesheet-uri", &userStylesheetUri, "enable-developer-extras", &enableDeveloperExtras, "enable-private-browsing", &enablePrivateBrowsing, "enable-caret-browsing", &enableCaretBrowsing, "enable-html5-database", &enableHTML5Database, "enable-html5-local-storage", &enableHTML5LocalStorage, "enable-xss-auditor", &enableXSSAuditor, "enable-spatial-navigation", &enableSpatialNavigation, "enable-frame-flattening", &enableFrameFlattening, "javascript-can-open-windows-automatically", &javascriptCanOpenWindows, "javascript-can-access-clipboard", &javaScriptCanAccessClipboard, "enable-offline-web-application-cache", &enableOfflineWebAppCache, "editing-behavior", &editingBehavior, "enable-universal-access-from-file-uris", &enableUniversalAccessFromFileURI, "enable-file-access-from-file-uris", &enableFileAccessFromFileURI, "enable-dom-paste", &enableDOMPaste, "tab-key-cycles-through-elements", &tabKeyCyclesThroughElements, "enable-site-specific-quirks", &enableSiteSpecificQuirks, "enable-page-cache", &usePageCache, "enable-java-applet", &enableJavaApplet, "enable-hyperlink-auditing", &enableHyperlinkAuditing, NULL); settings->setDefaultTextEncodingName(defaultEncoding); settings->setCursiveFontFamily(cursiveFontFamily); settings->setStandardFontFamily(defaultFontFamily); settings->setFantasyFontFamily(fantasyFontFamily); settings->setFixedFontFamily(monospaceFontFamily); settings->setSansSerifFontFamily(sansSerifFontFamily); settings->setSerifFontFamily(serifFontFamily); settings->setLoadsImagesAutomatically(autoLoadImages); settings->setShrinksStandaloneImagesToFit(autoShrinkImages); settings->setShouldPrintBackgrounds(printBackgrounds); settings->setJavaScriptEnabled(enableScripts); settings->setPluginsEnabled(enablePlugins); settings->setTextAreasAreResizable(resizableTextAreas); settings->setUserStyleSheetLocation(KURL(KURL(), userStylesheetUri)); settings->setDeveloperExtrasEnabled(enableDeveloperExtras); settings->setPrivateBrowsingEnabled(enablePrivateBrowsing); settings->setCaretBrowsingEnabled(enableCaretBrowsing); #if ENABLE(DATABASE) AbstractDatabase::setIsAvailable(enableHTML5Database); #endif settings->setLocalStorageEnabled(enableHTML5LocalStorage); settings->setXSSAuditorEnabled(enableXSSAuditor); settings->setSpatialNavigationEnabled(enableSpatialNavigation); settings->setFrameFlatteningEnabled(enableFrameFlattening); settings->setJavaScriptCanOpenWindowsAutomatically(javascriptCanOpenWindows); settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard); settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache); settings->setEditingBehaviorType(core(editingBehavior)); settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI); settings->setAllowFileAccessFromFileURLs(enableFileAccessFromFileURI); settings->setDOMPasteAllowed(enableDOMPaste); settings->setNeedsSiteSpecificQuirks(enableSiteSpecificQuirks); settings->setUsesPageCache(usePageCache); settings->setJavaEnabled(enableJavaApplet); settings->setHyperlinkAuditingEnabled(enableHyperlinkAuditing); Page* page = core(webView); if (page) page->setTabKeyCyclesThroughElements(tabKeyCyclesThroughElements); g_free(defaultEncoding); g_free(cursiveFontFamily); g_free(defaultFontFamily); g_free(fantasyFontFamily); g_free(monospaceFontFamily); g_free(sansSerifFontFamily); g_free(serifFontFamily); g_free(userStylesheetUri); webkit_web_view_screen_changed(GTK_WIDGET(webView), NULL); } static inline gint pixelsFromSize(WebKitWebView* webView, gint size) { gdouble DPI = webViewGetDPI(webView); return size / 72.0 * DPI; } static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView) { Settings* settings = core(webView)->settings(); const gchar* name = g_intern_string(pspec->name); GValue value = { 0, { { 0 } } }; g_value_init(&value, pspec->value_type); g_object_get_property(G_OBJECT(webSettings), name, &value); if (name == g_intern_string("default-encoding")) settings->setDefaultTextEncodingName(g_value_get_string(&value)); else if (name == g_intern_string("cursive-font-family")) settings->setCursiveFontFamily(g_value_get_string(&value)); else if (name == g_intern_string("default-font-family")) settings->setStandardFontFamily(g_value_get_string(&value)); else if (name == g_intern_string("fantasy-font-family")) settings->setFantasyFontFamily(g_value_get_string(&value)); else if (name == g_intern_string("monospace-font-family")) settings->setFixedFontFamily(g_value_get_string(&value)); else if (name == g_intern_string("sans-serif-font-family")) settings->setSansSerifFontFamily(g_value_get_string(&value)); else if (name == g_intern_string("serif-font-family")) settings->setSerifFontFamily(g_value_get_string(&value)); else if (name == g_intern_string("default-font-size")) settings->setDefaultFontSize(pixelsFromSize(webView, g_value_get_int(&value))); else if (name == g_intern_string("default-monospace-font-size")) settings->setDefaultFixedFontSize(pixelsFromSize(webView, g_value_get_int(&value))); else if (name == g_intern_string("minimum-font-size")) settings->setMinimumFontSize(pixelsFromSize(webView, g_value_get_int(&value))); else if (name == g_intern_string("minimum-logical-font-size")) settings->setMinimumLogicalFontSize(pixelsFromSize(webView, g_value_get_int(&value))); else if (name == g_intern_string("enforce-96-dpi")) webkit_web_view_screen_changed(GTK_WIDGET(webView), NULL); else if (name == g_intern_string("auto-load-images")) settings->setLoadsImagesAutomatically(g_value_get_boolean(&value)); else if (name == g_intern_string("auto-shrink-images")) settings->setShrinksStandaloneImagesToFit(g_value_get_boolean(&value)); else if (name == g_intern_string("print-backgrounds")) settings->setShouldPrintBackgrounds(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-scripts")) settings->setJavaScriptEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-plugins")) settings->setPluginsEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("resizable-text-areas")) settings->setTextAreasAreResizable(g_value_get_boolean(&value)); else if (name == g_intern_string("user-stylesheet-uri")) settings->setUserStyleSheetLocation(KURL(KURL(), g_value_get_string(&value))); else if (name == g_intern_string("enable-developer-extras")) settings->setDeveloperExtrasEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-private-browsing")) settings->setPrivateBrowsingEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-caret-browsing")) settings->setCaretBrowsingEnabled(g_value_get_boolean(&value)); #if ENABLE(DATABASE) else if (name == g_intern_string("enable-html5-database")) { AbstractDatabase::setIsAvailable(g_value_get_boolean(&value)); } #endif else if (name == g_intern_string("enable-html5-local-storage")) settings->setLocalStorageEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-xss-auditor")) settings->setXSSAuditorEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-spatial-navigation")) settings->setSpatialNavigationEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-frame-flattening")) settings->setFrameFlatteningEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("javascript-can-open-windows-automatically")) settings->setJavaScriptCanOpenWindowsAutomatically(g_value_get_boolean(&value)); else if (name == g_intern_string("javascript-can-access-clipboard")) settings->setJavaScriptCanAccessClipboard(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-offline-web-application-cache")) settings->setOfflineWebApplicationCacheEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("editing-behavior")) settings->setEditingBehaviorType(core(static_cast<WebKitEditingBehavior>(g_value_get_enum(&value)))); else if (name == g_intern_string("enable-universal-access-from-file-uris")) settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-file-access-from-file-uris")) settings->setAllowFileAccessFromFileURLs(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-dom-paste")) settings->setDOMPasteAllowed(g_value_get_boolean(&value)); else if (name == g_intern_string("tab-key-cycles-through-elements")) { Page* page = core(webView); if (page) page->setTabKeyCyclesThroughElements(g_value_get_boolean(&value)); } else if (name == g_intern_string("enable-site-specific-quirks")) settings->setNeedsSiteSpecificQuirks(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-page-cache")) settings->setUsesPageCache(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-java-applet")) settings->setJavaEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-hyperlink-auditing")) settings->setHyperlinkAuditingEnabled(g_value_get_boolean(&value)); else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name)) g_warning("Unexpected setting '%s'", name); g_value_unset(&value); } static void webkit_web_view_init(WebKitWebView* webView) { WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); webView->priv = priv; // This is the placement new syntax: http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10 // It allows us to call a constructor on manually allocated locations in memory. We must use it // in this case, because GLib manages the memory for the private data section, but we wish it // to contain C++ object members. The use of placement new calls the constructor on all C++ data // members, which ensures they are initialized properly. new (priv) WebKitWebViewPrivate(); priv->imContext = adoptPlatformRef(gtk_im_multicontext_new()); Page::PageClients pageClients; pageClients.chromeClient = new WebKit::ChromeClient(webView); pageClients.contextMenuClient = new WebKit::ContextMenuClient(webView); pageClients.editorClient = new WebKit::EditorClient(webView); pageClients.dragClient = new WebKit::DragClient(webView); pageClients.inspectorClient = new WebKit::InspectorClient(webView); priv->corePage = new Page(pageClients); // We also add a simple wrapper class to provide the public // interface for the Web Inspector. priv->webInspector = adoptPlatformRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL))); webkit_web_inspector_set_inspector_client(priv->webInspector.get(), priv->corePage); // The smart pointer will call g_object_ref_sink on these adjustments. priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); gtk_widget_set_can_focus(GTK_WIDGET(webView), TRUE); priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView)); priv->lastPopupXPosition = priv->lastPopupYPosition = -1; priv->editable = false; priv->backForwardList = adoptPlatformRef(webkit_web_back_forward_list_new_with_web_view(webView)); priv->zoomFullContent = FALSE; priv->webSettings = adoptPlatformRef(webkit_web_settings_new()); webkit_web_view_update_settings(webView); g_signal_connect(priv->webSettings.get(), "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); priv->webWindowFeatures = adoptPlatformRef(webkit_web_window_features_new()); priv->subResources = adoptPlatformRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref)); priv->currentClickCount = 0; priv->previousClickButton = 0; priv->previousClickTime = 0; gtk_drag_dest_set(GTK_WIDGET(webView), static_cast<GtkDestDefaults>(0), 0, 0, static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE)); gtk_drag_dest_set_target_list(GTK_WIDGET(webView), pasteboardHelperInstance()->targetList()); } GtkWidget* webkit_web_view_new(void) { WebKitWebView* webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, NULL)); return GTK_WIDGET(webView); } // for internal use only void webkit_web_view_notify_ready(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); gboolean isHandled = FALSE; g_signal_emit(webView, webkit_web_view_signals[WEB_VIEW_READY], 0, &isHandled); } void webkit_web_view_request_download(WebKitWebView* webView, WebKitNetworkRequest* request, const ResourceResponse& response, ResourceHandle* handle) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitDownload* download; if (handle) download = webkit_download_new_with_handle(request, handle, response); else download = webkit_download_new(request); gboolean handled; g_signal_emit(webView, webkit_web_view_signals[DOWNLOAD_REQUESTED], 0, download, &handled); if (!handled) { webkit_download_cancel(download); g_object_unref(download); return; } /* Start the download now if it has a destination URI, otherwise it may be handled asynchronously by the application. */ if (webkit_download_get_destination_uri(download)) webkit_download_start(download); } bool webkit_web_view_use_primary_for_paste(WebKitWebView* webView) { return webView->priv->usePrimaryForPaste; } /** * webkit_web_view_set_settings: * @webView: a #WebKitWebView * @settings: (transfer none): the #WebKitWebSettings to be set * * Replaces the #WebKitWebSettings instance that is currently attached * to @web_view with @settings. The reference held by the @web_view on * the old #WebKitWebSettings instance is dropped, and the reference * count of @settings is inscreased. * * The settings are automatically applied to @web_view. */ void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* webSettings) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(WEBKIT_IS_WEB_SETTINGS(webSettings)); WebKitWebViewPrivate* priv = webView->priv; g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); priv->webSettings = webSettings; webkit_web_view_update_settings(webView); g_signal_connect(webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); g_object_notify(G_OBJECT(webView), "settings"); } /** * webkit_web_view_get_settings: * @webView: a #WebKitWebView * * Obtains the #WebKitWebSettings associated with the * #WebKitWebView. The #WebKitWebView always has an associated * instance of #WebKitWebSettings. The reference that is returned by * this call is owned by the #WebKitWebView. You may need to increase * its reference count if you intend to keep it alive for longer than * the #WebKitWebView. * * Return value: (transfer none): the #WebKitWebSettings instance */ WebKitWebSettings* webkit_web_view_get_settings(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); return webView->priv->webSettings.get(); } /** * webkit_web_view_get_inspector: * @webView: a #WebKitWebView * * Obtains the #WebKitWebInspector associated with the * #WebKitWebView. Every #WebKitWebView object has a * #WebKitWebInspector object attached to it as soon as it is created, * so this function will only return NULL if the argument is not a * valid #WebKitWebView. * * Return value: (transfer none): the #WebKitWebInspector instance. * * Since: 1.0.3 */ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); return webView->priv->webInspector.get(); } // internal static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures) { if (!webWindowFeatures) return; if (webkit_web_window_features_equal(webView->priv->webWindowFeatures.get(), webWindowFeatures)) return; webView->priv->webWindowFeatures = webWindowFeatures; } /** * webkit_web_view_get_window_features: * @webView: a #WebKitWebView * * Returns the instance of #WebKitWebWindowFeatures held by the given * #WebKitWebView. * * Return value: (transfer none): the #WebKitWebWindowFeatures * * Since: 1.0.3 */ WebKitWebWindowFeatures* webkit_web_view_get_window_features(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); return webView->priv->webWindowFeatures.get(); } /** * webkit_web_view_get_title: * @webView: a #WebKitWebView * * Returns the @web_view's document title * * Since: 1.1.4 * * Return value: the title of @web_view */ G_CONST_RETURN gchar* webkit_web_view_get_title(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); WebKitWebViewPrivate* priv = webView->priv; return priv->mainFrame->priv->title; } /** * webkit_web_view_get_uri: * @webView: a #WebKitWebView * * Returns the current URI of the contents displayed by the @web_view * * Since: 1.1.4 * * Return value: the URI of @web_view */ G_CONST_RETURN gchar* webkit_web_view_get_uri(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); WebKitWebViewPrivate* priv = webView->priv; return priv->mainFrame->priv->uri; } /** * webkit_web_view_set_maintains_back_forward_list: * @webView: a #WebKitWebView * @flag: to tell the view to maintain a back or forward list * * Set the view to maintain a back or forward list of history items. */ void webkit_web_view_set_maintains_back_forward_list(WebKitWebView* webView, gboolean flag) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->backForwardList()->setEnabled(flag); } /** * webkit_web_view_get_back_forward_list: * @webView: a #WebKitWebView * * Obtains the #WebKitWebBackForwardList associated with the given #WebKitWebView. The * #WebKitWebBackForwardList is owned by the #WebKitWebView. * * Return value: (transfer none): the #WebKitWebBackForwardList */ WebKitWebBackForwardList* webkit_web_view_get_back_forward_list(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); if (!core(webView) || !core(webView)->backForwardList()->enabled()) return 0; return webView->priv->backForwardList.get(); } /** * webkit_web_view_go_to_back_forward_item: * @webView: a #WebKitWebView * @item: a #WebKitWebHistoryItem* * * Go to the specified #WebKitWebHistoryItem * * Return value: %TRUE if loading of item is successful, %FALSE if not */ gboolean webkit_web_view_go_to_back_forward_item(WebKitWebView* webView, WebKitWebHistoryItem* item) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); g_return_val_if_fail(WEBKIT_IS_WEB_HISTORY_ITEM(item), FALSE); WebKitWebBackForwardList* backForwardList = webkit_web_view_get_back_forward_list(webView); if (!webkit_web_back_forward_list_contains_item(backForwardList, item)) return FALSE; core(webView)->goToItem(core(item), FrameLoadTypeIndexedBackForward); return TRUE; } /** * webkit_web_view_go_back: * @webView: a #WebKitWebView * * Loads the previous history item. */ void webkit_web_view_go_back(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->goBack(); } /** * webkit_web_view_go_back_or_forward: * @webView: a #WebKitWebView * @steps: the number of steps * * Loads the history item that is the number of @steps away from the current * item. Negative values represent steps backward while positive values * represent steps forward. */ void webkit_web_view_go_back_or_forward(WebKitWebView* webView, gint steps) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->goBackOrForward(steps); } /** * webkit_web_view_go_forward: * @webView: a #WebKitWebView * * Loads the next history item. */ void webkit_web_view_go_forward(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->goForward(); } /** * webkit_web_view_can_go_back: * @webView: a #WebKitWebView * * Determines whether #web_view has a previous history item. * * Return value: %TRUE if able to move back, %FALSE otherwise */ gboolean webkit_web_view_can_go_back(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); if (!core(webView) || !core(webView)->backForwardList()->backItem()) return FALSE; return TRUE; } /** * webkit_web_view_can_go_back_or_forward: * @webView: a #WebKitWebView * @steps: the number of steps * * Determines whether #web_view has a history item of @steps. Negative values * represent steps backward while positive values represent steps forward. * * Return value: %TRUE if able to move back or forward the given number of * steps, %FALSE otherwise */ gboolean webkit_web_view_can_go_back_or_forward(WebKitWebView* webView, gint steps) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); return core(webView)->canGoBackOrForward(steps); } /** * webkit_web_view_can_go_forward: * @webView: a #WebKitWebView * * Determines whether #web_view has a next history item. * * Return value: %TRUE if able to move forward, %FALSE otherwise */ gboolean webkit_web_view_can_go_forward(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Page* page = core(webView); if (!page) return FALSE; if (!page->backForwardList()->forwardItem()) return FALSE; return TRUE; } /** * webkit_web_view_open: * @webView: a #WebKitWebView * @uri: an URI * * Requests loading of the specified URI string. * * Deprecated: 1.1.1: Use webkit_web_view_load_uri() instead. */ void webkit_web_view_open(WebKitWebView* webView, const gchar* uri) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(uri); // We used to support local paths, unlike the newer // function webkit_web_view_load_uri if (g_path_is_absolute(uri)) { gchar* fileUri = g_filename_to_uri(uri, NULL, NULL); webkit_web_view_load_uri(webView, fileUri); g_free(fileUri); } else webkit_web_view_load_uri(webView, uri); } void webkit_web_view_reload(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->mainFrame()->loader()->reload(); } /** * webkit_web_view_reload_bypass_cache: * @webView: a #WebKitWebView * * Reloads the @web_view without using any cached data. * * Since: 1.0.3 */ void webkit_web_view_reload_bypass_cache(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->mainFrame()->loader()->reload(true); } /** * webkit_web_view_load_uri: * @webView: a #WebKitWebView * @uri: an URI string * * Requests loading of the specified URI string. * * Since: 1.1.1 */ void webkit_web_view_load_uri(WebKitWebView* webView, const gchar* uri) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(uri); WebKitWebFrame* frame = webView->priv->mainFrame; webkit_web_frame_load_uri(frame, uri); } /** * webkit_web_view_load_string: * @webView: a #WebKitWebView * @content: an URI string * @mime_type: the MIME type, or %NULL * @encoding: the encoding, or %NULL * @base_uri: the base URI for relative locations * * Requests loading of the given @content with the specified @mime_type, * @encoding and @base_uri. * * If @mime_type is %NULL, "text/html" is assumed. * * If @encoding is %NULL, "UTF-8" is assumed. */ void webkit_web_view_load_string(WebKitWebView* webView, const gchar* content, const gchar* mimeType, const gchar* encoding, const gchar* baseUri) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(content); WebKitWebFrame* frame = webView->priv->mainFrame; webkit_web_frame_load_string(frame, content, mimeType, encoding, baseUri); } /** * webkit_web_view_load_html_string: * @webView: a #WebKitWebView * @content: an URI string * @base_uri: the base URI for relative locations * * Requests loading of the given @content with the specified @base_uri. * * Deprecated: 1.1.1: Use webkit_web_view_load_string() instead. */ void webkit_web_view_load_html_string(WebKitWebView* webView, const gchar* content, const gchar* baseUri) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(content); webkit_web_view_load_string(webView, content, NULL, NULL, baseUri); } /** * webkit_web_view_load_request: * @webView: a #WebKitWebView * @request: a #WebKitNetworkRequest * * Requests loading of the specified asynchronous client request. * * Creates a provisional data source that will transition to a committed data * source once any data has been received. Use webkit_web_view_stop_loading() to * stop the load. * * Since: 1.1.1 */ void webkit_web_view_load_request(WebKitWebView* webView, WebKitNetworkRequest* request) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(WEBKIT_IS_NETWORK_REQUEST(request)); WebKitWebFrame* frame = webView->priv->mainFrame; webkit_web_frame_load_request(frame, request); } /** * webkit_web_view_stop_loading: * @webView: a #WebKitWebView * * Stops any ongoing load in the @webView. **/ void webkit_web_view_stop_loading(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); Frame* frame = core(webView)->mainFrame(); if (FrameLoader* loader = frame->loader()) loader->stopForUserCancel(); } /** * webkit_web_view_search_text: * @webView: a #WebKitWebView * @text: a string to look for * @forward: whether to find forward or not * @case_sensitive: whether to respect the case of text * @wrap: whether to continue looking at the beginning after reaching the end * * Looks for a specified string inside #web_view. * * Return value: %TRUE on success or %FALSE on failure */ gboolean webkit_web_view_search_text(WebKitWebView* webView, const gchar* string, gboolean caseSensitive, gboolean forward, gboolean shouldWrap) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); g_return_val_if_fail(string, FALSE); TextCaseSensitivity caseSensitivity = caseSensitive ? TextCaseSensitive : TextCaseInsensitive; FindDirection direction = forward ? FindDirectionForward : FindDirectionBackward; return core(webView)->findString(String::fromUTF8(string), caseSensitivity, direction, shouldWrap); } /** * webkit_web_view_mark_text_matches: * @webView: a #WebKitWebView * @string: a string to look for * @case_sensitive: whether to respect the case of text * @limit: the maximum number of strings to look for or 0 for all * * Attempts to highlight all occurances of #string inside #web_view. * * Return value: the number of strings highlighted */ guint webkit_web_view_mark_text_matches(WebKitWebView* webView, const gchar* string, gboolean caseSensitive, guint limit) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); g_return_val_if_fail(string, 0); TextCaseSensitivity caseSensitivity = caseSensitive ? TextCaseSensitive : TextCaseInsensitive; return core(webView)->markAllMatchesForText(String::fromUTF8(string), caseSensitivity, false, limit); } /** * webkit_web_view_set_highlight_text_matches: * @webView: a #WebKitWebView * @highlight: whether to highlight text matches * * Highlights text matches previously marked by webkit_web_view_mark_text_matches. */ void webkit_web_view_set_highlight_text_matches(WebKitWebView* webView, gboolean shouldHighlight) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); Frame *frame = core(webView)->mainFrame(); do { frame->editor()->setMarkedTextMatchesAreHighlighted(shouldHighlight); frame = frame->tree()->traverseNextWithWrap(false); } while (frame); } /** * webkit_web_view_unmark_text_matches: * @webView: a #WebKitWebView * * Removes highlighting previously set by webkit_web_view_mark_text_matches. */ void webkit_web_view_unmark_text_matches(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); return core(webView)->unmarkAllTextMatches(); } /** * webkit_web_view_get_main_frame: * @webView: a #WebKitWebView * * Returns the main frame for the @webView. * * Return value: (transfer none): the main #WebKitWebFrame for @webView */ WebKitWebFrame* webkit_web_view_get_main_frame(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); return webView->priv->mainFrame; } /** * webkit_web_view_get_focused_frame: * @webView: a #WebKitWebView * * Returns the frame that has focus or an active text selection. * * Return value: (transfer none): The focused #WebKitWebFrame or %NULL if no frame is focused */ WebKitWebFrame* webkit_web_view_get_focused_frame(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); Frame* focusedFrame = core(webView)->focusController()->focusedFrame(); return kit(focusedFrame); } void webkit_web_view_execute_script(WebKitWebView* webView, const gchar* script) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(script); core(webView)->mainFrame()->script()->executeScript(String::fromUTF8(script), true); } /** * webkit_web_view_cut_clipboard: * @webView: a #WebKitWebView * * Determines whether or not it is currently possible to cut to the clipboard. * * Return value: %TRUE if a selection can be cut, %FALSE if not */ gboolean webkit_web_view_can_cut_clipboard(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); return frame->editor()->canCut() || frame->editor()->canDHTMLCut(); } /** * webkit_web_view_copy_clipboard: * @webView: a #WebKitWebView * * Determines whether or not it is currently possible to copy to the clipboard. * * Return value: %TRUE if a selection can be copied, %FALSE if not */ gboolean webkit_web_view_can_copy_clipboard(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); return frame->editor()->canCopy() || frame->editor()->canDHTMLCopy(); } /** * webkit_web_view_paste_clipboard: * @webView: a #WebKitWebView * * Determines whether or not it is currently possible to paste from the clipboard. * * Return value: %TRUE if a selection can be pasted, %FALSE if not */ gboolean webkit_web_view_can_paste_clipboard(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); return frame->editor()->canPaste() || frame->editor()->canDHTMLPaste(); } /** * webkit_web_view_cut_clipboard: * @webView: a #WebKitWebView * * Cuts the current selection inside the @web_view to the clipboard. */ void webkit_web_view_cut_clipboard(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (webkit_web_view_can_cut_clipboard(webView)) g_signal_emit(webView, webkit_web_view_signals[CUT_CLIPBOARD], 0); } /** * webkit_web_view_copy_clipboard: * @webView: a #WebKitWebView * * Copies the current selection inside the @web_view to the clipboard. */ void webkit_web_view_copy_clipboard(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (webkit_web_view_can_copy_clipboard(webView)) g_signal_emit(webView, webkit_web_view_signals[COPY_CLIPBOARD], 0); } /** * webkit_web_view_paste_clipboard: * @webView: a #WebKitWebView * * Pastes the current contents of the clipboard to the @web_view. */ void webkit_web_view_paste_clipboard(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (webkit_web_view_can_paste_clipboard(webView)) g_signal_emit(webView, webkit_web_view_signals[PASTE_CLIPBOARD], 0); } /** * webkit_web_view_delete_selection: * @webView: a #WebKitWebView * * Deletes the current selection inside the @web_view. */ void webkit_web_view_delete_selection(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); frame->editor()->performDelete(); } /** * webkit_web_view_has_selection: * @webView: a #WebKitWebView * * Determines whether text was selected. * * Return value: %TRUE if there is selected text, %FALSE if not */ gboolean webkit_web_view_has_selection(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); return !core(webView)->selection().isNone(); } /** * webkit_web_view_get_selected_text: * @webView: a #WebKitWebView * * Retrieves the selected text if any. * * Return value: a newly allocated string with the selection or %NULL */ gchar* webkit_web_view_get_selected_text(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); return g_strdup(frame->editor()->selectedText().utf8().data()); } /** * webkit_web_view_select_all: * @webView: a #WebKitWebView * * Attempts to select everything inside the @web_view. */ void webkit_web_view_select_all(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_signal_emit(webView, webkit_web_view_signals[SELECT_ALL], 0); } /** * webkit_web_view_get_editable: * @webView: a #WebKitWebView * * Returns whether the user is allowed to edit the document. * * Returns %TRUE if @web_view allows the user to edit the HTML document, %FALSE if * it doesn't. You can change @web_view's document programmatically regardless of * this setting. * * Return value: a #gboolean indicating the editable state */ gboolean webkit_web_view_get_editable(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); WebKitWebViewPrivate* priv = webView->priv; return priv->editable; } /** * webkit_web_view_set_editable: * @webView: a #WebKitWebView * @flag: a #gboolean indicating the editable state * * Sets whether @web_view allows the user to edit its HTML document. * * If @flag is %TRUE, @web_view allows the user to edit the document. If @flag is * %FALSE, an element in @web_view's document can only be edited if the * CONTENTEDITABLE attribute has been set on the element or one of its parent * elements. You can change @web_view's document programmatically regardless of * this setting. By default a #WebKitWebView is not editable. * Normally, an HTML document is not editable unless the elements within the * document are editable. This function provides a low-level way to make the * contents of a #WebKitWebView editable without altering the document or DOM * structure. */ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitWebViewPrivate* priv = webView->priv; Frame* frame = core(webView)->mainFrame(); g_return_if_fail(frame); // TODO: What happens when the frame is replaced? flag = flag != FALSE; if (flag == priv->editable) return; priv->editable = flag; if (flag) { frame->editor()->applyEditingStyleToBodyElement(); // TODO: If the WebKitWebView is made editable and the selection is empty, set it to something. //if (!webkit_web_view_get_selected_dom_range(webView)) // mainFrame->setSelectionFromNone(); } g_object_notify(G_OBJECT(webView), "editable"); } /** * webkit_web_view_get_copy_target_list: * @webView: a #WebKitWebView * * This function returns the list of targets this #WebKitWebView can * provide for clipboard copying and as DND source. The targets in the list are * added with values from the #WebKitWebViewTargetInfo enum, * using gtk_target_list_add() and * gtk_target_list_add_text_targets(). * * Return value: the #GtkTargetList **/ GtkTargetList* webkit_web_view_get_copy_target_list(WebKitWebView* webView) { return pasteboardHelperInstance()->targetList(); } /** * webkit_web_view_get_paste_target_list: * @webView: a #WebKitWebView * * This function returns the list of targets this #WebKitWebView can * provide for clipboard pasting and as DND destination. The targets in the list are * added with values from the #WebKitWebViewTargetInfo enum, * using gtk_target_list_add() and * gtk_target_list_add_text_targets(). * * Return value: the #GtkTargetList **/ GtkTargetList* webkit_web_view_get_paste_target_list(WebKitWebView* webView) { return pasteboardHelperInstance()->targetList(); } /** * webkit_web_view_can_show_mime_type: * @webView: a #WebKitWebView * @mime_type: a MIME type * * This functions returns whether or not a MIME type can be displayed using this view. * * Return value: a #gboolean indicating if the MIME type can be displayed * * Since: 1.0.3 **/ gboolean webkit_web_view_can_show_mime_type(WebKitWebView* webView, const gchar* mimeType) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Frame* frame = core(webkit_web_view_get_main_frame(webView)); if (FrameLoader* loader = frame->loader()) return loader->canShowMIMEType(String::fromUTF8(mimeType)); else return FALSE; } /** * webkit_web_view_get_transparent: * @webView: a #WebKitWebView * * Returns whether the #WebKitWebView has a transparent background. * * Return value: %FALSE when the #WebKitWebView draws a solid background * (the default), otherwise %TRUE. */ gboolean webkit_web_view_get_transparent(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); WebKitWebViewPrivate* priv = webView->priv; return priv->transparent; } /** * webkit_web_view_set_transparent: * @webView: a #WebKitWebView * * Sets whether the #WebKitWebView has a transparent background. * * Pass %FALSE to have the #WebKitWebView draw a solid background * (the default), otherwise %TRUE. */ void webkit_web_view_set_transparent(WebKitWebView* webView, gboolean flag) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitWebViewPrivate* priv = webView->priv; priv->transparent = flag; // TODO: This needs to be made persistent or it could become a problem when // the main frame is replaced. Frame* frame = core(webView)->mainFrame(); g_return_if_fail(frame); frame->view()->setTransparent(flag); g_object_notify(G_OBJECT(webView), "transparent"); } /** * webkit_web_view_get_zoom_level: * @webView: a #WebKitWebView * * Returns the zoom level of @web_view, i.e. the factor by which elements in * the page are scaled with respect to their original size. * If the "full-content-zoom" property is set to %FALSE (the default) * the zoom level changes the text size, or if %TRUE, scales all * elements in the page. * * Return value: the zoom level of @web_view * * Since: 1.0.1 */ gfloat webkit_web_view_get_zoom_level(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1.0f); Frame* frame = core(webView)->mainFrame(); if (!frame) return 1.0f; WebKitWebViewPrivate* priv = webView->priv; return priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor(); } static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoomLevel) { Frame* frame = core(webView)->mainFrame(); if (!frame) return; WebKitWebViewPrivate* priv = webView->priv; if (priv->zoomFullContent) frame->setPageZoomFactor(zoomLevel); else frame->setTextZoomFactor(zoomLevel); } /** * webkit_web_view_set_zoom_level: * @webView: a #WebKitWebView * @zoom_level: the new zoom level * * Sets the zoom level of @web_view, i.e. the factor by which elements in * the page are scaled with respect to their original size. * If the "full-content-zoom" property is set to %FALSE (the default) * the zoom level changes the text size, or if %TRUE, scales all * elements in the page. * * Since: 1.0.1 */ void webkit_web_view_set_zoom_level(WebKitWebView* webView, gfloat zoomLevel) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); webkit_web_view_apply_zoom_level(webView, zoomLevel); g_object_notify(G_OBJECT(webView), "zoom-level"); } /** * webkit_web_view_zoom_in: * @webView: a #WebKitWebView * * Increases the zoom level of @web_view. The current zoom * level is incremented by the value of the "zoom-step" * property of the #WebKitWebSettings associated with @web_view. * * Since: 1.0.1 */ void webkit_web_view_zoom_in(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitWebViewPrivate* priv = webView->priv; gfloat zoomMultiplierRatio; g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL); webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) + zoomMultiplierRatio); } /** * webkit_web_view_zoom_out: * @webView: a #WebKitWebView * * Decreases the zoom level of @web_view. The current zoom * level is decremented by the value of the "zoom-step" * property of the #WebKitWebSettings associated with @web_view. * * Since: 1.0.1 */ void webkit_web_view_zoom_out(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitWebViewPrivate* priv = webView->priv; gfloat zoomMultiplierRatio; g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL); webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) - zoomMultiplierRatio); } /** * webkit_web_view_get_full_content_zoom: * @webView: a #WebKitWebView * * Returns whether the zoom level affects only text or all elements. * * Return value: %FALSE if only text should be scaled (the default), * %TRUE if the full content of the view should be scaled. * * Since: 1.0.1 */ gboolean webkit_web_view_get_full_content_zoom(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); WebKitWebViewPrivate* priv = webView->priv; return priv->zoomFullContent; } /** * webkit_web_view_set_full_content_zoom: * @webView: a #WebKitWebView * @full_content_zoom: %FALSE if only text should be scaled (the default), * %TRUE if the full content of the view should be scaled. * * Sets whether the zoom level affects only text or all elements. * * Since: 1.0.1 */ void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoomFullContent) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitWebViewPrivate* priv = webView->priv; if (priv->zoomFullContent == zoomFullContent) return; Frame* frame = core(webView)->mainFrame(); if (!frame) return; gfloat zoomLevel = priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor(); priv->zoomFullContent = zoomFullContent; if (priv->zoomFullContent) frame->setPageAndTextZoomFactors(zoomLevel, 1); else frame->setPageAndTextZoomFactors(1, zoomLevel); g_object_notify(G_OBJECT(webView), "full-content-zoom"); } /** * webkit_web_view_get_load_status: * @webView: a #WebKitWebView * * Determines the current status of the load. * * Since: 1.1.7 */ WebKitLoadStatus webkit_web_view_get_load_status(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), WEBKIT_LOAD_FINISHED); WebKitWebViewPrivate* priv = webView->priv; return priv->loadStatus; } /** * webkit_web_view_get_progress: * @webView: a #WebKitWebView * * Determines the current progress of the load. * * Since: 1.1.7 */ gdouble webkit_web_view_get_progress(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1.0); return core(webView)->progress()->estimatedProgress(); } /** * webkit_web_view_get_encoding: * @webView: a #WebKitWebView * * Returns the default encoding of the #WebKitWebView. * * Return value: the default encoding * * Since: 1.1.1 */ const gchar* webkit_web_view_get_encoding(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); String encoding = core(webView)->mainFrame()->loader()->writer()->encoding(); if (encoding.isEmpty()) return 0; webView->priv->encoding = encoding.utf8(); return webView->priv->encoding.data(); } /** * webkit_web_view_set_custom_encoding: * @webView: a #WebKitWebView * @encoding: the new encoding, or %NULL to restore the default encoding * * Sets the current #WebKitWebView encoding, without modifying the default one, * and reloads the page. * * Since: 1.1.1 */ void webkit_web_view_set_custom_encoding(WebKitWebView* webView, const char* encoding) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); core(webView)->mainFrame()->loader()->reloadWithOverrideEncoding(String::fromUTF8(encoding)); } /** * webkit_web_view_get_custom_encoding: * @webView: a #WebKitWebView * * Returns the current encoding of the #WebKitWebView, not the default-encoding * of WebKitWebSettings. * * Return value: a string containing the current custom encoding for @web_view, or %NULL if there's none set. * * Since: 1.1.1 */ const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); String overrideEncoding = core(webView)->mainFrame()->loader()->documentLoader()->overrideEncoding(); if (overrideEncoding.isEmpty()) return 0; webView->priv->customEncoding = overrideEncoding.utf8(); return webView->priv->customEncoding.data(); } /** * webkit_web_view_set_view_mode: * @webView: the #WebKitWebView that will have its view mode set * @mode: the %WebKitWebViewViewMode to be set * * Sets the view-mode property of the #WebKitWebView. Check the * property's documentation for more information. * * Since: 1.3.4 */ void webkit_web_view_set_view_mode(WebKitWebView* webView, WebKitWebViewViewMode mode) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); Page* page = core(webView); switch (mode) { case WEBKIT_WEB_VIEW_VIEW_MODE_FLOATING: page->setViewMode(Page::ViewModeFloating); break; case WEBKIT_WEB_VIEW_VIEW_MODE_FULLSCREEN: page->setViewMode(Page::ViewModeFullscreen); break; case WEBKIT_WEB_VIEW_VIEW_MODE_MAXIMIZED: page->setViewMode(Page::ViewModeMaximized); break; case WEBKIT_WEB_VIEW_VIEW_MODE_MINIMIZED: page->setViewMode(Page::ViewModeMinimized); break; default: page->setViewMode(Page::ViewModeWindowed); break; } } /** * webkit_web_view_get_view_mode: * @webView: the #WebKitWebView to obtain the view mode from * * Gets the value of the view-mode property of the * #WebKitWebView. Check the property's documentation for more * information. * * Return value: the %WebKitWebViewViewMode currently set for the * #WebKitWebView. * * Since: 1.3.4 */ WebKitWebViewViewMode webkit_web_view_get_view_mode(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), WEBKIT_WEB_VIEW_VIEW_MODE_WINDOWED); Page* page = core(webView); Page::ViewMode mode = page->viewMode(); if (mode == Page::ViewModeFloating) return WEBKIT_WEB_VIEW_VIEW_MODE_FLOATING; if (mode == Page::ViewModeFullscreen) return WEBKIT_WEB_VIEW_VIEW_MODE_FULLSCREEN; if (mode == Page::ViewModeMaximized) return WEBKIT_WEB_VIEW_VIEW_MODE_MAXIMIZED; if (mode == Page::ViewModeMinimized) return WEBKIT_WEB_VIEW_VIEW_MODE_MINIMIZED; return WEBKIT_WEB_VIEW_VIEW_MODE_WINDOWED; } /** * webkit_web_view_move_cursor: * @webView: a #WebKitWebView * @step: a #GtkMovementStep * @count: integer describing the direction of the movement. 1 for forward, -1 for backwards. * * Move the cursor in @view as described by @step and @count. * * Since: 1.1.4 */ void webkit_web_view_move_cursor(WebKitWebView* webView, GtkMovementStep step, gint count) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(step == GTK_MOVEMENT_VISUAL_POSITIONS || step == GTK_MOVEMENT_DISPLAY_LINES || step == GTK_MOVEMENT_PAGES || step == GTK_MOVEMENT_BUFFER_ENDS); g_return_if_fail(count == 1 || count == -1); gboolean handled; g_signal_emit(webView, webkit_web_view_signals[MOVE_CURSOR], 0, step, count, &handled); } void webkit_web_view_set_group_name(WebKitWebView* webView, const gchar* groupName) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); WebKitWebViewPrivate* priv = webView->priv; if (!priv->corePage) return; priv->corePage->setGroupName(String::fromUTF8(groupName)); } /** * webkit_web_view_can_undo: * @webView: a #WebKitWebView * * Determines whether or not it is currently possible to undo the last * editing command in the view. * * Return value: %TRUE if a undo can be done, %FALSE if not * * Since: 1.1.14 */ gboolean webkit_web_view_can_undo(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); return frame->editor()->canUndo(); } /** * webkit_web_view_undo: * @webView: a #WebKitWebView * * Undoes the last editing command in the view, if possible. * * Since: 1.1.14 */ void webkit_web_view_undo(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (webkit_web_view_can_undo(webView)) g_signal_emit(webView, webkit_web_view_signals[UNDO], 0); } /** * webkit_web_view_can_redo: * @webView: a #WebKitWebView * * Determines whether or not it is currently possible to redo the last * editing command in the view. * * Return value: %TRUE if a redo can be done, %FALSE if not * * Since: 1.1.14 */ gboolean webkit_web_view_can_redo(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); return frame->editor()->canRedo(); } /** * webkit_web_view_redo: * @webView: a #WebKitWebView * * Redoes the last editing command in the view, if possible. * * Since: 1.1.14 */ void webkit_web_view_redo(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (webkit_web_view_can_redo(webView)) g_signal_emit(webView, webkit_web_view_signals[REDO], 0); } /** * webkit_web_view_set_view_source_mode: * @webView: a #WebKitWebView * @view_source_mode: the mode to turn on or off view source mode * * Set whether the view should be in view source mode. Setting this mode to * %TRUE before loading a URI will display the source of the web page in a * nice and readable format. * * Since: 1.1.14 */ void webkit_web_view_set_view_source_mode (WebKitWebView* webView, gboolean mode) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (Frame* mainFrame = core(webView)->mainFrame()) mainFrame->setInViewSourceMode(mode); } /** * webkit_web_view_get_view_source_mode: * @webView: a #WebKitWebView * * Return value: %TRUE if @web_view is in view source mode, %FALSE otherwise. * * Since: 1.1.14 */ gboolean webkit_web_view_get_view_source_mode (WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); if (Frame* mainFrame = core(webView)->mainFrame()) return mainFrame->inViewSourceMode(); return FALSE; } // Internal subresource management void webkit_web_view_add_resource(WebKitWebView* webView, const char* identifier, WebKitWebResource* webResource) { WebKitWebViewPrivate* priv = webView->priv; if (!priv->mainResource) { priv->mainResource = adoptPlatformRef(webResource); priv->mainResourceIdentifier = identifier; return; } g_hash_table_insert(priv->subResources.get(), g_strdup(identifier), webResource); } WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* identifier) { WebKitWebViewPrivate* priv = webView->priv; gpointer webResource = 0; gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources.get(), identifier, NULL, &webResource); // The only resource we do not store in this hash table is the // main! If we did not find a request, it probably means the load // has been interrupted while while a resource was still being // loaded. if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier.data())) return 0; if (!webResource) return webkit_web_view_get_main_resource(webView); return WEBKIT_WEB_RESOURCE(webResource); } WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView) { return webView->priv->mainResource.get(); } void webkit_web_view_clear_resources(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; priv->mainResourceIdentifier = ""; priv->mainResource = 0; if (priv->subResources) g_hash_table_remove_all(priv->subResources.get()); } GList* webkit_web_view_get_subresources(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; GList* subResources = g_hash_table_get_values(priv->subResources.get()); return g_list_remove(subResources, priv->mainResource.get()); } /* From EventHandler.cpp */ static IntPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint) { FrameView* view = frame->view(); // FIXME: Is it really OK to use the wrong coordinates here when view is 0? // Historically the code would just crash; this is clearly no worse than that. return view ? view->windowToContents(windowPoint) : windowPoint; } void webkit_web_view_set_tooltip_text(WebKitWebView* webView, const char* tooltip) { #if GTK_CHECK_VERSION(2, 12, 0) WebKitWebViewPrivate* priv = webView->priv; if (tooltip && *tooltip != '\0') { priv->tooltipText = tooltip; gtk_widget_set_has_tooltip(GTK_WIDGET(webView), TRUE); } else { priv->tooltipText = ""; gtk_widget_set_has_tooltip(GTK_WIDGET(webView), FALSE); } gtk_widget_trigger_tooltip_query(GTK_WIDGET(webView)); #else // TODO: Support older GTK+ versions // See http://bugs.webkit.org/show_bug.cgi?id=15793 notImplemented(); #endif } /** * webkit_web_view_get_hit_test_result: * @webView: a #WebKitWebView * @event: a #GdkEventButton * * Does a 'hit test' in the coordinates specified by @event to figure * out context information about that position in the @webView. * * Returns: (transfer none): a newly created #WebKitHitTestResult with the context of the * specified position. * * Since: 1.1.15 **/ WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, GdkEventButton* event) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); g_return_val_if_fail(event, NULL); PlatformMouseEvent mouseEvent = PlatformMouseEvent(event); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); HitTestRequest request(HitTestRequest::Active); IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.pos()); MouseEventWithHitTestResults mev = frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); return kit(mev.hitTestResult()); } /** * webkit_web_view_get_icon_uri: * @webView: the #WebKitWebView object * * Obtains the URI for the favicon for the given #WebKitWebView, or * %NULL if there is none. * * Return value: the URI for the favicon, or %NULL * * Since: 1.1.18 */ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); String iconURL = iconDatabase()->iconURLForPageURL(core(webView)->mainFrame()->loader()->url().prettyURL()); webView->priv->iconURI = iconURL.utf8(); return webView->priv->iconURI.data(); } /** * webkit_web_view_get_dom_document: * @webView: a #WebKitWebView * * Returns: (transfer none): the #WebKitDOMDocument currently loaded in the @webView * * Since: 1.3.1 **/ WebKitDOMDocument* webkit_web_view_get_dom_document(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); Frame* coreFrame = core(webView)->mainFrame(); if (!coreFrame) return 0; Document* doc = coreFrame->document(); if (!doc) return 0; return static_cast<WebKitDOMDocument*>(kit(doc)); } /** * SECTION:webkit * @short_description: Global functions controlling WebKit * * WebKit manages many resources which are not related to specific * views. These functions relate to cross-view limits, such as cache * sizes, database quotas, and the HTTP session management. */ /** * webkit_get_default_session: * * Retrieves the default #SoupSession used by all web views. * Note that the session features are added by WebKit on demand, * so if you insert your own #SoupCookieJar before any network * traffic occurs, WebKit will use it instead of the default. * * Return value: (transfer none): the default #SoupSession * * Since: 1.1.1 */ SoupSession* webkit_get_default_session () { webkit_init(); return ResourceHandle::defaultSession(); } /** * webkit_set_cache_model: * @cache_model: a #WebKitCacheModel * * Specifies a usage model for WebViews, which WebKit will use to * determine its caching behavior. All web views follow the cache * model. This cache model determines the RAM and disk space to use * for caching previously viewed content . * * Research indicates that users tend to browse within clusters of * documents that hold resources in common, and to revisit previously * visited documents. WebKit and the frameworks below it include * built-in caches that take advantage of these patterns, * substantially improving document load speed in browsing * situations. The WebKit cache model controls the behaviors of all of * these caches, including various WebCore caches. * * Browsers can improve document load speed substantially by * specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a * browsing interface can reduce memory usage substantially by * specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. Default value is * WEBKIT_CACHE_MODEL_WEB_BROWSER. * * Since: 1.1.18 */ void webkit_set_cache_model(WebKitCacheModel model) { webkit_init(); if (cacheModel == model) return; // FIXME: Add disk cache handling when soup has the API guint cacheTotalCapacity; guint cacheMinDeadCapacity; guint cacheMaxDeadCapacity; gdouble deadDecodedDataDeletionInterval; guint pageCacheCapacity; switch (model) { case WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: pageCacheCapacity = 0; cacheTotalCapacity = 0; cacheMinDeadCapacity = 0; cacheMaxDeadCapacity = 0; deadDecodedDataDeletionInterval = 0; break; case WEBKIT_CACHE_MODEL_WEB_BROWSER: pageCacheCapacity = 3; cacheTotalCapacity = 32 * 1024 * 1024; cacheMinDeadCapacity = cacheTotalCapacity / 4; cacheMaxDeadCapacity = cacheTotalCapacity / 2; deadDecodedDataDeletionInterval = 60; break; default: g_return_if_reached(); } cache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); cache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); pageCache()->setCapacity(pageCacheCapacity); cacheModel = model; } /** * webkit_get_cache_model: * * Returns the current cache model. For more information about this * value check the documentation of the function * webkit_set_cache_model(). * * Return value: the current #WebKitCacheModel * * Since: 1.1.18 */ WebKitCacheModel webkit_get_cache_model() { webkit_init(); return cacheModel; } void webkit_web_view_execute_core_command_by_name(WebKitWebView* webView, const gchar* name, const gchar* value) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(name); g_return_if_fail(value); core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value); } gboolean webkit_web_view_is_command_enabled(WebKitWebView* webView, const gchar* name) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); g_return_val_if_fail(name, FALSE); return core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled(); } GtkMenu* webkit_web_view_get_context_menu(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); #if ENABLE(CONTEXT_MENUS) ContextMenu* menu = core(webView)->contextMenuController()->contextMenu(); if (!menu) return 0; return menu->platformDescription(); #else return 0; #endif }
[ "sdevitt@rim.com" ]
sdevitt@rim.com
3709a447706a4b253e5239f9ae20ed93181b775d
961714d4298245d9c762e59c716c070643af2213
/ThirdParty-mod/java2cpp/java/security/cert/LDAPCertStoreParameters.hpp
ab0c42f60a95d2749e8ed08a738c7a703c858cbd
[ "MIT" ]
permissive
blockspacer/HQEngine
b072ff13d2c1373816b40c29edbe4b869b4c69b1
8125b290afa7c62db6cc6eac14e964d8138c7fd0
refs/heads/master
2023-04-22T06:11:44.953694
2018-10-02T15:24:43
2018-10-02T15:24:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,346
hpp
/*================================================================================ code generated by: java2cpp author: Zoran Angelov, mailto://baldzar@gmail.com class: java.security.cert.LDAPCertStoreParameters ================================================================================*/ #ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_JAVA_SECURITY_CERT_LDAPCERTSTOREPARAMETERS_HPP_DECL #define J2CPP_JAVA_SECURITY_CERT_LDAPCERTSTOREPARAMETERS_HPP_DECL namespace j2cpp { namespace java { namespace lang { class Object; } } } namespace j2cpp { namespace java { namespace lang { class String; } } } namespace j2cpp { namespace java { namespace security { namespace cert { class CertStoreParameters; } } } } #include <java/lang/Object.hpp> #include <java/lang/String.hpp> #include <java/security/cert/CertStoreParameters.hpp> namespace j2cpp { namespace java { namespace security { namespace cert { class LDAPCertStoreParameters; class LDAPCertStoreParameters : public object<LDAPCertStoreParameters> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) J2CPP_DECLARE_METHOD(2) J2CPP_DECLARE_METHOD(3) J2CPP_DECLARE_METHOD(4) J2CPP_DECLARE_METHOD(5) J2CPP_DECLARE_METHOD(6) explicit LDAPCertStoreParameters(jobject jobj) : object<LDAPCertStoreParameters>(jobj) { } operator local_ref<java::lang::Object>() const; operator local_ref<java::security::cert::CertStoreParameters>() const; LDAPCertStoreParameters(local_ref< java::lang::String > const&, jint); LDAPCertStoreParameters(); LDAPCertStoreParameters(local_ref< java::lang::String > const&); local_ref< java::lang::Object > clone(); jint getPort(); local_ref< java::lang::String > getServerName(); local_ref< java::lang::String > toString(); }; //class LDAPCertStoreParameters } //namespace cert } //namespace security } //namespace java } //namespace j2cpp #endif //J2CPP_JAVA_SECURITY_CERT_LDAPCERTSTOREPARAMETERS_HPP_DECL #else //J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_JAVA_SECURITY_CERT_LDAPCERTSTOREPARAMETERS_HPP_IMPL #define J2CPP_JAVA_SECURITY_CERT_LDAPCERTSTOREPARAMETERS_HPP_IMPL namespace j2cpp { java::security::cert::LDAPCertStoreParameters::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } java::security::cert::LDAPCertStoreParameters::operator local_ref<java::security::cert::CertStoreParameters>() const { return local_ref<java::security::cert::CertStoreParameters>(get_jobject()); } java::security::cert::LDAPCertStoreParameters::LDAPCertStoreParameters(local_ref< java::lang::String > const &a0, jint a1) : object<java::security::cert::LDAPCertStoreParameters>( call_new_object< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(0), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(0) >(a0, a1) ) { } java::security::cert::LDAPCertStoreParameters::LDAPCertStoreParameters() : object<java::security::cert::LDAPCertStoreParameters>( call_new_object< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(1), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(1) >() ) { } java::security::cert::LDAPCertStoreParameters::LDAPCertStoreParameters(local_ref< java::lang::String > const &a0) : object<java::security::cert::LDAPCertStoreParameters>( call_new_object< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(2), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(2) >(a0) ) { } local_ref< java::lang::Object > java::security::cert::LDAPCertStoreParameters::clone() { return call_method< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(3), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(3), local_ref< java::lang::Object > >(get_jobject()); } jint java::security::cert::LDAPCertStoreParameters::getPort() { return call_method< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(4), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(4), jint >(get_jobject()); } local_ref< java::lang::String > java::security::cert::LDAPCertStoreParameters::getServerName() { return call_method< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(5), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(5), local_ref< java::lang::String > >(get_jobject()); } local_ref< java::lang::String > java::security::cert::LDAPCertStoreParameters::toString() { return call_method< java::security::cert::LDAPCertStoreParameters::J2CPP_CLASS_NAME, java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_NAME(6), java::security::cert::LDAPCertStoreParameters::J2CPP_METHOD_SIGNATURE(6), local_ref< java::lang::String > >(get_jobject()); } J2CPP_DEFINE_CLASS(java::security::cert::LDAPCertStoreParameters,"java/security/cert/LDAPCertStoreParameters") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,0,"<init>","(Ljava/lang/String;I)V") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,1,"<init>","()V") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,2,"<init>","(Ljava/lang/String;)V") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,3,"clone","()Ljava/lang/Object;") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,4,"getPort","()I") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,5,"getServerName","()Ljava/lang/String;") J2CPP_DEFINE_METHOD(java::security::cert::LDAPCertStoreParameters,6,"toString","()Ljava/lang/String;") } //namespace j2cpp #endif //J2CPP_JAVA_SECURITY_CERT_LDAPCERTSTOREPARAMETERS_HPP_IMPL #endif //J2CPP_INCLUDE_IMPLEMENTATION
[ "le.hoang.q@gmail.com@2e56ffda-155b-7872-b1f3-609f5c043f28" ]
le.hoang.q@gmail.com@2e56ffda-155b-7872-b1f3-609f5c043f28
df457a31529300b5a4c2a0571133679e79a7adeb
1518b89cac3afff7ed7c4cd48ca25574d8357d75
/src/qt/peertablemodel.h
b628404b695e801866407e6c84a1ed83cf1e8881
[ "MIT" ]
permissive
HelioNetwork/Helio
b036c488d0b276783ee909be9ce4805aff966cab
af6bd585231fd54dbbc6570369c8b0cdaef7c6f0
refs/heads/master
2022-12-26T03:48:33.305335
2020-10-08T05:31:26
2020-10-08T05:31:26
302,241,086
3
1
null
null
null
null
UTF-8
C++
false
false
2,145
h
// Copyright (c) 2011-2013 The Bitcoin developers // Copyright (c) 2017-2019 The PIVX developers // Copyright (c) 2020 The Helio Coin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_PEERTABLEMODEL_H #define BITCOIN_QT_PEERTABLEMODEL_H #include "main.h" #include "net.h" #include <QAbstractTableModel> #include <QStringList> class ClientModel; class PeerTablePriv; QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE struct CNodeCombinedStats { CNodeStats nodeStats; CNodeStateStats nodeStateStats; bool fNodeStateStatsAvailable; }; class NodeLessThan { public: NodeLessThan(int nColumn, Qt::SortOrder fOrder) : column(nColumn), order(fOrder) {} bool operator()(const CNodeCombinedStats& left, const CNodeCombinedStats& right) const; private: int column; Qt::SortOrder order; }; /** Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call. Used by the rpc console UI. */ class PeerTableModel : public QAbstractTableModel { Q_OBJECT public: explicit PeerTableModel(ClientModel* parent = 0); const CNodeCombinedStats* getNodeStats(int idx); int getRowByNodeId(NodeId nodeid); void startAutoRefresh(); void stopAutoRefresh(); enum ColumnIndex { Address = 0, Subversion = 1, Ping = 2 }; /** @name Methods overridden from QAbstractTableModel @{*/ int rowCount(const QModelIndex& parent) const; int columnCount(const QModelIndex& parent) const; QVariant data(const QModelIndex& index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column, const QModelIndex& parent) const; Qt::ItemFlags flags(const QModelIndex& index) const; void sort(int column, Qt::SortOrder order); /*@}*/ public Q_SLOTS: void refresh(); private: ClientModel* clientModel; QStringList columns; PeerTablePriv* priv; QTimer* timer; }; #endif // BITCOIN_QT_PEERTABLEMODEL_H
[ "72230497+HelioNetwork@users.noreply.github.com" ]
72230497+HelioNetwork@users.noreply.github.com
16ba1739281bb240d8f61571a4f9dde57a8490a5
a3300955c094f9323bea7a5e899a685e6797789a
/src/modules/connectivity/http/cpp/artik_http.cpp
064cf31edc042eede58f9f8cc727d4fba95e5f5e
[ "Apache-2.0" ]
permissive
bswhite1/artik-sdk
bb4560860a8985fc3d4b89f53aa151f1ade833e0
e4dc8d6720d3627ef126596ea47d5c60d2a517a0
refs/heads/master
2020-04-01T02:04:24.337826
2018-11-29T17:03:36
2018-11-29T17:03:36
152,764,529
0
1
Apache-2.0
2018-10-12T14:42:09
2018-10-12T14:42:08
null
UTF-8
C++
false
false
3,351
cpp
/* * * Copyright 2017 Samsung Electronics All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the License. * */ #include "artik_http.hh" artik::Http::Http() { m_module = reinterpret_cast<artik_http_module*>( artik_request_api_module("http")); } artik::Http::~Http() { artik_release_api_module(reinterpret_cast<void*>(this->m_module)); } artik_error artik::Http::get_stream(const char *url, artik_http_headers *headers, int *status, artik_http_stream_callback callback, void *user_data, artik_ssl_config *ssl) { return m_module->get_stream(url, headers, status, callback, user_data, ssl); } artik_error artik::Http::get_stream_async(const char* url, artik_http_headers* headers, artik_http_stream_callback stream_callback, artik_http_response_callback response_callback, void *user_data, artik_ssl_config *ssl) { return m_module->get_stream_async(url, headers, stream_callback, response_callback, user_data, ssl); } artik_error artik::Http::get(const char *url, artik_http_headers *headers, char **response, int *status, artik_ssl_config *ssl) { return m_module->get(url, headers, response, status, ssl); } artik_error artik::Http::get_async(const char *url, artik_http_headers *headers, artik_http_response_callback callback, void *user_data, artik_ssl_config *ssl) { return m_module->get_async(url, headers, callback, user_data, ssl); } artik_error artik::Http::post(const char *url, artik_http_headers* headers, const char *body, char **response, int *status, artik_ssl_config *ssl) { return m_module->post(url, headers, body, response, status, ssl); } artik_error artik::Http::post_async(const char *url, artik_http_headers *headers, const char *body, artik_http_response_callback callback, void *user_data, artik_ssl_config *ssl) { return m_module->post_async(url, headers, body, callback, user_data, ssl); } artik_error artik::Http::put(const char *url, artik_http_headers *headers, const char *body, char **response, int *status, artik_ssl_config *ssl) { return m_module->put(url, headers, body, response, status, ssl); } artik_error artik::Http::put_async(const char *url, artik_http_headers *headers, const char *body, artik_http_response_callback callback, void *user_data, artik_ssl_config *ssl) { return m_module->put_async(url, headers, body, callback, user_data, ssl); } artik_error artik::Http::del(const char *url, artik_http_headers *headers, char **response, int *status, artik_ssl_config *ssl) { return m_module->del(url, headers, response, status, ssl); } artik_error artik::Http::del_async(const char *url, artik_http_headers *headers, artik_http_response_callback callback, void *user_data, artik_ssl_config *ssl) { return m_module->del_async(url, headers, callback, user_data, ssl); }
[ "g.lemercier@samsung.com" ]
g.lemercier@samsung.com
4e24cf7924e396a1e68bacb2b098d048e9da2514
32cbb0a1fc652005198d6ed5ed52e25572612057
/core/src/eti/OpenMP/Kokkos_OpenMP_ViewCopyETIInst_int64_t_int_LayoutRight_Rank4.cpp
ef3f8b30e1f77a34e2f2e3eb1362884d9c89e7a6
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
ORNL-CEES/kokkos
3874d42a685084f0eb7999939cd9f1da9d42a2a6
70d113838b7dade09218a46c1e8aae44b6dbd321
refs/heads/hip
2020-05-04T03:32:58.012717
2020-01-24T20:43:25
2020-01-24T20:43:25
178,948,568
1
1
NOASSERTION
2020-03-01T19:21:45
2019-04-01T21:19:04
C++
UTF-8
C++
false
false
2,543
cpp
//@HEADER // ************************************************************************ // // Kokkos v. 2.0 // Copyright (2014) Sandia Corporation // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Kokkos is licensed under 3-clause BSD terms of use: // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE // 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. // // Questions? Contact Christian R. Trott (crtrott@sandia.gov) // // ************************************************************************ //@HEADER #define KOKKOS_IMPL_COMPILING_LIBRARY true #include <Kokkos_Core.hpp> namespace Kokkos { namespace Impl { KOKKOS_IMPL_VIEWCOPY_ETI_INST(int****, LayoutRight, LayoutRight, OpenMP, int64_t) KOKKOS_IMPL_VIEWCOPY_ETI_INST(int****, LayoutRight, LayoutLeft, OpenMP, int64_t) KOKKOS_IMPL_VIEWCOPY_ETI_INST(int****, LayoutRight, LayoutStride, OpenMP, int64_t) KOKKOS_IMPL_VIEWFILL_ETI_INST(int****, LayoutRight, OpenMP, int64_t) } // namespace Impl } // namespace Kokkos
[ "crtrott@sandia.gov" ]
crtrott@sandia.gov
c7c88777c3443191058b576ec8a413871b22b3a9
86dae49990a297d199ea2c8e47cb61336b1ca81e
/c/2019่€ƒ่ฏ•/noip2019/9.27/data/a/a.cpp
9ad802ef0de8df8b9a748684af1c69d5303f72e3
[]
no_license
yingziyu-llt/OI
7cc88f6537df0675b60718da73b8407bdaeb5f90
c8030807fe46b27e431687d5ff050f2f74616bc0
refs/heads/main
2023-04-04T03:59:22.255818
2021-04-11T10:15:03
2021-04-11T10:15:03
354,771,118
0
0
null
null
null
null
UTF-8
C++
false
false
1,685
cpp
#include<cstdio> #include<cstring> #include<algorithm> #include<queue> #define INF 0x3f3f3f3f using namespace std; typedef long long LL; typedef double db; inline int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); } return x*f; } const int MAXN=160; int n,m,head[MAXN*2],cnt,idx[MAXN*2],tot,S,T; struct edge { int v,next,val; }e[MAXN*MAXN*2]; void addedge(int x,int y,int z) { e[cnt]=(edge){y,head[x],z}; head[x]=cnt++; swap(x,y); e[cnt]=(edge){y,head[x],0}; head[x]=cnt++; return; } void bfs() { memset(idx,0,sizeof(idx)); queue<int>q; q.push(S); idx[S]=1; while(!q.empty()) { int u=q.front();q.pop(); for(int i=head[u];~i;i=e[i].next) { int v=e[i].v; if(idx[v]||!e[i].val)continue; idx[v]=idx[u]+1; q.push(v); } } return; } int dfs(int u,int _min) { if(u==T)return _min; int ret=0,k; for(int i=head[u];~i;i=e[i].next) { int v=e[i].v; if(idx[v]!=idx[u]+1||!e[i].val)continue; k=dfs(v,min(_min-ret,e[i].val)); e[i].val-=k; e[i^1].val+=k; ret+=k; if(ret==_min)break; } return ret; } int dinic() { int ret=0; while(true) { bfs(); if(!idx[T])break; ret+=dfs(S,INF); if(ret==INF)break; } return ret; } int main() { int TT=read(); while(TT--) { n=read();m=read(); memset(head,-1,sizeof(head)); tot=cnt=0; for(int i=1;i<=n;++i) { int x=read(); tot+=x; addedge(0,i,x); } T=n+m+1; for(int i=1;i<=m;++i)addedge(i+n,T,read()); for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) addedge(i,j+n,1); int ans=dinic(); if(ans==tot)puts("Yes"); else puts("No"); } return 0; }
[ "linletian1@sina.com" ]
linletian1@sina.com
211d962960787da0371473a42bfef73405084cfa
06df1e57108d34d899dc204ac5f1423d6e2507fe
/Video/Render/Core/DispSvr/3.X/3.2.X/3.2.X/stdafx.h
3e70c9ecd155ad11c29fd33bcf00e575360a4caa
[ "MIT" ]
permissive
goodspeed24e/2011Corel
dcf51f34b153f96a3f3904a9249cfcd56d5ff4aa
4efb585a589ea5587a877f4184493b758fa6f9b2
refs/heads/master
2021-01-01T17:28:23.541299
2015-03-16T15:02:11
2015-03-16T15:04:58
32,332,498
2
6
null
null
null
null
UTF-8
C++
false
false
2,819
h
#pragma once #ifndef STRICT #define STRICT #endif #include "SDKConfigDef.h" #ifdef _DEBUG_D3D #define D3D_DEBUG_INFO #endif #if _MSC_VER >= 1400 #include <windows.h> #include <tchar.h> #endif //_MSC_VER #include <streams.h> #if _MSC_VER >= 1400 #undef lstrlenW #endif //_MSC_VER #include "Imports/ThirdParty/Microsoft/DXVAHD/d3d9.h" #include "Imports/ThirdParty/Microsoft/DXVAHD/d3d9types.h" #include "Imports/ThirdParty/Microsoft/DXVAHD/dxvahd.h" #ifdef _NO_USE_D3DXDLL #include "./Imports/Inc/_D3DX9Math.h" //#include <d3dx9.h> #else #include <d3dx9.h> #ifndef _DEBUG_D3D #pragma comment(lib, "d3dx9.lib") #endif #include <vmr9.h> #endif #include <dshow.h> #include <atlbase.h> #include "./Imports/Diagnosis/GPS/Inc/DogCategory.h" #include "./Imports/Diagnosis/GPS/Inc/DogProfile.h" #include "./Imports/Diagnosis/GPS/Inc/SubCategory.h" #ifndef SAFE_RELEASE #define SAFE_RELEASE(p) if(p) { (p)->Release(); p = NULL; } #endif // SAFE_RELEASE #ifndef SAFE_DELETE #define SAFE_DELETE(p) if(p) { delete p; p = NULL; } #endif // SAFE_DELETE #ifndef SAFE_DELETE_ARRAY #define SAFE_DELETE_ARRAY(p) if(p) { delete [] p; p = NULL; } #endif // SAFE_DELETE_ARRAY #ifndef CHECK_HR #define CHECK_HR(hr, f) \ if( FAILED(hr) ){ f; throw hr; } #endif #ifndef CHECK_POINTER #define CHECK_POINTER(p) \ if (p == NULL) { return E_POINTER; } #endif #ifndef D3DCOLOR_ARGB #define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) #endif namespace DispSvr { int GetRegInt(const TCHAR *pKey, int iDefault); } // Global prototypes #ifndef __QUOTE #define __QUOTE__(x) #x #define __QUOTE(x) __QUOTE__(x) #endif // _QUOTE #if defined(TR_ENABLE_NEWMACROS) || defined(DISABLE_DEBUG_MESSAGES) #define DbgMsg(...) __noop #else #define DbgMsg(fmt, ...) DbgMsgInfo(fmt, __VA_ARGS__); #endif void DbgMsgInfo( char* szMessage, ... ); #ifndef DXToFile #if defined (_NO_USE_D3DXDLL) #define DXToFile(pSurface) __noop #else static inline HRESULT __DXResourceToFile(LPCTSTR fn, IDirect3DSurface9 *pS) { return D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, pS, NULL, NULL); } static inline HRESULT __DXResourceToFile(LPCTSTR fn, IDirect3DBaseTexture9 *pTx) { return D3DXSaveTextureToFile(fn, D3DXIFF_PNG, pTx, NULL); } #define DXToFile(pResource) __DXResourceToFile("C:\\\\" __FILE__ "-" __QUOTE(__LINE__) ".png", pResource) #endif #endif // #ifndef DXToFile #pragma warning(disable:4786) #pragma warning(disable:4245) #include "DispSvr.h" #include "ObjectCounter.h" #include <initguid.h> #include <dxva2api.h> #include <vector> #include "Exports/Inc/VideoMixer.h" #include "Exports/Inc/VideoPresenter.h" #include "ResourceManager.h" #include "RegistryService.h" #include "DynLibManager.h" #include "MathVideoMixing.h" #include "ColorSpaceVideoMixing.h" #include "Imports/LibGPU/GPUID.h"
[ "lin.yongyuanone@gmail.com" ]
lin.yongyuanone@gmail.com
d761acc4f754aa97a3c0a1d245810c509a5b9399
243af6f697c16c54af3613988ddaef62a2b29212
/firmware/uvc_controller/mbed-os/TESTS/netsocket/udp/udpsocket_bind_address_null.cpp
19b89ad42a8c884608798aa59d8fc404f4bd9ca8
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "MIT" ]
permissive
davewhiiite/uvc
0020fcc99d279a70878baf7cdc5c02c19b08499a
fd45223097eed5a824294db975b3c74aa5f5cc8f
refs/heads/main
2023-05-29T10:18:08.520756
2021-06-12T13:06:40
2021-06-12T13:06:40
376,287,264
1
0
null
null
null
null
UTF-8
C++
false
false
1,336
cpp
/* * Copyright (c) 2018, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "greentea-client/test_env.h" #include "mbed.h" #include "udp_tests.h" #include "UDPSocket.h" #include "unity/unity.h" #include "utest.h" using namespace utest::v1; void UDPSOCKET_BIND_ADDRESS_NULL() { UDPSocket *sock = new UDPSocket; if (!sock) { TEST_FAIL(); } TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance())); nsapi_error_t bind_result = sock->bind(nullptr); if (bind_result == NSAPI_ERROR_UNSUPPORTED) { TEST_IGNORE_MESSAGE("bind() not supported"); } else { TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, bind_result); } delete sock; }
[ "13125501+davewhiiite@users.noreply.github.com" ]
13125501+davewhiiite@users.noreply.github.com
ff44a30c8d70213e3f1e196d0579d4194e00dc05
31496cbdd3cee9d6a7b4aec3762033ac479b252d
/LiquidCrystal/HelloWorldwith_DateTime/HelloWorldwith_DateTime.ino
010b8c07e2892a536e25eb4389c7e33d6ad8ae38
[]
no_license
miken101/arduino
ef3edfda502e21d1756bd3f623e1a6b364949a94
0fbf28364bd68717cc07f46c6770ea0c95d65650
refs/heads/master
2020-08-23T11:49:23.355949
2019-10-31T16:52:48
2019-10-31T16:52:48
216,609,514
0
0
null
2019-10-21T16:03:59
2019-10-21T16:03:59
null
UTF-8
C++
false
false
2,145
ino
/* LiquidCrystal Library - Hello World Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and shows the time. The circuit: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * LCD VSS pin to ground * LCD VCC pin to 5V * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystal */ // include the library code: #include <LiquidCrystal.h> #include <Time.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. //lcd.print("hello, world!"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: digitalClockDisplay(); delay(1000); } void digitalClockDisplay(){ // digital clock display of the time lcd.setCursor(0, 0); printDigits(hour()); printColon(); printDigits(minute()); printColon(); printDigits(second()); lcd.setCursor(0, 1); printDigits(day()); lcd.print(" "); printDigits(month()); lcd.print(" "); lcd.print(year()); // lcd.println(); } void printDigits(int digits){ // utility function for digital clock display: prints preceding colon and leading 0 if(digits < 10) lcd.print('0'); lcd.print(digits); } void printColon(){ lcd.print(":"); }
[ "mike.norris@nodmore.info" ]
mike.norris@nodmore.info
915881e9c0f1ce03c965f207f6b8ac2bf4c5d7c4
a011692f67757ff5c0ccb6602affa16370279d62
/src/classes/main_window/main_window_show_inventory.cpp
7e1c2ef801bf9433bcf3235cee15480744ba1191
[ "MIT" ]
permissive
kevinxtung/MICE
0884c229b82c4b433fd3d4c01172ae52b0fa5f3e
6559c8d242893f0697f64853ab49688198e9692d
refs/heads/master
2020-03-16T20:55:59.609212
2018-05-18T23:37:03
2018-05-18T23:37:03
132,978,265
0
0
MIT
2018-05-18T23:37:04
2018-05-11T02:23:28
C++
UTF-8
C++
false
false
1,416
cpp
#include "main_window.h" void Main_Window::showInventoryScreen() { clean(); // Back Button Gtk::Image* i_back = Gtk::manage(new Gtk::Image{"backbutton.png"}); Gtk::Button* b_back = Gtk::manage(new Gtk::Button()); b_back->signal_clicked().connect(sigc::mem_fun(*this, &Main_Window::employeeScreen)); b_back->set_image(*i_back); // Create a new Item Gtk::Image* i_createItem = Gtk::manage(new Gtk::Image{"createitem.png"}); Gtk::Button* b_createItem = Gtk::manage(new Gtk::Button()); b_createItem->signal_clicked().connect(sigc::mem_fun(*this, &Main_Window::onCreateItemClick)); b_createItem->set_image(*i_createItem); // Populate Emporium with Items Gtk::Image* i_66 = Gtk::manage(new Gtk::Image{"66.png"}); Gtk::Button* b_66 = Gtk::manage(new Gtk::Button()); b_66->signal_clicked().connect(sigc::mem_fun(*this, &Main_Window::generate)); b_66->set_image(*i_66); // Permission Flags b_createItem->set_sensitive(true); b_66->set_sensitive(true); if (!m_isManager) { b_createItem->set_sensitive(false); } if (!m_isOwner) { b_66->set_sensitive(false); } Gtk::Grid* grid = Gtk::manage(new Gtk::Grid()); grid->attach(*b_back, 0, 0, 1, 1); grid->attach(*b_createItem, 1, 1, 1, 1); grid->attach(*b_66, 2, 1, 1, 1); box->add(*grid); mainbox->add(*box); mainbox->show_all(); }
[ "kevin.tung@mavs.uta.edu" ]
kevin.tung@mavs.uta.edu
bd504e61200e131cd2645a4c83ab4f48d12be66a
08c124d070ab505bfc554f1fa76c2cdd9d667e4d
/qt-network/SignalSocket/sockettest.h
a1348cdba4a0a5dac2318cdbe60c3be01f1f56fa
[]
no_license
slymnkbdyi/benchmark
f08f1f376274d48999514efca132b44b44c72379
a10fac6cb5dcb86faaee3be3ee054e1ef22b2b5b
refs/heads/master
2021-01-19T16:47:26.857021
2017-04-14T18:06:48
2017-04-14T18:06:48
88,286,734
0
0
null
null
null
null
UTF-8
C++
false
false
446
h
#ifndef SOCKETTEST_H #define SOCKETTEST_H #include <QObject> #include<QDebug> #include<QTcpSocket> #include<QAbstractSocket> class SocketTest : public QObject { Q_OBJECT public: explicit SocketTest(QObject *parent = 0); void Test(); signals: public slots: void connected(); void disconnected(); void bytesWritten(qint64 bytes); void readyRead(); private: QTcpSocket *socket; }; #endif // SOCKETTEST_H
[ "slymnkbdyi@gmail.com" ]
slymnkbdyi@gmail.com
35bcb6045bd6161a53f42f8c78ca94b89cf1e3d9
e24a981d22dc9f08eaead51792f5933d359f003d
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/glsl/loop_analysis.cpp
40897bb6fa8d44c531f0d2894c7eff89169658e2
[]
no_license
Harmon758/kolibrios
d6001876fefb006ea65e5fe3810b26606e33284e
0d615a7c442e8974f58b7260b094c1212c618bcf
refs/heads/master
2023-08-20T11:47:59.999028
2023-08-20T10:40:03
2023-08-20T10:40:03
66,638,292
32
4
null
null
null
null
UTF-8
C++
false
false
13,506
cpp
/* * Copyright ยฉ 2010 Intel Corporation * * 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 (including the next * paragraph) 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 "glsl_types.h" #include "loop_analysis.h" #include "ir_hierarchical_visitor.h" static bool is_loop_terminator(ir_if *ir); static bool all_expression_operands_are_loop_constant(ir_rvalue *, hash_table *); static ir_rvalue *get_basic_induction_increment(ir_assignment *, hash_table *); loop_state::loop_state() { this->ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); this->mem_ctx = ralloc_context(NULL); this->loop_found = false; } loop_state::~loop_state() { hash_table_dtor(this->ht); ralloc_free(this->mem_ctx); } loop_variable_state * loop_state::insert(ir_loop *ir) { loop_variable_state *ls = new(this->mem_ctx) loop_variable_state; hash_table_insert(this->ht, ls, ir); this->loop_found = true; return ls; } loop_variable_state * loop_state::get(const ir_loop *ir) { return (loop_variable_state *) hash_table_find(this->ht, ir); } loop_variable * loop_variable_state::get(const ir_variable *ir) { return (loop_variable *) hash_table_find(this->var_hash, ir); } loop_variable * loop_variable_state::insert(ir_variable *var) { void *mem_ctx = ralloc_parent(this); loop_variable *lv = rzalloc(mem_ctx, loop_variable); lv->var = var; hash_table_insert(this->var_hash, lv, lv->var); this->variables.push_tail(lv); return lv; } loop_terminator * loop_variable_state::insert(ir_if *if_stmt) { void *mem_ctx = ralloc_parent(this); loop_terminator *t = rzalloc(mem_ctx, loop_terminator); t->ir = if_stmt; this->terminators.push_tail(t); return t; } class loop_analysis : public ir_hierarchical_visitor { public: loop_analysis(loop_state *loops); virtual ir_visitor_status visit(ir_loop_jump *); virtual ir_visitor_status visit(ir_dereference_variable *); virtual ir_visitor_status visit_enter(ir_call *); virtual ir_visitor_status visit_enter(ir_loop *); virtual ir_visitor_status visit_leave(ir_loop *); virtual ir_visitor_status visit_enter(ir_assignment *); virtual ir_visitor_status visit_leave(ir_assignment *); virtual ir_visitor_status visit_enter(ir_if *); virtual ir_visitor_status visit_leave(ir_if *); loop_state *loops; int if_statement_depth; ir_assignment *current_assignment; exec_list state; }; loop_analysis::loop_analysis(loop_state *loops) : loops(loops), if_statement_depth(0), current_assignment(NULL) { /* empty */ } ir_visitor_status loop_analysis::visit(ir_loop_jump *ir) { (void) ir; assert(!this->state.is_empty()); loop_variable_state *const ls = (loop_variable_state *) this->state.get_head(); ls->num_loop_jumps++; return visit_continue; } ir_visitor_status loop_analysis::visit_enter(ir_call *ir) { /* If we're not somewhere inside a loop, there's nothing to do. */ if (this->state.is_empty()) return visit_continue; loop_variable_state *const ls = (loop_variable_state *) this->state.get_head(); ls->contains_calls = true; return visit_continue_with_parent; } ir_visitor_status loop_analysis::visit(ir_dereference_variable *ir) { /* If we're not somewhere inside a loop, there's nothing to do. */ if (this->state.is_empty()) return visit_continue; loop_variable_state *const ls = (loop_variable_state *) this->state.get_head(); ir_variable *var = ir->variable_referenced(); loop_variable *lv = ls->get(var); if (lv == NULL) { lv = ls->insert(var); lv->read_before_write = !this->in_assignee; } if (this->in_assignee) { assert(this->current_assignment != NULL); lv->conditional_assignment = (this->if_statement_depth > 0) || (this->current_assignment->condition != NULL); if (lv->first_assignment == NULL) { assert(lv->num_assignments == 0); lv->first_assignment = this->current_assignment; } lv->num_assignments++; } else if (lv->first_assignment == this->current_assignment) { /* This catches the case where the variable is used in the RHS of an * assignment where it is also in the LHS. */ lv->read_before_write = true; } return visit_continue; } ir_visitor_status loop_analysis::visit_enter(ir_loop *ir) { loop_variable_state *ls = this->loops->insert(ir); this->state.push_head(ls); return visit_continue; } ir_visitor_status loop_analysis::visit_leave(ir_loop *ir) { loop_variable_state *const ls = (loop_variable_state *) this->state.pop_head(); /* Function calls may contain side effects. These could alter any of our * variables in ways that cannot be known, and may even terminate shader * execution (say, calling discard in the fragment shader). So we can't * rely on any of our analysis about assignments to variables. * * We could perform some conservative analysis (prove there's no statically * possible assignment, etc.) but it isn't worth it for now; function * inlining will allow us to unroll loops anyway. */ if (ls->contains_calls) return visit_continue; foreach_list(node, &ir->body_instructions) { /* Skip over declarations at the start of a loop. */ if (((ir_instruction *) node)->as_variable()) continue; ir_if *if_stmt = ((ir_instruction *) node)->as_if(); if ((if_stmt != NULL) && is_loop_terminator(if_stmt)) ls->insert(if_stmt); else break; } foreach_list_safe(node, &ls->variables) { loop_variable *lv = (loop_variable *) node; /* Move variables that are already marked as being loop constant to * a separate list. These trivially don't need to be tested. */ if (lv->is_loop_constant()) { lv->remove(); ls->constants.push_tail(lv); } } /* Each variable assigned in the loop that isn't already marked as being loop * constant might still be loop constant. The requirements at this point * are: * * - Variable is written before it is read. * * - Only one assignment to the variable. * * - All operands on the RHS of the assignment are also loop constants. * * The last requirement is the reason for the progress loop. A variable * marked as a loop constant on one pass may allow other variables to be * marked as loop constant on following passes. */ bool progress; do { progress = false; foreach_list_safe(node, &ls->variables) { loop_variable *lv = (loop_variable *) node; if (lv->conditional_assignment || (lv->num_assignments > 1)) continue; /* Process the RHS of the assignment. If all of the variables * accessed there are loop constants, then add this */ ir_rvalue *const rhs = lv->first_assignment->rhs; if (all_expression_operands_are_loop_constant(rhs, ls->var_hash)) { lv->rhs_clean = true; if (lv->is_loop_constant()) { progress = true; lv->remove(); ls->constants.push_tail(lv); } } } } while (progress); /* The remaining variables that are not loop invariant might be loop * induction variables. */ foreach_list_safe(node, &ls->variables) { loop_variable *lv = (loop_variable *) node; /* If there is more than one assignment to a variable, it cannot be a * loop induction variable. This isn't strictly true, but this is a * very simple induction variable detector, and it can't handle more * complex cases. */ if (lv->num_assignments > 1) continue; /* All of the variables with zero assignments in the loop are loop * invariant, and they should have already been filtered out. */ assert(lv->num_assignments == 1); assert(lv->first_assignment != NULL); /* The assignmnet to the variable in the loop must be unconditional. */ if (lv->conditional_assignment) continue; /* Basic loop induction variables have a single assignment in the loop * that has the form 'VAR = VAR + i' or 'VAR = VAR - i' where i is a * loop invariant. */ ir_rvalue *const inc = get_basic_induction_increment(lv->first_assignment, ls->var_hash); if (inc != NULL) { lv->iv_scale = NULL; lv->biv = lv->var; lv->increment = inc; lv->remove(); ls->induction_variables.push_tail(lv); } } return visit_continue; } ir_visitor_status loop_analysis::visit_enter(ir_if *ir) { (void) ir; if (!this->state.is_empty()) this->if_statement_depth++; return visit_continue; } ir_visitor_status loop_analysis::visit_leave(ir_if *ir) { (void) ir; if (!this->state.is_empty()) this->if_statement_depth--; return visit_continue; } ir_visitor_status loop_analysis::visit_enter(ir_assignment *ir) { /* If we're not somewhere inside a loop, there's nothing to do. */ if (this->state.is_empty()) return visit_continue_with_parent; this->current_assignment = ir; return visit_continue; } ir_visitor_status loop_analysis::visit_leave(ir_assignment *ir) { /* Since the visit_enter exits with visit_continue_with_parent for this * case, the loop state stack should never be empty here. */ assert(!this->state.is_empty()); assert(this->current_assignment == ir); this->current_assignment = NULL; return visit_continue; } class examine_rhs : public ir_hierarchical_visitor { public: examine_rhs(hash_table *loop_variables) { this->only_uses_loop_constants = true; this->loop_variables = loop_variables; } virtual ir_visitor_status visit(ir_dereference_variable *ir) { loop_variable *lv = (loop_variable *) hash_table_find(this->loop_variables, ir->var); assert(lv != NULL); if (lv->is_loop_constant()) { return visit_continue; } else { this->only_uses_loop_constants = false; return visit_stop; } } hash_table *loop_variables; bool only_uses_loop_constants; }; bool all_expression_operands_are_loop_constant(ir_rvalue *ir, hash_table *variables) { examine_rhs v(variables); ir->accept(&v); return v.only_uses_loop_constants; } ir_rvalue * get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash) { /* The RHS must be a binary expression. */ ir_expression *const rhs = ir->rhs->as_expression(); if ((rhs == NULL) || ((rhs->operation != ir_binop_add) && (rhs->operation != ir_binop_sub))) return NULL; /* One of the of operands of the expression must be the variable assigned. * If the operation is subtraction, the variable in question must be the * "left" operand. */ ir_variable *const var = ir->lhs->variable_referenced(); ir_variable *const op0 = rhs->operands[0]->variable_referenced(); ir_variable *const op1 = rhs->operands[1]->variable_referenced(); if (((op0 != var) && (op1 != var)) || ((op1 == var) && (rhs->operation == ir_binop_sub))) return NULL; ir_rvalue *inc = (op0 == var) ? rhs->operands[1] : rhs->operands[0]; if (inc->as_constant() == NULL) { ir_variable *const inc_var = inc->variable_referenced(); if (inc_var != NULL) { loop_variable *lv = (loop_variable *) hash_table_find(var_hash, inc_var); if (!lv->is_loop_constant()) inc = NULL; } else inc = NULL; } if ((inc != NULL) && (rhs->operation == ir_binop_sub)) { void *mem_ctx = ralloc_parent(ir); inc = new(mem_ctx) ir_expression(ir_unop_neg, inc->type, inc->clone(mem_ctx, NULL), NULL); } return inc; } /** * Detect whether an if-statement is a loop terminating condition * * Detects if-statements of the form * * (if (expression bool ...) (break)) */ bool is_loop_terminator(ir_if *ir) { if (!ir->else_instructions.is_empty()) return false; ir_instruction *const inst = (ir_instruction *) ir->then_instructions.get_head(); if (inst == NULL) return false; if (inst->ir_type != ir_type_loop_jump) return false; ir_loop_jump *const jump = (ir_loop_jump *) inst; if (jump->mode != ir_loop_jump::jump_break) return false; return true; } loop_state * analyze_loop_variables(exec_list *instructions) { loop_state *loops = new loop_state; loop_analysis v(loops); v.run(instructions); return v.loops; }
[ "Serge@a494cfbc-eb01-0410-851d-a64ba20cac60" ]
Serge@a494cfbc-eb01-0410-851d-a64ba20cac60
1b8299fc44bf2be35d20ba93976b9656474ce1db
d19377741d4e6e99f08d4aa8e147c77e3d385877
/2018/September/A. Palindrome Dance.cpp
7a12f3d69d52acbd71a505cbfc693378762ad30b
[]
no_license
enaim/Competitive_Programming
aad08716d33bfa598fe60934cd28552062577086
ae2eb7dc2f4934b49f6508e66c2e9ee04190c59e
refs/heads/master
2021-06-25T13:09:08.120578
2021-02-01T07:02:41
2021-02-01T07:02:41
205,707,800
10
4
null
null
null
null
UTF-8
C++
false
false
2,030
cpp
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include <algorithm> #include <iostream> #include <vector> #include <map> #include <set> #include <string> #include <sstream> #include <stack> #include <queue> #include <bitset> using namespace std; #define deb(a) cout<<__LINE__<<"# "<<#a<<" -> "<<a<<endl; #define pb push_back #define OO 2e9+10 typedef long long ll; typedef pair<int,int>pii; template<class T> T abs(T x){ if(x<0) return -x; return x; } template<class T>T sqr(T a){ return a*a; } const double pi = acos(-1.0); const double eps = 1e-8; int main() { // freopen("in.txt","r",stdin); // freopen("output.txt","w",stdout); int i,x,n,sum,mn,a,b; int ar[110]; while(3==scanf("%d%d%d",&n,&a,&b)) { for(i=0;i<n;i++) scanf("%d",&ar[i]); mn = 0; if(a>b) mn = 1; x = n/2; i=0; sum = 0; while(x>=i) { if(ar[n-i-1] !=2 && ar[i]==2) { ar[i] = ar[n-i-1]; if(ar[i]==1) sum+=b; else sum+=a; } else if(ar[n-i-1] == 2 && ar[i]!=2) { ar[n-i-1] = ar[i]; if(ar[i]==1) sum+=b; else sum+=a; } i++; } for(i=0;i<n;i++) if(ar[i]==2) { ar[i]=mn; if(ar[i]==1) sum+=b; else sum+=a; } i = 0; while(i<=x) { if(ar[i] != ar[n-i-1]) break; i++; } if(i!=x+1) { printf("-1\n"); continue; } cout<<sum<<endl; } return 0; }
[ "naimelias56@gmail.com" ]
naimelias56@gmail.com
1f81bf3be04ce11e53ddca36921c4d1c0ab0aaf6
261f84525af86037f6e32f9234e44f74edefa621
/Ohjelmointi 2/student/06/vertical/main.cpp
4d478f262a5a82bedf8f7d4017a2bf59a2aee2e1
[]
no_license
kkemppi/TIE-courses
7cf0232b281e60b70e01e98da0febd6b92dcbe33
8a28a71120eb03213cbf1c18d6eed1d8df6fd820
refs/heads/master
2022-10-17T00:56:48.542490
2022-09-30T17:30:28
2022-09-30T17:30:28
231,389,998
0
2
null
null
null
null
UTF-8
C++
false
false
702
cpp
#include <iostream> #ifndef RECURSIVE_FUNC #define RECURSIVE_FUNC #endif using namespace std; void print_vertical(unsigned int num) { RECURSIVE_FUNC // Do not remove RECURSIVE_FUNC declaration, it's necessary for automatic testing to work if (num >= 10){ print_vertical(num / 10); cout << num % 10 << endl; }else{ cout << num << endl; } } // Do not modify rest of the code, or the automated testing won't work. #ifndef UNIT_TESTING int main() { unsigned int number = 0; cout << "Enter a number: "; cin >> number; cout << "The given number (" << number << ") written vertically:" << endl; print_vertical(number); return 0; } #endif
[ "mikko.kemppi@tuni.fi" ]
mikko.kemppi@tuni.fi
5be1e54ee7ee9282e6d5c760d1608183a7837308
d5785b4a1abf832fb6fed4ff4cfe06a0e44e0fe6
/toj54.cpp
1b4119d430e4284ed4dbe7b7c84104c62c61dc3e
[]
no_license
arasHi87/OnlineJudgeExercise
7caaf58f43c675488a712279cb310c55729957d4
90afc36d25bd2a015c7fde604c78d82591d2113a
refs/heads/master
2022-02-21T19:06:39.260348
2019-09-22T09:17:13
2019-09-22T09:17:13
197,958,223
0
1
null
null
null
null
UTF-8
C++
false
false
541
cpp
#include <iostream> #include <algorithm> using namespace std; const int maxN=1e6+10; int h[26], t[26]; // inline int init() { // h[26]={0}; // t[26]={0}; // } int main() { int n; string s; while (cin>>n) { for (int i=1;i<=n;i++) { cin>>s; int head=s[0]-'a'; int tail=s[(int)s.length()-1]-'a'; h[head]>=tail[t]?h[head]++:tail[t]++; } bool ok=true; for (int i=1;i<=26;i++) { } } }
[ "arasi27676271@gmail.com" ]
arasi27676271@gmail.com
ef5e992bf2594b75893f899b909e04cb8be67dff
98e9ea6c268b125df7db10f17fdbc29e580f0ae2
/SGE/Graphics/CTexture.cpp
7cb8da71f7166feaaaae22846db4c8b0043b3056
[]
no_license
Equinox-/Mirage--
23a45d6056a7812606600b2f6f1e89681a3907f2
4cb2e07b762b1256ba87708307f3e65421b0ff18
refs/heads/master
2020-04-06T04:30:55.440502
2013-08-14T05:28:15
2013-08-14T05:31:12
12,090,226
1
0
null
null
null
null
UTF-8
C++
false
false
2,506
cpp
//==================================================================================================== // Filename: CTexture.cpp // Created by: Peter Chan //==================================================================================================== //==================================================================================================== // Includes //==================================================================================================== #include "CTexture.h" #include "../Core/CLog.h" #include "CDXGraphics.h" //==================================================================================================== // Class Definitions //==================================================================================================== CTexture::CTexture(void) : mpTexture(NULL) { // Empty } //---------------------------------------------------------------------------------------------------- CTexture::~CTexture(void) { // Release everything Unload(); } //---------------------------------------------------------------------------------------------------- void CTexture::Load(const char* pFilename) { // Clear everything before we create the texture Unload(); // Struct for getting image info mpTexture = new GLTexture(); // Load the texture from file int result = mpTexture->loadFromFile(pFilename); if (result != TEXTURE_LOAD_SUCCESS) { // Write to log CLog::Get()->Write(ELogMessageType_ERROR, "[Texture] Failed to create texture from file %s", pFilename); return; } } //---------------------------------------------------------------------------------------------------- void CTexture::Unload(void) { // Release everything if (NULL != mpTexture) { mpTexture->freeRawData(); mpTexture->freeTexture(); mpTexture = NULL; } } //---------------------------------------------------------------------------------------------------- GLTexture* CTexture::GetTexture(void) const { return mpTexture; } //---------------------------------------------------------------------------------------------------- int CTexture::GetWidth(void) const { if (NULL == mpTexture) { return 0; } return mpTexture->getWidth(); } //---------------------------------------------------------------------------------------------------- int CTexture::GetHeight(void) const { if (NULL == mpTexture) { return 0; } return mpTexture->getHeight(); }
[ "equinoxscripts@gmail.com" ]
equinoxscripts@gmail.com
f4e834de8ee9d076de761f9df9f370d43b6e0979
c80bd757f18735452eef1f0f7cd7bd305d4313c7
/src/Core/Datatypes/Legacy/Field/cd_templates_fields_4.cc
b0b955942348ce7afefc8c438015c6d14f7f48d9
[ "MIT" ]
permissive
kenlouie/SCIRunGUIPrototype
956449f4b4ce3ed76ccc1fa23a6656f084c3a9b1
062ff605839b076177c4e50f08cf36d83a6a9220
refs/heads/master
2020-12-25T03:11:44.510875
2013-10-01T05:51:39
2013-10-01T05:51:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,877
cc
/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2009 Scientific Computing and Imaging Institute, University of Utah. 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 <Core/Persistent/PersistentSTL.h> #include <Core/GeometryPrimitives/Tensor.h> #include <Core/GeometryPrimitives/Vector.h> #include <Core/Basis/Constant.h> #include <Core/Basis/NoData.h> #include <Core/Basis/TriLinearLgn.h> #include <Core/Basis/CrvLinearLgn.h> #include <Core/Datatypes/Legacy/Field/TriSurfMesh.h> #include <Core/Datatypes/Legacy/Field/CurveMesh.h> #include <Core/Datatypes/Legacy/Field/GenericField.h> using namespace SCIRun; //NoData typedef NoDataBasis<double> NDBasis; //Linear typedef ConstantBasis<Tensor> CFDTensorBasis; typedef ConstantBasis<Vector> CFDVectorBasis; typedef ConstantBasis<double> CFDdoubleBasis; typedef ConstantBasis<float> CFDfloatBasis; typedef ConstantBasis<int> CFDintBasis; typedef ConstantBasis<long long> CFDlonglongBasis; typedef ConstantBasis<short> CFDshortBasis; typedef ConstantBasis<char> CFDcharBasis; typedef ConstantBasis<unsigned int> CFDuintBasis; typedef ConstantBasis<unsigned short> CFDushortBasis; typedef ConstantBasis<unsigned char> CFDucharBasis; typedef ConstantBasis<unsigned long> CFDulongBasis; //Linear typedef TriLinearLgn<Tensor> FDTensorBasis; typedef TriLinearLgn<Vector> FDVectorBasis; typedef TriLinearLgn<double> FDdoubleBasis; typedef TriLinearLgn<float> FDfloatBasis; typedef TriLinearLgn<int> FDintBasis; typedef TriLinearLgn<long long> FDlonglongBasis; typedef TriLinearLgn<short> FDshortBasis; typedef TriLinearLgn<char> FDcharBasis; typedef TriLinearLgn<unsigned int> FDuintBasis; typedef TriLinearLgn<unsigned short> FDushortBasis; typedef TriLinearLgn<unsigned char> FDucharBasis; typedef TriLinearLgn<unsigned long> FDulongBasis; typedef TriSurfMesh<TriLinearLgn<Point> > TSMesh; namespace SCIRun { template class TriSurfMesh<TriLinearLgn<Point> >; //noData template class GenericField<TSMesh, NDBasis, std::vector<double> >; //Constant template class GenericField<TSMesh, CFDTensorBasis, std::vector<Tensor> >; template class GenericField<TSMesh, CFDVectorBasis, std::vector<Vector> >; template class GenericField<TSMesh, CFDdoubleBasis, std::vector<double> >; template class GenericField<TSMesh, CFDfloatBasis, std::vector<float> >; template class GenericField<TSMesh, CFDintBasis, std::vector<int> >; template class GenericField<TSMesh, CFDlonglongBasis,std::vector<long long> >; template class GenericField<TSMesh, CFDshortBasis, std::vector<short> >; template class GenericField<TSMesh, CFDcharBasis, std::vector<char> >; template class GenericField<TSMesh, CFDuintBasis, std::vector<unsigned int> >; template class GenericField<TSMesh, CFDushortBasis, std::vector<unsigned short> >; template class GenericField<TSMesh, CFDucharBasis, std::vector<unsigned char> >; template class GenericField<TSMesh, CFDulongBasis, std::vector<unsigned long> >; //Linear template class GenericField<TSMesh, FDTensorBasis, std::vector<Tensor> >; template class GenericField<TSMesh, FDVectorBasis, std::vector<Vector> >; template class GenericField<TSMesh, FDdoubleBasis, std::vector<double> >; template class GenericField<TSMesh, FDfloatBasis, std::vector<float> >; template class GenericField<TSMesh, FDintBasis, std::vector<int> >; template class GenericField<TSMesh, FDlonglongBasis,std::vector<long long> >; template class GenericField<TSMesh, FDshortBasis, std::vector<short> >; template class GenericField<TSMesh, FDcharBasis, std::vector<char> >; template class GenericField<TSMesh, FDuintBasis, std::vector<unsigned int> >; template class GenericField<TSMesh, FDushortBasis, std::vector<unsigned short> >; template class GenericField<TSMesh, FDucharBasis, std::vector<unsigned char> >; template class GenericField<TSMesh, FDulongBasis, std::vector<unsigned long> >; } PersistentTypeID backwards_compat_TSM("TriSurfMesh", "Mesh", TSMesh::maker, TSMesh::maker); PersistentTypeID backwards_compat_TSFT("TriSurfField<Tensor>", "Field", GenericField<TSMesh, FDTensorBasis, std::vector<Tensor> >::maker, GenericField<TSMesh, CFDTensorBasis, std::vector<Tensor> >::maker); PersistentTypeID backwards_compat_TSFV("TriSurfField<Vector>", "Field", GenericField<TSMesh, FDVectorBasis, std::vector<Vector> >::maker, GenericField<TSMesh, CFDVectorBasis, std::vector<Vector> >::maker); PersistentTypeID backwards_compat_TSFd("TriSurfField<double>", "Field", GenericField<TSMesh, FDdoubleBasis, std::vector<double> >::maker, GenericField<TSMesh, CFDdoubleBasis, std::vector<double> >::maker); PersistentTypeID backwards_compat_TSFf("TriSurfField<float>", "Field", GenericField<TSMesh, FDfloatBasis, std::vector<float> >::maker, GenericField<TSMesh, CFDfloatBasis, std::vector<float> >::maker); PersistentTypeID backwards_compat_TSFi("TriSurfField<int>", "Field", GenericField<TSMesh, FDintBasis, std::vector<int> >::maker, GenericField<TSMesh, CFDintBasis, std::vector<int> >::maker); PersistentTypeID backwards_compat_TSFs("TriSurfField<short>", "Field", GenericField<TSMesh, FDshortBasis, std::vector<short> >::maker, GenericField<TSMesh, CFDshortBasis, std::vector<short> >::maker); PersistentTypeID backwards_compat_TSFc("TriSurfField<char>", "Field", GenericField<TSMesh, FDcharBasis, std::vector<char> >::maker, GenericField<TSMesh, CFDcharBasis, std::vector<char> >::maker); PersistentTypeID backwards_compat_TSFui("TriSurfField<unsigned_int>", "Field", GenericField<TSMesh, FDuintBasis, std::vector<unsigned int> >::maker, GenericField<TSMesh, CFDuintBasis, std::vector<unsigned int> >::maker); PersistentTypeID backwards_compat_TSFus("TriSurfField<unsigned_short>", "Field", GenericField<TSMesh, FDushortBasis, std::vector<unsigned short> >::maker, GenericField<TSMesh, CFDushortBasis, std::vector<unsigned short> >::maker); PersistentTypeID backwards_compat_TSFuc("TriSurfField<unsigned_char>", "Field", GenericField<TSMesh, FDucharBasis, std::vector<unsigned char> >::maker, GenericField<TSMesh, CFDucharBasis, std::vector<unsigned char> >::maker); PersistentTypeID backwards_compat_TSFul("TriSurfField<unsigned_long>", "Field", GenericField<TSMesh, FDulongBasis, std::vector<unsigned long> >::maker, GenericField<TSMesh, CFDulongBasis, std::vector<unsigned long> >::maker); //Linear typedef CrvLinearLgn<Tensor> CrFDTensorBasis; typedef CrvLinearLgn<Vector> CrFDVectorBasis; typedef CrvLinearLgn<double> CrFDdoubleBasis; typedef CrvLinearLgn<float> CrFDfloatBasis; typedef CrvLinearLgn<int> CrFDintBasis; typedef CrvLinearLgn<long long> CrFDlonglongBasis; typedef CrvLinearLgn<short> CrFDshortBasis; typedef CrvLinearLgn<char> CrFDcharBasis; typedef CrvLinearLgn<unsigned int> CrFDuintBasis; typedef CrvLinearLgn<unsigned short> CrFDushortBasis; typedef CrvLinearLgn<unsigned char> CrFDucharBasis; typedef CrvLinearLgn<unsigned long> CrFDulongBasis; typedef CurveMesh<CrvLinearLgn<Point> > CMesh; PersistentTypeID backwards_compat_CM("CurveMesh", "Mesh", CMesh::maker, CMesh::maker); namespace SCIRun { template class CurveMesh<CrvLinearLgn<Point> >; //NoData template class GenericField<CMesh, NDBasis, std::vector<double> >; //Constant template class GenericField<CMesh, CFDTensorBasis, std::vector<Tensor> >; template class GenericField<CMesh, CFDVectorBasis, std::vector<Vector> >; template class GenericField<CMesh, CFDdoubleBasis, std::vector<double> >; template class GenericField<CMesh, CFDfloatBasis, std::vector<float> >; template class GenericField<CMesh, CFDintBasis, std::vector<int> >; template class GenericField<CMesh, CFDlonglongBasis,std::vector<long long> >; template class GenericField<CMesh, CFDshortBasis, std::vector<short> >; template class GenericField<CMesh, CFDcharBasis, std::vector<char> >; template class GenericField<CMesh, CFDuintBasis, std::vector<unsigned int> >; template class GenericField<CMesh, CFDushortBasis, std::vector<unsigned short> >; template class GenericField<CMesh, CFDucharBasis, std::vector<unsigned char> >; template class GenericField<CMesh, CFDulongBasis, std::vector<unsigned long> >; //Linear template class GenericField<CMesh, CrFDTensorBasis, std::vector<Tensor> >; template class GenericField<CMesh, CrFDVectorBasis, std::vector<Vector> >; template class GenericField<CMesh, CrFDdoubleBasis, std::vector<double> >; template class GenericField<CMesh, CrFDfloatBasis, std::vector<float> >; template class GenericField<CMesh, CrFDintBasis, std::vector<int> >; template class GenericField<CMesh, CrFDlonglongBasis,std::vector<long long> >; template class GenericField<CMesh, CrFDshortBasis, std::vector<short> >; template class GenericField<CMesh, CrFDcharBasis, std::vector<char> >; template class GenericField<CMesh, CrFDuintBasis, std::vector<unsigned int> >; template class GenericField<CMesh, CrFDushortBasis, std::vector<unsigned short> >; template class GenericField<CMesh, CrFDucharBasis, std::vector<unsigned char> >; template class GenericField<CMesh, CrFDulongBasis, std::vector<unsigned long> >; } PersistentTypeID backwards_compat_CFT("CurveField<Tensor>", "Field", GenericField<CMesh, CrFDTensorBasis, std::vector<Tensor> >::maker, GenericField<CMesh, CFDTensorBasis, std::vector<Tensor> >::maker); PersistentTypeID backwards_compat_CFV("CurveField<Vector>", "Field", GenericField<CMesh, CrFDVectorBasis, std::vector<Vector> >::maker, GenericField<CMesh, CFDVectorBasis, std::vector<Vector> >::maker); PersistentTypeID backwards_compat_CFd("CurveField<double>", "Field", GenericField<CMesh, CrFDdoubleBasis, std::vector<double> >::maker, GenericField<CMesh, CFDdoubleBasis, std::vector<double> >::maker, GenericField<CMesh, NDBasis, std::vector<double> >::maker); PersistentTypeID backwards_compat_CFf("CurveField<float>", "Field", GenericField<CMesh, CrFDfloatBasis, std::vector<float> >::maker, GenericField<CMesh, CFDfloatBasis, std::vector<float> >::maker); PersistentTypeID backwards_compat_CFi("CurveField<int>", "Field", GenericField<CMesh, CrFDintBasis, std::vector<int> >::maker, GenericField<CMesh, CFDintBasis, std::vector<int> >::maker); PersistentTypeID backwards_compat_CFs("CurveField<short>", "Field", GenericField<CMesh, CrFDshortBasis, std::vector<short> >::maker, GenericField<CMesh, CFDshortBasis, std::vector<short> >::maker); PersistentTypeID backwards_compat_CFc("CurveField<char>", "Field", GenericField<CMesh, CrFDcharBasis, std::vector<char> >::maker, GenericField<CMesh, CFDcharBasis, std::vector<char> >::maker); PersistentTypeID backwards_compat_CFui("CurveField<unsigned_int>", "Field", GenericField<CMesh, CrFDuintBasis, std::vector<unsigned int> >::maker, GenericField<CMesh, CFDuintBasis, std::vector<unsigned int> >::maker); PersistentTypeID backwards_compat_CFus("CurveField<unsigned_short>", "Field", GenericField<CMesh, CrFDushortBasis, std::vector<unsigned short> >::maker, GenericField<CMesh, CFDushortBasis, std::vector<unsigned short> >::maker); PersistentTypeID backwards_compat_CFuc("CurveField<unsigned_char>", "Field", GenericField<CMesh, CrFDucharBasis, std::vector<unsigned char> >::maker, GenericField<CMesh, CFDucharBasis, std::vector<unsigned char> >::maker); PersistentTypeID backwards_compat_CFul("CurveField<unsigned_long>", "Field", GenericField<CMesh, CrFDulongBasis, std::vector<unsigned long> >::maker, GenericField<CMesh, CFDulongBasis, std::vector<unsigned long> >::maker);
[ "dwhite@sci.utah.edu" ]
dwhite@sci.utah.edu
e30160ebfe1658c84394944b1cefc4d2a1cce89d
cca8f4c82dadbfabbc5c8f80f7c18385dca05cac
/HW2-3/3๋ฒˆ.cpp
7993ba092556f3dccf62a555f66a6db85d52875b
[]
no_license
SeongHwanJin/2013440148
912a9715de3f7ca0c2f597c1c590e14f2583d75f
3356cc72ab6f3bc2828831c48166d31e66a4f529
refs/heads/master
2020-03-28T22:34:03.231770
2018-12-11T07:41:54
2018-12-11T07:41:54
149,242,308
0
0
null
null
null
null
UHC
C++
false
false
416
cpp
//3. 1๋ถ€ํ„ฐ 100์‚ฌ์ด์˜ ์ˆซ์ž(์ •์ˆ˜) ์ค‘์—์„œ 3์˜ ๊ณต๋ฐฐ์ˆ˜(3,6,9,12,..)๋“ค์˜ ์ดํ•ฉ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.(while๋ฌธ ์‚ฌ์šฉ) #include <stdio.h> int main(){ int a = 1; int sum = 0; while(a < 100){ if(a % 3 == 0){ sum = sum + a; a = a + 1; } else a = a+1; } printf("1๋ถ€ํ„ฐ 100์‚ฌ์ด์˜ ์ˆซ์ž ์ค‘์—์„œ 3์˜ ๊ณต๋ฐฐ์ˆ˜๋“ค์˜ ์ดํ•ฉ์€ %d์ด๋‹ค.", sum); return 0; }
[ "jinsh806@naver.com" ]
jinsh806@naver.com
6c9e9c6a7c3d9274fbae3914a7d4ac9e9b8a0df3
a4adce78d958665beb05f45177ccb46485352f6b
/SsPlayerExamples/Plugins/SpriteStudio5/Source/SpriteStudio5/Private/Component/SsRenderPlaneProxy.h
ac49fed8ea7e18ecd19f8154397f9c2dacf1bc80
[]
no_license
rapgamer/SS5PlayerForUnrealEngine4
a00cc5f6713d91fe2f67df6d9731782990e88033
7c3c2a73f6ed1b7eb3dd5bd8d83e92b870ff6085
refs/heads/master
2020-12-25T10:50:19.230154
2016-06-02T02:27:21
2016-06-02T02:27:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,523
h
๏ปฟ#pragma once #include "PrimitiveSceneProxy.h" // VertexBuffer class FSsPlaneVertexBuffer : public FVertexBuffer { public: virtual void InitRHI() override; uint32 NumVerts; }; // IndexBuffer class FSsPlaneIndexBuffer : public FIndexBuffer { public: virtual void InitRHI() override; uint32 NumIndices; }; // VertexFactory class FSsPlaneVertexFactory : public FLocalVertexFactory { public: void Init(const FSsPlaneVertexBuffer* VertexBuffer); }; // RenderProxy class FSsRenderPlaneProxy : public FPrimitiveSceneProxy { public: FSsRenderPlaneProxy(class USsPlayerComponent* InComponent, UMaterialInterface* InMaterial); virtual ~FSsRenderPlaneProxy(); // FPrimitiveSceneProxy interface virtual void GetDynamicMeshElements(const TArray<const FSceneView*>& Views, const FSceneViewFamily& ViewFamily, uint32 VisibilityMap, FMeshElementCollector& Collector) const override; virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView* View) const override; virtual uint32 GetMemoryFootprint() const override; void SetDynamicData_RenderThread(); void SetMaterial(UMaterialInterface* InMaterial) { Material = InMaterial; } void SetPivot(const FVector2D& InPivot) { Pivot = InPivot; } public: FVector2D CanvasSizeUU; private: USsPlayerComponent* Component; UPROPERTY() UMaterialInterface* Material; FVector2D Pivot; FSsPlaneVertexBuffer VertexBuffer; FSsPlaneIndexBuffer IndexBuffer; FSsPlaneVertexFactory VertexFactory; };
[ "k-ohashi@historia.co.jp" ]
k-ohashi@historia.co.jp
37a497645e86b1b1c44ccbc5b81ba6c4f54f8b4a
dfc8edc3a1c832961bb9a7041bad55b25c5ea146
/games/coreminer/bomb.hpp
c9c69350f5ae46d8d193ffc0cb623dfb7fc52d96
[ "MIT" ]
permissive
siggame/Joueur.cpp
5f7332e2d8bbd0daac078ed93ca697a74a847435
673fce574ca80fb8f02777e610884a1c9808501d
refs/heads/master
2022-06-05T16:32:09.667029
2022-05-04T15:43:48
2022-05-04T15:43:48
39,783,980
9
21
MIT
2020-11-08T17:06:08
2015-07-27T16:02:44
C++
UTF-8
C++
false
false
2,570
hpp
#ifndef GAMES_COREMINER_BOMB_H #define GAMES_COREMINER_BOMB_H // Bomb // A Bomb in the game. // DO NOT MODIFY THIS FILE // Never try to directly create an instance of this class, or modify its member variables. // Instead, you should only be reading its variables and calling its functions. #include <vector> #include <queue> #include <deque> #include <unordered_map> #include <string> #include <initializer_list> #include "../../joueur/src/any.hpp" #include "game_object.hpp" #include "impl/coreminer_fwd.hpp" // <<-- Creer-Merge: includes -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. // you can add additional #includes here // <<-- /Creer-Merge: includes -->> namespace cpp_client { namespace coreminer { /// <summary> /// A Bomb in the game. /// </summary> class Bomb_ : public Game_object_ { public: /// <summary> /// The Tile this Bomb is on. /// </summary> const Tile& tile; /// <summary> /// The number of turns before this Bomb explodes. One means it will explode after the current turn. /// </summary> const int& timer; // <<-- Creer-Merge: member variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. // You can add additional member variables here. None of them will be tracked or updated by the server. // <<-- /Creer-Merge: member variables -->> // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. // You can add additional methods here. // <<-- /Creer-Merge: methods -->> ~Bomb_(); // #################### // Don't edit these! // #################### /// \cond FALSE Bomb_(std::initializer_list<std::pair<std::string, Any&&>> init); Bomb_() : Bomb_({}){} virtual void resize(const std::string& name, std::size_t size) override; virtual void change_vec_values(const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) override; virtual void remove_key(const std::string& name, Any& key) override; virtual std::unique_ptr<Any> add_key_value(const std::string& name, Any& key, Any& value) override; virtual bool is_map(const std::string& name) override; virtual void rebind_by_name(Any* to_change, const std::string& member, std::shared_ptr<Base_object> ref) override; /// \endcond // #################### // Don't edit these! // #################### }; } // coreminer } // cpp_client #endif // GAMES_COREMINER_BOMB_H
[ "jkhenderson999@gmail.com" ]
jkhenderson999@gmail.com