text
stringlengths
8
6.88M
#include<stdio.h> #include<conio.h> void main() { clrscr(); int arr[7]; int *p; printf(" arr[0] %u",&arr[0]); printf("\n arr[1] %u",&arr[1]); printf("\n arr[2] %u",&arr[2]); printf("\n arr[3] %u",&arr[3]); printf("\n arr[4] %u",&arr[4]); printf("\n arr[5] %u",&arr[5]); printf("\n arr[6] %u",&arr[6]); printf("\n arr[7] %u",&arr[7]); int *q; p=&arr[1]; q=&arr[5]; printf(" i-j %u \n *i-*j %d",q-p,*q-*p); getch(); }
#include "3Dmodel.h" void Modelo::trasladar_figurax(float traslacion){ for (int i = 0; i < vertices.size(); i++){ vertices[i].x+=traslacion; } } void Modelo::trasladar_figuray(float traslacion){ for (int i = 0; i < vertices.size(); i++){ vertices[i].y+=traslacion; } } void Modelo::escalar(double escalado){ _vertex3f punto; for (int i = 0; i < vertices.size(); i++){ punto.x = vertices[i].x*escalado; punto.y = vertices[i].y*escalado; punto.z = vertices[i].z*escalado; vertices[i]=punto; } } void Modelo::rotar_z(double ang){ double angulo = grados_radianes(ang); _vertex3f punto; for (int i = 0; i < vertices.size(); i++){ punto.x = (vertices[i].x * cos(angulo)) - (vertices[i].y * sin(angulo)); punto.y = (vertices[i].x * sin(angulo)) + (vertices[i].y * cos(angulo)); punto.z = vertices[i].z; vertices[i]=punto; } } _vertex3f Modelo::modulizar(_vertex3f normales){ double module = normales.x*normales.x+normales.y*normales.y+normales.z*normales.z; module = sqrt(module); module = 1.0/module; normales.x*= module; normales.y*= module; normales.z*= module; return normales; } void Modelo::generarBarrido(){ _vertex3f normal,P,Q; int v1,v2,v3; for( int i = 0; i < triangulos.size(); i++){ v1=triangulos[i]._0; v2=triangulos[i]._1; v3=triangulos[i]._2; P=vertices[v2]-vertices[v1]; Q=vertices[v3]-vertices[v1]; normal.x=P.y*Q.z-P.z*Q.y; normal.y=Q.x*P.z-P.x*Q.z; normal.z=P.x*Q.y-Q.x*P.y; normal = modulizar(normal); normalesCara.push_back(normal); } } _vertex3f Modelo::rotar(_vertex3f p, double alpha){ _vertex3f point; point.x = cos(alpha) * p.x + sin(alpha) * p.z; point.y = p.y; point.z = -sin(alpha) * p.x + cos(alpha) * p.z; return point; } float Modelo::grados_radianes(float angulo){ return angulo*M_PI/180; } void Modelo::generarRevolucion(float angulo_inicial, float angulo_final){ float ang_ini, ang_fin; ang_ini = grados_radianes(angulo_inicial); ang_fin = grados_radianes(angulo_final); for(unsigned int m = 0;m < vertices.size(); m++){ vertices[m] = rotar(vertices[m],ang_ini); } vector<_vertex3f> puntos(vertices); //Para guardar los nuevos puntos. vector<_vertex3f> perfil(vertices); //Para trabajar con el perfil. vector<_vertex3i> triang; //Para guardar las caras. int pasos = 10; //Numero de perfiles que vamos a generar. //2*pi es una vuelta entera, así pues dividimos entre los perfiles que generaremos double angulo= (ang_ini-ang_fin) / pasos; //perfil[0]=rotar(perfil[0],ang_ini); //puntos[0]=perfil[0]; for(int i = 0; i < pasos; i++){ vector<_vertex3f> siguientePerfil(perfil.size()); for(unsigned int j = 0; j < perfil.size(); j++){ siguientePerfil[j] = rotar(perfil[j],angulo); //Obtenemos el perfil rotado } puntos.insert(puntos.end(),siguientePerfil.begin(),siguientePerfil.end()); //Intrdocimos los nuevos puntos unsigned int inicioPerfil, finPerfil; inicioPerfil = i * perfil.size(); finPerfil = inicioPerfil + perfil.size(); for(unsigned int n = inicioPerfil+1, j = finPerfil+1; n < finPerfil; n++, j++){ //Metemos las caras. triang.push_back(_vertex3i(n-1, j-1,j)); triang.push_back(_vertex3i(n-1,j,n)); } perfil = siguientePerfil; } /* Ahora viene la parte que considero más complicada, para montar las tapas, debemos obtener * el punto superior central y el punto inferior central. Debería obtener la altura del primer y último punto para localizar * las tapas. * */ if(puntos.front().x){ //Tapa superior _vertex3f puntoCentral(0.0, puntos.front().y,0.0); //Metemos el punto central puntos.push_back(puntoCentral); for(int paso = 0; paso < pasos; paso++){ //Solo tenemos que controlar las caras. int perfilActual = paso * perfil.size(); int siguientePerfil = perfilActual + perfil.size(); triang.push_back(_vertex3i(puntos.size()-1,siguientePerfil,perfilActual)); } } if(puntos[perfil.size()-1].x){ //Tapa inferior _vertex3f puntoCentral(0.0,puntos[perfil.size()-1].y,0.0); puntos.push_back(puntoCentral); for(int paso = 0; paso < pasos;paso++){ int perfilActual=(paso+1)*perfil.size()-1; int siguientePerfil=perfilActual + perfil.size(); triang.push_back(_vertex3i(puntos.size()-1,perfilActual,siguientePerfil)); } } setVert(puntos); setTrian(triang); generar_matrix_textura(pasos,perfil.size()); } void Modelo::drawModel(int i){ GLenum dibujo; int v1,v2,v3; float x=0,y=0,z=0; switch(i){ case 0: dibujo = GL_POINTS; //Pintamos Puntos x=1; break; case 1: dibujo = GL_LINE_STRIP; //Pintamos Lineas y=1; break; case 4: drawModel(0); drawModel(1); default: dibujo = GL_TRIANGLES; //Dibujamos triangulos para el sólido, o modo ajedrez x=colore._0; y=colore._1; z=colore._2; break; } glEnable(GL_COLOR_MATERIAL); glPointSize(4); glBegin(dibujo); for(int j =0; j < triangulos.size();j++){ glColor3f(x,y,z); if(i==2){ //Hacemos el ajedrez if((j%2)==0){ //Vamos intercambiando colores glColor3f(0, 0, 0); } } v1 = triangulos.at(j)._0; v2 = triangulos.at(j)._1; v3 = triangulos.at(j)._2; glVertex3f(vertices.at(v1).x, vertices.at(v1).y,vertices.at(v1).z); glVertex3f(vertices.at(v2).x, vertices.at(v2).y,vertices.at(v2).z); glVertex3f(vertices.at(v3).x, vertices.at(v3).y,vertices.at(v3).z); } glEnd(); } void Modelo::dibujar_normales(){ glPointSize(4); glBegin(GL_POINTS); for(int i =0; i < normalesCara.size();i++){ glNormal3f(normalesCara.at(i).x,normalesCara.at(i).y,normalesCara.at(i).z); //glVertex3f(normalesVert.at(i).x,normalesVert.at(i).y,normalesVert.at(i).z); } glEnd(); } void Modelo::mostrar_normales(){ for(int i = 0; i< normalesCara.size(); i++)cout<< " " << normalesCara.at(i).x << " - " << normalesCara.at(i).y << " - " << normalesCara.at(i).z << endl; } void Modelo::esfera(int lados, float rad){ vertices.push_back(_vertex3f(0,rad,0)); float x=0.01; for (int i = 0; i < 200; i++){ vertices.push_back(_vertex3f(x,rad-x,0)); if(x<1)x+=0.01; else x-=0.01; } //creamos la esfera rotando el perfil a través del eje Z generarRevolucion(0, 360); } void Modelo::drawNormales(int i){ GLenum dibujo; float t = 5; int v1,v2,v3; float x=0,y=0,z=0; //glColor3f(colore._0,colore._1,colore._2); if (imagen != NULL){ // Carga la imagen glTexImage2D(GL_TEXTURE_2D, 0, 3, imagen->tamX(), imagen->tamY(), 0, GL_RGB, GL_UNSIGNED_BYTE, imagen->leerPixels()); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); glEnable(GL_TEXTURE_2D); glDisable(GL_COLOR_MATERIAL); } else{ glEnable(GL_COLOR_MATERIAL); glDisable(GL_TEXTURE_2D); glColor3f(colore._0,colore._1,colore._2); } if(i==0){ glBegin(GL_TRIANGLES); for(int j =0; j < triangulos.size();j++){ glColor3f(colore._0,colore._1,colore._2); glNormal3f(normalesCara.at(j).x,normalesCara.at(j).y,normalesCara.at(j).z); v1 = triangulos.at(j)._0; v2 = triangulos.at(j)._1; v3 = triangulos.at(j)._2; glVertex3f(vertices.at(v1).x, vertices.at(v1).y,vertices.at(v1).z); glVertex3f(vertices.at(v2).x, vertices.at(v2).y,vertices.at(v2).z); glVertex3f(vertices.at(v3).x, vertices.at(v3).y,vertices.at(v3).z); } glEnd(); } else{ glBegin(GL_TRIANGLES); for(int j =0; j < triangulos.size();j++){ glColor3f(colore._0,colore._1,colore._2); v1 = triangulos.at(j)._0; v2 = triangulos.at(j)._1; v3 = triangulos.at(j)._2; if (texturas.size() > 0) glTexCoord2f(texturas[v1].x, texturas[v1].y); if (normalesCara.size() > 0) glNormal3f(normalesCara[v1].x, normalesCara[v1].y, normalesCara[v1].z); glVertex3f(vertices[v1].x, vertices[v1].y, vertices[v1].z); if (texturas.size() > 0) glTexCoord2f(texturas[v2].x, texturas[v2].y); if (normalesCara.size() > 0) glNormal3f(normalesCara[v2].x, normalesCara[v2].y, normalesCara[v2].z); glVertex3f(vertices[v2].x, vertices[v2].y, vertices[v2].z); if (texturas.size() > 0) glTexCoord2f(texturas[v3].x, texturas[v3].y); if (normalesCara.size() > 0) glNormal3f(normalesCara[v3].x, normalesCara[v3].y, normalesCara[v3].z); glVertex3f(vertices[v3].x, vertices[v3].y, vertices[v3].z); } glEnd(); } /* glPointSize(4); glBegin(dibujo); for (int i= 0; i < vertices.size(); i++) { _vertex3f _1 = vertices.at(i); _vertex3f _2; _2.x = _1.x + t * normalesVert.at(i).x; _2.y = _1.y + t * normalesVert.at(i).y; _2.z = _1.z + t * normalesVert.at(i).z; glVertex3f(_1.x, _1.y, _1.z); glVertex3f(_2.x, _2.y, _2.z); } glEnd(); */ } void Modelo::generar_matrix_textura(int n, int m){ double distancias[m]; distancias[0]=0; for(unsigned int k=1; k<m; k++)distancias[k] = distancias[k-1] + distancia(vertices[k-1], vertices[k]); for(unsigned int i=0; i<n; i++){ for(unsigned int j=0; j<m; j++){ float si = (float)i/(n-1); float tj = distancias[j]/distancias[m-1]; texturas.push_back(_vertex2f(si, tj)); } } } double Modelo::distancia(_vertex3f a, _vertex3f b){ double x = pow((b.x-a.x), 2); double y = pow((b.y-a.y), 2); double z = pow((b.z-a.z), 2); return sqrt((double)(x+y+z)); }
// Calculates the sum of dist(v,u) for all pairs of vertices v, u. // Running time: O(n) int distsum, n; int dfs(int v, int p=-1, int w=0) { int k = 1; for (int i = 0; i < G[v].size(); i++) { int u = G[v][i].first, w = G[v][i].second; if (u != p) k += dfs(u, v, w); } distsum += w*(n-k)*k; return k; }
/** * Author : BurningTiles * Created : 2020-08-07 01:02:38 **/ #include <bits/stdc++.h> #define ll long long using namespace std; int main(){ ll i, d, z, tt; bool flag = false; cin >> tt; while(tt--){ flag = false; cin >> i >> d >> z; for(int j=2; j<=z; ++j){ if((i+d)%j==0 && z%j==0){ flag = true; break; } } if(!flag){ cout << "-1" << endl; continue; } while(true){ i+=d; if(i%z == 0){ cout << i/z << endl; break; } } } return 0; } /** Welcome to the Planet Zandar, the second most prominent planet in the Milky Way Galaxy (of course after our own Earth). The planet is in a distress condition, a Group of Galactic pirates, Zorons have stolen the Trident Crystal, which is the main source of energy of the planet, and are escaping the Galaxy. The Nova Corps, the military agency of Zandar, have gathered intelligence that the Zoronion space craft can run in cosmic leaps of exactly D units, (it means that the space craft will move D units from its position in every leap/turn) and is currently I units away from Zandar. The Zandarian Space crafts can run in cosmic leaps of exactly Z units. The Commander of Nova Corps wants to know the smallest number of leaps required to catch Zorons (Note that it is possible to catch the pirates only when they will be at the same point in the cosmic universe). The Zorons, even though are clever thieves, travel in one direction, and keep jumping exactly D units without stopping at any point. The Nova Corps can dial in the number of jumps they need to make (each of them exactly Z units), and reach the place almost instantly. They can then wait there until the Zorons arrive, and recover the Trident Crystal. However, their wizard has told them that there may be situations where it is impossible for the Nova corps to be at the same distance as the Zorons. As the planet is out of power currently, their supercomputers are shut down and they are not able to calculate the required information. As you are there from Earth they have approached you for help. Note: Assume that the Cosmic universe is one dimensional. Input An integer T for number of test cases, followed by T test cases each one consisting of three numbers 1) I :- initial distance of Zorons 2) D:- distance covered in a single cosmic leap by Zoronion space craft. 3) Z:- distance covered by Zandarian space crafts. Output Single number, the number of leaps required to catch the pirates, and if it is not possible to catch them, output will be -1 Constraints 1 ≤ I,D ≤ 10^12 1≤ Z ≤ 10^9 Sample Input 1 2 9 5 12 5 7 9 Sample Output 1 2 6 Explanation The first line is 2, so T is 2, and there are 2 test cases. In the first test case, The Zorons will initially be at 9 and then they will leap to 14,19 24..... The Nova Corps can take leaps of 12 and will catch them nearest at a distance 24, taking 2 leaps 12 and 24. In the second test case, The Zorons will initially be at 5 and then they will leap to 12,19 26, 33, 40, 47, 54..... The Nova Corps can take leaps of 9 and will catch them nearest at 54, taking 6 leaps. Hence the output has 2 lines, 2 and 6. Sample Input 2 1 10 15 20 Sample Output 2 2 Explanation The first line is 1, so T is 1, and there is 1 test case. The Zorons will initially be at 10, and jump in jumps of 15, landing at 25,40 The Nova Corps take leaps of 20, and arrive at 20, 40. Hence, they can meet at 40 after 2 leaps. The output is 2. **/
// // Created by hw730 on 2020/6/11. // #ifndef DEFENCE_GAME_MONSTERLINKLISTMANAGER_H #define DEFENCE_GAME_MONSTERLINKLISTMANAGER_H class MonsterLinkListManager { }; #endif //DEFENCE_GAME_MONSTERLINKLISTMANAGER_H
#include <iostream> #include <unistd.h> #include <cstdio> #include <cstdlib> #include <cstring> #include <sys/types.h> // socket 及 宏定义头文件 #include <sys/socket.h> #include <netinet/in.h> //sockaddr_in htonl等 #include <arpa/inet.h> // inet_pton 等 #include <fcntl.h> #include <sys/select.h> #include <sys/time.h> using namespace std; constexpr int BufferLen = 2048; void ExitWithError(const char *pro) { perror(pro); exit(EXIT_FAILURE); } void setNonBlock(const int fd) { if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) == -1) ExitWithError("fcntl"); } int createSocket(const char *serverIp, const int serverPort, const int DOMAIN = AF_INET) { int sfdes = socket(DOMAIN, SOCK_STREAM, 0); if (sfdes == -1) { ExitWithError("create socket error"); } else { cout << "套接字创建成功..." << endl; } setNonBlock(sfdes); return sfdes; } int main(int argc, char *argv[]) { if (argc != 3) { cerr << "使用方法 : ./tcp_client1-1 <ip> <port>" << endl; exit(EXIT_FAILURE); } const char *ipAddr = argv[1]; const int port = atoi(argv[2]); fd_set rfds, wfds; int sfdes = createSocket(ipAddr, port); struct sockaddr_in serverAddr; memset(&serverAddr, 0, sizeof(serverAddr)); serverAddr.sin_family = AF_INET; serverAddr.sin_port = htons(port); serverAddr.sin_addr.s_addr = inet_addr(ipAddr); // 清空fds FD_ZERO(&wfds); FD_ZERO(&rfds); // 将clientFd加入 FD_SET(sfdes, &wfds); FD_SET(sfdes, &rfds); // select设置 timeval 设置为NULL 无可读文件便一直阻塞 if (select(sfdes + 1, &rfds, &wfds, NULL, NULL) == -1) ExitWithError("select"); // 初始化连接 if (connect(sfdes, (struct sockaddr*)(&serverAddr), sizeof(serverAddr)) == -1) { int val; socklen_t len; getsockopt(sfdes, SOL_SOCKET, SO_ERROR, &val, &len); if (val != 0) ExitWithError("connect socket error"); } cout << "connect server with IP : " << inet_ntoa(serverAddr.sin_addr) << ", with PORT : " << ntohs(serverAddr.sin_port) << endl; char *buffer = new char[BufferLen]; if (buffer == nullptr) { cerr << "bad_alloc" << endl; close(sfdes); exit(EXIT_FAILURE); } // 清空fds FD_ZERO(&rfds); // 将clientFd加入 FD_SET(sfdes, &rfds); // select设置 timeval 设置为NULL 无可读文件便一直阻塞 int selRet = select(sfdes + 1, &rfds, NULL, NULL, NULL); if (selRet == -1) { ExitWithError("select"); } else if (selRet == 0) { // 设为NULL不存在超时 cout << "the timeout expires" << endl; } int recvLen = recv(sfdes, buffer, BufferLen, 0); if (recvLen == -1) { ExitWithError("recv error"); } else if (recvLen == 0) { cout << "连接关闭" << endl; exit(EXIT_FAILURE); } else cout << "Message From " << inet_ntoa(serverAddr.sin_addr) << " : " << buffer << endl; close(sfdes); return 0; }
#include<bits/stdc++.h> using namespace std; int main() { int n,k,x=0,count=0; cin>>n>>k; n=n+1; vector<int> v; int a[1000]={0}; for(int i=4;i<=n;i+=2) a[i]=1; for(int i=3;i<=sqrt(n);i+=2) { if(a[i]==0){ for(int j=i*i;j<n;j+=i) { a[j]=1; } } } for(int i=2;i<=n;i++) { if(a[i]==0) v.push_back(i); } for(int i=0;i<v.size()-1;i++) { x=v[i]+v[i+1]+1; if(binary_search(v.begin(),v.end(),x)) count++; } //cout<<count<<endl; if(count>=k) cout<<"YES"<<endl; else cout<<"NO"<<endl; }
#ifndef ROSE_RTIHELPERS_H #define ROSE_RTIHELPERS_H #include <string> #include <vector> #include <list> #include <set> #include <sstream> #include <iomanip> #include <boost/lexical_cast.hpp> // Helpful functions for Cxx_GrammarRTI.C // Probably should not be included anywhere else #if ROSE_USE_VALGRIND #include <valgrind/valgrind.h> #include <valgrind/memcheck.h> #include <stdio.h> static void doUninitializedFieldCheck(const char* fieldName, void* fieldPointer, size_t fieldSize, void* wholeObject, const char* className) { if (VALGRIND_CHECK_READABLE(fieldPointer, fieldSize)) { fprintf(stderr, "Warning: uninitialized field p_%s of object %p of class %s\n", fieldName, wholeObject, className); } } #endif template <typename T> static std::string toStringForRTI(const T& x) { std::ostringstream ss; ss << x; return ss.str(); } template <typename T> static std::string toStringForRTI(const std::vector<T>& x) { std::ostringstream ss; ss << "["; for (typename std::vector<T>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i);} ss << "]"; return ss.str(); } // DQ (8/8/2008): Added support for type used in binary file format support. template <typename T> static std::string toStringForRTI(const std::vector<std::pair<T,T> >& x) { std::ostringstream ss; ss << "["; for (typename std::vector<std::pair<T,T> >::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } static std::string toStringForRTI(const ExtentMap &x) { std::ostringstream ss; ss << "["; for (ExtentMap::const_iterator i=x.begin(); i!=x.end(); ++i) { if (i!=x.begin()) ss << ", "; ss << i->first << "->" << i->second; } ss <<"]"; return ss.str(); } // DQ (8/29/2008): Added the support for the Robb's SgSharedVector class. template <typename T> static std::string toStringForRTI(const SgSharedVector<T>& x) { std::ostringstream ss; ss << "["; printf ("Warning: SgSharedVector iterator support is not finished! \n"); // ROSE_ASSERT(false); // for (typename std::vector<T>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i);} ss << "]"; return ss.str(); } static std::string toStringForRTI(const std::vector<bool>& x) { std::ostringstream ss; ss << "["; for (std::vector<bool>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i ? "T" : "F");} ss << "]"; return ss.str(); } template <typename T> static std::string toStringForRTI(const std::list<T>& x) { std::ostringstream ss; ss << "["; for (typename std::list<T>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i);} ss << "]"; return ss.str(); } template <typename T> static std::string toStringForRTI(const std::set<T>& x) { std::ostringstream ss; ss << "["; for (typename std::set<T>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i);} ss << "]"; return ss.str(); } template <typename K, typename V> static std::string toStringForRTI(const std::map<K, V>& x) { std::ostringstream ss; ss << "["; for (typename std::map<K, V>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } // negara1 (06/27/2011): Added support for the map of including files (field p_preprocessorDirectivesAndCommentsList) template <typename K> static std::string toStringForRTI(const std::map<K, std::set<PreprocessingInfo*> >& x) { std::ostringstream ss; ss << "["; for (typename std::map<K, std::set<PreprocessingInfo*> >::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << toStringForRTI(i->second);} ss << "]"; return ss.str(); } // DQ (4/30/2009): Added new support for std::multimap. template <typename K, typename V> static std::string toStringForRTI(const std::multimap<K, V>& x) { std::ostringstream ss; ss << "["; for (typename std::multimap<K, V>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #if 0 static std::string toStringForRTI(const std::map<std::pair<int,std::pair<int,int> >, uint64_t > & x) { std::ostringstream ss; ss << "["; // for (std::vector<bool>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i ? "T" : "F");} ss << "]"; return ss.str(); } #endif #if 0 static std::string toStringForRTI(const std::map<uint64_t ,std::pair<int,std::pair<int,int> > > & x) { std::ostringstream ss; ss << "["; // for (std::vector<bool>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << (*i ? "T" : "F");} ss << "]"; return ss.str(); } #endif #if 1 // #if !OLD_GRAPH_NODES //#ifdef ROSE_USE_NEW_GRAPH_NODES // DQ (8/18/2008): Added support for new Graph IR node. #ifdef ROSE_USING_GRAPH_IR_NODES_FOR_BACKWARD_COMPATABILITY // static std::string toStringForRTI(const SgGraphNodeDirectedGraphEdgeMultimapPtrList & x) static std::string toStringForRTI(const rose_graph_node_edge_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeUndirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #endif static std::string toStringForRTI(const rose_graph_integer_node_hash_map & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeUndirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } static std::string toStringForRTI(const rose_graph_integer_edge_hash_map & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeUndirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } static std::string toStringForRTI(const rose_graph_integer_edge_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeUndirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } static std::string toStringForRTI(const rose_graph_string_integer_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (rose_graph_string_integer_hash_multimap::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } static std::string toStringForRTI(const rose_graph_integerpair_edge_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (rose_graph_string_integer_hash_multimap::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #if 0 // DQ (4/30/2009): Removed these in favor of the hash_multimap using the SgGraphEdge class. static std::string toStringForRTI(const rose_undirected_graph_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeUndirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #endif #if 0 // DQ (4/30/2009): Removed these in favor of the hash_multimap using the SgGraphEdge class. static std::string toStringForRTI(const rose_directed_graph_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeDirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #endif #ifdef ROSE_USING_GRAPH_IR_NODES_FOR_BACKWARD_COMPATABILITY // DQ (8/18/2008): Added support for new Graph IR node. // static std::string toStringForRTI(const SgStringGraphNodeMapPtrList & x) static std::string toStringForRTI(const rose_graph_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (SgStringGraphNodeMapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #endif #if 0 // DQ (5/1/2009): This is no longer used and is replaced by an implementation using a hash_map. // DQ (8/18/2008): Added support for new Graph IR node. // static std::string toStringForRTI(const SgIntegerGraphNodeMapPtrList & x) static std::string toStringForRTI(const std::map<int, SgGraphNode*> & x) { std::ostringstream ss; ss << "["; // for (SgIntegerGraphNodeMapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} for (std::map<int, SgGraphNode*>::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #endif #if 0 // DQ (4/25/2009): This is now redundant... // DQ (8/18/2008): Added support for new Graph IR node. // static std::string toStringForRTI(const SgGraphNodeUndirectedGraphEdgeMultimapPtrList & x) static std::string toStringForRTI(const rose_undirected_graph_hash_multimap & x) { std::ostringstream ss; ss << "["; // for (SgGraphNodeUndirectedGraphEdgeMultimapPtrList::const_iterator i = x.begin(); i != x.end(); ++i) {if (i != x.begin()) ss << ", "; ss << i->first << "->" << i->second;} ss << "]"; return ss.str(); } #endif #endif //#endif // end condition new_graph static std::string toStringForRTI(const SgAccessModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgUPC_AccessModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgConstVolatileModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgElaboratedTypeModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgTypeModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgStorageModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgDeclarationModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgFunctionModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgSpecialFunctionModifier& m) { return m.displayString(); } static std::string toStringForRTI(const SgName& n) { return n.getString(); } static std::string toStringForRTI(const SgFunctionModifier::opencl_work_group_size_t & x) { std::ostringstream os; os << " ( " << x.x << ", " << x.y << ", " << x.z << " ) "; return os.str(); } #if 0 // None of these seem to be used template <typename Sym> static std::string toStringForRTISymbol(Sym* sym) { std::ostringstream ss; ss << sym; if (sym) { ss << ": varsym " << sym->get_name().str() << " declared at 0x" << std::hex << (sym->get_declaration()); } return ss.str(); } static std::string toStringForRTI(SgVariableSymbol* sym) {return toStringForRTISymbol(sym);} static std::string toStringForRTI(SgFunctionSymbol* sym) {return toStringForRTISymbol(sym);} static std::string toStringForRTI(SgMemberFunctionSymbol* sym) {return toStringForRTISymbol(sym);} static std::string toStringForRTI(const SgSymbolTable&) {return "<no output operator defined for this type>";} static std::string toStringForRTI(const SgSymbolHashBase::iterator&) {return "<no output operator defined for this type>";} #endif void doRTI(const char* fieldNameBase, void* fieldPtr, size_t fieldSize, void* thisPtr, const char* className, const char* typeString, const char* fieldName, const std::string& fieldContents, RTIMemberData& memberData); #endif // ROSE_RTIHELPERS_H
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. 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 University of Oxford 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. */ #ifndef ABSTRACTCORRECTIONTERMASSEMBLER_HPP_ #define ABSTRACTCORRECTIONTERMASSEMBLER_HPP_ #include "AbstractCardiacFeVolumeIntegralAssembler.hpp" #include "AbstractCardiacTissue.hpp" /** * A parent class for MonodomainCorrectionTermAssembler and BidomainCorrectionTermAssembler, * used for state variable interpolation (SVI). */ template<unsigned ELEM_DIM,unsigned SPACE_DIM,unsigned PROBLEM_DIM> class AbstractCorrectionTermAssembler : public AbstractCardiacFeVolumeIntegralAssembler<ELEM_DIM,SPACE_DIM,PROBLEM_DIM,true,false,CARDIAC> { protected: /** Ionic current to be interpolated from cache */ double mIionicInterp; /** State variables interpolated onto quadrature point */ std::vector<double> mStateVariablesAtQuadPoint; /** * Resets interpolated state variables and ionic current. */ void ResetInterpolatedQuantities( void ); /** * Vector of bools, one bool per element, representing whether each * element can do SVI. If the element has different cell models at * each node, or has been designated a bath element, then it cannot * do SVI. */ std::vector<bool> mElementsCanDoSvi; /** * Interpolates state variables and ionic current. * * @param phiI * @param pNode */ void IncrementInterpolatedQuantities(double phiI, const Node<SPACE_DIM>* pNode); /** * @return true if we should assemble the correction term for this element. * Checks if there is a sufficiently steep ionic current gradient to make the expense worthwhile, by checking * if the maximum difference between nodal ionic currents is greater than 1 uA/cm^2^. * * @param rElement the element to test */ bool ElementAssemblyCriterion(Element<ELEM_DIM,SPACE_DIM>& rElement); public: /** * Constructor. * * @param pMesh pointer to the mesh * @param pTissue pointer to the cardiac tissue */ AbstractCorrectionTermAssembler(AbstractTetrahedralMesh<ELEM_DIM,SPACE_DIM>* pMesh, AbstractCardiacTissue<ELEM_DIM,SPACE_DIM>* pTissue); }; #endif /*ABSTRACTCORRECTIONTERMASSEMBLER_HPP_*/
#pragma once #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #include "object.h" class Bound:public Object{ private: sf::Sprite shape; int w; int h; sf::Texture texture; public: Bound(int _x, int _y, int _w, int _h, int _r, int _g, int _b); void draw(sf::RenderWindow& window); int getW(); int getH(); sf::Sprite getShape(); void loadTexture(std::string name); };
#include "configReader.h" #ifdef __ROOT__ ClassImp(ConfigReader) #endif ConfigReader::ConfigReader() { mCommentString = "#"; mSectionString = "%"; } ConfigReader::ConfigReader(string fileName) { mCommentString = "#"; mSectionString = "%"; readFile(fileName); } void ConfigReader::readFile(string fileName) { ifstream configFile(fileName.c_str()); string line; string sectionName = "default"; while (getline(configFile, line)) { if( line.find(mCommentString, 0) == 0) { continue; } if( line.find(mSectionString, 0) == 0 ) { sectionName = line.substr(1, line.length()); continue; } int firstSpace = line.find(" ", 0); if(firstSpace >=1) { string key = line.substr(0, firstSpace); string value = line.substr(firstSpace + 1, line.length() - 1); options[sectionName][key] = value; } } //end while } vector<string> ConfigReader::getV(string key, string section, string delim ) { string valString = get(key, section); vector<string> valVector; int delimPosition = valString.find(delim, 0); while( delimPosition >= 0 ) { valVector.push_back( valString.substr(0, delimPosition) ); valString = valString.substr( delimPosition + 1, valString.length() - 1 ); delimPosition = valString.find(delim, 0); } // Get last item valVector.push_back(valString); return valVector; } vector<int> ConfigReader::getVI(string key, string section, string delim) { vector<string> stringVector = getV(key, section, delim); vector<int> intVector; for(unsigned i = 0; i <= (stringVector.size() - 1); i++) { int element = atoi( stringVector.at(i).c_str() ); intVector.push_back(element); } return intVector; } vector<float> ConfigReader::getVF(string key, string section, string delim) { vector<string> stringVector = getV(key, section, delim); vector<float> floatVector; for(unsigned i = 0; i <= (stringVector.size() - 1); i++) { float element = atof( stringVector.at(i).c_str() ); floatVector.push_back(element); } return floatVector; }
#include <bits/stdc++.h> using namespace std; int main() { int n, p, p2; cin>>n>>p; p2 = (n%2==0 ? n+1-p : n-p); p = (p%2==0 ? p/2 : (p-1)/2); p2 = (p2%2==0 ? p2/2 : (p2-1)/2); cout<<min(p, p2)<<endl; }
#include "../inc.h" TreeNode * help(TreeNode * root) { if(!root) return NULL; TreeNode * r = help(root->left); if(r) return r; r = help(root->right); if(r) return r; return (root->val ? root : NULL); } void solve(TreeNode * root) { if(!root) return; if(0 == root->val){ TreeNode * n = help(root); if(!n) return; swap(n->val, root->val); } solve(root->left); solve(root->right); } int main() { { TreeNode n[7]; n[0].left = &n[1]; n[0].right = &n[2]; n[1].left = &n[3]; n[1].right = &n[4]; n[2].left = &n[5]; //n[2].right = &n[6]; n[5].val = 1; solve(n); print(n); } { TreeNode n[7]; n[0].left = &n[1]; n[0].right = &n[2]; n[1].left = &n[3]; n[1].right = &n[4]; n[2].left = &n[5]; n[2].right = &n[6]; n[3].val = 2; n[4].val = 3; n[5].val = 4; n[6].val = 5; solve(n); print(n); } { TreeNode n[7]; n[0].left = &n[1]; n[0].right = &n[2]; n[1].left = &n[3]; n[1].right = &n[4]; n[2].left = &n[5]; n[2].right = &n[6]; n[1].val = 1; n[2].val = 1; n[3].val = 2; n[4].val = 3; n[5].val = 4; n[6].val = 5; solve(n); print(n); } }
/** * Class Controller * @author Patricio Ferreira <3dimentionar@gmail.com> * Copyright (c) 2017 nahuelio. All rights reserved. **/ #include <iostream> #include "headers/Controller.h" #include <GLFW/glfw3.h> using namespace game_controller; Controller::Controller() {}; void Controller::onError(int error, const char *desc) { std::cout << printf("Error %d: %s", error, desc); return; }; void Controller::onGLFWError(const char *desc) { printf("GLFW Error: %s", desc); glfwTerminate(); return; }; Controller *Controller::run() { return this; } void Controller::terminate() { glfwTerminate(); return; };
#include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; #define nx (x + xx[i]) #define ny (y + yy[i]) const int maxn = 505; int n, m, h[maxn][maxn]; bool vis[maxn][maxn] = { false }; int s[maxn][maxn], t[maxn][maxn], xx[4] = { -1, 1, 0, 0 }, yy[4] = { 0, 0, -1, 1 }; void init() { memset(s, 0x3f, sizeof(s)); memset(t, 0xff, sizeof(t)); for (int i = 0; i < m; ++i) s[n - 1][i] = t[n - 1][i] = i; } bool valid(int x, int y) { if (x >= 0 && x < n && y >= 0 && y < m) return true; return false; } void dfs(int x, int y) { vis[x][y] = true; for (int i = 0; i < 4; ++i) if (valid(nx, ny) && h[x][y] > h[nx][ny]) { if (!vis[nx][ny]) dfs(nx, ny); s[x][y] = min(s[x][y], s[nx][ny]); t[x][y] = max(t[x][y], t[nx][ny]); } } // #define DEBUG int main() { #ifdef DEBUG freopen("d:\\.in", "r", stdin); freopen("d:\\.out", "w", stdout); #endif cin >> n >> m; init(); for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> h[i][j]; for (int i = 0; i < m; ++i) if (!vis[0][i]) dfs(0, i); int cnt = 0; for (int i = 0; i < m; ++i) if (!vis[n - 1][i]) ++cnt; if (cnt) { cout << 0 << endl << cnt; return 0; } int left = 0, right = 0; while (left < m) { for (int i = 0; i < m; ++i) if (s[0][i] <= left) right = max(right, t[0][i]); ++cnt; left = right + 1; } cout << 1 << endl << cnt; return 0; }
#include <stdio.h> #include <stdlib.h> class Graph { private: int **arr; bool *visited; public: int n; Graph() { int N; FILE * f; f = fopen("input.txt", "r"); fscanf(f, "%d", &N); this->n = N; visited = (bool *)calloc(sizeof(bool), N); arr = (int **)calloc(sizeof(int*),N); for (int i = 0; i < N; i++) { arr[i] = (int *)calloc(sizeof(int), N); for (int j = 0; j < N; j++) { fscanf(f, "%d", &(this->arr[i][j])); } } fclose(f); } void write() { for (int i = 0; i < this->n; i++) { printf("\n"); for (int j = 0; j < this->n; j++) printf("%d ", this->arr[i][j]); } printf("\n"); } bool Euler() { bool euler = true; int chet; for (int i = 0; i < this->n; i++) { chet = 0; for (int j = 0; j < this->n; j++) { chet += this->arr[i][j]; } if ((chet % 2) == 1) euler = false; } return euler; } bool Smezh(int i, int j) { if (this->arr[i][j] != 0) return true; else { return false; } } bool Gamil(int v,int w,int d) { if (d == 1 && Smezh(w, v)) return true; visited[v] = true; for (int t = 0; t < this->n; t++) if (Smezh(t, v)) if (!visited[t]) if (Gamil(t, w, d - 1)) return true; visited[v] = false; return false; } }; void main() { Graph *graph = new Graph(); graph->write(); if (graph->Euler()) printf("GRAPH IS EULER\n"); else { printf("GRAPH ISNT EULER\n"); } if (graph->Gamil(0,0,graph->n)) printf("GRAPH IS GAMILTONIAN\n"); else { printf("GRAPH ISNT GAMILTONIAN\n"); } }
/** * Copyright (c) William Niemiec. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <fstream> #include <string> #include <initializer_list> #include <functional> #include <list> #include "HistoryConsolex.hpp" #include "LoggerConsolex.hpp" #include "LogLevel.hpp" namespace wniemiec { namespace io { namespace cpp { /** * Responsible for console output. */ class OutputConsolex { //------------------------------------------------------------------------- // Attributes //------------------------------------------------------------------------- private: static const int MARGIN_LEFT; static const int DIV_WIDTH; static const std::string DIV_SYMBOL; HistoryConsolex* history; LoggerConsolex* logger; int margin_left; //------------------------------------------------------------------------- // Constructor //------------------------------------------------------------------------- public: OutputConsolex(); //------------------------------------------------------------------------- // Methods //------------------------------------------------------------------------- public: static std::string build_margin(int width); static std::string build_div(std::string symbol); static std::string build_title(std::string title); static std::string build_spaces(int amount); void write_line(std::string line); void write_lines(std::initializer_list<std::reference_wrapper<std::string>> lines); void write_lines(std::list<std::string> lines); void write(std::string content); void write_file_lines(std::string filepath); void write_file_lines_with_enumeration(std::string filepath); void write_div(); void write_div(std::string symbol); void write_header(std::string line); void write_header(std::string line, std::string symbol); void write_error(std::string message); void write_warning(std::string message); void write_info(std::string message); void write_debug(std::string message); void clear_history(); void dump_to(std::string output); private: void write_line_with_enumeration(std::string line, int lineNumber); std::string add_margin(std::string line); std::string normalize(std::string file); void write_title(std::string title); //------------------------------------------------------------------------- // Getters & Setters //------------------------------------------------------------------------- public: static std::string get_default_div_symbol(); void set_logger_level(LogLevel* level); void set_margin_left(int margin); std::vector<std::string> get_history(); }; }}}
#include <iostream> #include <algorithm> #include <queue> #include <string> using namespace std; char map[51][51]; int dp[51][51],startp,endp; queue<pair<int,int>> stream,mole; int dir[4][2] = {{1,0},{0,1},{-1,0},{0,-1}}; int main() { int R,C; cin >> R >> C; for(int i=0;i<R;i++){ string buf; cin >> buf; for(int j=0;j<C;j++){ map[i][j] = buf[j]; if(buf[j] == 'S') startp= i * C + j; else if(buf[j] == 'D'){ endp = i * C + j; } else if(buf[j] == '*'){ stream.push({i,j}); } } } mole.push({startp / C,startp % C}); dp[startp / C][startp % C] = 1; while(!mole.empty()){ int streamlength = stream.size(); for(int i=0;i<streamlength;i++){ int x = stream.front().first; int y = stream.front().second; stream.pop(); for(int k=0;k<4;k++){ int nextX= x + dir[k][0]; int nextY = y + dir[k][1]; if(nextX >= 0 && nextX < R && nextY >= 0 && nextY < C){ if(map[nextX][nextY] == '.'){ map[nextX][nextY] = '*'; stream.push({nextX,nextY}); } } } } int molesize = mole.size(); for(int i=0;i<molesize;i++){ int x = mole.front().first; int y = mole.front().second; mole.pop(); if(x == endp / C && y == endp % C){ cout << dp[x][y] - 1 << '\n'; exit(0); } for(int k=0;k<4;k++){ int nextX = x + dir[k][0]; int nextY = y + dir[k][1]; if(nextX >= 0 && nextX < R && nextY >= 0 && nextY < C){ if(map[nextX][nextY] != '*'&&map[nextX][nextY] != 'X'&&dp[nextX][nextY] == 0){ dp[nextX][nextY] = dp[x][y] + 1; mole.push({nextX,nextY}); } } } } } cout << "KAKTUS" << '\n'; }
// -*- C++ -*- // // Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory, // Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC // // This file is part of FreePOOMA. // // FreePOOMA is free software; you can redistribute it and/or modify it // under the terms of the Expat license. // // 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 Expat // license for more details. // // You should have received a copy of the Expat license along with // FreePOOMA; see the file LICENSE. // //----------------------------------------------------------------------------- // Test of DynamicLayout //----------------------------------------------------------------------------- // Include files #include "Layout/DynamicLayout.h" #include "Partition/GridPartition.h" #include "Utilities/Tester.h" #include "Pooma/Pooma.h" #include "Domain/Range.h" #include "Domain/Grid.h" #if POOMA_NO_STRINGSTREAM #include <strstream> #else #include <sstream> #endif #define BARRIER #ifndef BARRIER #if POOMA_CHEETAH # define BARRIER Pooma::controller()->barrier() #else # define BARRIER #endif #endif void printLayout(Inform &out, const std::string msg, const DynamicLayout &l); void printLayout(Inform &out, const std::string msg, const DynamicLayout &l) { DynamicLayout::const_iterator pos; const int numContexts = Pooma::contexts(); const int myContext = Pooma::context(); BARRIER; out.setOutputContext(0); out << msg << std::endl; out.setOutputContext(-1); BARRIER; // This looks like a silly loop, but with the BARRIER it causes the contexts // to print things in order. for (int i = 0; i < numContexts; ++i) { if (myContext == i) for (pos = l.beginLocal(); pos != l.endLocal(); ++pos) out << pos->domain() << std::endl; BARRIER; } out.setOutputContext(0); out << "Total Domain = " << l.domain() << std::endl; BARRIER; } int main(int argc, char *argv[]) { Pooma::initialize(argc, argv); Pooma::Tester tester(argc, argv); const int numContexts = Pooma::contexts(); const int myContext = Pooma::context(); tester.out() << "Testing dynamic ops in DynamicLayout class . . .\n"; tester.out() << "Running with " << numContexts << " contexts." << std::endl; Interval<1> domain; int numBlocks = numContexts * 5; tester.out() << "Creating DynamicLayout with domain " << domain << " and " << numBlocks << " blocks." << std::endl; BARRIER; Loc<1> foo(numBlocks); GridPartition<1> gp(foo); DistributedMapper<1> cmap(gp); DynamicLayout layout(domain, gp, cmap); DynamicLayout::iterator pos; std::string msg("Here are the patch domains for the initial partitioning:"); printLayout(tester.out(), msg, layout); // Creates 35 elements in the first patch of each subdomain. for (int i = 0; i < numContexts; ++i) { if (i == myContext) { layout.create(35,0); layout.create(10,1); #if POOMA_NO_STRINGSTREAM std::strstream s; #else std::ostringstream s; #endif s << "Here are the patch domains after adding elements\n" << "to the first two patches on context " << i << ", before syncing."; printLayout(tester.out(), s.str(), layout); BARRIER; layout.sync(); #if POOMA_NO_STRINGSTREAM std::strstream ss; #else std::ostringstream ss; #endif ss << "Here are the patch domains on context " << i << ", after syncing."; printLayout(tester.out(), ss.str(), layout); BARRIER; } } BARRIER; int ret = tester.results("DynamicLayout Test2"); Pooma::finalize(); return ret; }
/* value_test_utils.cpp -*- C++ -*- Rémi Attab (remi.attab@gmail.com), 25 Apr 2015 FreeBSD-style copyright and disclaimer apply */ #include "test_types.h" #include "dsl/all.h" #include "types/primitives.h" #include "types/std/map.h" #include "types/std/vector.h" #include "types/std/string.h" #include "types/std/smart_ptr.h" /******************************************************************************/ /* CUSTOM */ /******************************************************************************/ reflectTypeImpl(Custom) { reflectPlumbing(); reflectFn(parseJson); reflectFn(printJson); reflectTypeValue(json, reflect::json::custom("parseJson", "printJson")); } /******************************************************************************/ /* BASICS */ /******************************************************************************/ Basics:: Basics() : boolean(false), integer(0), floating(0), stringPtr(nullptr), nullPtr(nullptr), skip(0), alias(0), next(nullptr) {} Basics:: ~Basics() { if (stringPtr) delete stringPtr; for (const auto& item : vectorPtr) delete item; for (const auto& entry : mapPtr) delete entry.second; if (next) delete next; } void Basics:: construct(Basics& value) { value.boolean = true; value.integer = 123; value.floating = 123.321; value.string = "abc"; value.stringPtr = new std::string("def"); value.stringShared = std::make_shared<std::string>("ghi"); value.skip = 0; value.alias = 654; value.custom = { 789 }; auto pInt = [](int64_t i) { return new int64_t(i); }; value.vector = { 1, 2, 3 }; value.vectorPtr = { pInt(4), pInt(5), pInt(6) }; value.map = { {"abc", 10}, {"def", 20} }; value.mapPtr = { {"hig", pInt(30)} }; value.next = new Basics; value.next->integer = 10; value.next->next = new Basics; value.next->next->integer = 20; } bool Basics:: operator==(const Basics& other) const { auto err = [] (const std::string& msg) { std::cerr << "ERROR: " << msg << std::endl; return false; }; bool ok = boolean == other.boolean && integer == other.integer && floating == other.floating && string == other.string && skip == other.skip && alias == other.alias && custom == other.custom; if (!ok) return err("basics"); if ((stringPtr == nullptr) != (other.stringPtr == nullptr)) return err("ptr.nil"); if (stringPtr && (*stringPtr != *other.stringPtr)) return err("ptr.eq"); if (nullPtr) return err("nullPtr"); if (nullShared) return err("nullShared"); if (vector.size() != other.vector.size()) return err("vec.size"); for (size_t i = 0; i < vector.size(); ++i) { if (vector[i] != other.vector[i]) return err("vec.item"); } if (vectorPtr.size() != other.vectorPtr.size()) return err("vecPtr.size"); for (size_t i = 0; i < vectorPtr.size(); ++i) { if (*vectorPtr[i] != *other.vectorPtr[i]) return err("vecPtr.item"); } if (map.size() != other.map.size()) return err("map.size"); for (const auto& entry : map) { auto it = other.map.find(entry.first); if (it == other.map.end() || entry.second != it->second) return err("map.entry"); } if (mapPtr.size() != other.mapPtr.size()) return err("map.size"); for (const auto& entry : mapPtr) { auto it = other.mapPtr.find(entry.first); if (it == other.mapPtr.end() || *entry.second != *it->second) return err("map.entry"); } if ((next == nullptr) != (other.next == nullptr)) return err("next"); return next != nullptr ? (*next) == (*other.next) : true; } std::string Basics:: print(size_t indent) const { std::string i0(indent * 4, ' '); std::string i1(++indent * 4, ' '); std::stringstream ss; ss << "{\n" << i1 << "boolean: " << boolean << '\n' << i1 << "integer: " << integer << '\n' << i1 << "floating: " << floating << '\n' << i1 << "string: " << string << '\n' << i1 << "stringPtr: " << printPtr(stringPtr) << '\n' << i1 << "stringShared: " << printPtr(stringShared) << '\n' << i1 << "nullPtr: " << printPtr(nullPtr) << '\n' << i1 << "nullShared: " << printPtr(nullShared) << '\n' << i1 << "skip: " << skip << '\n' << i1 << "alias: " << alias << '\n' << i1 << "custom: " << custom.print() << '\n'; ss << i1 << "vector: " << vector.size() << "[ "; for (const auto& item : vector) ss << item << ' '; ss << "]\n"; ss << i1 << "vectorPtr: " << vectorPtr.size() << "[ "; for (const auto& item : vectorPtr) ss << printPtr(item) << ' '; ss << "]\n"; ss << i1 << "map: " << map.size() << "[ "; for (const auto& entry : map) ss << entry.first << ':' << entry.second << ' '; ss << "]\n"; ss << i1 << "mapPtr: " << mapPtr.size() << "[ "; for (const auto& entry : mapPtr) ss << entry.first << ':' << printPtr(entry.second) << ' '; ss << "]\n"; ss << i1 << "next: " << (next ? next->print(indent) : "nil") << '\n'; ss << i0 << "}"; return ss.str(); } reflectTypeImpl(Basics) { reflectPlumbing(); reflectAlloc(); reflectField(boolean); reflectField(integer); reflectField(floating); reflectField(string); reflectField(stringPtr); reflectField(stringShared); reflectField(nullPtr); reflectField(nullShared); reflectField(skip); reflectFieldValue(skip, json, json::skip()); reflectField(alias); reflectFieldValue(alias, json, json::alias("bob")); reflectField(custom); reflectField(vector); reflectField(vectorPtr); reflectField(map); reflectField(mapPtr); reflectField(next); reflectFieldValue(next, json, json::skipEmpty()); }
//======================================================================================= // CardManager.cpp // カード管理関連のソースファイル //======================================================================================= // ヘッダファイルの読み込み ================================================ #include <iostream> #include <vector> #include "CardManager.h" #include "Card.h" using namespace std; // 定数の定義 ============================================================== //================================================================ // コンストラクタ //================================================================ CardManager::CardManager() { for (int i = 0; i < 13; i++) { m_list[i] = new Card(Card::SPADE, i); m_list[i+13] = new Card(Card::CLUB, i); m_list[i+26] = new Card(Card::DIAMOND, i); m_list[i+39] = new Card(Card::HEART, i); } CreateDeck(); } //================================================================ // デストラクタ //================================================================ CardManager::~CardManager() { for (int i = 0; i < 52; i++) { delete m_list[i]; } } //================================================================ // トランプデッキを構築 //================================================================ void CardManager::CreateDeck() { for (int i = 0; i < 52; i++) { m_deck.push_back(m_list[i]); } } //================================================================ // トランプを表示する //================================================================ void CardManager::ShowDeck() { for each (Card* card in m_deck) { card->ShowCard(); } } //================================================================ // トランプをシャッフルする //================================================================ void CardManager::ShuffleCards() { // n回シャッフルする for (int i = 0; i < 100; i++) { // 現在のデッキのサイズに合わせた乱数 int randomNum = rand() % m_deck.size(); // 乱数のカードを引き抜く Card* card = m_deck.at(randomNum); m_deck.erase(m_deck.begin() + randomNum); // 抜いたカードを一番上に乗せる m_deck.push_back(card); } } //================================================================ // トランプを1枚配る //================================================================ Card* CardManager::DrawCard() { Card* card = m_deck.back(); m_deck.pop_back(); return card; }
#include "ScrambleString.hpp" #include <vector> using namespace std; bool ScrambleString::isScramble(string s1, string s2) { if (s1.size() != s2.size()) return false; if (s1 == s2) return true; int n = s1.size(); vector<vector<vector<bool>>> dp(n, vector<vector<bool>>(n, vector<bool>(n, false))); // dp[i][j][k]: s1[i:i+k] v.s. s2[j:j+k] for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dp[i][j][0] = (s1[i] == s2[j]); for (int k = 1; k < n; k++) { for (int i = 0; i < n - k; i++) { for (int j = 0; j < n - k; j++) { for (int p = 0; p < k; p++) { // s1[i:i+p] + s1[i+p+1:i+k] v.s. s2[j:j+p] + s2[j+p+1:j+k] // s1[i:i+p] + s1[i+p+1:i+k] v.s. s2[j:j+k-p-1] + s2[j+k-p:j+k] if ((dp[i][j][p] && dp[i + p + 1][j + p + 1][k - p - 1]) || (dp[i][j + k - p][p] && dp[i + p + 1][j][k - p - 1])) dp[i][j][k] = true; } } } } return dp[0][0][n - 1]; }
#include "boost_logger_severity.h" // The operator is used for regular stream formatting std::ostream& operator<< (std::ostream& strm, SysLogSeverity level) { static const char* strings[] = { "EMERGENCY", "ALERT", "CRITICAL", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG" }; if (static_cast< std::size_t >(level) < sizeof(strings) / sizeof(*strings)) strm << strings[static_cast<std::size_t>(level)]; else strm << level; return strm; } std::istream& operator>>(std::istream& i, SysLogSeverity &level) { std::string s_tmp; i >> s_tmp; static const char* strings[] = { "EMERGENCY", "ALERT", "CRITICAL", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG" }; bool bFound = false; const std::size_t i_array_size = sizeof(strings) / sizeof(*strings); for (int k = 0; k < i_array_size ; k++) { if (s_tmp == std::string(strings[k])) { level = SysLogSeverity(k); bFound = true; break; } } if (!bFound) { level = SysLogSeverity(std::stoul(s_tmp)); } return i; }
#include "NoxTacticEngine.h" #include <string> std::string inttostring(int a) { char buf[100]; _itoa_s(a, buf, 10); std::string tmp(buf); return tmp; } const CoordD Input::GlitchyInputRepresentationScale = CoordD(1.0204081632653061224489795918367, 1.0714285714285714285714285714286); #pragma warning (disable:4244) template <class T> D3DXVECTOR2 tod3d(const Coord<T>& a) { return D3DXVECTOR2(a.x, a.y); } CoordD Graphics::getTextureSize(TextureHandler texture) { return CoordD(getTextureWidth(texture), getTextureHeight(texture)); } void Graphics::setMapSize(const CoordI& size) { setMapSize(size.x, size.y); } void Graphics::setMapSize(int x, int y) { spritemap.resize(x); for (auto it = spritemap.begin(); it != spritemap.end(); ++it) { it->resize(y); } size = CoordI(x, y); } void Graphics::pushTexture(const CoordI& coor, TextureHandler texture, const CoordD& offset) { spritemap[coor.x-1][coor.y-1].push_back(ShiftedTextureHandler(texture, offset)); } void Graphics::clearCell(const CoordI& coor) { spritemap[coor.x-1][coor.y-1].clear(); } PictureHandler Graphics::addPicture(const CoordI& position, const CoordI& size, ELEMENT_TYPE type) { PictureBase* element = nullptr; switch (type) { case ELEMENT_PICTURE: element = new Picture(); break; case ELEMENT_SPELLICON: element = new SpellIcon(); break; case ELEMENT_BUTTON: element = new Button(); break; }; element->coor = position; element->size = size; pictures.push_back(element); element->setTexture(EMPTY_TEXTURE); element->setActiveTexture(EMPTY_TEXTURE); element->setDisabledTexture(EMPTY_TEXTURE); element->setState(PICTURESTATE_BASE); return pictures.size(); } PictureHandler Graphics::addPicture(const Rectangle& rect, ELEMENT_TYPE type) { return addPicture(rect.coor, rect.size, type); } LabelHandler Graphics::addLabel(const CoordI& position, const CoordI& size, const Color& color) { return addLabel(Rectangle(position, size), color); } LabelHandler Graphics::addLabel(const Rectangle& rect, const Color& color) { Label *label = new Label(rect, color); labels.push_back(label); return labels.size(); } void Graphics::setPictureState(PictureHandler pic, PICTURE_STATE state) { pictures[pic-1]->state = state; } void Graphics::setPictureTexture(PictureHandler pic, TextureHandler text) { pictures[pic-1]->setTexture(text); } void Graphics::setPictureActiveTexture(PictureHandler pic, TextureHandler text) { pictures[pic-1]->setActiveTexture(text); } void Graphics::setDisabledTexture(PictureHandler pic, TextureHandler text) { pictures[pic-1]->setDisabledTexture(text); } void Graphics::setPicturePosition(PictureHandler pic, const CoordI& position) { pictures[pic-1]->coor = position; } void Graphics::setPictureSize(PictureHandler pic, const CoordI& size) { pictures[pic-1]->size = size; } void Graphics::setLabelText(LabelHandler label, const string& text) { labels[label-1]->text = text; } void Graphics::setLabelText(LabelHandler label) { setLabelText(label, ""); } void Graphics::setLabelColor(LabelHandler label, const Color& color) { labels[label-1]->color = color; } void Graphics::setPictureVisibility(PictureHandler pic, bool visibility) { pictures[pic-1]->is_invisible = !visibility; } void Graphics::setLabelVisibility(LabelHandler label, bool visibility) { labels[label-1]->is_invisible = !visibility; } void Graphics::movePicture(PictureHandler pic, CoordI newposition) { pictures[pic-1]->coor = newposition; } void Graphics::printLabel(const Label* label) { if (label->is_invisible) { return; } CoordI coor2 = label->coor + label->size; this->printString(label->text, label->color, label->coor.x, coor2.x, label->coor.y, coor2.y); } void Graphics::paintPicture(const PictureBase* pic) { if (pic->is_invisible) { return; } TextureHandler texture = pic->getTexture(); if (texture == 0) { return; } setSpriteScale(tod3d((CoordD)pic->size / getTextureSize(texture))); paintSprite(texture, tod3d(pic->coor)); } void Graphics::paint(const CoordI& coor1, const CoordI& coor2) { clearDisplay(); beginSprite(); setSpriteScale(tod3d(picscale)); //TODO: print grid //HACK: painting walls and tiles via index 0 and 1; TODO: fix such relativity with something like 'texture->paintfirst' for (RectangleIterator it(coor1, minCoord(size, coor2)); it.isInside(); ++it) { for (unsigned int i = 0; i < 2; ++i) { auto tmp = spritemap[it.getCoor().x-1][it.getCoor().y-1][i]; CoordI tmpcoor = (tmp.offset + it.getCoor() - coor1) * picsize; paintSprite(tmp.texture, tod3d(tmpcoor)); } } //finishing painting other shit for (RectangleIterator it(coor1, minCoord(size, coor2)); it.isInside(); ++it) { for (unsigned int i = 2; i < spritemap[it.getCoor().x-1][it.getCoor().y-1].size(); ++i) { auto tmp = spritemap[it.getCoor().x-1][it.getCoor().y-1][i]; CoordI tmpcoor = (tmp.offset + it.getCoor() - coor1) * picsize; paintSprite(tmp.texture, tod3d(tmpcoor)); } } for (auto it = pictures.begin(); it != pictures.end(); ++it) { paintPicture(*it); } setSpriteScale(); for (auto it = labels.begin(); it != labels.end(); ++it) { printLabel(*it); } endSprite(); } void Graphics::shutdown() { for (auto it = pictures.begin(); it != pictures.end(); ++it) { delete *it; } for (auto it = labels.begin(); it != labels.end(); ++it) { delete *it; } GraphicCore::shutdown(); } TextureHandler Graphics::addAnimatedTexture(const string& dir, const string& extension, const int frames, long long milliseconds_per_frame, const Color& transparent) { vector<TextureHandler> tmptextures; for (int i = 0; i < frames; ++i) { tmptextures.push_back(addTexture(dir + inttostring(i+1) + extension, transparent)); } return GraphicCore::addAnimatedTexture(tmptextures, milliseconds_per_frame); } //============================================== void Input::setDefaultKeyBindings() { for (int i = 0; i < KEYS; ++i) { this->keybinds[i] = NO_KEY; } keybinds['A'] = KEY_SPELL1; keybinds['S'] = KEY_SPELL2; keybinds['D'] = KEY_SPELL3; keybinds['F'] = KEY_SPELL4; keybinds['G'] = KEY_SPELL5; keybinds['Q'] = KEY_PREV_SPELLSET; keybinds['E'] = KEY_NEXT_SPELLSET; keybinds[VK_LEFT] = KEY_ARROW_LEFT; keybinds[VK_RIGHT] = KEY_ARROW_RIGHT; keybinds[VK_UP] = KEY_ARROW_UP; keybinds[VK_DOWN] = KEY_ARROW_DOWN; keybinds[VK_RETURN] = KEY_ACCEPT; keybinds[VK_ESCAPE] = KEY_ESC; } void Input::setKeyBindings(Keys keybindings[]) { for (int i = 0; i < KEYS; ++i) { this->keybinds[i] = keybindings[i]; } } void Input::setField(CoordL cellsize, CoordL fieldstart, CoordI windowsize) { this->cellsize = cellsize; this->fieldstart = fieldstart; this->windowsize = windowsize; } void Input::addButton(CoordL coor, CoordL size, Buttons id, int index) { buttons.push_back(ButtonField(coor, size, id, index)); activateButton(id); id_to_handler[id].push_back(buttons.size()-1); //TODO: Check if map works like that } void Input::activateButton(Buttons id) { for (auto it = active_buttons.begin(); it != active_buttons.end(); ++it) { if (*it == id) { return; //it is already activated; } } active_buttons.push_back(id); } void Input::deactivateButton(Buttons id) { for (auto it = active_buttons.begin(); it != active_buttons.end(); ++it) { if (*it == id) { active_buttons.erase(it); return; } } } pair<Buttons, int> Input::findButton( const CoordL& coor ) { for (auto it = active_buttons.begin(); it != active_buttons.end(); ++it) { for (auto it2 = id_to_handler[*it].begin(); it2 != id_to_handler[*it].end(); ++it2) { if (coor.isInside(buttons[*it2].coor, buttons[*it2].coor + buttons[*it2].size)) { return make_pair(buttons[*it2].id, buttons[*it2].index); } } } return make_pair(NO_BUTTON, 0); } Keys Input::findKey(unsigned virtual_code) { if (virtual_code < KEYS) { return keybinds[virtual_code]; } else { return NO_KEY; } } CoordI Input::findCell(CoordL coor) { coor -= fieldstart; if (coor.isInside(CoordL(0, 0), (CoordL)(cellsize)*windowsize - Coord1)) { coor /= cellsize; return coor + Coord1; } else { return Coord0; } } CoordL Input::deglitchCoor(const CoordL& coor) { return CoordD(coor)*GlitchyInputRepresentationScale; }
/********************************************************** * License: The MIT License * https://www.github.com/doc97/TxtAdv/blob/master/LICENSE **********************************************************/ #pragma once #include <unordered_map> #include "LineReader.h" namespace txt { /* Struct: CtrlContent * Represents <LuaResponseHandler> data about one <StoryPoint>. */ struct CtrlContent { std::string storypoint; std::string script; std::string matcher_func; std::string action_func; }; /* Struct: CtrlContentInfo * The result of <CtrlContentReader>. */ struct CtrlContentInfo { std::unordered_map<std::string, std::vector<CtrlContent>> ctrl_content; }; /* Class: CtrlContentReader * Reads and parses control content. */ class CtrlContentReader { public: CtrlContentReader(); ~CtrlContentReader(); /* Function: Read * * Parameters: * * filename - Path to the file to read * * Returns: * * The data in the form of a <CtrlContentInfo> object * * Throws: * * std::runtime_error if there is an error such as file format error or I/O error */ CtrlContentInfo Read(const std::string& filename); /* Function: Read * * Parameters: * * filename - Path to the file to read * * Returns: * * The data in the form of a <CtrlContentInfo> object * * Throws: * * std::runtime_error if there is an error such as file format error or I/O error */ CtrlContentInfo Read(std::istream& stream); private: LineReader m_reader; }; } // namespace txt
#include "Common.h" #include <algorithm> #include <iostream> #include <unordered_map> int partOne(std::vector<int> lines) { std::unordered_map<int, int> dict; for (const auto &n : lines) dict[n] = lines[n]; for (const auto &n : lines) { if (dict.find(2020 - n) != dict.end()) return n * (2020 - n); } return 0; } int partTwo(std::vector<int> lines) { std::unordered_map<int, int> dict; for (const auto &n : lines) dict[n] = lines[n]; for (std::size_t i = 0; i < lines.size(); i++) { for (std::size_t j = i + 1; j < lines.size(); j++) { if (dict.find(2020 - (lines[i] + lines[j])) != dict.end()) return lines[i] * lines[j] * (2020 - (lines[i] + lines[j])); } } return 0; } int main() { auto lines = getLines(getFileContents("../input/Day1/input.txt")); auto numbers = std::vector<int>(lines.size()); std::transform(std::begin(lines), std::end(lines), std::begin(numbers), [](auto x) { return std::stoi(x); }); std::cout << partOne(numbers) << "\n"; std::cout << partTwo(numbers) << "\n"; }
// // Copyright (c) 2017-2019 Native Instruments GmbH, Berlin // // 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. // #pragma once #include <ni/media/pcm/iterator.h> #include <boost/range/iterator_range.hpp> namespace pcm { namespace converted_detail { template <class Value, class Format> struct format_holder { Format fmt; using value_type = Value; }; template <class Rng, class Value, class Format> auto operator|( Rng& r, const format_holder<Value, Format>& h ) { return boost::make_iterator_range( pcm::make_iterator<typename format_holder<Value, Format>::value_type>( std::begin( r ), h.fmt ), pcm::make_iterator<typename format_holder<Value, Format>::value_type>( std::end( r ), h.fmt ) ); } template <class Rng, class Value, class Format> auto operator|( const Rng& r, const format_holder<Value, Format>& h ) { return boost::make_iterator_range( pcm::make_iterator<typename format_holder<Value, Format>::value_type>( std::begin( r ), h.fmt ), pcm::make_iterator<typename format_holder<Value, Format>::value_type>( std::end( r ), h.fmt ) ); } } // namespace converted_detail template <class Value, class Format> auto converted_to( const Format& from ) -> converted_detail::format_holder<Value, Format> { return {from}; } } // namespace pcm
#include <iostream> #include <string> class Shape{ protected: std::string name; public: Shape(std::string name = "Amorphous Base Shape"): name(name){} std::string getName(){ return name; } }; class Triangle : public Shape{ public: Triangle(std::string name = "Nice Triangle!") : Shape(name){} //!TODO add method area() to calculate the area of the triangle }; using namespace std; int main(){ Triangle tria; cout << tria.getName() << endl; return 0; }
#ifndef PAGES_H #define PAGES_H #include <mgui.h> // this file declares your different pages // pagecontroller handles input/output switches pages for you etc class PageController : public PageControllerBase { DigitalInputButton // declare some inputs _upBtn, _downBtn, _okBtn; EventListener // declare events that listens on the input pins _upPressedListener, _downPressedListener, _okPressedListener, _okReleasedListener; public: PageController(); void onPressed(const EventInfo *evt); // recieves press events from input buttons void onReleased(const EventInfo *evt); // ids to the application pages, // an enum makes sure we have a uniqe id to each page enum Pages { welcomePage, // the welcome screen labelsPage, // shows different labels buttonsPage, // change settings toggleButtonsPage, valueChangePage }; }; // ----------- WelcomePage ---------------- // all pages must inherit from PageBase class WelcomePage : public PageBase { IconButton _prevBtn, _nextBtn; public: WelcomePage(); void okPressed(); void show(); }; // ---------- LabelsPage ------------------ class LabelsPage : public PageBase { Label _leftAlignNoBorder, _rightAlignNoBorder, _centerAlignNoBorder, _borderLeftAlign, _customSizeBorder; IconButton _prevBtn, _nextBtn; public: LabelsPage(); void okPressed(); }; // ---------- ButtonsPage ----------------- class ButtonsPage : public PageBase { // buttons with only text TextButton _textBtn; // buttons with icons IconButton _redoIcon, _upIcon, _downIcon, _undoText, _closeText, _playText; // event listeners listenes on button events and calls a callback method EventListener _undoEvent, _redoEvent; void onUndo(); void onRedo(); // for page navigation IconButton _prevBtn, _nextBtn; public: ButtonsPage(); void okPressed(); }; // ---------- ToggleButtonsPage ----------- class ToggleButtonsPage : public PageBase { RadioButton _radio1, _radio2, _radio3; CheckBox _chkBox1, _chkBox2; // for page navigation IconButton _prevBtn, _nextBtn; public: ToggleButtonsPage(); void okPressed(); }; // ---------- ValueChangePage ------------- class ValueChangePage : public PageBase { SpinBox _spinBox1, _spinBox2; HSlider _hSldNoText, _hSldText; VSlider _vSldNoText, _vSldText; EventListener _spin1Evt, _hSldEvt, _vSldEvt; // for page navigation IconButton _prevBtn, _nextBtn; void onSpinChange(const EventInfo *evt); void onHSldChange(const EventInfo *evt); void onVSldChange(const EventInfo *evt); public: ValueChangePage(); void okPressed(); }; #endif // PAGES_H
// This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface // (the "Fluent UI") and is provided only as referential material to supplement the // Microsoft Foundation Classes Reference and related electronic documentation // included with the MFC C++ library software. // License terms to copy, use or distribute the Fluent UI are available separately. // To learn more about our Fluent UI licensing program, please visit // http://msdn.microsoft.com/officeui. // // Copyright (C) Microsoft Corporation // All rights reserved. #include "stdafx.h" #include "PropertiesWnd.h" #include "Resource.h" #include "MainFrm.h" #include "asmodeling.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ///////////////////////////////////////////////////////////////////////////// // CResourceViewBar CPropertiesWnd::CPropertiesWnd() { pGroup1 = new CMFCPropertyGridProperty(_T("PMedia")); pGroup2 = new CMFCPropertyGridProperty(_T("Render")); pGroup3 = new CMFCPropertyGridProperty(_T("Light")); pGroup4 = new CMFCPropertyGridProperty(_T("Volume")); pGroup5 = new CMFCPropertyGridProperty(_T("LBFGSB")); } CPropertiesWnd::~CPropertiesWnd() { } BEGIN_MESSAGE_MAP(CPropertiesWnd, CDockablePane) ON_WM_CREATE() ON_WM_SIZE() ON_COMMAND(ID_EXPAND_ALL, OnExpandAllProperties) ON_UPDATE_COMMAND_UI(ID_EXPAND_ALL, OnUpdateExpandAllProperties) ON_COMMAND(ID_SORTPROPERTIES, OnSortProperties) ON_UPDATE_COMMAND_UI(ID_SORTPROPERTIES, OnUpdateSortProperties) ON_COMMAND(ID_PROPERTIES1, OnProperties1) ON_UPDATE_COMMAND_UI(ID_PROPERTIES1, OnUpdateProperties1) ON_COMMAND(ID_PROPERTIES2, OnProperties2) ON_UPDATE_COMMAND_UI(ID_PROPERTIES2, OnUpdateProperties2) ON_WM_SETFOCUS() ON_WM_SETTINGCHANGE() END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CResourceViewBar message handlers void CPropertiesWnd::AdjustLayout() { if (GetSafeHwnd() == NULL) { return; } CRect rectClient,rectCombo; GetClientRect(rectClient); /* m_wndObjectCombo.GetWindowRect(&rectCombo); int cyCmb = rectCombo.Size().cy; int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy; m_wndObjectCombo.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), 200, SWP_NOACTIVATE | SWP_NOZORDER); */ m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top , rectClient.Width(), 0, SWP_NOACTIVATE | SWP_NOZORDER); m_wndPropList.SetWindowPos(NULL, rectClient.left, rectClient.top , rectClient.Width(), rectClient.Height(), SWP_NOACTIVATE | SWP_NOZORDER); } int CPropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1; CRect rectDummy; rectDummy.SetRectEmpty(); /* // Create combo: const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; if (!m_wndObjectCombo.Create(dwViewStyle, rectDummy, this, 1)) { TRACE0("Failed to create Properties Combo \n"); return -1; // fail to create } m_wndObjectCombo.AddString(_T("Application")); m_wndObjectCombo.AddString(_T("Properties Window")); m_wndObjectCombo.SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); m_wndObjectCombo.SetCurSel(0); */ if (!m_wndPropList.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, 2)) { TRACE0("Failed to create Properties Grid \n"); return -1; // fail to create } InitPropList(); m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES); m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* Is locked */); m_wndToolBar.CleanUpLockedImages(); m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_PROPERTIES_HC : IDR_PROPERTIES, 0, 0, TRUE /* Locked */); m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT)); m_wndToolBar.SetOwner(this); // All commands will be routed via this control , not via the parent frame: m_wndToolBar.SetRouteCommandsViaFrame(FALSE); AdjustLayout(); return 0; } void CPropertiesWnd::OnSize(UINT nType, int cx, int cy) { CDockablePane::OnSize(nType, cx, cy); AdjustLayout(); } void CPropertiesWnd::OnExpandAllProperties() { m_wndPropList.ExpandAll(); } void CPropertiesWnd::OnUpdateExpandAllProperties(CCmdUI* pCmdUI) { } void CPropertiesWnd::OnSortProperties() { m_wndPropList.SetAlphabeticMode(!m_wndPropList.IsAlphabeticMode()); } void CPropertiesWnd::OnUpdateSortProperties(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode()); } void CPropertiesWnd::OnProperties1() { // TODO: Add your command handler code here } void CPropertiesWnd::OnUpdateProperties1(CCmdUI* /*pCmdUI*/) { // TODO: Add your command update UI handler code here } void CPropertiesWnd::OnProperties2() { // TODO: Add your command handler code here } void CPropertiesWnd::OnUpdateProperties2(CCmdUI* /*pCmdUI*/) { // TODO: Add your command update UI handler code here } void CPropertiesWnd::InitPropList() { SetPropListFont(); m_wndPropList.EnableHeaderCtrl(FALSE); // m_wndPropList.EnableDescriptionArea(); /* m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); */ pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("extinction"), (_variant_t) theApp.currentXML.PMedia.extinction, _T("指定窗口标题栏中显示的文本"))); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("scattering"), (_variant_t) theApp.currentXML.PMedia.scattering, _T("指定窗口标题栏中显示的文本"))); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("alaph"), (_variant_t) theApp.currentXML.PMedia.alaph, _T("指定窗口标题栏中显示的文本"))); m_wndPropList.AddProperty(pGroup1); //////////////////////////////////////////////////////////////// pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("CurrentView"), (_variant_t) theApp.currentXML.Render.CurrentView, _T("指定窗口标题栏中显示的文本"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("width"), (_variant_t) theApp.currentXML.Render.width, _T("指定窗口标题栏中显示的文本"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("height"), (_variant_t) theApp.currentXML.Render.height, _T("指定窗口标题栏中显示的文本"))); CMFCPropertyGridProperty* pGroup21 = new CMFCPropertyGridProperty(_T("RenderInterval")); pGroup2->AddSubItem(pGroup21); pGroup21->AddSubItem(new CMFCPropertyGridProperty(_T("Level5"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level5, _T("此为说明"))); pGroup21->AddSubItem(new CMFCPropertyGridProperty(_T("Level6"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level6, _T("此为说明"))); pGroup21->AddSubItem(new CMFCPropertyGridProperty(_T("Level7"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level7, _T("此为说明"))); pGroup21->AddSubItem(new CMFCPropertyGridProperty(_T("Level8"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level8, _T("此为说明"))); pGroup21->Expand(true); m_wndPropList.AddProperty(pGroup2); /////////////////////////////////////////////////// pGroup3->AddSubItem(new CMFCPropertyGridProperty(_T("LightType"), (_variant_t) theApp.currentXML.Light.LightType, _T("指定窗口标题栏中显示的文本"))); pGroup3->AddSubItem(new CMFCPropertyGridProperty(_T("LightIntensityR"), (_variant_t) theApp.currentXML.Light.LightIntensityR, _T("指定窗口标题栏中显示的文本"))); pGroup3->AddSubItem(new CMFCPropertyGridProperty(_T("LightX"), (_variant_t) theApp.currentXML.Light.LightX, _T("指定窗口标题栏中显示的文本"))); pGroup3->AddSubItem(new CMFCPropertyGridProperty(_T("Lighty"), (_variant_t) theApp.currentXML.Light.LightY, _T("指定窗口标题栏中显示的文本"))); pGroup3->AddSubItem(new CMFCPropertyGridProperty(_T("Lightz"), (_variant_t) theApp.currentXML.Light.LightZ, _T("指定窗口标题栏中显示的文本"))); m_wndPropList.AddProperty(pGroup3); /////////////////////////////////////////////////////// pGroup4->AddSubItem(new CMFCPropertyGridProperty(_T("BoxSize"), (_variant_t) theApp.currentXML.Volume.BoxSize, _T("指定窗口标题栏中显示的文本"))); pGroup4->AddSubItem(new CMFCPropertyGridProperty(_T("TransX"), (_variant_t) theApp.currentXML.Volume.TransX, _T("指定窗口标题栏中显示的文本"))); pGroup4->AddSubItem(new CMFCPropertyGridProperty(_T("TransY"), (_variant_t) theApp.currentXML.Volume.TransY, _T("指定窗口标题栏中显示的文本"))); pGroup4->AddSubItem(new CMFCPropertyGridProperty(_T("TransZ"), (_variant_t) theApp.currentXML.Volume.TransZ, _T("指定窗口标题栏中显示的文本"))); pGroup4->AddSubItem(new CMFCPropertyGridProperty(_T("VolumeInitiallLevel"), (_variant_t) theApp.currentXML.Volume.VolumeInitialLevel, _T("指定窗口标题栏中显示的文本"))); pGroup4->AddSubItem(new CMFCPropertyGridProperty(_T("VolumeMaxLevel"), (_variant_t) theApp.currentXML.Volume.VolumeMaxLevel, _T("指定窗口标题栏中显示的文本"))); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("VolInterval")); pGroup4->AddSubItem(pGroup41); pGroup41->AddSubItem(new CMFCPropertyGridProperty(_T("Level5"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level5, _T("此为说明"))); pGroup41->AddSubItem(new CMFCPropertyGridProperty(_T("Level6"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level6, _T("此为说明"))); pGroup41->AddSubItem(new CMFCPropertyGridProperty(_T("Level7"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level7, _T("此为说明"))); pGroup41->AddSubItem(new CMFCPropertyGridProperty(_T("Level8"), (_variant_t) theApp.currentXML.Render.RenderInterval.Level8, _T("此为说明"))); pGroup41->Expand(true); m_wndPropList.AddProperty(pGroup4); ///////////////////////////////////////////////////// pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("disturb"), (_variant_t) theApp.currentXML.LBFGSB.disturb, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("EpsG"), (_variant_t) theApp.currentXML.LBFGSB.EpsG, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("EpsF"), (_variant_t) theApp.currentXML.LBFGSB.EpsF, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("EpsX"), (_variant_t) theApp.currentXML.LBFGSB.EpsX, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("MaxIts"), (_variant_t) theApp.currentXML.LBFGSB.MaxIts, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("m"), (_variant_t) theApp.currentXML.LBFGSB.m, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("ConstrainType"), (_variant_t) theApp.currentXML.LBFGSB.ConstrainType, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("LowerBound"), (_variant_t) theApp.currentXML.LBFGSB.LowerBound, _T("指定窗口标题栏中显示的文本"))); pGroup5->AddSubItem(new CMFCPropertyGridProperty(_T("UpperBound"), (_variant_t) theApp.currentXML.LBFGSB.UpperBound, _T("指定窗口标题栏中显示的文本"))); m_wndPropList.AddProperty(pGroup5); } void CPropertiesWnd::OnSetFocus(CWnd* pOldWnd) { CDockablePane::OnSetFocus(pOldWnd); m_wndPropList.SetFocus(); } void CPropertiesWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) { CDockablePane::OnSettingChange(uFlags, lpszSection); SetPropListFont(); } void CPropertiesWnd::SetPropListFont() { ::DeleteObject(m_fntPropList.Detach()); LOGFONT lf; afxGlobalData.fontRegular.GetLogFont(&lf); NONCLIENTMETRICS info; info.cbSize = sizeof(info); afxGlobalData.GetNonClientMetrics(info); lf.lfHeight = info.lfMenuFont.lfHeight; lf.lfWeight = info.lfMenuFont.lfWeight; lf.lfItalic = info.lfMenuFont.lfItalic; m_fntPropList.CreateFontIndirect(&lf); m_wndPropList.SetFont(&m_fntPropList); } void CPropertiesWnd::reflesh() { pGroup1->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.PMedia.extinction); pGroup1->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.PMedia.scattering); pGroup1->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.PMedia.alaph); //////////////////////////////////////////////////////////////// pGroup2->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.Render.CurrentView); pGroup2->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.Render.width); pGroup2->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.Render.height); pGroup2->GetSubItem(3)->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level5); pGroup2->GetSubItem(3)->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level6); pGroup2->GetSubItem(3)->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level7); pGroup2->GetSubItem(3)->GetSubItem(3)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level8); /////////////////////////////////////////////////// pGroup3->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.Light.LightType); pGroup3->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.Light.LightIntensityR); pGroup3->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.Light.LightX); pGroup3->GetSubItem(3)->SetValue((_variant_t) theApp.currentXML.Light.LightY); pGroup3->GetSubItem(4)->SetValue((_variant_t) theApp.currentXML.Light.LightZ); /////////////////////////////////////////////////////// pGroup4->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.Volume.BoxSize); pGroup4->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.Volume.TransX); pGroup4->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.Volume.TransY); pGroup4->GetSubItem(3)->SetValue((_variant_t) theApp.currentXML.Volume.TransZ); pGroup4->GetSubItem(4)->SetValue((_variant_t) theApp.currentXML.Volume.VolumeInitialLevel); pGroup4->GetSubItem(5)->SetValue((_variant_t) theApp.currentXML.Volume.VolumeMaxLevel); pGroup4->GetSubItem(6)->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level5); pGroup4->GetSubItem(6)->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level6); pGroup4->GetSubItem(6)->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level7); pGroup4->GetSubItem(6)->GetSubItem(3)->SetValue((_variant_t) theApp.currentXML.Render.RenderInterval.Level8); ///////////////////////////////////////////////////// pGroup5->GetSubItem(0)->SetValue((_variant_t) theApp.currentXML.LBFGSB.disturb); pGroup5->GetSubItem(1)->SetValue((_variant_t) theApp.currentXML.LBFGSB.EpsG); pGroup5->GetSubItem(2)->SetValue((_variant_t) theApp.currentXML.LBFGSB.EpsF); pGroup5->GetSubItem(3)->SetValue((_variant_t) theApp.currentXML.LBFGSB.EpsX); pGroup5->GetSubItem(4)->SetValue((_variant_t) theApp.currentXML.LBFGSB.MaxIts); pGroup5->GetSubItem(5)->SetValue((_variant_t) theApp.currentXML.LBFGSB.m); pGroup5->GetSubItem(6)->SetValue((_variant_t) theApp.currentXML.LBFGSB.ConstrainType); pGroup5->GetSubItem(7)->SetValue((_variant_t) theApp.currentXML.LBFGSB.LowerBound); pGroup5->GetSubItem(8)->SetValue((_variant_t) theApp.currentXML.LBFGSB.UpperBound); }
// // encryptor.cpp // CPSC_441_assign_3_server // // Created by Keenan on 2018-10-16. // Copyright © 2018 Keenan. All rights reserved. // #include "encryptor.h" #include <stdlib.h> #include <string> #include <string.h> #include <iostream> #include <stdexcept> Encryptor::Encryptor(){ //initialize map seqnum = 1; char* zero = new char(); memcpy(zero, "\0", 1); encounteredHashes = {{0x00,zero}}; //set 0 to 0, because it seems like the kind of thing to cause problems } //just assignment operator, never has more than one instance so i didnt worry about copies void Encryptor::operator=(const Encryptor& other) { encryptionMethod = other.encryptionMethod; seqnum = other.seqnum; encounteredHashes = other.encounteredHashes; } Encryptor::Encryptor(eType type) : Encryptor() { setEncrytionAlgorithm(type); } void Encryptor::setEncrytionAlgorithm(eType type){ encryptionMethod = type; } char* Encryptor::transform(char* begin){ //picks encryption or decryption based on first word char* in = begin; char* delim = (char*) "0x"; while( !isalnum(*in) ) in++; //find first letter / number bool isEncrypted = true; for(; *delim && *in; delim++, in++) if (*in != *delim) { isEncrypted = false; break; } if (isEncrypted) return decrypt( begin ); else return encrypt( begin ); } char* Encryptor::encrypt(char* in){ #ifdef INSIDE printf("in encrypt\n"); #endif int wordNum, totalSize; char** wordArr = splitWords(in, wordNum); totalSize = wordNum + (int) strlen(in); char* tmp = (char*) malloc(totalSize + 1); //the output c string char* tm2 = (char*) malloc(totalSize + 1); //space enough for the entire tweet to be one word (overkill) bzero(tmp, totalSize + 1); bzero(tm2, totalSize + 1); // iterate over all words in incoming c string array and hash each one, // then store in memory to be kept in map for(int i = 0; i <= wordNum; i++){ uint16_t wordHash = selectHash(wordArr[i]); memcpy(tm2, tmp, totalSize + 1); sprintf(tmp, "%s 0x%04x", tmp, wordHash); #ifdef FULLDEBUG printf("appending 0x%04x to tmp(%d)\n", wordHash, wordHash); #endif } free( wordArr ); for ( auto it = encounteredHashes.begin(); it != encounteredHashes.end(); ++it ) std::cout << " " << it->first << ":" << it->second << std::endl; std::cout << std::endl; free(tm2); return tmp; // return concatenated hashes } uint16_t Encryptor::selectHash(char* in){ #ifdef INSIDE printf("in hash\n"); #endif switch (encryptionMethod) { case SEQUENCE: return sequential(in); case WORD_SUM: return wordSum(in); case CHECKSUM: default: return internetCheckSum(in); } } char* Encryptor::decrypt(char* in){ #ifdef INSIDE printf("in decrypt\n"); #endif int wordNum; char** words = splitWords(in, wordNum); std::string outputContainer = ""; for (int wordIndex = 0; wordIndex <= wordNum; wordIndex++){ //all words start with 0x, so we ignore those two std::string tmpWord = words[wordIndex]; size_t delim_length = 0; tmpWord.shrink_to_fit(); // convert to int uint16_t hash; try { hash = (uint16_t) std::stoi(tmpWord, &delim_length, 16); } catch( std::invalid_argument e) { printf("thats a big ol invalid arg: %d\n%s\n",hash, e.what()); } #ifdef FULLDEBUG std::cout << "printing the dictionary" << std::endl; for ( auto it = encounteredHashes.begin(); it != encounteredHashes.end(); ++it ) std::cout << " " << it->first << ":" << it->second << std::endl; std::cout << std::endl; printf("searching for word which hashes to 0x%04x (%d)\n", hash, hash); #endif //search map for hash char* foundWord; try{ foundWord = encounteredHashes.at( hash ); } catch (std::out_of_range& e) { foundWord = (char*) "[unknown]"; } //add a space and the word to output outputContainer.append(" "); outputContainer.append(foundWord); #ifdef FULLDEBUG printf("appended word %2d (hash 0x%04x): %s to outputContainer\n", wordIndex, hash, foundWord); #endif } free( words ); ulong len = outputContainer.length()+1; char* tmp = (char*) malloc(sizeof(char)*len); bzero(tmp, sizeof(char) * len ); memcpy(tmp, outputContainer.c_str(), len); return tmp; } uint16_t Encryptor::sequential(char* in){ #ifdef INSIDE printf("in sequential\n"); #endif ulong wordlen = strlen(in) + 1; char* store = (char*) malloc(sizeof(char) * wordlen); bzero(store, sizeof(char) * wordlen); memcpy(store, in, wordlen); int hash; if ((hash = checkForWord(in)) == 0){ hash = ++seqnum; // auto search = encounteredHashes.find(seqnum); // if (search == encounteredHashes.end()) encounteredHashes.insert({seqnum,store}); } else { #ifdef FULLDEBUG printf("storing %s with hash 0x%04x\n",store,hash); #endif free(store); } return hash; } uint16_t Encryptor::wordSum(char* in){ #ifdef INSIDE printf("in wordsum\n"); #endif ulong wordlen = strlen(in) + 1; char* store = (char*) malloc(sizeof(char) * wordlen); bzero(store, sizeof(char) * wordlen); memcpy(store, in, wordlen); int hash; // if in exists in encounteredHashes, use that index instead of generating one if ((hash = checkForWord(in)) == 0){ hash = 0; //sum chars in word char* inptr = in; int cur; while((cur = *(inptr++))) hash += cur; // if hash results in collision, add 1 until a space is available #ifdef FULLDEBUG printf("***looking for collisions with 0x%04x***\n", hash); for ( auto it = encounteredHashes.begin(); it != encounteredHashes.end(); ++it ) std::cout << " " << it->first << ":" << it->second; std::cout << std::endl; #endif while ( encounteredHashes.find(hash) != encounteredHashes.end() ){ hash = (uint16_t) (hash + 1); #ifdef FULLDEBUG printf("found, moving to hash: 0x%04x\n",hash); #endif } encounteredHashes.insert({hash,store}); #ifdef FULLDEBUG printf("storing %s with hash 0x%04x\n",store,hash); #endif } else { #ifdef FULLDEBUG printf("found %s with hash 0x%04x, no store necessary.\n",store,hash); #endif free(store); } return hash; } uint16_t Encryptor::internetCheckSum(char* start){ #ifdef INSIDE printf("in wordsum\n"); #endif char* in = start; ulong wordlen = strlen(in) + 1; char* store = (char*) malloc(sizeof(char) * wordlen); bzero(store, wordlen); memcpy(store, in, wordlen); uint16_t hash; // if in exists in encounteredHashes, use that index instead of generating one if ((hash = checkForWord(in)) == 0){ //internet checksum uint32_t total = 0; while ( *in ){ uint32_t num1 = *in, // this char num2 = *(in + 1); // next char total += (num1 << 8) + num2; // gives [firstcharbits][secondcharbits] total = total + (total >> 16); // adds carry bits to ones place total &= UINT16_MAX; // removes carries in += 2; } uint16_t out = (uint16_t) total; hash = 0xffff - out; hash = hash & 0xffff; #ifdef FULLDEBUG printf("***looking for collisions with 0x%04x (%d)***\n", hash,hash); for ( auto it = encounteredHashes.begin(); it != encounteredHashes.end(); ++it ) std::cout << " " << it->first << ":" << it->second << std::endl; std::cout << std::endl; #endif while ( encounteredHashes.find(hash) != encounteredHashes.end() ){ hash = (uint16_t) (hash + 1); #ifdef FULLDEBUG printf("found, moving to hash: 0x%04x\n",hash); #endif } hash = hash & 0xffff; encounteredHashes.insert({hash,store}); #ifdef FULLDEBUG printf("storing %s with hash 0x%04x\n",store,out); #endif } else { #ifdef FULLDEBUG printf("found %s with hash 0x%04x, no store necessary.\n",store,hash); #endif free(store); } return hash; } char** Encryptor::splitWords(char* in, int& wordNum) { #ifdef INSIDE printf("splitting words\n"); #endif std::string split = " "; std::string message = in; int i = 0, tokenCount = 0; /* counts number of spaces */ while ( in[i] ){ if (in[i] == split.c_str()[0] ) tokenCount++; i++; } #ifdef FULLDEBUG printf("in has %d spaces, and %d characters\n",tokenCount,i); #endif wordNum = 0; size_t first = 0, second = 0; char** retChar = (char**) malloc( (sizeof(char*))*(tokenCount + 1) ); bzero(retChar, (sizeof(char*)) * (tokenCount+1) ); // splits into words based on spaces while ( (second = message.find(split, first)) != std::string::npos ){ if (wordNum > tokenCount) break; //just in case std::string tok = message.substr(first, second-first); char* tmp = (char*) malloc( sizeof(char) * (tok.length() + 1) ); bzero(tmp, sizeof(char) * (tok.length()+1) ); memcpy( tmp, tok.c_str(), (tok.length()+1) ); retChar[wordNum] = tmp; #ifdef FULLDEBUG printf("adding %s to char** @ retChar[%d]\n", tmp,wordNum); #endif wordNum++; first = second + 1; //continue after space after word } //one more, last word not followed by a space std::string tok = message.substr(first, message.length() - first); char* tmp = (char*) malloc( sizeof(char) * (tok.length()+1) ); bzero(tmp, sizeof(char) * (tok.length()+1) ); memcpy( tmp, tok.c_str(), (tok.length()+1) ); check(tmp); //sometimes we got some weid characters popping up so this fixes it retChar[wordNum] = tmp; #ifdef FULLDEBUG printf("adding %s to char** @ retChar[%d]\n", tmp,wordNum); #endif retChar[wordNum+1] = NULL; // null terminate array, just in case #ifdef FULLDEBUG printf("wordCount: %d TokenCount: %d\n",wordNum,tokenCount); printf("split:\n"); int j = -1; while(++j <= wordNum) printf("retChar[%d] : %s\n",j,retChar[j]); #endif return retChar; } uint16_t Encryptor::checkForWord(char* in) { for(auto i : encounteredHashes){ uint16_t hash = i.first; char* value = i.second; if (!strcmp(in, value)) return hash; } return 0; //nothing should hash here } void Encryptor::check (char* in) { int i = 0; while (in[i]){ //if not usable ascii (invisible chars are the worst, so i remove them) // I think they get introduced from heap copies, but i dont really have the time to find out why if ((in[i] > 126 || in[i] < 33 )) /* this is a beep character, it doesnt print but it makes a noise which is SO FUN, so im using it to simplify the strings to std ascii*/ in[i] = '\0'; //jk it just ends the word i++; } }
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <set> #include <algorithm> #include <map> #include <algorithm> using namespace std; int main() { map<string, int> m; int n, a, val; string key; cin >> n; for(int i=0; i<n; i++) { cin >> a; cin >> key; switch(a) { case 1: cin >> val; m[key] += val; break; case 2: m.erase(key); break; case 3: map<string, int>::iterator itr = m.find(key); if(itr == m.end()) cout << "0" << endl; else cout << m[key] << endl; break; } } return 0; }
#pragma once // ReSharper disable once CppUnusedIncludeDirective #include <cstdint> #include <DirectXCollision.h> namespace GraphicsEngine { struct SubmeshGeometry { uint32_t IndexCount = 0; uint32_t StartIndexLocation = 0; uint32_t BaseVertexLocation = 0; DirectX::BoundingBox Bounds; }; }
#include <cmath> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <unordered_map> #include <unordered_set> #include <vector> #include <set> #include <stack> #include <sstream> #include <string> using namespace std; struct TreeNode { int val; TreeNode* left; TreeNode* right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; /* Solution */ const int MOD = 1000000007; class Solution { public: vector<int> pathsWithMaxScore(vector<string>& board) { int n = board.size(); // pair.first == max sum, pair.second == num of paths vector<vector<pair<int, int>>> dp(n, vector<pair<int, int>>(n, make_pair(0, 0))); // from bottom-right to top-left == from top-left to bottom-right dp[0][0] = make_pair(0, 1); int r_step[3] = {-1, 0, -1}; int c_step[3] = {0, -1, -1}; for (int r = 0; r < n; r++) { for (int c = 0; c < n; c++) { if (r == 0 && c == 0) continue; if (board[r][c] == 'X') continue; long long sum = 0; long long num = 0; for (int k = 0; k < 3; ++k) { int r_prev = r + r_step[k]; int c_prev = c + c_step[k]; if (r_prev >= 0 && c_prev >= 0 && dp[r_prev][c_prev].second != 0) { long long newSum = dp[r_prev][c_prev].first + (r == n - 1 && c == n - 1 ? 0 : board[r][c] - '0'); if (newSum > sum) { sum = newSum; num = dp[r_prev][c_prev].second; } else if (newSum == sum) { num = (num + dp[r_prev][c_prev].second) % MOD; } } } dp[r][c] = make_pair(sum, num); // cout << "(r,c) = (" << r << ", " << c << ") = " << sum << ", " << num << endl; } } return vector<int>{dp[n - 1][n - 1].first, dp[n - 1][n - 1].second}; } }; int main() { Solution sol; // vector<string> board = {"E23", "2X2", "12S"}; // 7, 1 // vector<string> board = {"E12","1X1","21S"}; // 4, 2 // vector<string> board = {"E11","XXX","11S"}; // 0, 0 vector<string> board = {"E11345","X452XX","3X43X4","422812","284522","13422S"}; // 34, 3 vector<int> ans = sol.pathsWithMaxScore(board); cout << ans[0] << ", " << ans[1] << endl; }
#include <stdint.h> #include <stdio.h> extern "C" { #include <SDL.h> #include <SDL2_gfxPrimitives.h> #include <math.h> } const int SCREEN_WIDTH = 1280; const int SCREEN_HEIGHT = 720; SDL_Window* window = NULL; SDL_Renderer* renderer = NULL; SDL_Event event; // List of leds per view and of view sizes uint16_t fauxel_leds[256] = {0}; uint16_t fauxel_view_size [256] = {0}; uint16_t fauxel_view_start[256] = {0}; uint8_t fauxel_view_count = 0; uint32_t n_leds = 0; extern "C" { void register_view(uint16_t start, uint16_t length) { // Track instances and assign leds to each view once. // TODO use static lists on the view classes. fauxel_view_count++; fauxel_view_size [fauxel_view_count] = length; fauxel_view_start[fauxel_view_count] = start; printf("In register view !!!\n"); for(int i = start; i < start + length; i++) { if(fauxel_leds[i] == 0) { fauxel_leds[i] = fauxel_view_count; } } } void render_pixel(uint16_t index, uint8_t r, uint8_t g, uint8_t b) { uint16_t x_center = SCREEN_WIDTH / 2; uint16_t y_center = SCREEN_HEIGHT / 2; //printf("Rendering index:%u", index); // x_angle = index / n_leds * 360; x = cos(x_angle * M_PI / 360) uint16_t x = x_center + 150.0 * cos(index *1.0f / n_leds * M_PI * 2.0); uint16_t y = y_center + 150.0 * sin(index * 1.0f / n_leds * M_PI * 2.0); //printf("{x,y} = {%f, %f}\n", index *1.0f / n_leds * 360.0, sin(index * 1.0f / n_leds * 360.0)); // Could derive from # of views and led count to squeeze into space uint16_t radius = 12; filledCircleRGBA( renderer, x, y, radius, r, g, b, 0xFF ); //printf("Done rendering\n"); // Alpha might be useful for simulating low color on leds (since its not black). // Could also draw overlapping alpha shapes since leds are individual colors. //SDL_SetRenderDrawColor( renderer, r, g, b, 0xFF ); //SDL_Rect fillRect = { (SCREEN_WIDTH / 40) * index, SCREEN_HEIGHT / 2, 15, 15}; //SDL_RenderFillRect( renderer, &fillRect ); } // TODO drawing loop could be handled here instead of per pixel. Just need a local copy of the color buffer as each color is set void show_pixels() { //printf("[0] show_pixels()\n"); //Update screen SDL_RenderPresent( renderer ); // Clear for next? SDL_SetRenderDrawColor( renderer, 0x10, 0x10, 0x10, 0xFF ); SDL_RenderClear( renderer ); // Clear out events while( SDL_PollEvent( &event ) != 0 ) { if( event.type == SDL_QUIT ) { exit(0); } } } void initialize_pixels(uint16_t count) { printf("[0] initialize_pixels(%d)\n", count); SDL_Init( SDL_INIT_VIDEO ); window = SDL_CreateWindow( "fauxel pixels", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED ); SDL_SetRenderDrawColor( renderer, 0xFF, 0xFF, 0xFF, 0xFF ); SDL_RenderClear( renderer ); SDL_RenderPresent( renderer ); n_leds = count; } }
#include<stdio.h> #include<stdlib.h> partition(int arr[],int start,int end) { int pivot=arr[end],i,index=start,temp; for(i=start;i<end;i++) { if(arr[i]<=pivot) { temp=arr[i]; arr[i]=arr[index]; arr[index]=temp; index++; } } arr[end]=arr[index]; arr[index]=pivot; return index; } void quickSort(int arr[],int start,int end) { int pindex; if(end>start) { pindex=partition(arr,start,end); quickSort(arr,start,pindex-1); //left array quickSort(arr,pindex+1,end); //right arrayfj } } int main() { int i; int arr[]={7,2,1,6,8,5,4,9,3}; quickSort(arr,0,8); for(i=0;i<=8;i++) printf("\n%d",arr[i]); }
#include <iostream> #include <string.h> #include <arpa/inet.h> #include <thread> #include "mypcap.h" #include <vector> //using std::thread; using namespace std; void onefunction(char* interface, char** argv,int is,struct packet_addr pd){ getMacIPAddress(interface, pd.mymac, pd.myip); printf("================Start ARP===================\n"); printf("[%d]interface is %s\n",is, interface); printf("[%d]myMAC[%02X:%02X:%02X:%02X:%02X:%02X]\n",is,pd.mymac[0],pd.mymac[1],pd.mymac[2],pd.mymac[3],pd.mymac[4],pd.mymac[5]); printf("[%d]myIP[%d.%d.%d.%d]\n",is,pd.myip[0],pd.myip[1],pd.myip[2],pd.myip[3]); //split argv uint32_t sip = inet_addr(argv[is*2]); uint32_t dip = inet_addr(argv[is*2+1]); memcpy(pd.sender_ip, &sip, sizeof(uint8_t)*4); memcpy(pd.target_ip, &dip, sizeof(uint8_t)*4); int len =0; myether myether = make_eth(pd.mymac,pd.broadcast); myarp myarp_t = make_arp(1,pd.mymac, pd.myip, pd.unknown, pd.target_ip); unsigned char * packet_t = make_packet(myether,myarp_t, len); get_arpmac(interface,packet_t,len,pd.target_mac,pd.target_ip); printf("[%d]Target ip[%d.%d.%d.%d]\n",is,pd.target_ip[0],pd.target_ip[1],pd.target_ip[2],pd.target_ip[3]); printf("[%d]Target mac[%x:%x:%x:%x:%x:%x]\n",is,pd.target_mac[0],pd.target_mac[1],pd.target_mac[2],pd.target_mac[3],pd.target_mac[4],pd.target_mac[5]); len=0; myarp myarp_s = make_arp(1,pd.mymac,pd.myip, pd.unknown, pd.sender_ip); unsigned char * packet_s = make_packet(myether, myarp_s, len); get_arpmac(interface,packet_s,len,pd.sender_mac,pd.sender_ip); printf("[%d]Sender ip[%d.%d.%d.%d]\n",is,pd.sender_ip[0],pd.sender_ip[1],pd.sender_ip[2],pd.sender_ip[3]); printf("[%d]Sender mac[%x:%x:%x:%x:%x:%x]\n",is,pd.sender_mac[0],pd.sender_mac[1],pd.sender_mac[2],pd.sender_mac[3],pd.sender_mac[4],pd.sender_mac[5]); arp_injection(10,interface, &pd); packet_sniffing(interface, &pd); } void usage(){ cout<<"syntax: arp_spoofing <interface> <sender_ip> <target_ip>\n"; cout<<"sample: arp_spoofing eth0 192.168.10.2 192.168.10.1\n"; } int main(int argc, char* argv[]) { //usage check if(argc < 4){ usage(); return -1; } char *interface = (char*)malloc(strlen(argv[1])); memcpy(interface, argv[1], strlen(argv[1])); //receive argvs int argvcnt = (argc-2)/2; vector<thread> a; struct packet_addr* pd = new packet_addr[argvcnt]; if(argvcnt == 1){ printf("a\n"); onefunction(interface,argv,1,pd[0]); }else{ for(int i = 1; i<=argvcnt;i++){ //create threads a.push_back(thread(onefunction, interface, argv,i,pd[i-1])); } for(int j = 1; j<=argvcnt;j++){ a[j].join(); } } return 0; }
#include<bits/stdc++.h> using namespace std; main() { string s; int n; cin >> n; cin >> s; int a = 0; int b = 0; for(int i = 0 ; s[i] != 0; i++) { if(s[i] == 'A') a++; else if(s[i] == 'B') b++; } if(b > a) cout << "B\n"; else if( a > b) cout << "A\n"; else cout << "Tie\n"; }
#include <iostream> using namespace std; void main() { int N; cin >> N; if (N%2==0) cout<<"even"; else cout<<"odd"; }
#include<bits/stdc++.h> using namespace std; #define ll long long int int main(){ int tc;cin>>tc; while(tc--){ int n;cin>>n;int k;cin>>k; vector<int> arr(n); for(int i=0;i<n;i++) cin>>arr[i]; map<int,int> mp; for(int i=0;i<n;i++){ mp[arr[i]]++; } int count=0; for(auto i:mp){ count+=min(k,i.second); } count=(count/k)*k; mp.clear(); int tempcount=0; map<int,set<int>>mpp; for(int i=0;i<n;i++){ int j=1; if(tempcount<count){ while(j<=k && (mpp[j].find(arr[i])!=mpp[j].end() || mpp[j].size()>=(count/k))) j++; mpp[j].insert(arr[i]); if(j<=k) {cout<<j<<" ";tempcount++;} else cout<<0<<" "; }else cout<<0<<" "; } cout<<endl; } }
#include <string> #include <iostream> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <string.h> int main() { std::string httpPost = "POST /device-api/site/querySiteInfoWithPage HTTP/1.1\n"; httpPost += "Connection:close\n"; httpPost += "Content-Length:178\n"; httpPost += "content-type:application/json\n"; httpPost += "Host: test.xhg.com\n\n"; httpPost += "{\"requestBody\":{\"data\":{\"currentPage\":1,\"pageSize\":50}},\"requestHead\":{\"appVersion\":\"1.0\",\"requestId\":\"string\",\"sign\":\"b730a66c56163d7aa84c95086b636bd5\",\"validateTime\":\"string\"}}"; std::cout << httpPost << std::endl; int sockfd = socket(AF_INET,SOCK_STREAM,0); if(-1 == sockfd) { std::cout << "socket error" << std::endl; } struct sockaddr_in address; struct hostent *server = NULL; server = gethostbyname("test.xhg.com"); if(NULL == server) { herror("gethostbyname"); return 0; } address.sin_family = AF_INET; address.sin_port = htons(8010); address.sin_addr.s_addr = (*((struct in_addr*)(server->h_addr))).s_addr; if(-1 == connect(sockfd, (struct sockaddr*)&address, sizeof(address))) { perror("connect"); return 0; } if(-1 == send(sockfd, httpPost.c_str(), httpPost.size(), 0)) { perror("send"); return 0; } char buf[1024] = {0}; int filefd = open("xhg.html", O_RDWR | O_CREAT | O_APPEND | O_TRUNC, 0644); if(-1 == filefd) { perror("open"); return 0; } int res = 1; while(-1 != res && 0 != res) { memset(buf,0, 1024); res = recv(sockfd, buf, sizeof(buf) - 1, 0); std::string str_buf = buf; std::cout << str_buf; if(-1 != res && 0 != res) { if(-1 == write(filefd, buf, res)) { perror("write"); return 0; } } } close(sockfd); close(filefd); return 0; }
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <bits/stdc++.h> using namespace std; void solve(vector<int> arr){ int _currMin = 0; int _currMax = 0; map<int,int> pairs; for(int i = 0; i < arr.size(); i++){ if(arr[i] > arr[_currMax]){ _currMax = i; } else if(arr[i] < arr[_currMax]){ if(_currMin != _currMax){ pairs[_currMin] = _currMax; } _currMax = i; _currMin = i; } } if(_currMin != _currMax){ pairs[_currMin] = _currMax; } map<int, int>::iterator it; for(it = pairs.begin(); it != pairs.end(); it++){ cout << "(" << it->first << " " << it->second << ") "; } if(pairs.size() == 0){cout << "No Profit";} cout << endl; } int main() { //code int n; cin >> n; while(n--){ int k; vector<int> arr; cin >> k; for(int i = 0; i < k; i++){ int element; cin >> element; arr.push_back(element); } solve(arr); } return 0; }
#include<iostream> using namespace std; int arr[] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};//{ 18, 22, 9, 17, 21, 50, 51}; int n = sizeof(arr)/sizeof(arr[0]); int dp[100]; int lis(int i) { //cout<<i<<endl; if(i>=n) return 0; if(dp[i]!=-1) return dp[i]; int ans=0; for(int j=i+1;j<n;j++) { if(arr[j]>arr[i]) { ans=max(ans,1+lis(j)); } } return dp[i]=ans; } int main() { int ans=0; for(int i=0;i<n;i++) dp[i]=-1; for(int i=0;i<n;i++) { cout<<lis(i)<<" "; ans=max(ans,1+lis(i)); } cout<<endl<<ans<<endl; //cout<<lis(0); system("pause"); return 0; }
#ifndef __DUAL_EVO24X9_H__ #define __DUAL_EVO24X9_H__ #include <math.h> #include <string.h> #include "esp_log.h" #include "driver.h" #include "device.h" #include "i2c-dev.h" #include "driver/uart.h" #include "kidbright32.h" class DualEVO24X9 : public Device { private: enum { s_detect, s_wait, } state; TickType_t tickcnt, polling_tickcnt; double temperature = 0.0, humidity = 0.0; public: // constructor DualEVO24X9(int bus_ch, int dev_addr) ; // override void init(void); void process(Driver *drv); int prop_count(void); bool prop_name(int index, char *name); bool prop_unit(int index, char *unit); bool prop_attr(int index, char *attr); bool prop_read(int index, char *value); bool prop_write(int index, char *value); // method bool motor(uint8_t ch, uint8_t dir, uint8_t speed) ; }; #endif
#include <algorithm> #include <array> #include <cstdio> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> #define ll long long using namespace std; typedef tuple<ll, ll, ll> tp; typedef pair<ll, ll> pr; const ll MOD = 1000000007; const ll INF = 1e18; template <typename T> void print(const T &t) { std::copy(t.cbegin(), t.cend(), std::ostream_iterator<typename T::value_type>(std::cout, " ")); cout << endl; } template <typename T> void print2d(const T &t) { std::for_each(t.cbegin(), t.cend(), print<typename T::value_type>); } void setIO(string s) { // the argument is the filename without the extension freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } vector<ll> indicies; vector<pair<pair<ll, ll>, ll>> updates(1e5 + 5); vector<pair<ll, ll>> query(1e5 + 5); vector<ll> diffArray(2e5 + 5); vector<ll> width(2e5 + 5); vector<ll> interval(2e5 + 5); vector<ll> prefixSum(2e5 + 5); ll getCompress(ll num) { return lower_bound(indicies.begin(), indicies.end(), num) - indicies.begin(); } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); ll N, Q; cin >> N >> Q; for (ll i = 0; i < N; i++) { ll l, r, v; cin >> l >> r >> v; indicies.push_back(l); indicies.push_back(r); updates[i] = {{l, r}, v}; } for (ll i = 0; i < Q; i++) { ll l, r; cin >> l >> r; indicies.push_back(l); indicies.push_back(r); query[i] = {l, r}; } // Create a sorted indicies for compression sort(indicies.begin(), indicies.end()); indicies.erase(unique(indicies.begin(), indicies.end()), indicies.end()); // Get the distance between each compression index for (ll i = 0; i < N; i++) { auto curr = updates[i]; diffArray[getCompress(curr.first.first) + 1] += curr.second; diffArray[getCompress(curr.first.second) + 1] -= curr.second; } //for (ll i = 0; i <= 15; i++) { //cout << diffArray[i] << " "; //} //cout << endl; for(ll i = 0; i < indicies.size(); i++){ width[i+1] = indicies[i+1] - indicies[i]; } for(ll i = 1; i < indicies.size(); i++){ interval[i] = interval[i-1] + diffArray[i]; } //for(ll i = 0; i <= 15; i++){ //cout << interval[i] << " "; //} //cout << endl; for(ll i = 1; i < indicies.size(); i++){ prefixSum[i] = prefixSum[i-1] + width[i] * interval[i]; } for(ll i = 0; i < Q; i++){ cout << prefixSum[getCompress(query[i].second)] - prefixSum[getCompress(query[i].first)] << endl; } }
#ifndef ANGRA_MC_EVENT #define ANGRA_MC_EVENT #include "TClonesArray.h" #include "TRefArray.h" #include "TVector3.h" #include "TLorentzVector.h" #include "TDatabasePDG.h" #include "TROOT.h" #include <iostream> TDatabasePDG *fPDGTable = new TDatabasePDG(); enum AngraPMTLocation {kTarget=0, kInnerVeto=1, kBoxVeto=2}; enum AngraPMTLevel {kAUp=0, kADown=1}; class AngraMCVertex : public TObject { public: Int_t fID; Float_t fX; Float_t fY; Float_t fZ; Float_t fT; Int_t fNParticles; public: AngraMCVertex() { } virtual ~AngraMCVertex(){ } inline Int_t GetID() {return fID;} inline Float_t GetX() {return fX;} inline Float_t GetY() {return fY;} inline Float_t GetZ() {return fZ;} inline Float_t GetT() {return fT;} inline Int_t GetNParticles() {return fNParticles;} ClassDef(AngraMCVertex,1) }; class AngraMCParticle : public TObject { public: Int_t fID; Int_t fPDG; Int_t fTrackID; Int_t fVertexID; Float_t fPx; Float_t fPy; Float_t fPz; Float_t fPolarizationX; Float_t fPolarizationY; Float_t fPolarizationZ; inline Int_t GetID() {return fID;} inline Int_t GetPDG() {return fPDG;} inline Int_t GetTrackID() {return fTrackID;} inline Int_t GetVertexID() {return fVertexID;} inline Int_t GetVertex() {return fVertexID;} inline Float_t GetPx() {return fPx;} inline Float_t GetPy() {return fPy;} inline Float_t GetPz() {return fPz;} inline Float_t GetPolX() {return fPolarizationX;} inline Float_t GetPolY() {return fPolarizationY;} inline Float_t GetPolZ() {return fPolarizationZ;} public: AngraMCParticle() { } virtual ~AngraMCParticle(){ } ClassDef(AngraMCParticle,1) }; class AngraMCTrack : public TObject { public: Int_t fID; Int_t fParent; Int_t fPDG; Float_t fGlobalTime; Float_t fLocalTime; Float_t fXi; Float_t fYi; Float_t fZi; Float_t fPix; Float_t fPiy; Float_t fPiz; Float_t fKineticEi; TString fVoli; Float_t fXf; Float_t fYf; Float_t fZf; Float_t fPfx; Float_t fPfy; Float_t fPfz; Float_t fKineticEf; TString fVolf; TString fProcess; public: AngraMCTrack() { } virtual ~AngraMCTrack() { } inline Int_t GetID() {return fID;} inline Int_t GetParent() {return fParent;} inline Int_t GetPDG() {return fPDG;} inline Float_t GetLocalTime() {return fGlobalTime;} // time since the primary inline Float_t GetTrackTime() {return fLocalTime;} // time of this track inline Float_t GetXi() {return fXi;} inline Float_t GetYi() {return fYi;} inline Float_t GetZi() {return fZi;} inline Float_t GetPxi() {return fPix;} inline Float_t GetPyi() {return fPiy;} inline Float_t GetPzi() {return fPiz;} inline Float_t GetKi() {return fKineticEi;} inline Float_t GetXf() {return fXf;} inline Float_t GetYf() {return fYf;} inline Float_t GetZf() {return fZf;} inline Float_t GetPxf() {return fPfx;} inline Float_t GetPyf() {return fPfy;} inline Float_t GetPzf() {return fPfz;} inline Float_t GetKf() {return fKineticEf;} inline TString GetVolume(Int_t i=0) {if (i) {return fVoli;} else return fVolf;} inline TString GetProcess() {return fProcess;} Bool_t IsSortable() const; virtual Int_t Compare(const TObject*) const; ClassDef(AngraMCTrack,1) }; class AngraMCTrackList : public TObject { public: Int_t fTrackPosition; AngraMCTrackList() { } virtual ~AngraMCTrackList() { } ClassDef(AngraMCTrackList,1) }; class AngraMCHit : public TObject { using TObject::Compare; using TObject::IsSortable; public: Int_t fID; Int_t fTrackID; Double_t fGlobalTime; Double_t fLocalTime; Float_t fX; //X of hit Float_t fY; //Y of hit Float_t fZ; //Z of hit Float_t fEn; AngraPMTLocation fPMTLocation; AngraPMTLevel fPMTLevel; Int_t fPMTNumber; public: AngraMCHit() { } virtual ~AngraMCHit() { } inline Int_t GetID() {return fID;} inline Int_t GetTrackID() {return fTrackID;} inline Float_t GetX() {return fX;} inline Float_t GetY() {return fY;} inline Float_t GetZ() {return fZ;} inline Float_t GetGlobalTime(){return fGlobalTime;} inline Float_t GetLocalTime() {return fLocalTime;} inline Float_t GetEn() {return fEn;} inline void SetGlobalTime(Double_t time) {fGlobalTime = time;} inline AngraPMTLocation GetPMTLocation() {return fPMTLocation;} inline AngraPMTLevel GetPMTLevel() {return fPMTLevel;} inline Int_t GetPMTNumber() {return fPMTNumber;} bool operator== (AngraMCHit *) const; bool operator< (AngraMCHit *) const; bool operator> (AngraMCHit *) const; bool operator<= (AngraMCHit *) const; bool operator>= (AngraMCHit *) const; Bool_t IsSortable() const; virtual Int_t Compare(const TObject*) const; ClassDef(AngraMCHit,1) //A p.e. hit }; class AngraMCEvent : public TObject { private: Int_t fNvertex; //Number of vertexes Int_t fNparticle; //Number of primaries Int_t fNtrack; //Number of tracks Int_t fNhit; //Number of hits on PMTs Double_t fGlobalTime; Bool_t fHasTrackList; string fFileName; TClonesArray *fVertexes; TClonesArray *fParticles; TClonesArray *fTracks; TClonesArray *fHits; static TClonesArray *fgVertexes; static TClonesArray *fgParticles; static TClonesArray *fgTracks; static TClonesArray *fgHits; public: AngraMCEvent(); virtual ~AngraMCEvent(); void NewEvent(); void Clear(Option_t *option =""); void Reset(Option_t *option =""); void BuildTrackList(); Int_t GetNvertex() const { return fNvertex; } Int_t GetNparticle() const { return fNparticle; } Int_t GetNtrack() const { return fNtrack; } Int_t GetNhit() const { return fNhit; } Double_t GetGlobalTime() const { return fGlobalTime; } string GetSourceFileName() const {return fFileName; } void SetGlobalTime(Double_t time) {fGlobalTime = time; } void SetSourceFileName(const string name){fFileName = name; } void SetNvertex(Int_t vtx) { fNvertex=vtx; } void SetNparticle(Int_t ptc) { fNparticle=ptc; } void SetNtrack(Int_t trk) { fNtrack=trk; } void SetNhit(Int_t hit) { fNhit=hit; } AngraMCVertex *AddVertex(); AngraMCParticle *AddPrimary(); AngraMCTrack *AddTrack(); AngraMCHit *AddHit(); inline void SortHits() {fHits->Sort();} inline void SortTracks() {fTracks->Sort();} vector<Int_t> fTrackList; inline Bool_t WasHit() { if (fNhit!=0) {return 1;} else {return 0;}} inline Float_t GetPDGMass(Int_t pdg) {return fPDGTable->GetParticle(pdg)->Mass()*1000.;} inline Float_t GetPDGCharge(Int_t pdg) {return fPDGTable->GetParticle(pdg)->Charge();} AngraMCVertex *GetVertex(Long64_t i); AngraMCParticle *GetPrimary(Long64_t i=0); AngraMCTrack *GetTrack(Long64_t i); AngraMCHit *GetHit(Long64_t i); ClassDef(AngraMCEvent,1) }; #endif // ANGRA_MC_EVENT
/*************************************************************************** Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 2010-2020 DADI ORISTAR TECHNOLOGY DEVELOPMENT(BEIJING)CO.,LTD FileName: OSQueue.cpp Description: Provide a queue operation class. Comment: copy from Darwin Streaming Server 5.5.5 Author: taoyunxing@dadimedia.com Version: v1.0.0.1 CreateDate: 2010-08-16 LastUpdate: 2010-08-19 ****************************************************************************/ #include "OSQueue.h" OSQueue::OSQueue() : fLength(0) { fSentinel.fNext = &fSentinel; fSentinel.fPrev = &fSentinel; } /* 将入参补在当前队列的锚点队列元素后面 */ void OSQueue::EnQueue(OSQueueElem* elem) { Assert(elem != NULL); /* 假如该队列所在的队列指针就是当前队列指针,这说明该队列元已在当前队列中,无条件返回 */ if (elem->fQueue == this) return; /* 所以要加入一个新的队列元,一定要确保它的队列指针为空! */ Assert(elem->fQueue == NULL); /* 将elem加到fQueue的后面 */ elem->fNext = fSentinel.fNext; elem->fPrev = &fSentinel; elem->fQueue = this; /* 修改相应的位置关系 */ fSentinel.fNext->fPrev = elem; fSentinel.fNext = elem; /* 长度增加1 */ fLength++; } /* 删除并返回锚点队列元素的前一个元素, used in FileBlockPool::GetBufferElement() */ OSQueueElem* OSQueue::DeQueue() { if (fLength > 0) { /* 取fSentinel的前一个队列元素 */ OSQueueElem* elem = fSentinel.fPrev; /* 断言两个相邻元素不相等 */ Assert(fSentinel.fPrev != &fSentinel); /* 调整删去fSentinel的前一个队列元素后的位置关系 */ elem->fPrev->fNext = &fSentinel; fSentinel.fPrev = elem->fPrev; /* 删去该队列元素 */ elem->fQueue = NULL; /* 队列长度减1 */ fLength--; return elem; } else return NULL; } /* 从当前队列中移去入参 */ void OSQueue::Remove(OSQueueElem* elem) { /* 确保入参非空且不是数据成员 */ Assert(elem != NULL); Assert(elem != &fSentinel); /* 确保入参就是当前队列中的元素,才能移去它 */ if (elem->fQueue == this) { /* 调整删去fSentinel的前一个队列元素后的位置关系 */ elem->fNext->fPrev = elem->fPrev; elem->fPrev->fNext = elem->fNext; /* 删去该队列元素 */ elem->fQueue = NULL; /* 队列长度减1 */ fLength--; } } /* 下面的demo将1,2,3加入当前队列,验证OSQueueElem和OSQueue中的方法 */ #if OSQUEUETESTING Bool16 OSQueue::Test() { OSQueue theVictim; void *x = (void*)1; OSQueueElem theElem1(x); x = (void*)2; OSQueueElem theElem2(x); x = (void*)3; OSQueueElem theElem3(x); if (theVictim.GetHead() != NULL) return false; if (theVictim.GetTail() != NULL) return false; theVictim.EnQueue(&theElem1); if (theVictim.GetHead() != &theElem1) return false; if (theVictim.GetTail() != &theElem1) return false; OSQueueElem* theElem = theVictim.DeQueue(); if (theElem != &theElem1) return false; if (theVictim.GetHead() != NULL) return false; if (theVictim.GetTail() != NULL) return false; theVictim.EnQueue(&theElem1); theVictim.EnQueue(&theElem2); if (theVictim.GetHead() != &theElem1) return false; if (theVictim.GetTail() != &theElem2) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem1) return false; if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem2) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem2) return false; theVictim.EnQueue(&theElem1); theVictim.EnQueue(&theElem2); theVictim.EnQueue(&theElem3); if (theVictim.GetHead() != &theElem1) return false; if (theVictim.GetTail() != &theElem3) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem1) return false; if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem3) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem2) return false; if (theVictim.GetHead() != &theElem3) return false; if (theVictim.GetTail() != &theElem3) return false; theElem = theVictim.DeQueue(); if (theElem != &theElem3) return false; theVictim.EnQueue(&theElem1); theVictim.EnQueue(&theElem2); theVictim.EnQueue(&theElem3); OSQueueIter theIterVictim(&theVictim); if (theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != &theElem3) return false; theIterVictim.Next(); if (theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != &theElem2) return false; theIterVictim.Next(); if (theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != &theElem1) return false; theIterVictim.Next(); if (!theIterVictim.IsDone()) return false; if (theIterVictim.GetCurrent() != NULL) return false; theVictim.Remove(&theElem1); if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem3) return false; theVictim.Remove(&theElem1); if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem3) return false; theVictim.Remove(&theElem3); if (theVictim.GetHead() != &theElem2) return false; if (theVictim.GetTail() != &theElem2) return false; return true; } #endif /* 该函数处理Queue element的前移问题,主要是要时刻判断是否位于队列末尾? */ void OSQueueIter::Next() { /* 依据当前队列元素指针的位置分情形 */ /* 判断当当前队列元素指针和其后的队列元素相等时 */ if (fCurrentElemP == fQueueP->GetTail()) fCurrentElemP = NULL; else /* 后移一个 */ fCurrentElemP = fCurrentElemP->Prev(); } /* used in TaskThread::WaitForTask() */ /* 当队列长度为0时,仅让当前线程阻塞,超时等待指定时间后,返回NULL;否则,否则删去并返回当前队列中锚点元素的前一个队列元素 */ OSQueueElem* OSQueue_Blocking::DeQueueBlocking(OSThread* inCurThread, SInt32 inTimeoutInMilSecs) { OSMutexLocker theLocker(&fMutex); #ifdef __Win32_ /* 当当前队列长度为0,则仅让当前线程阻塞,超时等待,并返回空值 */ if (fQueue.GetLength() == 0) { fCond.Wait(&fMutex, inTimeoutInMilSecs); return NULL; } #else if (fQueue.GetLength() == 0) fCond.Wait(&fMutex, inTimeoutInMilSecs); #endif /* 否则删去并返回当前队列中锚点元素的前一个队列元素 */ OSQueueElem* retval = fQueue.DeQueue(); return retval; } /* 删去并返回当前队列中锚点元素的前一个队列元素 */ OSQueueElem* OSQueue_Blocking::DeQueue() { OSMutexLocker theLocker(&fMutex); /* 用到OSQueue::DeQueue() */ OSQueueElem* retval = fQueue.DeQueue(); return retval; } /* 将入参加入当前队列,并传信 */ void OSQueue_Blocking::EnQueue(OSQueueElem* obj) { { /* 获取互斥锁 */ OSMutexLocker theLocker(&fMutex); /* 将当前入参加入描点队列元素后 */ fQueue.EnQueue(obj); } /* 参见OSCond.h,等同于::SetEvent(fCondition) */ /* 发信号通知外部条件已改变 */ fCond.Signal(); }
// // Bullet.cpp // Fighters // // Created by zhutun on 15/5/24. // Copyright (c) 2015年 zhutun. All rights reserved. // #include "Bullet.h" Bullet::Bullet() { this->setTexture(this->texture); } Bullet::~Bullet() { } void Bullet::move(char direction){ if (direction=='w') { this->setPosition(this->getPosition().x,this->getPosition().y-this->getSpeed()); }else if(direction=='s'){ this->setPosition(this->getPosition().x,this->getPosition().y+this->getSpeed()); }else if(direction=='a'){ this->setPosition(this->getPosition().x-0.5*this->getSpeed(),this->getPosition().y+this->getSpeed()); }else if(direction=='d'){ this->setPosition(this->getPosition().x+0.5*this->getSpeed(),this->getPosition().y+this->getSpeed()); } } void Bullet::setSpeed(int speed) { this->speed=speed; } int Bullet::getSpeed(){ return this->speed; }
//Implement non-recursive linear search algorithm. #include<iostream> using namespace std; int main() { int i,n,search,flag=0; cout<<"Enter No of elements : "; cin>>n; int a[n]; for ( i = 0; i < n; i++) { cout<<"Element : "; cin>>a[i]; } cout<<"\nEnter Element to be search : "; cin>>search; for ( i = 0; i < n; i++) { if(search==a[i]) { cout<<"\nElement "<<a[i]<<" found at position " <<i; flag =1; } } if(flag==0) cout<<"\nElement NOT FOUND..."; return 0; }
#include <iostream> #include <vector> #include "solution.h" using namespace std; int main() { Solution s; vector<int> ivec1 = {1, 3}; vector<int> ivec2 = {2}; vector<int> ivec3 = {1, 2}; vector<int> ivec4 = {3, 4}; cout << s.findMedianSortedArrays(ivec1, ivec2) << endl; cout << s.findMedianSortedArrays(ivec3, ivec4) << endl; return 0; }
#include "Sampling.h" #include "Utils.h" #include "omp.h" #define NUM_THREADS 4 #define MAX_SIZE_CLUSTER 100 #define MAX_NUM_DISTANCES 100 Sampling::Sampling(string filename, int samplesize) { ifstream fn(filename.c_str()); fn >> N >> K; S = MIN(N, samplesize); //cerr << "size " << N << " attributes " << K << " sample size "<< S << endl; data = new string*[N]; sample = new string*[S]; sampleIndex = new int[S]; srand48(1973); for (int i=0; i<N; i++) { data[i] = new string[K]; for (int j=0; j < K; j++) fn >> data[i][j]; if (i < S){ sample[i] = data[i]; sampleIndex[i] = i; } else { int r = (int) floor(drand48() * (i+1)); if (r < S) { sample[r] = data[i]; sampleIndex[r] = i; } } } fn.close(); /* for (int i = 0; i <N; i ++){ for (int j = 0; j < K; j ++){ cout << data[i][j]<< " "; } cout <<endl; } cout<<"\nsample!\n"; for (int i = 0; i <S; i ++){ cout << sampleIndex[i]<<":"; for (int j = 0; j < K; j ++){ cout << sample[i][j]<< " "; } cout <<endl; } cout << "lalalaaaa"<<endl; */ } void Sampling::computeMatrix(Matrix *matrix) { int i,j; omp_set_num_threads(NUM_THREADS); #pragma omp parallel private(i,j) { #pragma omp for for (i = 0; i < S; i ++){ //cout << "sample: "<< sampleIndex[i]<<endl; for (j = 0; j < S; j ++){ matrix->matrix[i][j] = distance(sample,i,j,K); //cout << matrix->matrix[i][j]<< " "; } //cout << endl; } }//end of parallel section } Sampling::~Sampling() { for (int i = 0; i < N; i ++) delete [] data[i]; delete [] data; /* This was a BUG! No new is made for sample[i] for (int i = 0; i < S; i ++) delete [] sample[i]; */ delete [] sample; delete [] sampleIndex; } void Sampling::postProcess(int *clusterVector, int nodesNum, int *sampleClusters, int SampleSize) // int *Sampling::postProcess(int *sampleClusters) { omp_set_num_threads(NUM_THREADS); vector <string *> singletonVector; vector <int> singletonIndex; if (SampleSize!=S || nodesNum!=N) error("Something has gone terribly wrong"); map<int, vector<int> > clusterMap; map<int,int> clusterSizes; set<int> sampleSet; vector<int> clusterLabels; for (int i = 0; i < S; i ++){ int label = sampleIndex[sampleClusters[i]]; clusterMap[label].push_back(sampleIndex[i]); clusterVector[sampleIndex[i]] = label; sampleSet.insert(sampleIndex[i]); } for (map<int, vector<int> >::iterator entry = clusterMap.begin(); entry != clusterMap.end(); entry ++){ int key = (*entry).first; clusterSizes[key] = ((*entry).second).size(); cout << "size of cluster "<<key <<" :"<<clusterSizes[key]<<endl; } for (int i = 0; i < N; i ++){ //if (i%1==0) cout << i << "/ "<< N << endl << flush; if (sampleSet.find(i) != sampleSet.end()) continue; map<int,float> distances; /* keeps the sum of disagreements of i with the elements of each cluster the key is the cluster label, the entry the sum */ map<int,float> tot_dist; /* keeps the cost of assigning i to each cluster the key is the cluster label the value the cost */ tot_dist[-1] = 0; // the -1 entry is the case for making i into a sigleton cluster //cout << "Parallel It:"; for (map<int, vector<int> >::iterator entry = clusterMap.begin(); entry != clusterMap.end(); entry ++){ int key = (*entry).first; distances[key] = 0; vector<int> cluster = (*entry).second; //Read iterators first deque<int> it_que; for (vector<int>::iterator iter = cluster.begin(); iter != cluster.end(); iter ++){ it_que.push_back(*iter); } int it_que_size = it_que.size(); int j; if( it_que_size > MAX_SIZE_CLUSTER ) { //cout << "-" << key; #pragma omp parallel private(j) { #pragma omp for schedule(static, it_que_size/NUM_THREADS) for(j=0; j<it_que_size; j++) distances[key] += distance(data, i, it_que[j], K); }//Parallel section } else for(j=0; j<it_que_size; j++) distances[key] += distance(data, i, it_que[j], K); tot_dist[-1] += clusterSizes[key] - distances[key]; //cout << "dist is " << distances[key] << " tot dist " << tot_dist[-1] << endl; } //cout << endl; // cout << "node " << i << " cost for being sigleton " << tot_dist[-1] << endl; int num_distances = distances.size(); for (map<int,float>::iterator iter = distances.begin(); iter != distances.end(); iter ++){ int key = (*iter).first; tot_dist[key] = 0; if(num_distances < MAX_NUM_DISTANCES){ for (map<int,float>::iterator inner = distances.begin(); inner != distances.end(); inner ++){ int other_key = (*inner).first; float value = (*inner).second; if (key == other_key){ tot_dist[key] += value; }else{ tot_dist[key] += clusterSizes[other_key] - value; } } } else{ deque<int> key_que; deque<float> value_que; for (map<int,float>::iterator inner = distances.begin(); inner != distances.end(); inner ++){ key_que.push_back((*inner).first); value_que.push_back((*inner).second); } int j; //Parallel loop #pragma omp parallel private(j) { #pragma omp for schedule(static, num_distances/NUM_THREADS) for (j=0;j<num_distances;j++){ if (key == key_que[j]){ tot_dist[key] += value_que[j]; }else{ tot_dist[key] += clusterSizes[key_que[j]] - value_que[j]; } } } } //cout << "node " << i << " cost of merging with " << key << ": " << tot_dist[key] << endl; } float min_dist = tot_dist[-1]; // used to be -1 to create singletons int min_key = -1; //same here for (map<int,float>::iterator iter = tot_dist.begin(); iter != tot_dist.end(); iter ++){ int key = (*iter).first; float value = (*iter).second; // cout << "key: " << key << " value: " << value << endl; if (value < min_dist){ // && key != -1){ // added && to avoid singletons min_dist = value; min_key = key; } } if (min_key == -1){ // assign i into a sigleton clusterVector[i] = i; singletonVector.push_back(data[i]); singletonIndex.push_back(i); }else{ clusterVector[i] = min_key; } } cout << endl; cout << "Cluster singletons" << endl; clusterSigletons(clusterVector, &singletonVector, &singletonIndex); } void Sampling::clusterSigletons(int *clusterVector, vector<string *> *singletonVector, vector<int> *singletonIndex) { int singletonSize = singletonVector->size(); if (singletonSize < 2){ cout << "Less than 2 singletons"<<endl; return; } cout << "number of singletons: "<< singletonSize<<endl; string **singletonData = new string*[singletonSize]; for (int i = 0; i < singletonSize; i ++){ singletonData[i] = (*singletonVector)[i]; } Matrix *singletonMatrix = new Matrix(singletonSize); int i,j; omp_set_num_threads(NUM_THREADS); #pragma omp parallel private(i,j) { #pragma omp for for (i = 0; i < singletonSize; i ++){ //cout << "sample: "<< sampleIndex[i]<<endl; for (j = 0; j < singletonSize; j ++){ singletonMatrix->matrix[i][j] = distance(singletonData,i,j,K); //cout << matrix->matrix[i][j]<< "\t"; } } } int singletonLabels[singletonSize]; if (BaseAlgo==NOB){ for (int i = 0; i < singletonSize; i ++){ singletonLabels[i] = i; } } else if (BaseAlgo==BALLS){ Balls(singletonMatrix, singletonLabels, Alpha); } else if (BaseAlgo==RANDOMSPLITS){ RandomSplits(singletonMatrix, singletonLabels, RSmaxIters); } else if (BaseAlgo==GONZALEZ){ Gonzalez(singletonMatrix, singletonLabels); } else if (BaseAlgo==AGGLOMERATIVE) { Agglomerative agglo(singletonMatrix); agglo.runAlgorithm(singletonLabels); } if (LocalSearchAlgo==LOCALSEARCH){ LocalSearch(singletonMatrix, singletonLabels, LSmaxIters); } else if (LocalSearchAlgo==D_LOCALSEARCH){ BestLocalSearch(singletonMatrix, singletonLabels); } for (int i = 0; i < singletonSize; i ++){ clusterVector[(*singletonIndex)[i]] = (*singletonIndex)[singletonLabels[i]]; //cout << "cluster label for entry "<< i <<" "<<(*singletonIndex)[i]<< ": "<<singletonLabels[i] << " "<<(*singletonIndex)[singletonLabels[i]]<<endl; } delete [] singletonData; delete singletonMatrix; }
#pragma once #include <Windows.h> #include <windowsx.h> #include <cstring> #include <string> #include <vector> #include <map> #include "resource.h" #define MSG_LEN 64 #define WM_CHILDEND (WM_USER+1) #define WM_SETOPTION (WM_USER+2) #define WM_LISTEDITDONE (WM_USER+2) #define MSG_CALLWND 0 #define MSG_GETMSG 1 #define MSG_KEYBOARD 2 #define MSG_MOUSE 3 #define MSG_MSGFILTER 4 #define MSG_CALLWNDRET 5 typedef struct _MsgData { WCHAR processName[MAX_PATH]; DWORD processID; DWORD threadID; int hookType; INT64 hwnd; DWORD msgCode; UINT64 wParam; UINT64 lParam; INT64 hInstance; WCHAR otherData[MAX_PATH]; _MsgData() { memset(&processName, 0, MAX_PATH); processID = 0; threadID = 0; hookType = 0; hwnd = NULL; msgCode = 0; wParam = NULL; lParam = NULL; hInstance = NULL; memset(&otherData, 0, MAX_PATH); } }MsgData, *LPMsgData; typedef struct _SettingData { bool msgOptions[65536]; bool otherMsgShow; bool wParamShow; bool lParamShow; _SettingData() { memset(msgOptions, 0, sizeof(msgOptions)); otherMsgShow = false; wParamShow = false; lParamShow = false; } }SettingData, *LPSettingData; static std::map<DWORD, LPWSTR> wmToString = { { 0, L"WM_NULL" }, { 1, L"WM_CREATE" }, { 2, L"WM_DESTROY" }, { 3, L"WM_MOVE" }, { 5, L"WM_SIZE" }, { 6, L"WM_ACTIVATE" }, { 7, L"WM_SETFOCUS" }, { 8, L"WM_KILLFOCUS" }, { 10, L"WM_ENABLE" }, { 11, L"WM_SETREDRAW" }, { 12, L"WM_SETTEXT" }, { 13, L"WM_GETTEXT" }, { 14, L"WM_GETTEXTLENGTH" }, { 15, L"WM_PAINT" }, { 16, L"WM_CLOSE" }, { 17, L"WM_QUERYENDSESSION" }, { 18, L"WM_QUIT" }, { 19, L"WM_QUERYOPEN" }, { 20, L"WM_ERASEBKGND" }, { 21, L"WM_SYSCOLORCHANGE" }, { 22, L"WM_ENDSESSION" }, { 24, L"WM_SHOWWINDOW" }, { 25, L"WM_CTLCOLOR" }, { 26, L"WM_WININICHANGE" }, { 27, L"WM_DEVMODECHANGE" }, { 28, L"WM_ACTIVATEAPP" }, { 29, L"WM_FONTCHANGE" }, { 30, L"WM_TIMECHANGE" }, { 31, L"WM_CANCELMODE" }, { 32, L"WM_SETCURSOR" }, { 33, L"WM_MOUSEACTIVATE" }, { 34, L"WM_CHILDACTIVATE" }, { 35, L"WM_QUEUESYNC" }, { 36, L"WM_GETMINMAXINFO" }, { 38, L"WM_PAINTICON" }, { 39, L"WM_ICONERASEBKGND" }, { 40, L"WM_NEXTDLGCTL" }, { 42, L"WM_SPOOLERSTATUS" }, { 43, L"WM_DRAWITEM" }, { 44, L"WM_MEASUREITEM" }, { 45, L"WM_DELETEITEM" }, { 46, L"WM_VKEYTOITEM" }, { 47, L"WM_CHARTOITEM" }, { 48, L"WM_SETFONT" }, { 49, L"WM_GETFONT" }, { 50, L"WM_SETHOTKEY" }, { 51, L"WM_GETHOTKEY" }, { 55, L"WM_QUERYDRAGICON" }, { 57, L"WM_COMPAREITEM" }, { 61, L"WM_GETOBJECT" }, { 65, L"WM_COMPACTING" }, { 68, L"WM_COMMNOTIFY" }, { 70, L"WM_WINDOWPOSCHANGING" }, { 71, L"WM_WINDOWPOSCHANGED" }, { 72, L"WM_POWER" }, { 73, L"WM_COPYGLOBALDATA" }, { 74, L"WM_COPYDATA" }, { 75, L"WM_CANCELJOURNAL" }, { 78, L"WM_NOTIFY" }, { 80, L"WM_INPUTLANGCHANGEREQUEST" }, { 81, L"WM_INPUTLANGCHANGE" }, { 82, L"WM_TCARD" }, { 83, L"WM_HELP" }, { 84, L"WM_USERCHANGED" }, { 85, L"WM_NOTIFYFORMAT" }, { 123, L"WM_CONTEXTMENU" }, { 124, L"WM_STYLECHANGING" }, { 125, L"WM_STYLECHANGED" }, { 126, L"WM_DISPLAYCHANGE" }, { 127, L"WM_GETICON" }, { 128, L"WM_SETICON" }, { 129, L"WM_NCCREATE" }, { 130, L"WM_NCDESTROY" }, { 131, L"WM_NCCALCSIZE" }, { 132, L"WM_NCHITTEST" }, { 133, L"WM_NCPAINT" }, { 134, L"WM_NCACTIVATE" }, { 135, L"WM_GETDLGCODE" }, { 136, L"WM_SYNCPAINT" }, { 160, L"WM_NCMOUSEMOVE" }, { 161, L"WM_NCLBUTTONDOWN" }, { 162, L"WM_NCLBUTTONUP" }, { 163, L"WM_NCLBUTTONDBLCLK" }, { 164, L"WM_NCRBUTTONDOWN" }, { 165, L"WM_NCRBUTTONUP" }, { 166, L"WM_NCRBUTTONDBLCLK" }, { 167, L"WM_NCMBUTTONDOWN" }, { 168, L"WM_NCMBUTTONUP" }, { 169, L"WM_NCMBUTTONDBLCLK" }, { 171, L"WM_NCXBUTTONDOWN" }, { 172, L"WM_NCXBUTTONUP" }, { 173, L"WM_NCXBUTTONDBLCLK" }, { 176, L"EM_GETSEL" }, { 177, L"EM_SETSEL" }, { 178, L"EM_GETRECT" }, { 179, L"EM_SETRECT" }, { 180, L"EM_SETRECTNP" }, { 181, L"EM_SCROLL" }, { 182, L"EM_LINESCROLL" }, { 183, L"EM_SCROLLCARET" }, { 185, L"EM_GETMODIFY" }, { 187, L"EM_SETMODIFY" }, { 188, L"EM_GETLINECOUNT" }, { 189, L"EM_LINEINDEX" }, { 190, L"EM_SETHANDLE" }, { 191, L"EM_GETHANDLE" }, { 192, L"EM_GETTHUMB" }, { 193, L"EM_LINELENGTH" }, { 194, L"EM_REPLACESEL" }, { 195, L"EM_SETFONT" }, { 196, L"EM_GETLINE" }, { 197, L"EM_LIMITTEXT" }, { 197, L"EM_SETLIMITTEXT" }, { 198, L"EM_CANUNDO" }, { 199, L"EM_UNDO" }, { 200, L"EM_FMTLINES" }, { 201, L"EM_LINEFROMCHAR" }, { 202, L"EM_SETWORDBREAK" }, { 203, L"EM_SETTABSTOPS" }, { 204, L"EM_SETPASSWORDCHAR" }, { 205, L"EM_EMPTYUNDOBUFFER" }, { 206, L"EM_GETFIRSTVISIBLELINE" }, { 207, L"EM_SETREADONLY" }, { 209, L"EM_SETWORDBREAKPROC" }, { 209, L"EM_GETWORDBREAKPROC" }, { 210, L"EM_GETPASSWORDCHAR" }, { 211, L"EM_SETMARGINS" }, { 212, L"EM_GETMARGINS" }, { 213, L"EM_GETLIMITTEXT" }, { 214, L"EM_POSFROMCHAR" }, { 215, L"EM_CHARFROMPOS" }, { 216, L"EM_SETIMESTATUS" }, { 217, L"EM_GETIMESTATUS" }, { 224, L"SBM_SETPOS" }, { 225, L"SBM_GETPOS" }, { 226, L"SBM_SETRANGE" }, { 227, L"SBM_GETRANGE" }, { 228, L"SBM_ENABLE_ARROWS" }, { 230, L"SBM_SETRANGEREDRAW" }, { 233, L"SBM_SETSCROLLINFO" }, { 234, L"SBM_GETSCROLLINFO" }, { 235, L"SBM_GETSCROLLBARINFO" }, { 240, L"BM_GETCHECK" }, { 241, L"BM_SETCHECK" }, { 242, L"BM_GETSTATE" }, { 243, L"BM_SETSTATE" }, { 244, L"BM_SETSTYLE" }, { 245, L"BM_CLICK" }, { 246, L"BM_GETIMAGE" }, { 247, L"BM_SETIMAGE" }, { 248, L"BM_SETDONTCLICK" }, { 255, L"WM_INPUT" }, { 256, L"WM_KEYDOWN" }, { 256, L"WM_KEYFIRST" }, { 257, L"WM_KEYUP" }, { 258, L"WM_CHAR" }, { 259, L"WM_DEADCHAR" }, { 260, L"WM_SYSKEYDOWN" }, { 261, L"WM_SYSKEYUP" }, { 262, L"WM_SYSCHAR" }, { 263, L"WM_SYSDEADCHAR" }, { 265, L"WM_UNICHAR / WM_KEYLAST" }, { 265, L"WM_WNT_CONVERTREQUESTEX" }, { 266, L"WM_CONVERTREQUEST" }, { 267, L"WM_CONVERTRESULT" }, { 268, L"WM_INTERIM" }, { 269, L"WM_IME_STARTCOMPOSITION" }, { 270, L"WM_IME_ENDCOMPOSITION" }, { 271, L"WM_IME_COMPOSITION" }, { 271, L"WM_IME_KEYLAST" }, { 272, L"WM_INITDIALOG" }, { 273, L"WM_COMMAND" }, { 274, L"WM_SYSCOMMAND" }, { 275, L"WM_TIMER" }, { 276, L"WM_HSCROLL" }, { 277, L"WM_VSCROLL" }, { 278, L"WM_INITMENU" }, { 279, L"WM_INITMENUPOPUP" }, { 280, L"WM_SYSTIMER" }, { 287, L"WM_MENUSELECT" }, { 288, L"WM_MENUCHAR" }, { 289, L"WM_ENTERIDLE" }, { 290, L"WM_MENURBUTTONUP" }, { 291, L"WM_MENUDRAG" }, { 292, L"WM_MENUGETOBJECT" }, { 293, L"WM_UNINITMENUPOPUP" }, { 294, L"WM_MENUCOMMAND" }, { 295, L"WM_CHANGEUISTATE" }, { 296, L"WM_UPDATEUISTATE" }, { 297, L"WM_QUERYUISTATE" }, { 306, L"WM_CTLCOLORMSGBOX" }, { 307, L"WM_CTLCOLOREDIT" }, { 308, L"WM_CTLCOLORLISTBOX" }, { 309, L"WM_CTLCOLORBTN" }, { 310, L"WM_CTLCOLORDLG" }, { 311, L"WM_CTLCOLORSCROLLBAR" }, { 312, L"WM_CTLCOLORSTATIC" }, { 512, L"WM_MOUSEFIRST" }, { 512, L"WM_MOUSEMOVE" }, { 513, L"WM_LBUTTONDOWN" }, { 514, L"WM_LBUTTONUP" }, { 515, L"WM_LBUTTONDBLCLK" }, { 516, L"WM_RBUTTONDOWN" }, { 517, L"WM_RBUTTONUP" }, { 518, L"WM_RBUTTONDBLCLK" }, { 519, L"WM_MBUTTONDOWN" }, { 520, L"WM_MBUTTONUP" }, { 521, L"WM_MBUTTONDBLCLK" }, { 521, L"WM_MOUSELAST" }, { 522, L"WM_MOUSEWHEEL" }, { 523, L"WM_XBUTTONDOWN" }, { 524, L"WM_XBUTTONUP" }, { 525, L"WM_XBUTTONDBLCLK" }, { 526, L"WM_MOUSEHWHEEL" }, { 528, L"WM_PARENTNOTIFY" }, { 529, L"WM_ENTERMENULOOP" }, { 530, L"WM_EXITMENULOOP" }, { 531, L"WM_NEXTMENU" }, { 532, L"WM_SIZING" }, { 533, L"WM_CAPTURECHANGED" }, { 534, L"WM_MOVING" }, { 536, L"WM_POWERBROADCAST" }, { 537, L"WM_DEVICECHANGE" }, { 544, L"WM_MDICREATE" }, { 545, L"WM_MDIDESTROY" }, { 546, L"WM_MDIACTIVATE" }, { 547, L"WM_MDIRESTORE" }, { 548, L"WM_MDINEXT" }, { 549, L"WM_MDIMAXIMIZE" }, { 550, L"WM_MDITILE" }, { 551, L"WM_MDICASCADE" }, { 552, L"WM_MDIICONARRANGE" }, { 553, L"WM_MDIGETACTIVE" }, { 560, L"WM_MDISETMENU" }, { 561, L"WM_ENTERSIZEMOVE" }, { 562, L"WM_EXITSIZEMOVE" }, { 563, L"WM_DROPFILES" }, { 564, L"WM_MDIREFRESHMENU" }, { 640, L"WM_IME_REPORT" }, { 641, L"WM_IME_SETCONTEXT" }, { 642, L"WM_IME_NOTIFY" }, { 643, L"WM_IME_CONTROL" }, { 644, L"WM_IME_COMPOSITIONFULL" }, { 645, L"WM_IME_SELECT" }, { 646, L"WM_IME_CHAR" }, { 648, L"WM_IME_REQUEST" }, { 656, L"WM_IMEKEYDOWN" }, { 656, L"WM_IME_KEYDOWN" }, { 657, L"WM_IMEKEYUP" }, { 657, L"WM_IME_KEYUP" }, { 672, L"WM_NCMOUSEHOVER" }, { 673, L"WM_MOUSEHOVER" }, { 674, L"WM_NCMOUSELEAVE" }, { 675, L"WM_MOUSELEAVE" }, { 768, L"WM_CUT" }, { 769, L"WM_COPY" }, { 770, L"WM_PASTE" }, { 771, L"WM_CLEAR" }, { 772, L"WM_UNDO" }, { 773, L"WM_RENDERFORMAT" }, { 774, L"WM_RENDERALLFORMATS" }, { 775, L"WM_DESTROYCLIPBOARD" }, { 776, L"WM_DRAWCLIPBOARD" }, { 777, L"WM_PAINTCLIPBOARD" }, { 778, L"WM_VSCROLLCLIPBOARD" }, { 779, L"WM_SIZECLIPBOARD" }, { 780, L"WM_ASKCBFORMATNAME" }, { 781, L"WM_CHANGECBCHAIN" }, { 782, L"WM_HSCROLLCLIPBOARD" }, { 783, L"WM_QUERYNEWPALETTE" }, { 784, L"WM_PALETTEISCHANGING" }, { 785, L"WM_PALETTECHANGED" }, { 786, L"WM_HOTKEY" }, { 791, L"WM_PRINT" }, { 792, L"WM_PRINTCLIENT" }, { 793, L"WM_APPCOMMAND" }, { 856, L"WM_HANDHELDFIRST" }, { 863, L"WM_HANDHELDLAST" }, { 864, L"WM_AFXFIRST" }, { 895, L"WM_AFXLAST" }, { 896, L"WM_PENWINFIRST" }, { 897, L"WM_RCRESULT" }, { 898, L"WM_HOOKRCRESULT" }, { 899, L"WM_GLOBALRCCHANGE" }, { 899, L"WM_PENMISCINFO" }, { 900, L"WM_SKB" }, { 901, L"WM_HEDITCTL" }, { 901, L"WM_PENCTL" }, { 902, L"WM_PENMISC" }, { 903, L"WM_CTLINIT" }, { 904, L"WM_PENEVENT" }, { 911, L"WM_PENWINLAST" }, { 1024, L"DDM_SETFMT" }, { 1024, L"DM_GETDEFID" }, { 1024, L"NIN_SELECT" }, { 1024, L"TBM_GETPOS" }, { 1024, L"WM_PSD_PAGESETUPDLG" }, { 1024, L"WM_USER" }, { 1025, L"CBEM_INSERTITEMA" }, { 1025, L"DDM_DRAW" }, { 1025, L"DM_SETDEFID" }, { 1025, L"HKM_SETHOTKEY" }, { 1025, L"PBM_SETRANGE" }, { 1025, L"RB_INSERTBANDA" }, { 1025, L"SB_SETTEXTA" }, { 1025, L"TB_ENABLEBUTTON" }, { 1025, L"TBM_GETRANGEMIN" }, { 1025, L"TTM_ACTIVATE" }, { 1025, L"WM_CHOOSEFONT_GETLOGFONT" }, { 1025, L"WM_PSD_FULLPAGERECT" }, { 1026, L"CBEM_SETIMAGELIST" }, { 1026, L"DDM_CLOSE" }, { 1026, L"DM_REPOSITION" }, { 1026, L"HKM_GETHOTKEY" }, { 1026, L"PBM_SETPOS" }, { 1026, L"RB_DELETEBAND" }, { 1026, L"SB_GETTEXTA" }, { 1026, L"TB_CHECKBUTTON" }, { 1026, L"TBM_GETRANGEMAX" }, { 1026, L"WM_PSD_MINMARGINRECT" }, { 1027, L"CBEM_GETIMAGELIST" }, { 1027, L"DDM_BEGIN" }, { 1027, L"HKM_SETRULES" }, { 1027, L"PBM_DELTAPOS" }, { 1027, L"RB_GETBARINFO" }, { 1027, L"SB_GETTEXTLENGTHA" }, { 1027, L"TBM_GETTIC" }, { 1027, L"TB_PRESSBUTTON" }, { 1027, L"TTM_SETDELAYTIME" }, { 1027, L"WM_PSD_MARGINRECT" }, { 1028, L"CBEM_GETITEMA" }, { 1028, L"DDM_END" }, { 1028, L"PBM_SETSTEP" }, { 1028, L"RB_SETBARINFO" }, { 1028, L"SB_SETPARTS" }, { 1028, L"TB_HIDEBUTTON" }, { 1028, L"TBM_SETTIC" }, { 1028, L"TTM_ADDTOOLA" }, { 1028, L"WM_PSD_GREEKTEXTRECT" }, { 1029, L"CBEM_SETITEMA" }, { 1029, L"PBM_STEPIT" }, { 1029, L"TB_INDETERMINATE" }, { 1029, L"TBM_SETPOS" }, { 1029, L"TTM_DELTOOLA" }, { 1029, L"WM_PSD_ENVSTAMPRECT" }, { 1030, L"CBEM_GETCOMBOCONTROL" }, { 1030, L"PBM_SETRANGE32" }, { 1030, L"RB_SETBANDINFOA" }, { 1030, L"SB_GETPARTS" }, { 1030, L"TB_MARKBUTTON" }, { 1030, L"TBM_SETRANGE" }, { 1030, L"TTM_NEWTOOLRECTA" }, { 1030, L"WM_PSD_YAFULLPAGERECT" }, { 1031, L"CBEM_GETEDITCONTROL" }, { 1031, L"PBM_GETRANGE" }, { 1031, L"RB_SETPARENT" }, { 1031, L"SB_GETBORDERS" }, { 1031, L"TBM_SETRANGEMIN" }, { 1031, L"TTM_RELAYEVENT" }, { 1032, L"CBEM_SETEXSTYLE" }, { 1032, L"PBM_GETPOS" }, { 1032, L"RB_HITTEST" }, { 1032, L"SB_SETMINHEIGHT" }, { 1032, L"TBM_SETRANGEMAX" }, { 1032, L"TTM_GETTOOLINFOA" }, { 1033, L"CBEM_GETEXSTYLE" }, { 1033, L"CBEM_GETEXTENDEDSTYLE" }, { 1033, L"PBM_SETBARCOLOR" }, { 1033, L"RB_GETRECT" }, { 1033, L"SB_SIMPLE" }, { 1033, L"TB_ISBUTTONENABLED" }, { 1033, L"TBM_CLEARTICS" }, { 1033, L"TTM_SETTOOLINFOA" }, { 1034, L"CBEM_HASEDITCHANGED" }, { 1034, L"RB_INSERTBANDW" }, { 1034, L"SB_GETRECT" }, { 1034, L"TB_ISBUTTONCHECKED" }, { 1034, L"TBM_SETSEL" }, { 1034, L"TTM_HITTESTA" }, { 1034, L"WIZ_QUERYNUMPAGES" }, { 1035, L"CBEM_INSERTITEMW" }, { 1035, L"RB_SETBANDINFOW" }, { 1035, L"SB_SETTEXTW" }, { 1035, L"TB_ISBUTTONPRESSED" }, { 1035, L"TBM_SETSELSTART" }, { 1035, L"TTM_GETTEXTA" }, { 1035, L"WIZ_NEXT" }, { 1036, L"CBEM_SETITEMW" }, { 1036, L"RB_GETBANDCOUNT" }, { 1036, L"SB_GETTEXTLENGTHW" }, { 1036, L"TB_ISBUTTONHIDDEN" }, { 1036, L"TBM_SETSELEND" }, { 1036, L"TTM_UPDATETIPTEXTA" }, { 1036, L"WIZ_PREV" }, { 1037, L"CBEM_GETITEMW" }, { 1037, L"RB_GETROWCOUNT" }, { 1037, L"SB_GETTEXTW" }, { 1037, L"TB_ISBUTTONINDETERMINATE" }, { 1037, L"TTM_GETTOOLCOUNT" }, { 1038, L"CBEM_SETEXTENDEDSTYLE" }, { 1038, L"RB_GETROWHEIGHT" }, { 1038, L"SB_ISSIMPLE" }, { 1038, L"TB_ISBUTTONHIGHLIGHTED" }, { 1038, L"TBM_GETPTICS" }, { 1038, L"TTM_ENUMTOOLSA" }, { 1039, L"SB_SETICON" }, { 1039, L"TBM_GETTICPOS" }, { 1039, L"TTM_GETCURRENTTOOLA" }, { 1040, L"RB_IDTOINDEX" }, { 1040, L"SB_SETTIPTEXTA" }, { 1040, L"TBM_GETNUMTICS" }, { 1040, L"TTM_WINDOWFROMPOINT" }, { 1041, L"RB_GETTOOLTIPS" }, { 1041, L"SB_SETTIPTEXTW" }, { 1041, L"TBM_GETSELSTART" }, { 1041, L"TB_SETSTATE" }, { 1041, L"TTM_TRACKACTIVATE" }, { 1042, L"RB_SETTOOLTIPS" }, { 1042, L"SB_GETTIPTEXTA" }, { 1042, L"TB_GETSTATE" }, { 1042, L"TBM_GETSELEND" }, { 1042, L"TTM_TRACKPOSITION" }, { 1043, L"RB_SETBKCOLOR" }, { 1043, L"SB_GETTIPTEXTW" }, { 1043, L"TB_ADDBITMAP" }, { 1043, L"TBM_CLEARSEL" }, { 1043, L"TTM_SETTIPBKCOLOR" }, { 1044, L"RB_GETBKCOLOR" }, { 1044, L"SB_GETICON" }, { 1044, L"TB_ADDBUTTONSA" }, { 1044, L"TBM_SETTICFREQ" }, { 1044, L"TTM_SETTIPTEXTCOLOR" }, { 1045, L"RB_SETTEXTCOLOR" }, { 1045, L"TB_INSERTBUTTONA" }, { 1045, L"TBM_SETPAGESIZE" }, { 1045, L"TTM_GETDELAYTIME" }, { 1046, L"RB_GETTEXTCOLOR" }, { 1046, L"TB_DELETEBUTTON" }, { 1046, L"TBM_GETPAGESIZE" }, { 1046, L"TTM_GETTIPBKCOLOR" }, { 1047, L"RB_SIZETORECT" }, { 1047, L"TB_GETBUTTON" }, { 1047, L"TBM_SETLINESIZE" }, { 1047, L"TTM_GETTIPTEXTCOLOR" }, { 1048, L"RB_BEGINDRAG" }, { 1048, L"TB_BUTTONCOUNT" }, { 1048, L"TBM_GETLINESIZE" }, { 1048, L"TTM_SETMAXTIPWIDTH" }, { 1049, L"RB_ENDDRAG" }, { 1049, L"TB_COMMANDTOINDEX" }, { 1049, L"TBM_GETTHUMBRECT" }, { 1049, L"TTM_GETMAXTIPWIDTH" }, { 1050, L"RB_DRAGMOVE" }, { 1050, L"TBM_GETCHANNELRECT" }, { 1050, L"TB_SAVERESTOREA" }, { 1050, L"TTM_SETMARGIN" }, { 1051, L"RB_GETBARHEIGHT" }, { 1051, L"TB_CUSTOMIZE" }, { 1051, L"TBM_SETTHUMBLENGTH" }, { 1051, L"TTM_GETMARGIN" }, { 1052, L"RB_GETBANDINFOW" }, { 1052, L"TB_ADDSTRINGA" }, { 1052, L"TBM_GETTHUMBLENGTH" }, { 1052, L"TTM_POP" }, { 1053, L"RB_GETBANDINFOA" }, { 1053, L"TB_GETITEMRECT" }, { 1053, L"TBM_SETTOOLTIPS" }, { 1053, L"TTM_UPDATE" }, { 1054, L"RB_MINIMIZEBAND" }, { 1054, L"TB_BUTTONSTRUCTSIZE" }, { 1054, L"TBM_GETTOOLTIPS" }, { 1054, L"TTM_GETBUBBLESIZE" }, { 1055, L"RB_MAXIMIZEBAND" }, { 1055, L"TBM_SETTIPSIDE" }, { 1055, L"TB_SETBUTTONSIZE" }, { 1055, L"TTM_ADJUSTRECT" }, { 1056, L"TBM_SETBUDDY" }, { 1056, L"TB_SETBITMAPSIZE" }, { 1056, L"TTM_SETTITLEA" }, { 1057, L"MSG_FTS_JUMP_VA" }, { 1057, L"TB_AUTOSIZE" }, { 1057, L"TBM_GETBUDDY" }, { 1057, L"TTM_SETTITLEW" }, { 1058, L"RB_GETBANDBORDERS" }, { 1059, L"MSG_FTS_JUMP_QWORD" }, { 1059, L"RB_SHOWBAND" }, { 1059, L"TB_GETTOOLTIPS" }, { 1060, L"MSG_REINDEX_REQUEST" }, { 1060, L"TB_SETTOOLTIPS" }, { 1061, L"MSG_FTS_WHERE_IS_IT" }, { 1061, L"RB_SETPALETTE" }, { 1061, L"TB_SETPARENT" }, { 1062, L"RB_GETPALETTE" }, { 1063, L"RB_MOVEBAND" }, { 1063, L"TB_SETROWS" }, { 1064, L"TB_GETROWS" }, { 1065, L"TB_GETBITMAPFLAGS" }, { 1066, L"TB_SETCMDID" }, { 1067, L"RB_PUSHCHEVRON" }, { 1067, L"TB_CHANGEBITMAP" }, { 1068, L"TB_GETBITMAP" }, { 1069, L"MSG_GET_DEFFONT" }, { 1069, L"TB_GETBUTTONTEXTA" }, { 1070, L"TB_REPLACEBITMAP" }, { 1071, L"TB_SETINDENT" }, { 1072, L"TB_SETIMAGELIST" }, { 1073, L"TB_GETIMAGELIST" }, { 1074, L"TB_LOADIMAGES" }, { 1074, L"EM_CANPASTE" }, { 1074, L"TTM_ADDTOOLW" }, { 1075, L"EM_DISPLAYBAND" }, { 1075, L"TB_GETRECT" }, { 1075, L"TTM_DELTOOLW" }, { 1076, L"EM_EXGETSEL" }, { 1076, L"TB_SETHOTIMAGELIST" }, { 1076, L"TTM_NEWTOOLRECTW" }, { 1077, L"EM_EXLIMITTEXT" }, { 1077, L"TB_GETHOTIMAGELIST" }, { 1077, L"TTM_GETTOOLINFOW" }, { 1078, L"EM_EXLINEFROMCHAR" }, { 1078, L"TB_SETDISABLEDIMAGELIST" }, { 1078, L"TTM_SETTOOLINFOW" }, { 1079, L"EM_EXSETSEL" }, { 1079, L"TB_GETDISABLEDIMAGELIST" }, { 1079, L"TTM_HITTESTW" }, { 1080, L"EM_FINDTEXT" }, { 1080, L"TB_SETSTYLE" }, { 1080, L"TTM_GETTEXTW" }, { 1081, L"EM_FORMATRANGE" }, { 1081, L"TB_GETSTYLE" }, { 1081, L"TTM_UPDATETIPTEXTW" }, { 1082, L"EM_GETCHARFORMAT" }, { 1082, L"TB_GETBUTTONSIZE" }, { 1082, L"TTM_ENUMTOOLSW" }, { 1083, L"EM_GETEVENTMASK" }, { 1083, L"TB_SETBUTTONWIDTH" }, { 1083, L"TTM_GETCURRENTTOOLW" }, { 1084, L"EM_GETOLEINTERFACE" }, { 1084, L"TB_SETMAXTEXTROWS" }, { 1085, L"EM_GETPARAFORMAT" }, { 1085, L"TB_GETTEXTROWS" }, { 1086, L"EM_GETSELTEXT" }, { 1086, L"TB_GETOBJECT" }, { 1087, L"EM_HIDESELECTION" }, { 1087, L"TB_GETBUTTONINFOW" }, { 1088, L"EM_PASTESPECIAL" }, { 1088, L"TB_SETBUTTONINFOW" }, { 1089, L"EM_REQUESTRESIZE" }, { 1089, L"TB_GETBUTTONINFOA" }, { 1090, L"EM_SELECTIONTYPE" }, { 1090, L"TB_SETBUTTONINFOA" }, { 1091, L"EM_SETBKGNDCOLOR" }, { 1091, L"TB_INSERTBUTTONW" }, { 1092, L"EM_SETCHARFORMAT" }, { 1092, L"TB_ADDBUTTONSW" }, { 1093, L"EM_SETEVENTMASK" }, { 1093, L"TB_HITTEST" }, { 1094, L"EM_SETOLECALLBACK" }, { 1094, L"TB_SETDRAWTEXTFLAGS" }, { 1095, L"EM_SETPARAFORMAT" }, { 1095, L"TB_GETHOTITEM" }, { 1096, L"EM_SETTARGETDEVICE" }, { 1096, L"TB_SETHOTITEM" }, { 1097, L"EM_STREAMIN" }, { 1097, L"TB_SETANCHORHIGHLIGHT" }, { 1098, L"EM_STREAMOUT" }, { 1098, L"TB_GETANCHORHIGHLIGHT" }, { 1099, L"EM_GETTEXTRANGE" }, { 1099, L"TB_GETBUTTONTEXTW" }, { 1100, L"EM_FINDWORDBREAK" }, { 1100, L"TB_SAVERESTOREW" }, { 1101, L"EM_SETOPTIONS" }, { 1101, L"TB_ADDSTRINGW" }, { 1102, L"EM_GETOPTIONS" }, { 1102, L"TB_MAPACCELERATORA" }, { 1103, L"EM_FINDTEXTEX" }, { 1103, L"TB_GETINSERTMARK" }, { 1104, L"EM_GETWORDBREAKPROCEX" }, { 1104, L"TB_SETINSERTMARK" }, { 1105, L"EM_SETWORDBREAKPROCEX" }, { 1105, L"TB_INSERTMARKHITTEST" }, { 1106, L"EM_SETUNDOLIMIT" }, { 1106, L"TB_MOVEBUTTON" }, { 1107, L"TB_GETMAXSIZE" }, { 1108, L"EM_REDO" }, { 1108, L"TB_SETEXTENDEDSTYLE" }, { 1109, L"EM_CANREDO" }, { 1109, L"TB_GETEXTENDEDSTYLE" }, { 1110, L"EM_GETUNDONAME" }, { 1110, L"TB_GETPADDING" }, { 1111, L"EM_GETREDONAME" }, { 1111, L"TB_SETPADDING" }, { 1112, L"EM_STOPGROUPTYPING" }, { 1112, L"TB_SETINSERTMARKCOLOR" }, { 1113, L"EM_SETTEXTMODE" }, { 1113, L"TB_GETINSERTMARKCOLOR" }, { 1114, L"EM_GETTEXTMODE" }, { 1114, L"TB_MAPACCELERATORW" }, { 1115, L"EM_AUTOURLDETECT" }, { 1115, L"TB_GETSTRINGW" }, { 1116, L"EM_GETAUTOURLDETECT" }, { 1116, L"TB_GETSTRINGA" }, { 1117, L"EM_SETPALETTE" }, { 1118, L"EM_GETTEXTEX" }, { 1119, L"EM_GETTEXTLENGTHEX" }, { 1120, L"EM_SHOWSCROLLBAR" }, { 1121, L"EM_SETTEXTEX" }, { 1123, L"TAPI_REPLY" }, { 1124, L"ACM_OPENA" }, { 1124, L"BFFM_SETSTATUSTEXTA" }, { 1124, L"CDM_FIRST" }, { 1124, L"CDM_GETSPEC" }, { 1124, L"EM_SETPUNCTUATION" }, { 1124, L"IPM_CLEARADDRESS" }, { 1124, L"WM_CAP_UNICODE_START" }, { 1125, L"ACM_PLAY" }, { 1125, L"BFFM_ENABLEOK" }, { 1125, L"CDM_GETFILEPATH" }, { 1125, L"EM_GETPUNCTUATION" }, { 1125, L"IPM_SETADDRESS" }, { 1125, L"PSM_SETCURSEL" }, { 1125, L"UDM_SETRANGE" }, { 1125, L"WM_CHOOSEFONT_SETLOGFONT" }, { 1126, L"ACM_STOP" }, { 1126, L"BFFM_SETSELECTIONA" }, { 1126, L"CDM_GETFOLDERPATH" }, { 1126, L"EM_SETWORDWRAPMODE" }, { 1126, L"IPM_GETADDRESS" }, { 1126, L"PSM_REMOVEPAGE" }, { 1126, L"UDM_GETRANGE" }, { 1126, L"WM_CAP_SET_CALLBACK_ERRORW" }, { 1126, L"WM_CHOOSEFONT_SETFLAGS" }, { 1127, L"ACM_OPENW" }, { 1127, L"BFFM_SETSELECTIONW" }, { 1127, L"CDM_GETFOLDERIDLIST" }, { 1127, L"EM_GETWORDWRAPMODE" }, { 1127, L"IPM_SETRANGE" }, { 1127, L"PSM_ADDPAGE" }, { 1127, L"UDM_SETPOS" }, { 1127, L"WM_CAP_SET_CALLBACK_STATUSW" }, { 1128, L"BFFM_SETSTATUSTEXTW" }, { 1128, L"CDM_SETCONTROLTEXT" }, { 1128, L"EM_SETIMECOLOR" }, { 1128, L"IPM_SETFOCUS" }, { 1128, L"PSM_CHANGED" }, { 1128, L"UDM_GETPOS" }, { 1129, L"CDM_HIDECONTROL" }, { 1129, L"EM_GETIMECOLOR" }, { 1129, L"IPM_ISBLANK" }, { 1129, L"PSM_RESTARTWINDOWS" }, { 1129, L"UDM_SETBUDDY" }, { 1130, L"CDM_SETDEFEXT" }, { 1130, L"EM_SETIMEOPTIONS" }, { 1130, L"PSM_REBOOTSYSTEM" }, { 1130, L"UDM_GETBUDDY" }, { 1131, L"EM_GETIMEOPTIONS" }, { 1131, L"PSM_CANCELTOCLOSE" }, { 1131, L"UDM_SETACCEL" }, { 1132, L"EM_CONVPOSITION" }, { 1132, L"EM_CONVPOSITION" }, { 1132, L"PSM_QUERYSIBLINGS" }, { 1132, L"UDM_GETACCEL" }, { 1133, L"MCIWNDM_GETZOOM" }, { 1133, L"PSM_UNCHANGED" }, { 1133, L"UDM_SETBASE" }, { 1134, L"PSM_APPLY" }, { 1134, L"UDM_GETBASE" }, { 1135, L"PSM_SETTITLEA" }, { 1135, L"UDM_SETRANGE32" }, { 1136, L"PSM_SETWIZBUTTONS" }, { 1136, L"UDM_GETRANGE32" }, { 1136, L"WM_CAP_DRIVER_GET_NAMEW" }, { 1137, L"PSM_PRESSBUTTON" }, { 1137, L"UDM_SETPOS32" }, { 1137, L"WM_CAP_DRIVER_GET_VERSIONW" }, { 1138, L"PSM_SETCURSELID" }, { 1138, L"UDM_GETPOS32" }, { 1139, L"PSM_SETFINISHTEXTA" }, { 1140, L"PSM_GETTABCONTROL" }, { 1141, L"PSM_ISDIALOGMESSAGE" }, { 1142, L"MCIWNDM_REALIZE" }, { 1142, L"PSM_GETCURRENTPAGEHWND" }, { 1143, L"MCIWNDM_SETTIMEFORMATA" }, { 1143, L"PSM_INSERTPAGE" }, { 1144, L"EM_SETLANGOPTIONS" }, { 1144, L"MCIWNDM_GETTIMEFORMATA" }, { 1144, L"PSM_SETTITLEW" }, { 1144, L"WM_CAP_FILE_SET_CAPTURE_FILEW" }, { 1145, L"EM_GETLANGOPTIONS" }, { 1145, L"MCIWNDM_VALIDATEMEDIA" }, { 1145, L"PSM_SETFINISHTEXTW" }, { 1145, L"WM_CAP_FILE_GET_CAPTURE_FILEW" }, { 1146, L"EM_GETIMECOMPMODE" }, { 1147, L"EM_FINDTEXTW" }, { 1147, L"MCIWNDM_PLAYTO" }, { 1147, L"WM_CAP_FILE_SAVEASW" }, { 1148, L"EM_FINDTEXTEXW" }, { 1148, L"MCIWNDM_GETFILENAMEA" }, { 1149, L"EM_RECONVERSION" }, { 1149, L"MCIWNDM_GETDEVICEA" }, { 1149, L"PSM_SETHEADERTITLEA" }, { 1149, L"WM_CAP_FILE_SAVEDIBW" }, { 1150, L"EM_SETIMEMODEBIAS" }, { 1150, L"MCIWNDM_GETPALETTE" }, { 1150, L"PSM_SETHEADERTITLEW" }, { 1151, L"EM_GETIMEMODEBIAS" }, { 1151, L"MCIWNDM_SETPALETTE" }, { 1151, L"PSM_SETHEADERSUBTITLEA" }, { 1152, L"MCIWNDM_GETERRORA" }, { 1152, L"PSM_SETHEADERSUBTITLEW" }, { 1153, L"PSM_HWNDTOINDEX" }, { 1154, L"PSM_INDEXTOHWND" }, { 1155, L"MCIWNDM_SETINACTIVETIMER" }, { 1155, L"PSM_PAGETOINDEX" }, { 1156, L"PSM_INDEXTOPAGE" }, { 1157, L"DL_BEGINDRAG" }, { 1157, L"MCIWNDM_GETINACTIVETIMER" }, { 1157, L"PSM_IDTOINDEX" }, { 1158, L"DL_DRAGGING" }, { 1158, L"PSM_INDEXTOID" }, { 1159, L"DL_DROPPED" }, { 1159, L"PSM_GETRESULT" }, { 1160, L"DL_CANCELDRAG" }, { 1160, L"PSM_RECALCPAGESIZES" }, { 1164, L"MCIWNDM_GET_SOURCE" }, { 1165, L"MCIWNDM_PUT_SOURCE" }, { 1166, L"MCIWNDM_GET_DEST" }, { 1167, L"MCIWNDM_PUT_DEST" }, { 1168, L"MCIWNDM_CAN_PLAY" }, { 1169, L"MCIWNDM_CAN_WINDOW" }, { 1170, L"MCIWNDM_CAN_RECORD" }, { 1171, L"MCIWNDM_CAN_SAVE" }, { 1172, L"MCIWNDM_CAN_EJECT" }, { 1173, L"MCIWNDM_CAN_CONFIG" }, { 1174, L"IE_GETINK" }, { 1174, L"IE_MSGFIRST" }, { 1174, L"MCIWNDM_PALETTEKICK" }, { 1175, L"IE_SETINK" }, { 1176, L"IE_GETPENTIP" }, { 1177, L"IE_SETPENTIP" }, { 1178, L"IE_GETERASERTIP" }, { 1179, L"IE_SETERASERTIP" }, { 1180, L"IE_GETBKGND" }, { 1181, L"IE_SETBKGND" }, { 1182, L"IE_GETGRIDORIGIN" }, { 1183, L"IE_SETGRIDORIGIN" }, { 1184, L"IE_GETGRIDPEN" }, { 1185, L"IE_SETGRIDPEN" }, { 1186, L"IE_GETGRIDSIZE" }, { 1187, L"IE_SETGRIDSIZE" }, { 1188, L"IE_GETMODE" }, { 1189, L"IE_SETMODE" }, { 1190, L"IE_GETINKRECT" }, { 1190, L"WM_CAP_SET_MCI_DEVICEW" }, { 1191, L"WM_CAP_GET_MCI_DEVICEW" }, { 1204, L"WM_CAP_PAL_OPENW" }, { 1205, L"WM_CAP_PAL_SAVEW" }, { 1208, L"IE_GETAPPDATA" }, { 1209, L"IE_SETAPPDATA" }, { 1210, L"IE_GETDRAWOPTS" }, { 1211, L"IE_SETDRAWOPTS" }, { 1212, L"IE_GETFORMAT" }, { 1213, L"IE_SETFORMAT" }, { 1214, L"IE_GETINKINPUT" }, { 1215, L"IE_SETINKINPUT" }, { 1216, L"IE_GETNOTIFY" }, { 1217, L"IE_SETNOTIFY" }, { 1218, L"IE_GETRECOG" }, { 1219, L"IE_SETRECOG" }, { 1220, L"IE_GETSECURITY" }, { 1221, L"IE_SETSECURITY" }, { 1222, L"IE_GETSEL" }, { 1223, L"IE_SETSEL" }, { 1224, L"CDM_LAST" }, { 1224, L"EM_SETBIDIOPTIONS" }, { 1224, L"IE_DOCOMMAND" }, { 1224, L"MCIWNDM_NOTIFYMODE" }, { 1225, L"EM_GETBIDIOPTIONS" }, { 1225, L"IE_GETCOMMAND" }, { 1226, L"EM_SETTYPOGRAPHYOPTIONS" }, { 1226, L"IE_GETCOUNT" }, { 1227, L"EM_GETTYPOGRAPHYOPTIONS" }, { 1227, L"IE_GETGESTURE" }, { 1227, L"MCIWNDM_NOTIFYMEDIA" }, { 1228, L"EM_SETEDITSTYLE" }, { 1228, L"IE_GETMENU" }, { 1229, L"EM_GETEDITSTYLE" }, { 1229, L"IE_GETPAINTDC" }, { 1229, L"MCIWNDM_NOTIFYERROR" }, { 1230, L"IE_GETPDEVENT" }, { 1231, L"IE_GETSELCOUNT" }, { 1232, L"IE_GETSELITEMS" }, { 1233, L"IE_GETSTYLE" }, { 1243, L"MCIWNDM_SETTIMEFORMATW" }, { 1244, L"EM_OUTLINE" }, { 1244, L"MCIWNDM_GETTIMEFORMATW" }, { 1245, L"EM_GETSCROLLPOS" }, { 1246, L"EM_SETSCROLLPOS" }, { 1246, L"EM_SETSCROLLPOS" }, { 1247, L"EM_SETFONTSIZE" }, { 1248, L"EM_GETZOOM" }, { 1248, L"MCIWNDM_GETFILENAMEW" }, { 1249, L"EM_SETZOOM" }, { 1249, L"MCIWNDM_GETDEVICEW" }, { 1250, L"EM_GETVIEWKIND" }, { 1251, L"EM_SETVIEWKIND" }, { 1252, L"EM_GETPAGE" }, { 1252, L"MCIWNDM_GETERRORW" }, { 1253, L"EM_SETPAGE" }, { 1254, L"EM_GETHYPHENATEINFO" }, { 1255, L"EM_SETHYPHENATEINFO" }, { 1259, L"EM_GETPAGEROTATE" }, { 1260, L"EM_SETPAGEROTATE" }, { 1261, L"EM_GETCTFMODEBIAS" }, { 1262, L"EM_SETCTFMODEBIAS" }, { 1264, L"EM_GETCTFOPENSTATUS" }, { 1265, L"EM_SETCTFOPENSTATUS" }, { 1266, L"EM_GETIMECOMPTEXT" }, { 1267, L"EM_ISIME" }, { 1268, L"EM_GETIMEPROPERTY" }, { 1293, L"EM_GETQUERYRTFOBJ" }, { 1294, L"EM_SETQUERYRTFOBJ" }, { 1536, L"FM_GETFOCUS" }, { 1537, L"FM_GETDRIVEINFOA" }, { 1538, L"FM_GETSELCOUNT" }, { 1539, L"FM_GETSELCOUNTLFN" }, { 1540, L"FM_GETFILESELA" }, { 1541, L"FM_GETFILESELLFNA" }, { 1542, L"FM_REFRESH_WINDOWS" }, { 1543, L"FM_RELOAD_EXTENSIONS" }, { 1553, L"FM_GETDRIVEINFOW" }, { 1556, L"FM_GETFILESELW" }, { 1557, L"FM_GETFILESELLFNW" }, { 1625, L"WLX_WM_SAS" }, { 2024, L"SM_GETSELCOUNT" }, { 2024, L"UM_GETSELCOUNT" }, { 2024, L"WM_CPL_LAUNCH" }, { 2025, L"SM_GETSERVERSELA" }, { 2025, L"UM_GETUSERSELA" }, { 2025, L"WM_CPL_LAUNCHED" }, { 2026, L"SM_GETSERVERSELW" }, { 2026, L"UM_GETUSERSELW" }, { 2027, L"SM_GETCURFOCUSA" }, { 2027, L"UM_GETGROUPSELA" }, { 2028, L"SM_GETCURFOCUSW" }, { 2028, L"UM_GETGROUPSELW" }, { 2029, L"SM_GETOPTIONS" }, { 2029, L"UM_GETCURFOCUSA" }, { 2030, L"UM_GETCURFOCUSW" }, { 2031, L"UM_GETOPTIONS" }, { 2032, L"UM_GETOPTIONS2" }, { 4096, L"LVM_FIRST" }, { 4096, L"LVM_GETBKCOLOR" }, { 4097, L"LVM_SETBKCOLOR" }, { 4098, L"LVM_GETIMAGELIST" }, { 4099, L"LVM_SETIMAGELIST" }, { 4100, L"LVM_GETITEMCOUNT" }, { 4101, L"LVM_GETITEMA" }, { 4102, L"LVM_SETITEMA" }, { 4103, L"LVM_INSERTITEMA" }, { 4104, L"LVM_DELETEITEM" }, { 4105, L"LVM_DELETEALLITEMS" }, { 4106, L"LVM_GETCALLBACKMASK" }, { 4107, L"LVM_SETCALLBACKMASK" }, { 4108, L"LVM_GETNEXTITEM" }, { 4109, L"LVM_FINDITEMA" }, { 4110, L"LVM_GETITEMRECT" }, { 4111, L"LVM_SETITEMPOSITION" }, { 4112, L"LVM_GETITEMPOSITION" }, { 4113, L"LVM_GETSTRINGWIDTHA" }, { 4114, L"LVM_HITTEST" }, { 4115, L"LVM_ENSUREVISIBLE" }, { 4116, L"LVM_SCROLL" }, { 4117, L"LVM_REDRAWITEMS" }, { 4118, L"LVM_ARRANGE" }, { 4119, L"LVM_EDITLABELA" }, { 4120, L"LVM_GETEDITCONTROL" }, { 4121, L"LVM_GETCOLUMNA" }, { 4122, L"LVM_SETCOLUMNA" }, { 4123, L"LVM_INSERTCOLUMNA" }, { 4124, L"LVM_DELETECOLUMN" }, { 4125, L"LVM_GETCOLUMNWIDTH" }, { 4126, L"LVM_SETCOLUMNWIDTH" }, { 4127, L"LVM_GETHEADER" }, { 4129, L"LVM_CREATEDRAGIMAGE" }, { 4130, L"LVM_GETVIEWRECT" }, { 4131, L"LVM_GETTEXTCOLOR" }, { 4132, L"LVM_SETTEXTCOLOR" }, { 4133, L"LVM_GETTEXTBKCOLOR" }, { 4134, L"LVM_SETTEXTBKCOLOR" }, { 4135, L"LVM_GETTOPINDEX" }, { 4136, L"LVM_GETCOUNTPERPAGE" }, { 4137, L"LVM_GETORIGIN" }, { 4138, L"LVM_UPDATE" }, { 4139, L"LVM_SETITEMSTATE" }, { 4140, L"LVM_GETITEMSTATE" }, { 4141, L"LVM_GETITEMTEXTA" }, { 4142, L"LVM_SETITEMTEXTA" }, { 4143, L"LVM_SETITEMCOUNT" }, { 4144, L"LVM_SORTITEMS" }, { 4145, L"LVM_SETITEMPOSITION32" }, { 4146, L"LVM_GETSELECTEDCOUNT" }, { 4147, L"LVM_GETITEMSPACING" }, { 4148, L"LVM_GETISEARCHSTRINGA" }, { 4149, L"LVM_SETICONSPACING" }, { 4150, L"LVM_SETEXTENDEDLISTVIEWSTYLE" }, { 4151, L"LVM_GETEXTENDEDLISTVIEWSTYLE" }, { 4152, L"LVM_GETSUBITEMRECT" }, { 4153, L"LVM_SUBITEMHITTEST" }, { 4154, L"LVM_SETCOLUMNORDERARRAY" }, { 4155, L"LVM_GETCOLUMNORDERARRAY" }, { 4156, L"LVM_SETHOTITEM" }, { 4157, L"LVM_GETHOTITEM" }, { 4158, L"LVM_SETHOTCURSOR" }, { 4159, L"LVM_GETHOTCURSOR" }, { 4160, L"LVM_APPROXIMATEVIEWRECT" }, { 4161, L"LVM_SETWORKAREAS" }, { 4162, L"LVM_GETSELECTIONMARK" }, { 4163, L"LVM_SETSELECTIONMARK" }, { 4164, L"LVM_SETBKIMAGEA" }, { 4165, L"LVM_GETBKIMAGEA" }, { 4166, L"LVM_GETWORKAREAS" }, { 4167, L"LVM_SETHOVERTIME" }, { 4168, L"LVM_GETHOVERTIME" }, { 4169, L"LVM_GETNUMBEROFWORKAREAS" }, { 4170, L"LVM_SETTOOLTIPS" }, { 4171, L"LVM_GETITEMW" }, { 4172, L"LVM_SETITEMW" }, { 4173, L"LVM_INSERTITEMW" }, { 4174, L"LVM_GETTOOLTIPS" }, { 4179, L"LVM_FINDITEMW" }, { 4183, L"LVM_GETSTRINGWIDTHW" }, { 4191, L"LVM_GETCOLUMNW" }, { 4192, L"LVM_SETCOLUMNW" }, { 4193, L"LVM_INSERTCOLUMNW" }, { 4211, L"LVM_GETITEMTEXTW" }, { 4212, L"LVM_SETITEMTEXTW" }, { 4213, L"LVM_GETISEARCHSTRINGW" }, { 4214, L"LVM_EDITLABELW" }, { 4235, L"LVM_GETBKIMAGEW" }, { 4236, L"LVM_SETSELECTEDCOLUMN" }, { 4237, L"LVM_SETTILEWIDTH" }, { 4238, L"LVM_SETVIEW" }, { 4239, L"LVM_GETVIEW" }, { 4241, L"LVM_INSERTGROUP" }, { 4243, L"LVM_SETGROUPINFO" }, { 4245, L"LVM_GETGROUPINFO" }, { 4246, L"LVM_REMOVEGROUP" }, { 4247, L"LVM_MOVEGROUP" }, { 4250, L"LVM_MOVEITEMTOGROUP" }, { 4251, L"LVM_SETGROUPMETRICS" }, { 4252, L"LVM_GETGROUPMETRICS" }, { 4253, L"LVM_ENABLEGROUPVIEW" }, { 4254, L"LVM_SORTGROUPS" }, { 4255, L"LVM_INSERTGROUPSORTED" }, { 4256, L"LVM_REMOVEALLGROUPS" }, { 4257, L"LVM_HASGROUP" }, { 4258, L"LVM_SETTILEVIEWINFO" }, { 4259, L"LVM_GETTILEVIEWINFO" }, { 4260, L"LVM_SETTILEINFO" }, { 4261, L"LVM_GETTILEINFO" }, { 4262, L"LVM_SETINSERTMARK" }, { 4263, L"LVM_GETINSERTMARK" }, { 4264, L"LVM_INSERTMARKHITTEST" }, { 4265, L"LVM_GETINSERTMARKRECT" }, { 4266, L"LVM_SETINSERTMARKCOLOR" }, { 4267, L"LVM_GETINSERTMARKCOLOR" }, { 4269, L"LVM_SETINFOTIP" }, { 4270, L"LVM_GETSELECTEDCOLUMN" }, { 4271, L"LVM_ISGROUPVIEWENABLED" }, { 4272, L"LVM_GETOUTLINECOLOR" }, { 4273, L"LVM_SETOUTLINECOLOR" }, { 4275, L"LVM_CANCELEDITLABEL" }, { 4276, L"LVM_MAPINDEXTOID" }, { 4277, L"LVM_MAPIDTOINDEX" }, { 4278, L"LVM_ISITEMVISIBLE" }, { 8192, L"OCM__BASE" }, { 8197, L"LVM_SETUNICODEFORMAT" }, { 8198, L"LVM_GETUNICODEFORMAT" }, { 8217, L"OCM_CTLCOLOR" }, { 8235, L"OCM_DRAWITEM" }, { 8236, L"OCM_MEASUREITEM" }, { 8237, L"OCM_DELETEITEM" }, { 8238, L"OCM_VKEYTOITEM" }, { 8239, L"OCM_CHARTOITEM" }, { 8249, L"OCM_COMPAREITEM" }, { 8270, L"OCM_NOTIFY" }, { 8465, L"OCM_COMMAND" }, { 8468, L"OCM_HSCROLL" }, { 8469, L"OCM_VSCROLL" }, { 8498, L"OCM_CTLCOLORMSGBOX" }, { 8499, L"OCM_CTLCOLOREDIT" }, { 8500, L"OCM_CTLCOLORLISTBOX" }, { 8501, L"OCM_CTLCOLORBTN" }, { 8502, L"OCM_CTLCOLORDLG" }, { 8503, L"OCM_CTLCOLORSCROLLBAR" }, { 8504, L"OCM_CTLCOLORSTATIC" }, { 8720, L"OCM_PARENTNOTIFY" }, { 32768, L"WM_APP" }, { 52429, L"WM_RASDIALEVENT" }, }; static std::map<std::wstring, DWORD> stringToWm = { { L"WM_NULL", 0 }, { L"WM_CREATE", 1 }, { L"WM_DESTROY", 2 }, { L"WM_MOVE", 3 }, { L"WM_SIZE", 5 }, { L"WM_ACTIVATE", 6 }, { L"WM_SETFOCUS", 7 }, { L"WM_KILLFOCUS", 8 }, { L"WM_ENABLE", 10 }, { L"WM_SETREDRAW", 11 }, { L"WM_SETTEXT", 12 }, { L"WM_GETTEXT", 13 }, { L"WM_GETTEXTLENGTH", 14 }, { L"WM_PAINT", 15 }, { L"WM_CLOSE", 16 }, { L"WM_QUERYENDSESSION", 17 }, { L"WM_QUIT", 18 }, { L"WM_QUERYOPEN", 19 }, { L"WM_ERASEBKGND", 20 }, { L"WM_SYSCOLORCHANGE", 21 }, { L"WM_ENDSESSION", 22 }, { L"WM_SHOWWINDOW", 24 }, { L"WM_CTLCOLOR", 25 }, { L"WM_WININICHANGE", 26 }, { L"WM_DEVMODECHANGE", 27 }, { L"WM_ACTIVATEAPP", 28 }, { L"WM_FONTCHANGE", 29 }, { L"WM_TIMECHANGE", 30 }, { L"WM_CANCELMODE", 31 }, { L"WM_SETCURSOR", 32 }, { L"WM_MOUSEACTIVATE", 33 }, { L"WM_CHILDACTIVATE", 34 }, { L"WM_QUEUESYNC", 35 }, { L"WM_GETMINMAXINFO", 36 }, { L"WM_PAINTICON", 38 }, { L"WM_ICONERASEBKGND", 39 }, { L"WM_NEXTDLGCTL", 40 }, { L"WM_SPOOLERSTATUS", 42 }, { L"WM_DRAWITEM", 43 }, { L"WM_MEASUREITEM", 44 }, { L"WM_DELETEITEM", 45 }, { L"WM_VKEYTOITEM", 46 }, { L"WM_CHARTOITEM", 47 }, { L"WM_SETFONT", 48 }, { L"WM_GETFONT", 49 }, { L"WM_SETHOTKEY", 50 }, { L"WM_GETHOTKEY", 51 }, { L"WM_QUERYDRAGICON", 55 }, { L"WM_COMPAREITEM", 57 }, { L"WM_GETOBJECT", 61 }, { L"WM_COMPACTING", 65 }, { L"WM_COMMNOTIFY", 68 }, { L"WM_WINDOWPOSCHANGING", 70 }, { L"WM_WINDOWPOSCHANGED", 71 }, { L"WM_POWER", 72 }, { L"WM_COPYGLOBALDATA", 73 }, { L"WM_COPYDATA", 74 }, { L"WM_CANCELJOURNAL", 75 }, { L"WM_NOTIFY", 78 }, { L"WM_INPUTLANGCHANGEREQUEST", 80 }, { L"WM_INPUTLANGCHANGE", 81 }, { L"WM_TCARD", 82 }, { L"WM_HELP", 83 }, { L"WM_USERCHANGED", 84 }, { L"WM_NOTIFYFORMAT", 85 }, { L"WM_CONTEXTMENU", 123 }, { L"WM_STYLECHANGING", 124 }, { L"WM_STYLECHANGED", 125 }, { L"WM_DISPLAYCHANGE", 126 }, { L"WM_GETICON", 127 }, { L"WM_SETICON", 128 }, { L"WM_NCCREATE", 129 }, { L"WM_NCDESTROY", 130 }, { L"WM_NCCALCSIZE", 131 }, { L"WM_NCHITTEST", 132 }, { L"WM_NCPAINT", 133 }, { L"WM_NCACTIVATE", 134 }, { L"WM_GETDLGCODE", 135 }, { L"WM_SYNCPAINT", 136 }, { L"WM_NCMOUSEMOVE", 160 }, { L"WM_NCLBUTTONDOWN", 161 }, { L"WM_NCLBUTTONUP", 162 }, { L"WM_NCLBUTTONDBLCLK", 163 }, { L"WM_NCRBUTTONDOWN", 164 }, { L"WM_NCRBUTTONUP", 165 }, { L"WM_NCRBUTTONDBLCLK", 166 }, { L"WM_NCMBUTTONDOWN", 167 }, { L"WM_NCMBUTTONUP", 168 }, { L"WM_NCMBUTTONDBLCLK", 169 }, { L"WM_NCXBUTTONDOWN", 171 }, { L"WM_NCXBUTTONUP", 172 }, { L"WM_NCXBUTTONDBLCLK", 173 }, { L"EM_GETSEL", 176 }, { L"EM_SETSEL", 177 }, { L"EM_GETRECT", 178 }, { L"EM_SETRECT", 179 }, { L"EM_SETRECTNP", 180 }, { L"EM_SCROLL", 181 }, { L"EM_LINESCROLL", 182 }, { L"EM_SCROLLCARET", 183 }, { L"EM_GETMODIFY", 185 }, { L"EM_SETMODIFY", 187 }, { L"EM_GETLINECOUNT", 188 }, { L"EM_LINEINDEX", 189 }, { L"EM_SETHANDLE", 190 }, { L"EM_GETHANDLE", 191 }, { L"EM_GETTHUMB", 192 }, { L"EM_LINELENGTH", 193 }, { L"EM_REPLACESEL", 194 }, { L"EM_SETFONT", 195 }, { L"EM_GETLINE", 196 }, { L"EM_LIMITTEXT", 197 }, { L"EM_SETLIMITTEXT", 197 }, { L"EM_CANUNDO", 198 }, { L"EM_UNDO", 199 }, { L"EM_FMTLINES", 200 }, { L"EM_LINEFROMCHAR", 201 }, { L"EM_SETWORDBREAK", 202 }, { L"EM_SETTABSTOPS", 203 }, { L"EM_SETPASSWORDCHAR", 204 }, { L"EM_EMPTYUNDOBUFFER", 205 }, { L"EM_GETFIRSTVISIBLELINE", 206 }, { L"EM_SETREADONLY", 207 }, { L"EM_SETWORDBREAKPROC", 209 }, { L"EM_GETWORDBREAKPROC", 209 }, { L"EM_GETPASSWORDCHAR", 210 }, { L"EM_SETMARGINS", 211 }, { L"EM_GETMARGINS", 212 }, { L"EM_GETLIMITTEXT", 213 }, { L"EM_POSFROMCHAR", 214 }, { L"EM_CHARFROMPOS", 215 }, { L"EM_SETIMESTATUS", 216 }, { L"EM_GETIMESTATUS", 217 }, { L"SBM_SETPOS", 224 }, { L"SBM_GETPOS", 225 }, { L"SBM_SETRANGE", 226 }, { L"SBM_GETRANGE", 227 }, { L"SBM_ENABLE_ARROWS", 228 }, { L"SBM_SETRANGEREDRAW", 230 }, { L"SBM_SETSCROLLINFO", 233 }, { L"SBM_GETSCROLLINFO", 234 }, { L"SBM_GETSCROLLBARINFO", 235 }, { L"BM_GETCHECK", 240 }, { L"BM_SETCHECK", 241 }, { L"BM_GETSTATE", 242 }, { L"BM_SETSTATE", 243 }, { L"BM_SETSTYLE", 244 }, { L"BM_CLICK", 245 }, { L"BM_GETIMAGE", 246 }, { L"BM_SETIMAGE", 247 }, { L"BM_SETDONTCLICK", 248 }, { L"WM_INPUT", 255 }, { L"WM_KEYDOWN", 256 }, { L"WM_KEYFIRST", 256 }, { L"WM_KEYUP", 257 }, { L"WM_CHAR", 258 }, { L"WM_DEADCHAR", 259 }, { L"WM_SYSKEYDOWN", 260 }, { L"WM_SYSKEYUP", 261 }, { L"WM_SYSCHAR", 262 }, { L"WM_SYSDEADCHAR", 263 }, { L"WM_UNICHAR / WM_KEYLAST", 265 }, { L"WM_WNT_CONVERTREQUESTEX", 265 }, { L"WM_CONVERTREQUEST", 266 }, { L"WM_CONVERTRESULT", 267 }, { L"WM_INTERIM", 268 }, { L"WM_IME_STARTCOMPOSITION", 269 }, { L"WM_IME_ENDCOMPOSITION", 270 }, { L"WM_IME_COMPOSITION", 271 }, { L"WM_IME_KEYLAST", 271 }, { L"WM_INITDIALOG", 272 }, { L"WM_COMMAND", 273 }, { L"WM_SYSCOMMAND", 274 }, { L"WM_TIMER", 275 }, { L"WM_HSCROLL", 276 }, { L"WM_VSCROLL", 277 }, { L"WM_INITMENU", 278 }, { L"WM_INITMENUPOPUP", 279 }, { L"WM_SYSTIMER", 280 }, { L"WM_MENUSELECT", 287 }, { L"WM_MENUCHAR", 288 }, { L"WM_ENTERIDLE", 289 }, { L"WM_MENURBUTTONUP", 290 }, { L"WM_MENUDRAG", 291 }, { L"WM_MENUGETOBJECT", 292 }, { L"WM_UNINITMENUPOPUP", 293 }, { L"WM_MENUCOMMAND", 294 }, { L"WM_CHANGEUISTATE", 295 }, { L"WM_UPDATEUISTATE", 296 }, { L"WM_QUERYUISTATE", 297 }, { L"WM_CTLCOLORMSGBOX", 306 }, { L"WM_CTLCOLOREDIT", 307 }, { L"WM_CTLCOLORLISTBOX", 308 }, { L"WM_CTLCOLORBTN", 309 }, { L"WM_CTLCOLORDLG", 310 }, { L"WM_CTLCOLORSCROLLBAR", 311 }, { L"WM_CTLCOLORSTATIC", 312 }, { L"WM_MOUSEFIRST", 512 }, { L"WM_MOUSEMOVE", 512 }, { L"WM_LBUTTONDOWN", 513 }, { L"WM_LBUTTONUP", 514 }, { L"WM_LBUTTONDBLCLK", 515 }, { L"WM_RBUTTONDOWN", 516 }, { L"WM_RBUTTONUP", 517 }, { L"WM_RBUTTONDBLCLK", 518 }, { L"WM_MBUTTONDOWN", 519 }, { L"WM_MBUTTONUP", 520 }, { L"WM_MBUTTONDBLCLK", 521 }, { L"WM_MOUSELAST", 521 }, { L"WM_MOUSEWHEEL", 522 }, { L"WM_XBUTTONDOWN", 523 }, { L"WM_XBUTTONUP", 524 }, { L"WM_XBUTTONDBLCLK", 525 }, { L"WM_MOUSEHWHEEL", 526 }, { L"WM_PARENTNOTIFY", 528 }, { L"WM_ENTERMENULOOP", 529 }, { L"WM_EXITMENULOOP", 530 }, { L"WM_NEXTMENU", 531 }, { L"WM_SIZING", 532 }, { L"WM_CAPTURECHANGED", 533 }, { L"WM_MOVING", 534 }, { L"WM_POWERBROADCAST", 536 }, { L"WM_DEVICECHANGE", 537 }, { L"WM_MDICREATE", 544 }, { L"WM_MDIDESTROY", 545 }, { L"WM_MDIACTIVATE", 546 }, { L"WM_MDIRESTORE", 547 }, { L"WM_MDINEXT", 548 }, { L"WM_MDIMAXIMIZE", 549 }, { L"WM_MDITILE", 550 }, { L"WM_MDICASCADE", 551 }, { L"WM_MDIICONARRANGE", 552 }, { L"WM_MDIGETACTIVE", 553 }, { L"WM_MDISETMENU", 560 }, { L"WM_ENTERSIZEMOVE", 561 }, { L"WM_EXITSIZEMOVE", 562 }, { L"WM_DROPFILES", 563 }, { L"WM_MDIREFRESHMENU", 564 }, { L"WM_IME_REPORT", 640 }, { L"WM_IME_SETCONTEXT", 641 }, { L"WM_IME_NOTIFY", 642 }, { L"WM_IME_CONTROL", 643 }, { L"WM_IME_COMPOSITIONFULL", 644 }, { L"WM_IME_SELECT", 645 }, { L"WM_IME_CHAR", 646 }, { L"WM_IME_REQUEST", 648 }, { L"WM_IMEKEYDOWN", 656 }, { L"WM_IME_KEYDOWN", 656 }, { L"WM_IMEKEYUP", 657 }, { L"WM_IME_KEYUP", 657 }, { L"WM_NCMOUSEHOVER", 672 }, { L"WM_MOUSEHOVER", 673 }, { L"WM_NCMOUSELEAVE", 674 }, { L"WM_MOUSELEAVE", 675 }, { L"WM_CUT", 768 }, { L"WM_COPY", 769 }, { L"WM_PASTE", 770 }, { L"WM_CLEAR", 771 }, { L"WM_UNDO", 772 }, { L"WM_RENDERFORMAT", 773 }, { L"WM_RENDERALLFORMATS", 774 }, { L"WM_DESTROYCLIPBOARD", 775 }, { L"WM_DRAWCLIPBOARD", 776 }, { L"WM_PAINTCLIPBOARD", 777 }, { L"WM_VSCROLLCLIPBOARD", 778 }, { L"WM_SIZECLIPBOARD", 779 }, { L"WM_ASKCBFORMATNAME", 780 }, { L"WM_CHANGECBCHAIN", 781 }, { L"WM_HSCROLLCLIPBOARD", 782 }, { L"WM_QUERYNEWPALETTE", 783 }, { L"WM_PALETTEISCHANGING", 784 }, { L"WM_PALETTECHANGED", 785 }, { L"WM_HOTKEY", 786 }, { L"WM_PRINT", 791 }, { L"WM_PRINTCLIENT", 792 }, { L"WM_APPCOMMAND", 793 }, { L"WM_HANDHELDFIRST", 856 }, { L"WM_HANDHELDLAST", 863 }, { L"WM_AFXFIRST", 864 }, { L"WM_AFXLAST", 895 }, { L"WM_PENWINFIRST", 896 }, { L"WM_RCRESULT", 897 }, { L"WM_HOOKRCRESULT", 898 }, { L"WM_GLOBALRCCHANGE", 899 }, { L"WM_PENMISCINFO", 899 }, { L"WM_SKB", 900 }, { L"WM_HEDITCTL", 901 }, { L"WM_PENCTL", 901 }, { L"WM_PENMISC", 902 }, { L"WM_CTLINIT", 903 }, { L"WM_PENEVENT", 904 }, { L"WM_PENWINLAST", 911 }, { L"DDM_SETFMT", 1024 }, { L"DM_GETDEFID", 1024 }, { L"NIN_SELECT", 1024 }, { L"TBM_GETPOS", 1024 }, { L"WM_PSD_PAGESETUPDLG", 1024 }, { L"WM_USER", 1024 }, { L"CBEM_INSERTITEMA", 1025 }, { L"DDM_DRAW", 1025 }, { L"DM_SETDEFID", 1025 }, { L"HKM_SETHOTKEY", 1025 }, { L"PBM_SETRANGE", 1025 }, { L"RB_INSERTBANDA", 1025 }, { L"SB_SETTEXTA", 1025 }, { L"TB_ENABLEBUTTON", 1025 }, { L"TBM_GETRANGEMIN", 1025 }, { L"TTM_ACTIVATE", 1025 }, { L"WM_CHOOSEFONT_GETLOGFONT", 1025 }, { L"WM_PSD_FULLPAGERECT", 1025 }, { L"CBEM_SETIMAGELIST", 1026 }, { L"DDM_CLOSE", 1026 }, { L"DM_REPOSITION", 1026 }, { L"HKM_GETHOTKEY", 1026 }, { L"PBM_SETPOS", 1026 }, { L"RB_DELETEBAND", 1026 }, { L"SB_GETTEXTA", 1026 }, { L"TB_CHECKBUTTON", 1026 }, { L"TBM_GETRANGEMAX", 1026 }, { L"WM_PSD_MINMARGINRECT", 1026 }, { L"CBEM_GETIMAGELIST", 1027 }, { L"DDM_BEGIN", 1027 }, { L"HKM_SETRULES", 1027 }, { L"PBM_DELTAPOS", 1027 }, { L"RB_GETBARINFO", 1027 }, { L"SB_GETTEXTLENGTHA", 1027 }, { L"TBM_GETTIC", 1027 }, { L"TB_PRESSBUTTON", 1027 }, { L"TTM_SETDELAYTIME", 1027 }, { L"WM_PSD_MARGINRECT", 1027 }, { L"CBEM_GETITEMA", 1028 }, { L"DDM_END", 1028 }, { L"PBM_SETSTEP", 1028 }, { L"RB_SETBARINFO", 1028 }, { L"SB_SETPARTS", 1028 }, { L"TB_HIDEBUTTON", 1028 }, { L"TBM_SETTIC", 1028 }, { L"TTM_ADDTOOLA", 1028 }, { L"WM_PSD_GREEKTEXTRECT", 1028 }, { L"CBEM_SETITEMA", 1029 }, { L"PBM_STEPIT", 1029 }, { L"TB_INDETERMINATE", 1029 }, { L"TBM_SETPOS", 1029 }, { L"TTM_DELTOOLA", 1029 }, { L"WM_PSD_ENVSTAMPRECT", 1029 }, { L"CBEM_GETCOMBOCONTROL", 1030 }, { L"PBM_SETRANGE32", 1030 }, { L"RB_SETBANDINFOA", 1030 }, { L"SB_GETPARTS", 1030 }, { L"TB_MARKBUTTON", 1030 }, { L"TBM_SETRANGE", 1030 }, { L"TTM_NEWTOOLRECTA", 1030 }, { L"WM_PSD_YAFULLPAGERECT", 1030 }, { L"CBEM_GETEDITCONTROL", 1031 }, { L"PBM_GETRANGE", 1031 }, { L"RB_SETPARENT", 1031 }, { L"SB_GETBORDERS", 1031 }, { L"TBM_SETRANGEMIN", 1031 }, { L"TTM_RELAYEVENT", 1031 }, { L"CBEM_SETEXSTYLE", 1032 }, { L"PBM_GETPOS", 1032 }, { L"RB_HITTEST", 1032 }, { L"SB_SETMINHEIGHT", 1032 }, { L"TBM_SETRANGEMAX", 1032 }, { L"TTM_GETTOOLINFOA", 1032 }, { L"CBEM_GETEXSTYLE", 1033 }, { L"CBEM_GETEXTENDEDSTYLE", 1033 }, { L"PBM_SETBARCOLOR", 1033 }, { L"RB_GETRECT", 1033 }, { L"SB_SIMPLE", 1033 }, { L"TB_ISBUTTONENABLED", 1033 }, { L"TBM_CLEARTICS", 1033 }, { L"TTM_SETTOOLINFOA", 1033 }, { L"CBEM_HASEDITCHANGED", 1034 }, { L"RB_INSERTBANDW", 1034 }, { L"SB_GETRECT", 1034 }, { L"TB_ISBUTTONCHECKED", 1034 }, { L"TBM_SETSEL", 1034 }, { L"TTM_HITTESTA", 1034 }, { L"WIZ_QUERYNUMPAGES", 1034 }, { L"CBEM_INSERTITEMW", 1035 }, { L"RB_SETBANDINFOW", 1035 }, { L"SB_SETTEXTW", 1035 }, { L"TB_ISBUTTONPRESSED", 1035 }, { L"TBM_SETSELSTART", 1035 }, { L"TTM_GETTEXTA", 1035 }, { L"WIZ_NEXT", 1035 }, { L"CBEM_SETITEMW", 1036 }, { L"RB_GETBANDCOUNT", 1036 }, { L"SB_GETTEXTLENGTHW", 1036 }, { L"TB_ISBUTTONHIDDEN", 1036 }, { L"TBM_SETSELEND", 1036 }, { L"TTM_UPDATETIPTEXTA", 1036 }, { L"WIZ_PREV", 1036 }, { L"CBEM_GETITEMW", 1037 }, { L"RB_GETROWCOUNT", 1037 }, { L"SB_GETTEXTW", 1037 }, { L"TB_ISBUTTONINDETERMINATE", 1037 }, { L"TTM_GETTOOLCOUNT", 1037 }, { L"CBEM_SETEXTENDEDSTYLE", 1038 }, { L"RB_GETROWHEIGHT", 1038 }, { L"SB_ISSIMPLE", 1038 }, { L"TB_ISBUTTONHIGHLIGHTED", 1038 }, { L"TBM_GETPTICS", 1038 }, { L"TTM_ENUMTOOLSA", 1038 }, { L"SB_SETICON", 1039 }, { L"TBM_GETTICPOS", 1039 }, { L"TTM_GETCURRENTTOOLA", 1039 }, { L"RB_IDTOINDEX", 1040 }, { L"SB_SETTIPTEXTA", 1040 }, { L"TBM_GETNUMTICS", 1040 }, { L"TTM_WINDOWFROMPOINT", 1040 }, { L"RB_GETTOOLTIPS", 1041 }, { L"SB_SETTIPTEXTW", 1041 }, { L"TBM_GETSELSTART", 1041 }, { L"TB_SETSTATE", 1041 }, { L"TTM_TRACKACTIVATE", 1041 }, { L"RB_SETTOOLTIPS", 1042 }, { L"SB_GETTIPTEXTA", 1042 }, { L"TB_GETSTATE", 1042 }, { L"TBM_GETSELEND", 1042 }, { L"TTM_TRACKPOSITION", 1042 }, { L"RB_SETBKCOLOR", 1043 }, { L"SB_GETTIPTEXTW", 1043 }, { L"TB_ADDBITMAP", 1043 }, { L"TBM_CLEARSEL", 1043 }, { L"TTM_SETTIPBKCOLOR", 1043 }, { L"RB_GETBKCOLOR", 1044 }, { L"SB_GETICON", 1044 }, { L"TB_ADDBUTTONSA", 1044 }, { L"TBM_SETTICFREQ", 1044 }, { L"TTM_SETTIPTEXTCOLOR", 1044 }, { L"RB_SETTEXTCOLOR", 1045 }, { L"TB_INSERTBUTTONA", 1045 }, { L"TBM_SETPAGESIZE", 1045 }, { L"TTM_GETDELAYTIME", 1045 }, { L"RB_GETTEXTCOLOR", 1046 }, { L"TB_DELETEBUTTON", 1046 }, { L"TBM_GETPAGESIZE", 1046 }, { L"TTM_GETTIPBKCOLOR", 1046 }, { L"RB_SIZETORECT", 1047 }, { L"TB_GETBUTTON", 1047 }, { L"TBM_SETLINESIZE", 1047 }, { L"TTM_GETTIPTEXTCOLOR", 1047 }, { L"RB_BEGINDRAG", 1048 }, { L"TB_BUTTONCOUNT", 1048 }, { L"TBM_GETLINESIZE", 1048 }, { L"TTM_SETMAXTIPWIDTH", 1048 }, { L"RB_ENDDRAG", 1049 }, { L"TB_COMMANDTOINDEX", 1049 }, { L"TBM_GETTHUMBRECT", 1049 }, { L"TTM_GETMAXTIPWIDTH", 1049 }, { L"RB_DRAGMOVE", 1050 }, { L"TBM_GETCHANNELRECT", 1050 }, { L"TB_SAVERESTOREA", 1050 }, { L"TTM_SETMARGIN", 1050 }, { L"RB_GETBARHEIGHT", 1051 }, { L"TB_CUSTOMIZE", 1051 }, { L"TBM_SETTHUMBLENGTH", 1051 }, { L"TTM_GETMARGIN", 1051 }, { L"RB_GETBANDINFOW", 1052 }, { L"TB_ADDSTRINGA", 1052 }, { L"TBM_GETTHUMBLENGTH", 1052 }, { L"TTM_POP", 1052 }, { L"RB_GETBANDINFOA", 1053 }, { L"TB_GETITEMRECT", 1053 }, { L"TBM_SETTOOLTIPS", 1053 }, { L"TTM_UPDATE", 1053 }, { L"RB_MINIMIZEBAND", 1054 }, { L"TB_BUTTONSTRUCTSIZE", 1054 }, { L"TBM_GETTOOLTIPS", 1054 }, { L"TTM_GETBUBBLESIZE", 1054 }, { L"RB_MAXIMIZEBAND", 1055 }, { L"TBM_SETTIPSIDE", 1055 }, { L"TB_SETBUTTONSIZE", 1055 }, { L"TTM_ADJUSTRECT", 1055 }, { L"TBM_SETBUDDY", 1056 }, { L"TB_SETBITMAPSIZE", 1056 }, { L"TTM_SETTITLEA", 1056 }, { L"MSG_FTS_JUMP_VA", 1057 }, { L"TB_AUTOSIZE", 1057 }, { L"TBM_GETBUDDY", 1057 }, { L"TTM_SETTITLEW", 1057 }, { L"RB_GETBANDBORDERS", 1058 }, { L"MSG_FTS_JUMP_QWORD", 1059 }, { L"RB_SHOWBAND", 1059 }, { L"TB_GETTOOLTIPS", 1059 }, { L"MSG_REINDEX_REQUEST", 1060 }, { L"TB_SETTOOLTIPS", 1060 }, { L"MSG_FTS_WHERE_IS_IT", 1061 }, { L"RB_SETPALETTE", 1061 }, { L"TB_SETPARENT", 1061 }, { L"RB_GETPALETTE", 1062 }, { L"RB_MOVEBAND", 1063 }, { L"TB_SETROWS", 1063 }, { L"TB_GETROWS", 1064 }, { L"TB_GETBITMAPFLAGS", 1065 }, { L"TB_SETCMDID", 1066 }, { L"RB_PUSHCHEVRON", 1067 }, { L"TB_CHANGEBITMAP", 1067 }, { L"TB_GETBITMAP", 1068 }, { L"MSG_GET_DEFFONT", 1069 }, { L"TB_GETBUTTONTEXTA", 1069 }, { L"TB_REPLACEBITMAP", 1070 }, { L"TB_SETINDENT", 1071 }, { L"TB_SETIMAGELIST", 1072 }, { L"TB_GETIMAGELIST", 1073 }, { L"TB_LOADIMAGES", 1074 }, { L"EM_CANPASTE", 1074 }, { L"TTM_ADDTOOLW", 1074 }, { L"EM_DISPLAYBAND", 1075 }, { L"TB_GETRECT", 1075 }, { L"TTM_DELTOOLW", 1075 }, { L"EM_EXGETSEL", 1076 }, { L"TB_SETHOTIMAGELIST", 1076 }, { L"TTM_NEWTOOLRECTW", 1076 }, { L"EM_EXLIMITTEXT", 1077 }, { L"TB_GETHOTIMAGELIST", 1077 }, { L"TTM_GETTOOLINFOW", 1077 }, { L"EM_EXLINEFROMCHAR", 1078 }, { L"TB_SETDISABLEDIMAGELIST", 1078 }, { L"TTM_SETTOOLINFOW", 1078 }, { L"EM_EXSETSEL", 1079 }, { L"TB_GETDISABLEDIMAGELIST", 1079 }, { L"TTM_HITTESTW", 1079 }, { L"EM_FINDTEXT", 1080 }, { L"TB_SETSTYLE", 1080 }, { L"TTM_GETTEXTW", 1080 }, { L"EM_FORMATRANGE", 1081 }, { L"TB_GETSTYLE", 1081 }, { L"TTM_UPDATETIPTEXTW", 1081 }, { L"EM_GETCHARFORMAT", 1082 }, { L"TB_GETBUTTONSIZE", 1082 }, { L"TTM_ENUMTOOLSW", 1082 }, { L"EM_GETEVENTMASK", 1083 }, { L"TB_SETBUTTONWIDTH", 1083 }, { L"TTM_GETCURRENTTOOLW", 1083 }, { L"EM_GETOLEINTERFACE", 1084 }, { L"TB_SETMAXTEXTROWS", 1084 }, { L"EM_GETPARAFORMAT", 1085 }, { L"TB_GETTEXTROWS", 1085 }, { L"EM_GETSELTEXT", 1086 }, { L"TB_GETOBJECT", 1086 }, { L"EM_HIDESELECTION", 1087 }, { L"TB_GETBUTTONINFOW", 1087 }, { L"EM_PASTESPECIAL", 1088 }, { L"TB_SETBUTTONINFOW", 1088 }, { L"EM_REQUESTRESIZE", 1089 }, { L"TB_GETBUTTONINFOA", 1089 }, { L"EM_SELECTIONTYPE", 1090 }, { L"TB_SETBUTTONINFOA", 1090 }, { L"EM_SETBKGNDCOLOR", 1091 }, { L"TB_INSERTBUTTONW", 1091 }, { L"EM_SETCHARFORMAT", 1092 }, { L"TB_ADDBUTTONSW", 1092 }, { L"EM_SETEVENTMASK", 1093 }, { L"TB_HITTEST", 1093 }, { L"EM_SETOLECALLBACK", 1094 }, { L"TB_SETDRAWTEXTFLAGS", 1094 }, { L"EM_SETPARAFORMAT", 1095 }, { L"TB_GETHOTITEM", 1095 }, { L"EM_SETTARGETDEVICE", 1096 }, { L"TB_SETHOTITEM", 1096 }, { L"EM_STREAMIN", 1097 }, { L"TB_SETANCHORHIGHLIGHT", 1097 }, { L"EM_STREAMOUT", 1098 }, { L"TB_GETANCHORHIGHLIGHT", 1098 }, { L"EM_GETTEXTRANGE", 1099 }, { L"TB_GETBUTTONTEXTW", 1099 }, { L"EM_FINDWORDBREAK", 1100 }, { L"TB_SAVERESTOREW", 1100 }, { L"EM_SETOPTIONS", 1101 }, { L"TB_ADDSTRINGW", 1101 }, { L"EM_GETOPTIONS", 1102 }, { L"TB_MAPACCELERATORA", 1102 }, { L"EM_FINDTEXTEX", 1103 }, { L"TB_GETINSERTMARK", 1103 }, { L"EM_GETWORDBREAKPROCEX", 1104 }, { L"TB_SETINSERTMARK", 1104 }, { L"EM_SETWORDBREAKPROCEX", 1105 }, { L"TB_INSERTMARKHITTEST", 1105 }, { L"EM_SETUNDOLIMIT", 1106 }, { L"TB_MOVEBUTTON", 1106 }, { L"TB_GETMAXSIZE", 1107 }, { L"EM_REDO", 1108 }, { L"TB_SETEXTENDEDSTYLE", 1108 }, { L"EM_CANREDO", 1109 }, { L"TB_GETEXTENDEDSTYLE", 1109 }, { L"EM_GETUNDONAME", 1110 }, { L"TB_GETPADDING", 1110 }, { L"EM_GETREDONAME", 1111 }, { L"TB_SETPADDING", 1111 }, { L"EM_STOPGROUPTYPING", 1112 }, { L"TB_SETINSERTMARKCOLOR", 1112 }, { L"EM_SETTEXTMODE", 1113 }, { L"TB_GETINSERTMARKCOLOR", 1113 }, { L"EM_GETTEXTMODE", 1114 }, { L"TB_MAPACCELERATORW", 1114 }, { L"EM_AUTOURLDETECT", 1115 }, { L"TB_GETSTRINGW", 1115 }, { L"EM_GETAUTOURLDETECT", 1116 }, { L"TB_GETSTRINGA", 1116 }, { L"EM_SETPALETTE", 1117 }, { L"EM_GETTEXTEX", 1118 }, { L"EM_GETTEXTLENGTHEX", 1119 }, { L"EM_SHOWSCROLLBAR", 1120 }, { L"EM_SETTEXTEX", 1121 }, { L"TAPI_REPLY", 1123 }, { L"ACM_OPENA", 1124 }, { L"BFFM_SETSTATUSTEXTA", 1124 }, { L"CDM_FIRST", 1124 }, { L"CDM_GETSPEC", 1124 }, { L"EM_SETPUNCTUATION", 1124 }, { L"IPM_CLEARADDRESS", 1124 }, { L"WM_CAP_UNICODE_START", 1124 }, { L"ACM_PLAY", 1125 }, { L"BFFM_ENABLEOK", 1125 }, { L"CDM_GETFILEPATH", 1125 }, { L"EM_GETPUNCTUATION", 1125 }, { L"IPM_SETADDRESS", 1125 }, { L"PSM_SETCURSEL", 1125 }, { L"UDM_SETRANGE", 1125 }, { L"WM_CHOOSEFONT_SETLOGFONT", 1125 }, { L"ACM_STOP", 1126 }, { L"BFFM_SETSELECTIONA", 1126 }, { L"CDM_GETFOLDERPATH", 1126 }, { L"EM_SETWORDWRAPMODE", 1126 }, { L"IPM_GETADDRESS", 1126 }, { L"PSM_REMOVEPAGE", 1126 }, { L"UDM_GETRANGE", 1126 }, { L"WM_CAP_SET_CALLBACK_ERRORW", 1126 }, { L"WM_CHOOSEFONT_SETFLAGS", 1126 }, { L"ACM_OPENW", 1127 }, { L"BFFM_SETSELECTIONW", 1127 }, { L"CDM_GETFOLDERIDLIST", 1127 }, { L"EM_GETWORDWRAPMODE", 1127 }, { L"IPM_SETRANGE", 1127 }, { L"PSM_ADDPAGE", 1127 }, { L"UDM_SETPOS", 1127 }, { L"WM_CAP_SET_CALLBACK_STATUSW", 1127 }, { L"BFFM_SETSTATUSTEXTW", 1128 }, { L"CDM_SETCONTROLTEXT", 1128 }, { L"EM_SETIMECOLOR", 1128 }, { L"IPM_SETFOCUS", 1128 }, { L"PSM_CHANGED", 1128 }, { L"UDM_GETPOS", 1128 }, { L"CDM_HIDECONTROL", 1129 }, { L"EM_GETIMECOLOR", 1129 }, { L"IPM_ISBLANK", 1129 }, { L"PSM_RESTARTWINDOWS", 1129 }, { L"UDM_SETBUDDY", 1129 }, { L"CDM_SETDEFEXT", 1130 }, { L"EM_SETIMEOPTIONS", 1130 }, { L"PSM_REBOOTSYSTEM", 1130 }, { L"UDM_GETBUDDY", 1130 }, { L"EM_GETIMEOPTIONS", 1131 }, { L"PSM_CANCELTOCLOSE", 1131 }, { L"UDM_SETACCEL", 1131 }, { L"EM_CONVPOSITION", 1132 }, { L"EM_CONVPOSITION", 1132 }, { L"PSM_QUERYSIBLINGS", 1132 }, { L"UDM_GETACCEL", 1132 }, { L"MCIWNDM_GETZOOM", 1133 }, { L"PSM_UNCHANGED", 1133 }, { L"UDM_SETBASE", 1133 }, { L"PSM_APPLY", 1134 }, { L"UDM_GETBASE", 1134 }, { L"PSM_SETTITLEA", 1135 }, { L"UDM_SETRANGE32", 1135 }, { L"PSM_SETWIZBUTTONS", 1136 }, { L"UDM_GETRANGE32", 1136 }, { L"WM_CAP_DRIVER_GET_NAMEW", 1136 }, { L"PSM_PRESSBUTTON", 1137 }, { L"UDM_SETPOS32", 1137 }, { L"WM_CAP_DRIVER_GET_VERSIONW", 1137 }, { L"PSM_SETCURSELID", 1138 }, { L"UDM_GETPOS32", 1138 }, { L"PSM_SETFINISHTEXTA", 1139 }, { L"PSM_GETTABCONTROL", 1140 }, { L"PSM_ISDIALOGMESSAGE", 1141 }, { L"MCIWNDM_REALIZE", 1142 }, { L"PSM_GETCURRENTPAGEHWND", 1142 }, { L"MCIWNDM_SETTIMEFORMATA", 1143 }, { L"PSM_INSERTPAGE", 1143 }, { L"EM_SETLANGOPTIONS", 1144 }, { L"MCIWNDM_GETTIMEFORMATA", 1144 }, { L"PSM_SETTITLEW", 1144 }, { L"WM_CAP_FILE_SET_CAPTURE_FILEW", 1144 }, { L"EM_GETLANGOPTIONS", 1145 }, { L"MCIWNDM_VALIDATEMEDIA", 1145 }, { L"PSM_SETFINISHTEXTW", 1145 }, { L"WM_CAP_FILE_GET_CAPTURE_FILEW", 1145 }, { L"EM_GETIMECOMPMODE", 1146 }, { L"EM_FINDTEXTW", 1147 }, { L"MCIWNDM_PLAYTO", 1147 }, { L"WM_CAP_FILE_SAVEASW", 1147 }, { L"EM_FINDTEXTEXW", 1148 }, { L"MCIWNDM_GETFILENAMEA", 1148 }, { L"EM_RECONVERSION", 1149 }, { L"MCIWNDM_GETDEVICEA", 1149 }, { L"PSM_SETHEADERTITLEA", 1149 }, { L"WM_CAP_FILE_SAVEDIBW", 1149 }, { L"EM_SETIMEMODEBIAS", 1150 }, { L"MCIWNDM_GETPALETTE", 1150 }, { L"PSM_SETHEADERTITLEW", 1150 }, { L"EM_GETIMEMODEBIAS", 1151 }, { L"MCIWNDM_SETPALETTE", 1151 }, { L"PSM_SETHEADERSUBTITLEA", 1151 }, { L"MCIWNDM_GETERRORA", 1152 }, { L"PSM_SETHEADERSUBTITLEW", 1152 }, { L"PSM_HWNDTOINDEX", 1153 }, { L"PSM_INDEXTOHWND", 1154 }, { L"MCIWNDM_SETINACTIVETIMER", 1155 }, { L"PSM_PAGETOINDEX", 1155 }, { L"PSM_INDEXTOPAGE", 1156 }, { L"DL_BEGINDRAG", 1157 }, { L"MCIWNDM_GETINACTIVETIMER", 1157 }, { L"PSM_IDTOINDEX", 1157 }, { L"DL_DRAGGING", 1158 }, { L"PSM_INDEXTOID", 1158 }, { L"DL_DROPPED", 1159 }, { L"PSM_GETRESULT", 1159 }, { L"DL_CANCELDRAG", 1160 }, { L"PSM_RECALCPAGESIZES", 1160 }, { L"MCIWNDM_GET_SOURCE", 1164 }, { L"MCIWNDM_PUT_SOURCE", 1165 }, { L"MCIWNDM_GET_DEST", 1166 }, { L"MCIWNDM_PUT_DEST", 1167 }, { L"MCIWNDM_CAN_PLAY", 1168 }, { L"MCIWNDM_CAN_WINDOW", 1169 }, { L"MCIWNDM_CAN_RECORD", 1170 }, { L"MCIWNDM_CAN_SAVE", 1171 }, { L"MCIWNDM_CAN_EJECT", 1172 }, { L"MCIWNDM_CAN_CONFIG", 1173 }, { L"IE_GETINK", 1174 }, { L"IE_MSGFIRST", 1174 }, { L"MCIWNDM_PALETTEKICK", 1174 }, { L"IE_SETINK", 1175 }, { L"IE_GETPENTIP", 1176 }, { L"IE_SETPENTIP", 1177 }, { L"IE_GETERASERTIP", 1178 }, { L"IE_SETERASERTIP", 1179 }, { L"IE_GETBKGND", 1180 }, { L"IE_SETBKGND", 1181 }, { L"IE_GETGRIDORIGIN", 1182 }, { L"IE_SETGRIDORIGIN", 1183 }, { L"IE_GETGRIDPEN", 1184 }, { L"IE_SETGRIDPEN", 1185 }, { L"IE_GETGRIDSIZE", 1186 }, { L"IE_SETGRIDSIZE", 1187 }, { L"IE_GETMODE", 1188 }, { L"IE_SETMODE", 1189 }, { L"IE_GETINKRECT", 1190 }, { L"WM_CAP_SET_MCI_DEVICEW", 1190 }, { L"WM_CAP_GET_MCI_DEVICEW", 1191 }, { L"WM_CAP_PAL_OPENW", 1204 }, { L"WM_CAP_PAL_SAVEW", 1205 }, { L"IE_GETAPPDATA", 1208 }, { L"IE_SETAPPDATA", 1209 }, { L"IE_GETDRAWOPTS", 1210 }, { L"IE_SETDRAWOPTS", 1211 }, { L"IE_GETFORMAT", 1212 }, { L"IE_SETFORMAT", 1213 }, { L"IE_GETINKINPUT", 1214 }, { L"IE_SETINKINPUT", 1215 }, { L"IE_GETNOTIFY", 1216 }, { L"IE_SETNOTIFY", 1217 }, { L"IE_GETRECOG", 1218 }, { L"IE_SETRECOG", 1219 }, { L"IE_GETSECURITY", 1220 }, { L"IE_SETSECURITY", 1221 }, { L"IE_GETSEL", 1222 }, { L"IE_SETSEL", 1223 }, { L"CDM_LAST", 1224 }, { L"EM_SETBIDIOPTIONS", 1224 }, { L"IE_DOCOMMAND", 1224 }, { L"MCIWNDM_NOTIFYMODE", 1224 }, { L"EM_GETBIDIOPTIONS", 1225 }, { L"IE_GETCOMMAND", 1225 }, { L"EM_SETTYPOGRAPHYOPTIONS", 1226 }, { L"IE_GETCOUNT", 1226 }, { L"EM_GETTYPOGRAPHYOPTIONS", 1227 }, { L"IE_GETGESTURE", 1227 }, { L"MCIWNDM_NOTIFYMEDIA", 1227 }, { L"EM_SETEDITSTYLE", 1228 }, { L"IE_GETMENU", 1228 }, { L"EM_GETEDITSTYLE", 1229 }, { L"IE_GETPAINTDC", 1229 }, { L"MCIWNDM_NOTIFYERROR", 1229 }, { L"IE_GETPDEVENT", 1230 }, { L"IE_GETSELCOUNT", 1231 }, { L"IE_GETSELITEMS", 1232 }, { L"IE_GETSTYLE", 1233 }, { L"MCIWNDM_SETTIMEFORMATW", 1243 }, { L"EM_OUTLINE", 1244 }, { L"MCIWNDM_GETTIMEFORMATW", 1244 }, { L"EM_GETSCROLLPOS", 1245 }, { L"EM_SETSCROLLPOS", 1246 }, { L"EM_SETSCROLLPOS", 1246 }, { L"EM_SETFONTSIZE", 1247 }, { L"EM_GETZOOM", 1248 }, { L"MCIWNDM_GETFILENAMEW", 1248 }, { L"EM_SETZOOM", 1249 }, { L"MCIWNDM_GETDEVICEW", 1249 }, { L"EM_GETVIEWKIND", 1250 }, { L"EM_SETVIEWKIND", 1251 }, { L"EM_GETPAGE", 1252 }, { L"MCIWNDM_GETERRORW", 1252 }, { L"EM_SETPAGE", 1253 }, { L"EM_GETHYPHENATEINFO", 1254 }, { L"EM_SETHYPHENATEINFO", 1255 }, { L"EM_GETPAGEROTATE", 1259 }, { L"EM_SETPAGEROTATE", 1260 }, { L"EM_GETCTFMODEBIAS", 1261 }, { L"EM_SETCTFMODEBIAS", 1262 }, { L"EM_GETCTFOPENSTATUS", 1264 }, { L"EM_SETCTFOPENSTATUS", 1265 }, { L"EM_GETIMECOMPTEXT", 1266 }, { L"EM_ISIME", 1267 }, { L"EM_GETIMEPROPERTY", 1268 }, { L"EM_GETQUERYRTFOBJ", 1293 }, { L"EM_SETQUERYRTFOBJ", 1294 }, { L"FM_GETFOCUS", 1536 }, { L"FM_GETDRIVEINFOA", 1537 }, { L"FM_GETSELCOUNT", 1538 }, { L"FM_GETSELCOUNTLFN", 1539 }, { L"FM_GETFILESELA", 1540 }, { L"FM_GETFILESELLFNA", 1541 }, { L"FM_REFRESH_WINDOWS", 1542 }, { L"FM_RELOAD_EXTENSIONS", 1543 }, { L"FM_GETDRIVEINFOW", 1553 }, { L"FM_GETFILESELW", 1556 }, { L"FM_GETFILESELLFNW", 1557 }, { L"WLX_WM_SAS", 1625 }, { L"SM_GETSELCOUNT", 2024 }, { L"UM_GETSELCOUNT", 2024 }, { L"WM_CPL_LAUNCH", 2024 }, { L"SM_GETSERVERSELA", 2025 }, { L"UM_GETUSERSELA", 2025 }, { L"WM_CPL_LAUNCHED", 2025 }, { L"SM_GETSERVERSELW", 2026 }, { L"UM_GETUSERSELW", 2026 }, { L"SM_GETCURFOCUSA", 2027 }, { L"UM_GETGROUPSELA", 2027 }, { L"SM_GETCURFOCUSW", 2028 }, { L"UM_GETGROUPSELW", 2028 }, { L"SM_GETOPTIONS", 2029 }, { L"UM_GETCURFOCUSA", 2029 }, { L"UM_GETCURFOCUSW", 2030 }, { L"UM_GETOPTIONS", 2031 }, { L"UM_GETOPTIONS2", 2032 }, { L"LVM_FIRST", 4096 }, { L"LVM_GETBKCOLOR", 4096 }, { L"LVM_SETBKCOLOR", 4097 }, { L"LVM_GETIMAGELIST", 4098 }, { L"LVM_SETIMAGELIST", 4099 }, { L"LVM_GETITEMCOUNT", 4100 }, { L"LVM_GETITEMA", 4101 }, { L"LVM_SETITEMA", 4102 }, { L"LVM_INSERTITEMA", 4103 }, { L"LVM_DELETEITEM", 4104 }, { L"LVM_DELETEALLITEMS", 4105 }, { L"LVM_GETCALLBACKMASK", 4106 }, { L"LVM_SETCALLBACKMASK", 4107 }, { L"LVM_GETNEXTITEM", 4108 }, { L"LVM_FINDITEMA", 4109 }, { L"LVM_GETITEMRECT", 4110 }, { L"LVM_SETITEMPOSITION", 4111 }, { L"LVM_GETITEMPOSITION", 4112 }, { L"LVM_GETSTRINGWIDTHA", 4113 }, { L"LVM_HITTEST", 4114 }, { L"LVM_ENSUREVISIBLE", 4115 }, { L"LVM_SCROLL", 4116 }, { L"LVM_REDRAWITEMS", 4117 }, { L"LVM_ARRANGE", 4118 }, { L"LVM_EDITLABELA", 4119 }, { L"LVM_GETEDITCONTROL", 4120 }, { L"LVM_GETCOLUMNA", 4121 }, { L"LVM_SETCOLUMNA", 4122 }, { L"LVM_INSERTCOLUMNA", 4123 }, { L"LVM_DELETECOLUMN", 4124 }, { L"LVM_GETCOLUMNWIDTH", 4125 }, { L"LVM_SETCOLUMNWIDTH", 4126 }, { L"LVM_GETHEADER", 4127 }, { L"LVM_CREATEDRAGIMAGE", 4129 }, { L"LVM_GETVIEWRECT", 4130 }, { L"LVM_GETTEXTCOLOR", 4131 }, { L"LVM_SETTEXTCOLOR", 4132 }, { L"LVM_GETTEXTBKCOLOR", 4133 }, { L"LVM_SETTEXTBKCOLOR", 4134 }, { L"LVM_GETTOPINDEX", 4135 }, { L"LVM_GETCOUNTPERPAGE", 4136 }, { L"LVM_GETORIGIN", 4137 }, { L"LVM_UPDATE", 4138 }, { L"LVM_SETITEMSTATE", 4139 }, { L"LVM_GETITEMSTATE", 4140 }, { L"LVM_GETITEMTEXTA", 4141 }, { L"LVM_SETITEMTEXTA", 4142 }, { L"LVM_SETITEMCOUNT", 4143 }, { L"LVM_SORTITEMS", 4144 }, { L"LVM_SETITEMPOSITION32", 4145 }, { L"LVM_GETSELECTEDCOUNT", 4146 }, { L"LVM_GETITEMSPACING", 4147 }, { L"LVM_GETISEARCHSTRINGA", 4148 }, { L"LVM_SETICONSPACING", 4149 }, { L"LVM_SETEXTENDEDLISTVIEWSTYLE", 4150 }, { L"LVM_GETEXTENDEDLISTVIEWSTYLE", 4151 }, { L"LVM_GETSUBITEMRECT", 4152 }, { L"LVM_SUBITEMHITTEST", 4153 }, { L"LVM_SETCOLUMNORDERARRAY", 4154 }, { L"LVM_GETCOLUMNORDERARRAY", 4155 }, { L"LVM_SETHOTITEM", 4156 }, { L"LVM_GETHOTITEM", 4157 }, { L"LVM_SETHOTCURSOR", 4158 }, { L"LVM_GETHOTCURSOR", 4159 }, { L"LVM_APPROXIMATEVIEWRECT", 4160 }, { L"LVM_SETWORKAREAS", 4161 }, { L"LVM_GETSELECTIONMARK", 4162 }, { L"LVM_SETSELECTIONMARK", 4163 }, { L"LVM_SETBKIMAGEA", 4164 }, { L"LVM_GETBKIMAGEA", 4165 }, { L"LVM_GETWORKAREAS", 4166 }, { L"LVM_SETHOVERTIME", 4167 }, { L"LVM_GETHOVERTIME", 4168 }, { L"LVM_GETNUMBEROFWORKAREAS", 4169 }, { L"LVM_SETTOOLTIPS", 4170 }, { L"LVM_GETITEMW", 4171 }, { L"LVM_SETITEMW", 4172 }, { L"LVM_INSERTITEMW", 4173 }, { L"LVM_GETTOOLTIPS", 4174 }, { L"LVM_FINDITEMW", 4179 }, { L"LVM_GETSTRINGWIDTHW", 4183 }, { L"LVM_GETCOLUMNW", 4191 }, { L"LVM_SETCOLUMNW", 4192 }, { L"LVM_INSERTCOLUMNW", 4193 }, { L"LVM_GETITEMTEXTW", 4211 }, { L"LVM_SETITEMTEXTW", 4212 }, { L"LVM_GETISEARCHSTRINGW", 4213 }, { L"LVM_EDITLABELW", 4214 }, { L"LVM_GETBKIMAGEW", 4235 }, { L"LVM_SETSELECTEDCOLUMN", 4236 }, { L"LVM_SETTILEWIDTH", 4237 }, { L"LVM_SETVIEW", 4238 }, { L"LVM_GETVIEW", 4239 }, { L"LVM_INSERTGROUP", 4241 }, { L"LVM_SETGROUPINFO", 4243 }, { L"LVM_GETGROUPINFO", 4245 }, { L"LVM_REMOVEGROUP", 4246 }, { L"LVM_MOVEGROUP", 4247 }, { L"LVM_MOVEITEMTOGROUP", 4250 }, { L"LVM_SETGROUPMETRICS", 4251 }, { L"LVM_GETGROUPMETRICS", 4252 }, { L"LVM_ENABLEGROUPVIEW", 4253 }, { L"LVM_SORTGROUPS", 4254 }, { L"LVM_INSERTGROUPSORTED", 4255 }, { L"LVM_REMOVEALLGROUPS", 4256 }, { L"LVM_HASGROUP", 4257 }, { L"LVM_SETTILEVIEWINFO", 4258 }, { L"LVM_GETTILEVIEWINFO", 4259 }, { L"LVM_SETTILEINFO", 4260 }, { L"LVM_GETTILEINFO", 4261 }, { L"LVM_SETINSERTMARK", 4262 }, { L"LVM_GETINSERTMARK", 4263 }, { L"LVM_INSERTMARKHITTEST", 4264 }, { L"LVM_GETINSERTMARKRECT", 4265 }, { L"LVM_SETINSERTMARKCOLOR", 4266 }, { L"LVM_GETINSERTMARKCOLOR", 4267 }, { L"LVM_SETINFOTIP", 4269 }, { L"LVM_GETSELECTEDCOLUMN", 4270 }, { L"LVM_ISGROUPVIEWENABLED", 4271 }, { L"LVM_GETOUTLINECOLOR", 4272 }, { L"LVM_SETOUTLINECOLOR", 4273 }, { L"LVM_CANCELEDITLABEL", 4275 }, { L"LVM_MAPINDEXTOID", 4276 }, { L"LVM_MAPIDTOINDEX", 4277 }, { L"LVM_ISITEMVISIBLE", 4278 }, { L"OCM__BASE", 8192 }, { L"LVM_SETUNICODEFORMAT", 8197 }, { L"LVM_GETUNICODEFORMAT", 8198 }, { L"OCM_CTLCOLOR", 8217 }, { L"OCM_DRAWITEM", 8235 }, { L"OCM_MEASUREITEM", 8236 }, { L"OCM_DELETEITEM", 8237 }, { L"OCM_VKEYTOITEM", 8238 }, { L"OCM_CHARTOITEM", 8239 }, { L"OCM_COMPAREITEM", 8249 }, { L"OCM_NOTIFY", 8270 }, { L"OCM_COMMAND", 8465 }, { L"OCM_HSCROLL", 8468 }, { L"OCM_VSCROLL", 8469 }, { L"OCM_CTLCOLORMSGBOX", 8498 }, { L"OCM_CTLCOLOREDIT", 8499 }, { L"OCM_CTLCOLORLISTBOX", 8500 }, { L"OCM_CTLCOLORBTN", 8501 }, { L"OCM_CTLCOLORDLG", 8502 }, { L"OCM_CTLCOLORSCROLLBAR", 8503 }, { L"OCM_CTLCOLORSTATIC", 8504 }, { L"OCM_PARENTNOTIFY", 8720 }, { L"WM_APP", 32768 }, { L"WM_RASDIALEVENT", 52429 } };
/* * File: main.cpp * Author: Angel Gil * Function: Able to Play a simple version of the card game WAR. * Created on June 1, 2019, 1:00 PM */ //System Libraries #include <cstdlib> //Random Seed #include <iomanip> //Location Manipulation #include <iostream> //Input and Output Library #include <ctime> //Time Library //User Libraries //Constant Variables //Function Prototypes void war (int, int); //Location where the battlefield is int score (int, int); //Location where the score is being stored using namespace std; int main(int argc, char** argv) { //Random Seed Generator //Declared Variables char tut; //Variables with Value int scr1 = 0, scr2 = 0; /*Variables in depth */ //User Interface "Opening Scene" cout<<"Hello, and welcome the the card game War."<<endl; cout<<"If you don't know how to play, please enter 'a', if you already"<<endl; cout<<"know how to play, enter 'x'. Have Fun and enjoy the game."<<endl; cin>>tut; //User Process //Tutorial if (tut == 'a'){ cout<<"The game consists of two or more players. A deck of cards"<<endl; cout<<"is then divided evenly among the players. The one who has"<<endl; cout<<"an ace card starts the game. Players then must compare card"<<endl; cout<<"values. The one with the highest card number wins the round."<<endl; cout<<"This will continue until all cards are played. If both players"<<endl; cout<<"have equal card values, then a War plays out. Both players will"<<endl; cout<<"then play the rest of their cards until someone becomes victorious."<<endl; cout<<"The points at stake will double as well, making it quite spicy."<<endl; } else if (tut == 'x'){ cout<<"Get ready, and hope you win your first game"<<endl; } else cout<<"why didn't you enter a valid input?"<<endl; //User Interface for the rest of the game //Spacing cout<<endl; cout<<endl; cout<<endl; cout<<"P1"<<" "<<"P2"<<endl; cout<<scr1<<" "<<scr2<<endl; //Displayed Output return 0; } void war (int, int) { } int score (int, int){ }
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QMenuBar> #include <QMenu> #include <QStackedWidget> class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); signals: public slots: private: void setupMenu(); QStackedWidget* frames; QMenu* menuProfiles; QMenu* menuAPI; }; #endif // MAINWINDOW_H
#include <bits/stdc++.h> using namespace std; //CODED BY SUMIT KUMAR PRAJAPATI typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pl; #define si(x) scanf("%d",&x) #define sl(x) scanf("%lld",&x) #define ss(s) scanf("%s",s) #define pi(x) printf("%d\n",x) #define pl(x) printf("%lld\n",x) #define ps(s) printf("%s\n",s) #define PI 3.1415926535897932384626 #define pb push_back #define mk make_pair #define F first #define S second #define all(x) x.begin(), x.end() #define clr(x) memset(x, 0, sizeof(x)) #define rep(i,n) for(ll i=0;i<n;i++) #define repe(i,n) for(ll i=1;i<=n;i++) #define FOR(i,a,b) for(ll i=a;i<=b;i++) #define curtime chrono::high_resolution_clock::now() #define timedif(start,end) chrono::duration_cast<chrono::nanoseconds>(end - start).count() const int MX=1e5+5; const int MD=1e9+7; const int MDL=99824453; auto time0 = curtime; int A,B,C,P; int gcd(int a,int b,int &x,int &y){ if(b==0){ x=1; y=0; return a; } int g=gcd(b,a%b,x,y); int temp=x; x=y; y=temp-(a/b)*y; return g; } int f(int x,int y,int a,int b,int c){ return a*x+b*y+c; } void solve(){ cin>>A>>B>>C>>P; int x0,y0,w0,z0; int g=gcd(A,B,x0,y0); int G=gcd(g,C,w0,z0); int b1=(B/g),a1=(x0*C)/G,c1=(x0*w0*P)/G; int b2=-(A/g),a2=(y0*C)/G ,c2=(y0*w0*P)/G; int a3=-(g/G) ,b3=0, c3=(z0*P)/G; int x_up=(z0*P)/g; int y_up=((w0*P+(C*z0*P)/g)*(y0*g))/(A*G); int y_down=0; int x_down=ceil((w0*P)/(-1.0*C)); // cout<<x_up<<"\n"; // cout<<y_up<<"\n"; // cout<<y_down<<"\n"<<x_down<<"\n"; // cout<<"x= "<<(x0*w0*P)/G<<" + "<<(x0*C)/G<<"k + "<<(B/g)<<"t \n"; // cout<<"y= "<<(y0*w0*P)/G<<" + "<<(y0*C)/G<<"k - "<<(A/g)<<"t \n"; // cout<<"z= "<<(z0*P)/G<<" - "<<(g/G)<<"k \n"; int cnt=0; FOR(x,x_down,x_up){ FOR(y,y_down,y_up){ if(f(x,y,a1,b1,c1)>=0 && f(x,y,a2,b2,c2)>=0 && f(x,y,a3,b3,c3)>=0 ){ //cout<<x<<" "<<y<<'\n'; cnt++; } } } cout<<cnt<<'\n'; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #endif srand(time(0)); time0 = curtime; ll t=1; cin>>t; while(t--) solve(); return 0; }
#include "test_util.h" void TEST_RM_4(const string &tableName, const int nameLength, const string &name, const int age, const float height, const int salary) { // Functions Tested // 1. Insert tuple // 2. Read Attributes ** cout << "****In Test Case 4****" << endl; RID rid; int tupleSize = 0; void *tuple = malloc(100); void *returnedData = malloc(100); // Test Insert Tuple prepareTuple(nameLength, name, age, height, salary, tuple, &tupleSize); RC rc = rm->insertTuple(tableName, tuple, rid); assert(rc == success); // Test Read Attribute rc = rm->readAttribute(tableName, rid, "Salary", returnedData); assert(rc == success); cout << "Salary: " << *(int *)returnedData << endl; if (memcmp((char *)returnedData, (char *)tuple+18, 4) != 0) { cout << "****Test case 4 failed" << endl << endl; } else { cout << "****Test case 4 passed" << endl << endl; } free(tuple); free(returnedData); return; } int main(int argc, char* argv[]) { (void)argv; if(argc > 1) { cout << "Attach debugger and press enter to continue.\n"; getchar(); } cout << endl << "Test Read Attributes .." << endl; // Read Attributes TEST_RM_4("tbl_employee", 6, "Veekay", 27, 171.4, 9000); return 0; }
// // Created by Jelle Spijker on 8/8/20. // #ifndef GCODEHERMENEUS_PARAMETERS_H #define GCODEHERMENEUS_PARAMETERS_H #include <string_view> #include <vector> namespace GHermeneus { /*! * @brief A type containing the parameter key (e.q. X, Y, Z, F, E) * @tparam T the primitive type of the parameter value, this should be the same as the primitive type of the State Space * Vector. Defaults to double */ template <typename T = double> struct Parameter { Parameter(const std::string_view& param, const T& value) : param(param), value(value){}; Parameter(Parameter<T>&& parameter) noexcept : param{ std::move(parameter.param) }, value{ parameter.value } {}; Parameter(const Parameter<T>& parameter) noexcept : param{ parameter.param }, value{ parameter.value } {}; std::string_view param; //<! The Key of the parameter name T value; //<! The extracted GCode parameter value }; template <typename T = double> using Parameters = std::vector<Parameter<T>>; //<! Vector of Parameter of type T default = double } // namespace GHermeneus #endif // GCODEHERMENEUS_PARAMETERS_H
/** * @file Newton3OnOffTest.cpp * @author seckler * @date 18.04.18 */ #include "Newton3OnOffTest.h" #include "autopas/utils/Logger.h" using ::testing::_; // anything is ok using ::testing::Combine; using ::testing::Return; using ::testing::ValuesIn; // Parse combination strings and call actual test function TEST_P(Newton3OnOffTest, countFunctorCallsTest) { auto contTravStr = std::get<0>(GetParam()); auto dataLayoutStr = std::get<1>(GetParam()); transform(contTravStr.begin(), contTravStr.end(), contTravStr.begin(), ::tolower); transform(dataLayoutStr.begin(), dataLayoutStr.end(), dataLayoutStr.begin(), ::tolower); auto containerOption = autopas::utils::StringUtils::parseContainerOptions(contTravStr).begin().operator*(); auto traversalOption = autopas::utils::StringUtils::parseTraversalOptions(contTravStr).begin().operator*(); auto dataLayoutOption = autopas::utils::StringUtils::parseDataLayout(dataLayoutStr).begin().operator*(); countFunctorCalls(containerOption, traversalOption, dataLayoutOption); } // Generate Unittests for all Container / Traversal / Datalayout combinations // Use strings such that generated test names are readable INSTANTIATE_TEST_SUITE_P( Generated, Newton3OnOffTest, Combine(ValuesIn([]() -> std::vector<std::string> { // needed because CellBlock3D (called when building containers) logs always autopas::Logger::create(); std::vector<std::string> ret; for (auto containerOption : autopas::allContainerOptions) { // @TODO: let verlet lists support Newton 3 if (containerOption == autopas::ContainerOption::verletLists || containerOption == autopas::ContainerOption::verletListsCells || containerOption == autopas::ContainerOption::verletClusterLists || containerOption == autopas::ContainerOption::varVerletListsAsBuild) { continue; } autopas::ContainerSelector<Particle, FPCell> containerSelector({0, 0, 0}, {10, 10, 10}, 1); autopas::ContainerSelectorInfo containerInfo(1, 0); containerSelector.selectContainer(containerOption, containerInfo); auto container = containerSelector.getCurrentContainer(); for (auto traversalOption : container->getAllTraversals()) { if (traversalOption == autopas::TraversalOption::c01 || traversalOption == autopas::TraversalOption::c01CombinedSoA /*and autopas::autopas_get_max_threads() > 1*/) { continue; } if (traversalOption == autopas::TraversalOption::c01Cuda) { // Traversal provides no AoS and SoA Traversal continue; } std::stringstream name; name << autopas::utils::StringUtils::to_string(containerOption); name << "+"; name << autopas::utils::StringUtils::to_string(traversalOption); ret.push_back(name.str()); } } autopas::Logger::unregister(); return ret; }()), ValuesIn([]() { std::vector<std::string> ret; std::transform( autopas::allDataLayoutOptions.begin(), autopas::allDataLayoutOptions.end(), std::back_inserter(ret), [](autopas::DataLayoutOption d) -> std::string { return autopas::utils::StringUtils::to_string(d); }); return ret; }()))); // Count number of Functor calls with and without newton 3 and compare void Newton3OnOffTest::countFunctorCalls(autopas::ContainerOption containerOption, autopas::TraversalOption traversalOption, autopas::DataLayoutOption dataLayout) { if (traversalOption == autopas::TraversalOption::c04SoA and dataLayout == autopas::DataLayoutOption::aos) { return; } autopas::ContainerSelector<Particle, FPCell> containerSelector(getBoxMin(), getBoxMax(), getCutoff()); autopas::ContainerSelectorInfo containerInfo(getCellSizeFactor(), getVerletSkin()); containerSelector.selectContainer(containerOption, containerInfo); auto container = containerSelector.getCurrentContainer(); autopas::MoleculeLJ defaultParticle; RandomGenerator::fillWithParticles(*container, defaultParticle, 100); RandomGenerator::fillWithHaloParticles(*container, defaultParticle, container->getCutoff(), 10); EXPECT_CALL(mockFunctor, isRelevantForTuning()).WillRepeatedly(Return(true)); if (dataLayout == autopas::DataLayoutOption::soa) { // loader and extractor will be called, we don't care how often. EXPECT_CALL(mockFunctor, SoALoader(_, _)) .Times(testing::AtLeast(1)) .WillRepeatedly(testing::WithArgs<0, 1>( testing::Invoke([](auto &cell, auto &buf) { buf.resizeArrays(cell.numParticles()); }))); EXPECT_CALL(mockFunctor, SoAExtractor(_, _)).Times(testing::AtLeast(1)); } const auto [callsNewton3SC, callsNewton3Pair] = eval<true>(dataLayout, container, traversalOption); const auto [callsNonNewton3SC, callsNonNewton3Pair] = eval<false>(dataLayout, container, traversalOption); if (autopas::DataLayoutOption::soa) { // within one cell no N3 optimization EXPECT_EQ(callsNewton3SC, callsNonNewton3SC) << "for containeroption: " << containerOption; } // should be called exactly two times EXPECT_EQ(callsNewton3Pair * 2, callsNonNewton3Pair) << "for containeroption: " << containerOption; if (::testing::Test::HasFailure()) { std::cerr << "Failures for Container: " << autopas::utils::StringUtils::to_string(containerOption) << ", Traversal: " << autopas::utils::StringUtils::to_string(traversalOption) << ", Data Layout: " << autopas::utils::StringUtils::to_string(dataLayout) << std::endl; } } template <class ParticleFunctor, class Container, class Traversal> void Newton3OnOffTest::iterate(Container container, Traversal traversal, autopas::DataLayoutOption dataLayout, autopas::Newton3Option newton3, ParticleFunctor *f) { container->iteratePairwise(traversal.get()); } template <bool useNewton3, class Container, class Traversal> std::pair<size_t, size_t> Newton3OnOffTest::eval(autopas::DataLayoutOption dataLayout, Container &container, Traversal traversalOption) { std::atomic<unsigned int> callsSC(0ul); std::atomic<unsigned int> callsPair(0ul); EXPECT_CALL(mockFunctor, allowsNewton3()).WillRepeatedly(Return(useNewton3)); EXPECT_CALL(mockFunctor, allowsNonNewton3()).WillRepeatedly(Return(not useNewton3)); auto traversalSelectorInfo = container->getTraversalSelectorInfo(); const autopas::Newton3Option n3option = (useNewton3) ? autopas::Newton3Option::enabled : autopas::Newton3Option::disabled; switch (dataLayout) { case autopas::DataLayoutOption::soa: { // single cell EXPECT_CALL(mockFunctor, SoAFunctor(_, useNewton3)) .Times(testing::AtLeast(1)) .WillRepeatedly(testing::InvokeWithoutArgs([&]() { callsSC++; })); // pair of cells EXPECT_CALL(mockFunctor, SoAFunctor(_, _, useNewton3)) .Times(testing::AtLeast(1)) .WillRepeatedly(testing::InvokeWithoutArgs([&]() { callsPair++; })); // non useNewton3 variant should not happen EXPECT_CALL(mockFunctor, SoAFunctor(_, _, not useNewton3)).Times(0); iterate( container, autopas::TraversalSelector<FPCell>::template generateTraversal<MockFunctor<Particle, FPCell>, autopas::DataLayoutOption::soa, useNewton3>( traversalOption, mockFunctor, traversalSelectorInfo), dataLayout, n3option, &mockFunctor); break; } case autopas::DataLayoutOption::aos: { EXPECT_CALL(mockFunctor, AoSFunctor(_, _, useNewton3)) .Times(testing::AtLeast(1)) .WillRepeatedly(testing::InvokeWithoutArgs([&]() { callsPair++; })); // non useNewton3 variant should not happen EXPECT_CALL(mockFunctor, AoSFunctor(_, _, not useNewton3)).Times(0); iterate( container, autopas::TraversalSelector<FPCell>::template generateTraversal<MockFunctor<Particle, FPCell>, autopas::DataLayoutOption::aos, useNewton3>( traversalOption, mockFunctor, traversalSelectorInfo), dataLayout, n3option, &mockFunctor); break; } case autopas::DataLayoutOption::cuda: { // supresses Warning // TODO implement suitable test iterate( container, autopas::TraversalSelector<FPCell>::template generateTraversal<MockFunctor<Particle, FPCell>, autopas::DataLayoutOption::cuda, useNewton3>( traversalOption, mockFunctor, traversalSelectorInfo), dataLayout, n3option, &mockFunctor); break; } default: ADD_FAILURE() << "This test does not support data layout : " << autopas::utils::StringUtils::to_string(dataLayout); } return std::make_pair(callsSC.load(), callsPair.load()); }
void setup() { Serial.begin(9600); //-----UDP----- Ethernet.begin(mac, machine1); Udp.begin(localPort); Serial.println("Machine 1 prête."); //-----Leds----- LED_1.begin(); LED_2.begin(); GYRO.begin(); //-----Boutons----- pinMode(BTN_0, INPUT_PULLUP); pinMode(BTN_1, INPUT_PULLUP); pinMode(BTN_2, INPUT_PULLUP); pinMode(BTN_3, INPUT_PULLUP); pinMode(BTN_4, INPUT_PULLUP); pinMode(BTN_5, INPUT_PULLUP); pinMode(BTN_6, INPUT_PULLUP); pinMode(SWT_1, INPUT_PULLUP); pinMode(BC1_1, INPUT_PULLUP); pinMode(BC1_2, INPUT_PULLUP); pinMode(BC1_3, INPUT_PULLUP); pinMode(BC1_4, INPUT_PULLUP); pinMode(SWT_2, INPUT_PULLUP); pinMode(BC2_1, INPUT_PULLUP); pinMode(BC2_2, INPUT_PULLUP); pinMode(BC2_3, INPUT_PULLUP); pinMode(BC2_4, INPUT_PULLUP); pinMode(SWT_3, INPUT_PULLUP); pinMode(BC3_1, INPUT_PULLUP); pinMode(BC3_2, INPUT_PULLUP); pinMode(BC3_3, INPUT_PULLUP); pinMode(BC3_4, INPUT_PULLUP); pinMode(CLN_1, INPUT_PULLUP); pinMode(CLN_2, INPUT_PULLUP); pinMode(CLN_3, INPUT_PULLUP); }
class Solution { typedef pair<int, int> ii; int dist(ii &a, ii &b) { return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second); } int dot(ii &a, ii &b) { return a.first * b.first + a.second * b.second; } public: bool validSquare(vector<int>& p1, vector<int>& p2, vector<int>& p3, vector<int>& p4) { ii coord[4] = { make_pair(p1[0], p1[1]), make_pair(p2[0], p2[1]), make_pair(p3[0], p3[1]), make_pair(p4[0], p4[1]) }; sort(coord, coord + 4); int edge1 = dist(coord[0], coord[1]); int edge2 = dist(coord[0], coord[2]); int edge3 = dist(coord[1], coord[3]); int edge4 = dist(coord[2], coord[3]); ii vec1 = make_pair((coord[1].first - coord[0].first), (coord[1].second - coord[0].second)); ii vec2 = make_pair((coord[2].first - coord[0].first), (coord[2].second - coord[0].second)); return (edge1 != 0) && (edge1 == edge2) && (edge1 == edge3) && (edge1 == edge4) && (dot(vec1, vec2) == 0); } };
#include<stdio.h> int main() { int s = 0;//sum s = s + 1; s = s + 2; s = s + 3; s = s + 4; s = s + 5; s = s + 6; s = s + 7; s = s + 8; s = s + 9; s = s + 10; printf("%d\n", s); return 0; }
#include "SpotifyFilter.h" std::string SpotifyFilter::filterATEndpoint(QJsonDocument api_response) { assert(api_response.object().contains("access_token")); return api_response["access_token"].toString().toStdString(); } std::vector<PlaylistElement> SpotifyFilter::filterSearchArtistEndpoint(QJsonDocument api_response) { //filters artist_id, name and artist images QJsonObject artists = api_response["artists"].toObject(); QJsonArray items = artists["items"].toArray(); std::vector<PlaylistElement> elements(items.size()); for (int i = 0; i < items.size(); ++i) { PlaylistElement pl; QJsonObject artist = items[i].toObject(); QJsonArray image_array = artist["images"].toArray(); //Storing information pl.artist = SpotifyFilter::filterArtistInfo(artist, "name"); pl.artist_id = SpotifyFilter::filterArtistInfo(artist, "id"); pl.artist_img = SpotifyFilter::filterImgInfo(image_array); elements[i] = pl; } return elements; } std::vector<PlaylistElement> SpotifyFilter::filterSearchTrackEndpoint(QJsonDocument api_response) { //filters artist_id, name and artist images QJsonObject tracks = api_response["tracks"].toObject(); QJsonArray items = tracks["items"].toArray(); std::vector<PlaylistElement> elements(items.size()); for (int i = 0; i < items.size(); ++i) { QJsonObject track = items[i].toObject(); QJsonArray artists = track["artists"].toArray(); QJsonObject album = track["album"].toObject(); QJsonArray image_array = album["images"].toArray(); int s = artists.size(); PlaylistElement pl; pl.track_artist = SpotifyFilter::filterMultipleArtists(artists, "name"); pl.track_artist_id = SpotifyFilter::filterMultipleArtists(artists, "id"); pl.album = SpotifyFilter::filterAlbumInfo(album, "name"); pl.album_id = SpotifyFilter::filterAlbumInfo(album, "id"); pl.album_img = SpotifyFilter::filterImgInfo(image_array); pl.track = SpotifyFilter::filterTrackInfo(track, "name"); pl.track_id = SpotifyFilter::filterTrackInfo(track, "id"); pl.sample_url = SpotifyFilter::filterTrackInfo(track, "preview_url"); elements[i] = pl; } return elements; } std::vector<PlaylistElement> SpotifyFilter::filterGetArtistAlbumsEndpoint(QJsonDocument api_response, PlaylistElement& pl) { QJsonArray albums = api_response["items"].toArray(); std::vector<PlaylistElement> elements(albums.size()); if (albums.size() > 0) { //Iterating over each album for (int i = 0; i < albums.size(); ++i) { QJsonObject album = albums[i].toObject(); QJsonArray image_array = album["images"].toArray(); QJsonArray artists = album["artists"].toArray(); pl.album = SpotifyFilter::filterAlbumInfo(album, "name"); pl.album_id = SpotifyFilter::filterAlbumInfo(album, "id"); pl.album_img = SpotifyFilter::filterImgInfo(image_array); pl.album_artist = SpotifyFilter::filterMultipleArtists(artists, "name"); pl.album_artist_id = SpotifyFilter::filterMultipleArtists(artists, "id"); elements[i] = pl; } } return elements; } std::vector<PlaylistElement> SpotifyFilter::filterGetAlbumTracksEndpoint(QJsonDocument api_response, PlaylistElement& pl) { QJsonArray tracks = api_response["items"].toArray(); std::vector<PlaylistElement> elements(tracks.size()); if (tracks.size() > 0) { //Iterate over each of the album's tracks for (int i = 0; i < tracks.size(); ++i) { QJsonObject track = tracks[i].toObject(); QJsonArray artists = track["artists"].toArray(); //Storing information pl.track_artist = SpotifyFilter::filterMultipleArtists(artists, "name"); pl.track_artist_id = SpotifyFilter::filterMultipleArtists(artists, "id"); pl.track = SpotifyFilter::filterTrackInfo(track, "name"); pl.track_id = SpotifyFilter::filterTrackInfo(track, "id"); pl.sample_url = SpotifyFilter::filterTrackInfo(track, "preview_url"); elements[i] = pl; } } return elements; } PlaylistElement SpotifyFilter::filterGetTrackEndpoint(QJsonDocument api_response) { PlaylistElement pl; QJsonObject track = api_response.object(); QJsonArray artists = track["artists"].toArray(); //Storing information pl.track_artist = SpotifyFilter::filterMultipleArtists(artists, "name"); pl.track_artist_id = SpotifyFilter::filterMultipleArtists(artists, "name"); pl.track = SpotifyFilter::filterTrackInfo(track, "name"); pl.track_id = SpotifyFilter::filterTrackInfo(track, "id"); pl.sample_url = SpotifyFilter::filterTrackInfo(track, "preview_url"); return pl; } std::vector<PlaylistElement> SpotifyFilter::filterGetArtistTTEndpoint(QJsonDocument api_response) { QJsonArray tracks = api_response["tracks"].toArray(); std::vector<PlaylistElement> elements(tracks.size()); if (tracks.size() > 0) { for (int i = 0; i < tracks.size(); ++i) { SpotifyImage im; PlaylistElement pl; QJsonObject track = tracks[i].toObject(); QJsonObject album = track["album"].toObject(); QJsonArray image_array = album["images"].toArray(); QJsonArray artists = track["artists"].toArray(); //Storing information pl.track_artist = SpotifyFilter::filterMultipleArtists(artists, "name"); pl.track_artist_id = SpotifyFilter::filterMultipleArtists(artists, "id"); pl.album = SpotifyFilter::filterAlbumInfo(album, "name"); pl.album_id = SpotifyFilter::filterAlbumInfo(album, "id"); pl.album_img = SpotifyFilter::filterImgInfo(image_array); pl.track = SpotifyFilter::filterTrackInfo(track, "name"); pl.track_id = SpotifyFilter::filterTrackInfo(track, "id"); pl.sample_url = SpotifyFilter::filterTrackInfo(track, "preview_url"); elements[i] = pl; } } return elements; } //private functions SpotifyImage SpotifyFilter::filterImgInfo(QJsonArray& image_array) { SpotifyImage im; if (image_array.size() > 0) { QJsonObject large_image = image_array[0].toObject(); QJsonObject medium_image = image_array[1].toObject(); QJsonObject small_image = image_array[2].toObject(); QString large_image_url = large_image["url"].toString(); QString medium_image_url = medium_image["url"].toString(); QString small_image_url = small_image["url"].toString(); im.large_image = large_image_url.toStdString(); im.medium_image = medium_image_url.toStdString(); im.small_image = small_image_url.toStdString(); } return im; } std::vector<std::string> SpotifyFilter::filterMultipleArtists(QJsonArray& artist_array, const char* info) { std::vector<std::string> artist_info(artist_array.size()); if (artist_array.size() > 0) { for (int j = 0; j < artist_array.size(); ++j) { QJsonObject artist = artist_array[j].toObject(); artist_info[j] = artist[info].toString().toStdString(); } } return artist_info; } std::string SpotifyFilter::filterTrackInfo(QJsonObject& track, const char* info) { if (track.contains(info)) { return track[info].toString().toStdString(); } else { return "Error: Track not found"; } } std::string SpotifyFilter::filterAlbumInfo(QJsonObject& album, const char* info) { if (album.contains(info)) { return album[info].toString().toStdString(); } else { return "Error: Album not found"; } } std::string SpotifyFilter::filterArtistInfo(QJsonObject& artist, const char* info) { if (artist.contains(info)) { return artist[info].toString().toStdString(); } else { return "Error: Album not found"; } }
#include <touchgfx/hal/Types.hpp> FONT_GLYPH_LOCATION_FLASH_PRAGMA KEEP extern const uint8_t unicodes_arial_14_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE = { // Unicode: [0x0021, exclam] 0xBC, 0xBC, 0xBC, 0xAB, 0x9A, 0x89, 0x78, 0x67, 0x11, 0x56, 0xAB, // Unicode: [0x0022, quotedbl] 0xF5, 0xF2, 0x05, 0xF5, 0xF2, 0x05, 0xE4, 0xE0, 0x03, 0xA1, 0xA0, 0x01, // Unicode: [0x0023, numbersign] 0x00, 0xB4, 0x20, 0x0E, 0x00, 0x87, 0x50, 0x0B, 0x00, 0x5A, 0x80, 0x08, 0xFD, 0xFF, 0xFF, 0x9F, 0x21, 0x1E, 0xE1, 0x13, 0x30, 0x0C, 0xE1, 0x00, 0x60, 0x09, 0xC4, 0x00, 0xFC, 0xEF, 0xFF, 0x9E, 0xC2, 0x25, 0x7A, 0x12, 0xE0, 0x01, 0x3C, 0x00, 0xD3, 0x00, 0x0E, 0x00, // Unicode: [0x0024, dollar] 0x00, 0xA2, 0x16, 0x00, 0x60, 0xEF, 0xDE, 0x02, 0xF1, 0x85, 0xB4, 0x0A, 0xF4, 0x80, 0x33, 0x05, 0xF2, 0x83, 0x03, 0x00, 0xA0, 0xDE, 0x17, 0x00, 0x00, 0xC5, 0xDF, 0x03, 0x00, 0x80, 0xA4, 0x0D, 0x42, 0x80, 0x33, 0x1F, 0xE6, 0x81, 0x43, 0x0F, 0xE1, 0x9A, 0xC6, 0x0A, 0x40, 0xFC, 0xAE, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x40, 0x02, 0x00, // Unicode: [0x0025, percent] 0x60, 0xDD, 0x04, 0x00, 0x3C, 0x00, 0xE1, 0x32, 0x0E, 0x50, 0x0A, 0x00, 0xE2, 0x00, 0x1F, 0xC0, 0x03, 0x00, 0xE1, 0x32, 0x0D, 0xB5, 0x00, 0x00, 0x50, 0xCD, 0x04, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0B, 0xDA, 0x08, 0x00, 0x00, 0xC0, 0x63, 0x1A, 0x5C, 0x00, 0x00, 0xB5, 0xA0, 0x06, 0x88, 0x00, 0x00, 0x3C, 0xA0, 0x06, 0x88, 0x00, 0x50, 0x0B, 0x70, 0x0A, 0x5C, 0x00, 0xC0, 0x03, 0x10, 0xEA, 0x09, // Unicode: [0x0026, ampersand] 0x00, 0xC3, 0xAE, 0x01, 0x00, 0x00, 0x8E, 0xD3, 0x07, 0x00, 0x10, 0x3F, 0xA0, 0x09, 0x00, 0x00, 0xBC, 0xE3, 0x04, 0x00, 0x00, 0xF4, 0x5E, 0x00, 0x00, 0x40, 0xCE, 0x4F, 0x10, 0x00, 0xE1, 0x08, 0xEA, 0xF4, 0x03, 0xF5, 0x00, 0xD1, 0xDE, 0x00, 0xF4, 0x02, 0x50, 0xAF, 0x00, 0xD0, 0x4B, 0xE5, 0xFC, 0x07, 0x20, 0xFB, 0x8E, 0x70, 0x09, // Unicode: [0x0027, quotesingle] 0xF6, 0xF6, 0xE4, 0x92, // Unicode: [0x0028, parenleft] 0x00, 0xC1, 0x00, 0x6A, 0x20, 0x0E, 0x80, 0x0A, 0xC0, 0x06, 0xF1, 0x03, 0xF2, 0x02, 0xF2, 0x02, 0xF0, 0x03, 0xC0, 0x06, 0x80, 0x0A, 0x20, 0x1E, 0x00, 0x6A, 0x00, 0xC2, // Unicode: [0x0029, parenright] 0x1C, 0x00, 0xA6, 0x00, 0xE0, 0x02, 0xA0, 0x08, 0x60, 0x0C, 0x30, 0x1F, 0x20, 0x2F, 0x20, 0x2F, 0x30, 0x0F, 0x60, 0x0C, 0xA0, 0x08, 0xE1, 0x02, 0xA6, 0x00, 0x2C, 0x00, // Unicode: [0x002A, asterisk] 0x00, 0x2C, 0x00, 0x95, 0x7C, 0x09, 0x72, 0xBF, 0x04, 0xA0, 0xD8, 0x02, 0x50, 0x40, 0x01, // Unicode: [0x002B, plus] 0x00, 0x10, 0x01, 0x00, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x80, 0x0A, 0x00, 0xF3, 0xFF, 0xFF, 0x6F, 0x31, 0x93, 0x3B, 0x13, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x80, 0x0A, 0x00, // Unicode: [0x002C, comma] 0x56, 0xAB, 0x92, 0x39, // Unicode: [0x002D, hyphen] 0x11, 0x11, 0x00, 0xF8, 0xFF, 0x03, 0x42, 0x44, 0x01, // Unicode: [0x002E, period] 0x56, 0xAB, // Unicode: [0x002F, slash] 0x00, 0xB3, 0x00, 0x77, 0x00, 0x3B, 0x10, 0x0E, 0x40, 0x0B, 0x80, 0x07, 0xC0, 0x03, 0xD1, 0x00, 0xA5, 0x00, 0x69, 0x00, 0x2D, 0x00, // Unicode: [0x0030, zero] 0x10, 0xE9, 0x7E, 0x00, 0x90, 0x3C, 0xE5, 0x05, 0xF1, 0x03, 0x80, 0x0B, 0xF4, 0x00, 0x40, 0x0E, 0xD6, 0x00, 0x30, 0x1F, 0xD6, 0x00, 0x20, 0x1F, 0xD6, 0x00, 0x30, 0x1F, 0xE4, 0x00, 0x40, 0x0E, 0xF1, 0x03, 0x80, 0x0B, 0x90, 0x3C, 0xE5, 0x05, 0x10, 0xEA, 0x6D, 0x00, // Unicode: [0x0031, one] 0x00, 0xD1, 0x03, 0x10, 0xFB, 0x03, 0xC3, 0xFC, 0x03, 0x86, 0xF1, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xF0, 0x03, // Unicode: [0x0032, two] 0x20, 0xEA, 0x9D, 0x01, 0xC0, 0x3A, 0xD4, 0x09, 0xF3, 0x01, 0x50, 0x0E, 0x31, 0x00, 0x50, 0x0E, 0x00, 0x00, 0xB0, 0x0A, 0x00, 0x00, 0xE8, 0x02, 0x00, 0x80, 0x4E, 0x00, 0x00, 0xE9, 0x04, 0x00, 0x80, 0x3E, 0x00, 0x00, 0xF3, 0x49, 0x44, 0x04, 0xF8, 0xFF, 0xFF, 0x1F, // Unicode: [0x0033, three] 0x10, 0xEA, 0x6D, 0x00, 0xB0, 0x2B, 0xF5, 0x03, 0xF2, 0x02, 0xA0, 0x09, 0x20, 0x00, 0xB0, 0x09, 0x00, 0x00, 0xF5, 0x03, 0x00, 0xE0, 0xBF, 0x01, 0x00, 0x10, 0xC2, 0x0B, 0x00, 0x00, 0x40, 0x1F, 0xE4, 0x00, 0x40, 0x1F, 0xD1, 0x2A, 0xD4, 0x09, 0x20, 0xEB, 0x8D, 0x00, // Unicode: [0x0034, four] 0x00, 0x00, 0xB9, 0x00, 0x00, 0x40, 0xBF, 0x00, 0x00, 0xD0, 0xBB, 0x00, 0x00, 0xA8, 0xB7, 0x00, 0x30, 0x1E, 0xB7, 0x00, 0xC0, 0x05, 0xB7, 0x00, 0xB8, 0x00, 0xB7, 0x00, 0xFC, 0xFF, 0xFF, 0x2F, 0x32, 0x33, 0xC9, 0x03, 0x00, 0x00, 0xB7, 0x00, 0x00, 0x00, 0xB7, 0x00, // Unicode: [0x0035, five] 0x50, 0xFF, 0xFF, 0x0B, 0x70, 0x4C, 0x44, 0x03, 0xA0, 0x08, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xE0, 0xDA, 0x9E, 0x01, 0xF2, 0x3A, 0xD5, 0x0A, 0x20, 0x00, 0x40, 0x1F, 0x00, 0x00, 0x20, 0x3F, 0xE4, 0x01, 0x50, 0x1F, 0xD1, 0x2A, 0xD4, 0x08, 0x30, 0xEB, 0x8E, 0x00, // Unicode: [0x0036, six] 0x00, 0xE8, 0x9E, 0x01, 0x80, 0x3D, 0xD3, 0x08, 0xF1, 0x04, 0x50, 0x0B, 0xE4, 0x00, 0x00, 0x00, 0xC6, 0xD6, 0x9E, 0x01, 0xE7, 0x4C, 0xD5, 0x09, 0xF7, 0x02, 0x50, 0x0F, 0xF5, 0x00, 0x20, 0x2F, 0xF2, 0x02, 0x50, 0x0E, 0xA0, 0x3C, 0xD3, 0x08, 0x10, 0xE9, 0x8E, 0x00, // Unicode: [0x0037, seven] 0xF5, 0xFF, 0xFF, 0x2F, 0x41, 0x44, 0xB4, 0x0C, 0x00, 0x00, 0xF4, 0x02, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x50, 0x1F, 0x00, 0x00, 0xB0, 0x09, 0x00, 0x00, 0xF2, 0x04, 0x00, 0x00, 0xE6, 0x00, 0x00, 0x00, 0xA9, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x6D, 0x00, 0x00, // Unicode: [0x0038, eight] 0x10, 0xEA, 0x8D, 0x00, 0xA0, 0x2B, 0xE4, 0x07, 0xF0, 0x04, 0x80, 0x0B, 0xE0, 0x0A, 0xC1, 0x08, 0x50, 0xFE, 0xBF, 0x00, 0x70, 0x3A, 0xD4, 0x08, 0xF3, 0x01, 0x50, 0x1F, 0xD6, 0x00, 0x20, 0x2F, 0xF4, 0x01, 0x40, 0x0F, 0xD0, 0x2A, 0xD4, 0x08, 0x20, 0xEA, 0x8D, 0x00, // Unicode: [0x0039, nine] 0x20, 0xEA, 0x6D, 0x00, 0xC0, 0x3C, 0xE4, 0x05, 0xF4, 0x02, 0x60, 0x0C, 0xD6, 0x00, 0x40, 0x1F, 0xE4, 0x01, 0x50, 0x2F, 0xE1, 0x19, 0xC2, 0x2F, 0x40, 0xFE, 0x6E, 0x1F, 0x00, 0x20, 0x30, 0x0E, 0xB2, 0x01, 0x80, 0x0B, 0xD0, 0x29, 0xF6, 0x04, 0x30, 0xEB, 0x5C, 0x00, // Unicode: [0x003A, colon] 0xAB, 0x56, 0x00, 0x00, 0x00, 0x00, 0x56, 0xAB, // Unicode: [0x003B, semicolon] 0xAB, 0x56, 0x00, 0x00, 0x00, 0x00, 0x56, 0xAB, 0x92, 0x39, // Unicode: [0x003C, less] 0x00, 0x00, 0x20, 0x59, 0x00, 0x30, 0xFA, 0x3B, 0x50, 0xFB, 0x39, 0x00, 0xF3, 0x1A, 0x00, 0x00, 0x91, 0xBF, 0x04, 0x00, 0x00, 0x82, 0xCE, 0x06, 0x00, 0x00, 0x71, 0x6D, 0x00, 0x00, 0x00, 0x10, // Unicode: [0x003D, equal] 0xF3, 0xFF, 0xFF, 0x6F, 0x41, 0x44, 0x44, 0x14, 0x00, 0x00, 0x00, 0x00, 0xF3, 0xFF, 0xFF, 0x6F, 0x31, 0x33, 0x33, 0x13, // Unicode: [0x003E, greater] 0xA3, 0x03, 0x00, 0x00, 0xA1, 0xBF, 0x04, 0x00, 0x00, 0x82, 0xCE, 0x06, 0x00, 0x00, 0x81, 0x6F, 0x00, 0x30, 0xFA, 0x2A, 0x50, 0xFB, 0x29, 0x00, 0xE3, 0x18, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, // Unicode: [0x003F, question] 0x20, 0xEA, 0x9D, 0x01, 0xC0, 0x3B, 0xD4, 0x0A, 0xF3, 0x02, 0x50, 0x0F, 0x31, 0x00, 0x50, 0x0F, 0x00, 0x00, 0xD1, 0x09, 0x00, 0x10, 0xBC, 0x00, 0x00, 0x70, 0x1D, 0x00, 0x00, 0xB0, 0x07, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x70, 0x04, 0x00, 0x00, 0xD0, 0x08, 0x00, // Unicode: [0x0040, at] 0x00, 0x00, 0xB5, 0xFE, 0xAD, 0x04, 0x00, 0x00, 0xA0, 0x7D, 0x23, 0x83, 0x8E, 0x00, 0x00, 0xB9, 0x01, 0x00, 0x00, 0xD2, 0x06, 0x30, 0x1D, 0x70, 0xDE, 0xD4, 0x45, 0x0D, 0xA0, 0x06, 0xD8, 0x44, 0xFD, 0x02, 0x3D, 0xE0, 0x21, 0x3F, 0x00, 0xE8, 0x00, 0x5A, 0xD2, 0x70, 0x0D, 0x00, 0xB7, 0x00, 0x5B, 0xC3, 0x90, 0x0A, 0x00, 0x9A, 0x10, 0x1E, 0xD2, 0x80, 0x0B, 0x20, 0x6F, 0x80, 0x0A, 0xE0, 0x32, 0x7F, 0xD5, 0x7F, 0xD9, 0x01, 0x90, 0x09, 0xE7, 0x3D, 0xEB, 0x2A, 0x21, 0x20, 0x7E, 0x00, 0x00, 0x00, 0x40, 0x4E, 0x00, 0xD3, 0x6C, 0x23, 0x52, 0xEA, 0x05, 0x00, 0x10, 0xB6, 0xFE, 0xCE, 0x28, 0x00, // Unicode: [0x0041, A] 0x00, 0x50, 0x7F, 0x00, 0x00, 0x00, 0xA0, 0xCD, 0x00, 0x00, 0x00, 0xF1, 0xF5, 0x03, 0x00, 0x00, 0xE6, 0xD0, 0x08, 0x00, 0x00, 0xAB, 0x80, 0x0E, 0x00, 0x20, 0x5F, 0x30, 0x5F, 0x00, 0x70, 0x1F, 0x00, 0xAD, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0x01, 0xF2, 0x37, 0x33, 0xF5, 0x06, 0xE7, 0x00, 0x00, 0xC0, 0x0C, 0x9D, 0x00, 0x00, 0x50, 0x3F, // Unicode: [0x0042, B] 0xFF, 0xFF, 0xAE, 0x01, 0x8F, 0x44, 0xD6, 0x0B, 0x5F, 0x00, 0x50, 0x1F, 0x5F, 0x00, 0x40, 0x1F, 0x6F, 0x11, 0xB2, 0x0A, 0xFF, 0xFF, 0xEF, 0x03, 0x8F, 0x44, 0xA4, 0x2E, 0x5F, 0x00, 0x00, 0x8D, 0x5F, 0x00, 0x00, 0x8E, 0x8F, 0x44, 0xA5, 0x3F, 0xFF, 0xFF, 0xCE, 0x05, // Unicode: [0x0043, C] 0x00, 0x91, 0xED, 0x6C, 0x00, 0x10, 0xCD, 0x46, 0xE7, 0x08, 0xA0, 0x1C, 0x00, 0x50, 0x2F, 0xF1, 0x05, 0x00, 0x00, 0x15, 0xF3, 0x02, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0xF3, 0x02, 0x00, 0x00, 0x00, 0xF1, 0x06, 0x00, 0x00, 0x4B, 0xA0, 0x1C, 0x00, 0x60, 0x2F, 0x20, 0xCE, 0x45, 0xF8, 0x08, 0x00, 0x92, 0xED, 0x6C, 0x00, // Unicode: [0x0044, D] 0xFE, 0xFF, 0xBE, 0x04, 0x00, 0x8E, 0x44, 0xA5, 0x4F, 0x00, 0x6E, 0x00, 0x00, 0xCB, 0x00, 0x6E, 0x00, 0x00, 0xF4, 0x02, 0x6E, 0x00, 0x00, 0xF1, 0x04, 0x6E, 0x00, 0x00, 0xF0, 0x05, 0x6E, 0x00, 0x00, 0xF1, 0x04, 0x6E, 0x00, 0x00, 0xF4, 0x02, 0x6E, 0x00, 0x00, 0xCB, 0x00, 0x9E, 0x44, 0xB5, 0x4F, 0x00, 0xFE, 0xFF, 0xBE, 0x03, 0x00, // Unicode: [0x0045, E] 0xFD, 0xFF, 0xFF, 0x5F, 0x9D, 0x44, 0x44, 0x14, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0xFD, 0xFF, 0xFF, 0x0F, 0x8D, 0x33, 0x33, 0x03, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x9D, 0x44, 0x44, 0x24, 0xFD, 0xFF, 0xFF, 0x9F, // Unicode: [0x0046, F] 0xFD, 0xFF, 0xFF, 0x0E, 0x9D, 0x44, 0x44, 0x04, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x11, 0x11, 0x00, 0xFD, 0xFF, 0xFF, 0x03, 0x9D, 0x44, 0x44, 0x01, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, // Unicode: [0x0047, G] 0x00, 0x71, 0xED, 0xBE, 0x03, 0x10, 0xEC, 0x46, 0xA5, 0x3F, 0x80, 0x2E, 0x00, 0x00, 0xAA, 0xE0, 0x07, 0x00, 0x00, 0x11, 0xF2, 0x03, 0x00, 0x00, 0x00, 0xF3, 0x02, 0x40, 0xFF, 0xFF, 0xF2, 0x03, 0x10, 0x33, 0xF7, 0xE0, 0x07, 0x00, 0x00, 0xF4, 0x80, 0x2E, 0x00, 0x00, 0xF7, 0x10, 0xEC, 0x58, 0xB6, 0xAF, 0x00, 0x70, 0xEC, 0xBE, 0x05, // Unicode: [0x0048, H] 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0xFD, 0xFF, 0xFF, 0xFF, 0x9D, 0x33, 0x33, 0xF7, 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, // Unicode: [0x0049, I] 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, // Unicode: [0x004A, J] 0x00, 0x00, 0xE6, 0x00, 0x00, 0xE6, 0x00, 0x00, 0xE6, 0x00, 0x00, 0xE6, 0x00, 0x00, 0xE6, 0x00, 0x00, 0xE6, 0x00, 0x00, 0xE6, 0x43, 0x00, 0xD6, 0xB8, 0x00, 0xC8, 0xF4, 0x67, 0x8E, 0x70, 0xED, 0x1A, // Unicode: [0x004B, K] 0x5F, 0x00, 0x30, 0xAE, 0x00, 0x5F, 0x00, 0xE2, 0x0A, 0x00, 0x5F, 0x10, 0xBD, 0x00, 0x00, 0x5F, 0xC1, 0x1C, 0x00, 0x00, 0x6F, 0xFB, 0x02, 0x00, 0x00, 0xEF, 0xED, 0x09, 0x00, 0x00, 0xDF, 0x52, 0x4F, 0x00, 0x00, 0x6F, 0x00, 0xDA, 0x01, 0x00, 0x5F, 0x00, 0xE1, 0x0A, 0x00, 0x5F, 0x00, 0x60, 0x5F, 0x00, 0x5F, 0x00, 0x00, 0xEB, 0x01, // Unicode: [0x004C, L] 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x8F, 0x44, 0x44, 0x01, 0xFF, 0xFF, 0xFF, 0x04, // Unicode: [0x004D, M] 0xFE, 0x03, 0x00, 0x50, 0x9F, 0xFE, 0x07, 0x00, 0xA0, 0x9F, 0xBE, 0x0C, 0x00, 0xE0, 0x9C, 0x6E, 0x1F, 0x00, 0xC4, 0x9A, 0x5E, 0x6C, 0x00, 0x79, 0x9A, 0x5E, 0xB7, 0x00, 0x2D, 0x9A, 0x5E, 0xF3, 0x31, 0x0D, 0x9A, 0x5E, 0xD0, 0x85, 0x08, 0x9A, 0x5E, 0x80, 0xD9, 0x03, 0x9A, 0x5E, 0x40, 0xDE, 0x00, 0x9A, 0x5E, 0x00, 0x8E, 0x00, 0x9A, // Unicode: [0x004E, N] 0xBE, 0x00, 0x00, 0xF5, 0xFE, 0x05, 0x00, 0xF5, 0xDE, 0x1D, 0x00, 0xF5, 0x6E, 0x8E, 0x00, 0xF5, 0x5E, 0xF5, 0x03, 0xF5, 0x5E, 0xB0, 0x0C, 0xF5, 0x5E, 0x20, 0x6F, 0xF5, 0x5E, 0x00, 0xE8, 0xF6, 0x5E, 0x00, 0xD1, 0xFD, 0x5E, 0x00, 0x50, 0xFF, 0x5E, 0x00, 0x00, 0xFA, // Unicode: [0x004F, O] 0x00, 0x91, 0xFD, 0x8D, 0x01, 0x00, 0x10, 0xDD, 0x46, 0xD7, 0x1C, 0x00, 0xA0, 0x1D, 0x00, 0x20, 0x8E, 0x00, 0xF1, 0x05, 0x00, 0x00, 0xE7, 0x00, 0xF4, 0x02, 0x00, 0x00, 0xF3, 0x02, 0xF5, 0x01, 0x00, 0x00, 0xF2, 0x04, 0xF4, 0x02, 0x00, 0x00, 0xF4, 0x02, 0xF1, 0x06, 0x00, 0x00, 0xE7, 0x00, 0x90, 0x1D, 0x00, 0x10, 0x8E, 0x00, 0x10, 0xDC, 0x46, 0xD6, 0x1C, 0x00, 0x00, 0x81, 0xFD, 0x8D, 0x01, 0x00, // Unicode: [0x0050, P] 0xFE, 0xFF, 0xDF, 0x06, 0x8E, 0x44, 0x84, 0x5F, 0x6E, 0x00, 0x00, 0xAB, 0x6E, 0x00, 0x00, 0xAB, 0x7E, 0x11, 0x62, 0x6F, 0xFE, 0xFF, 0xFF, 0x09, 0x8E, 0x44, 0x13, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x00, 0x00, // Unicode: [0x0051, Q] 0x00, 0x81, 0xED, 0x7D, 0x00, 0x00, 0x20, 0xCD, 0x46, 0xE7, 0x0B, 0x00, 0xA0, 0x1C, 0x00, 0x20, 0x7E, 0x00, 0xF1, 0x04, 0x00, 0x00, 0xD8, 0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, 0x01, 0xF6, 0x00, 0x00, 0x00, 0xF3, 0x02, 0xF4, 0x01, 0x00, 0x00, 0xF4, 0x02, 0xF1, 0x05, 0x00, 0x00, 0xD8, 0x00, 0xA0, 0x1D, 0x60, 0x5C, 0x7E, 0x00, 0x20, 0xCD, 0x45, 0xFB, 0x1D, 0x00, 0x00, 0x91, 0xFD, 0x7D, 0xCC, 0x02, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, // Unicode: [0x0052, R] 0xFE, 0xFF, 0xEF, 0x2A, 0x00, 0x8E, 0x33, 0x53, 0xBD, 0x00, 0x6E, 0x00, 0x00, 0xF6, 0x01, 0x6E, 0x00, 0x00, 0xF5, 0x01, 0x6E, 0x00, 0x30, 0xBD, 0x00, 0xFE, 0xFF, 0xFF, 0x2B, 0x00, 0x8E, 0x43, 0xCB, 0x01, 0x00, 0x6E, 0x00, 0xC0, 0x0C, 0x00, 0x6E, 0x00, 0x30, 0x7F, 0x00, 0x6E, 0x00, 0x00, 0xE9, 0x01, 0x6E, 0x00, 0x00, 0xE1, 0x0A, // Unicode: [0x0053, S] 0x00, 0xD8, 0xDF, 0x19, 0x00, 0x80, 0x7E, 0x64, 0xBD, 0x00, 0xE0, 0x06, 0x00, 0xF3, 0x03, 0xD0, 0x08, 0x00, 0x40, 0x01, 0x60, 0xCF, 0x37, 0x00, 0x00, 0x00, 0xA4, 0xFE, 0x5E, 0x00, 0x00, 0x00, 0x30, 0xF9, 0x04, 0xA3, 0x00, 0x00, 0xC0, 0x08, 0xF2, 0x04, 0x00, 0xC0, 0x07, 0xA0, 0x8E, 0x65, 0xEB, 0x02, 0x00, 0xD7, 0xEF, 0x3A, 0x00, // Unicode: [0x0054, T] 0xFA, 0xFF, 0xFF, 0xFF, 0x04, 0x43, 0x84, 0x4F, 0x44, 0x01, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, // Unicode: [0x0055, U] 0x6E, 0x00, 0x00, 0xF5, 0x6E, 0x00, 0x00, 0xF5, 0x6E, 0x00, 0x00, 0xF5, 0x6E, 0x00, 0x00, 0xF5, 0x6E, 0x00, 0x00, 0xF5, 0x6E, 0x00, 0x00, 0xF5, 0x7D, 0x00, 0x00, 0xF5, 0x8C, 0x00, 0x00, 0xE6, 0xCA, 0x00, 0x00, 0xBB, 0xF3, 0x5B, 0xA6, 0x4F, 0x40, 0xEB, 0xCE, 0x04, // Unicode: [0x0056, V] 0xAB, 0x00, 0x00, 0x40, 0x1F, 0xE6, 0x00, 0x00, 0xA0, 0x0A, 0xF1, 0x05, 0x00, 0xE0, 0x05, 0xB0, 0x0A, 0x00, 0xE5, 0x01, 0x50, 0x0E, 0x00, 0x9A, 0x00, 0x10, 0x4E, 0x00, 0x4E, 0x00, 0x00, 0x9A, 0x50, 0x0E, 0x00, 0x00, 0xE4, 0xA0, 0x08, 0x00, 0x00, 0xE0, 0xE4, 0x03, 0x00, 0x00, 0x90, 0xDC, 0x00, 0x00, 0x00, 0x40, 0x7F, 0x00, 0x00, // Unicode: [0x0057, W] 0xAB, 0x00, 0x40, 0x8F, 0x00, 0x60, 0x0E, 0xD7, 0x00, 0x80, 0xCD, 0x00, 0x90, 0x0A, 0xF3, 0x01, 0xC0, 0xF7, 0x01, 0xD0, 0x07, 0xE0, 0x04, 0xF1, 0xD1, 0x05, 0xF1, 0x03, 0xB0, 0x07, 0xD5, 0x90, 0x09, 0xE4, 0x00, 0x80, 0x0A, 0x99, 0x50, 0x0D, 0xA7, 0x00, 0x40, 0x0E, 0x5C, 0x20, 0x1F, 0x7B, 0x00, 0x10, 0x3F, 0x1F, 0x00, 0x5D, 0x3E, 0x00, 0x00, 0x9C, 0x0C, 0x00, 0xA9, 0x0E, 0x00, 0x00, 0xE8, 0x08, 0x00, 0xE5, 0x0A, 0x00, 0x00, 0xF4, 0x05, 0x00, 0xF1, 0x07, 0x00, // Unicode: [0x0058, X] 0xF3, 0x06, 0x00, 0xC0, 0x09, 0x80, 0x2E, 0x00, 0xD8, 0x01, 0x00, 0xBD, 0x30, 0x4F, 0x00, 0x00, 0xF3, 0xD5, 0x09, 0x00, 0x00, 0x80, 0xDF, 0x01, 0x00, 0x00, 0x40, 0xAF, 0x00, 0x00, 0x00, 0xD1, 0xFB, 0x05, 0x00, 0x00, 0xD9, 0xA1, 0x1E, 0x00, 0x40, 0x4F, 0x10, 0x9E, 0x00, 0xD1, 0x0A, 0x00, 0xF5, 0x04, 0xE9, 0x01, 0x00, 0xB0, 0x1D, // Unicode: [0x0059, Y] 0xEA, 0x01, 0x00, 0x90, 0x1D, 0xE1, 0x08, 0x00, 0xF3, 0x04, 0x70, 0x2F, 0x00, 0xAC, 0x00, 0x00, 0xBC, 0x60, 0x1E, 0x00, 0x00, 0xF3, 0xE5, 0x06, 0x00, 0x00, 0x90, 0xBF, 0x00, 0x00, 0x00, 0x20, 0x4F, 0x00, 0x00, 0x00, 0x10, 0x4F, 0x00, 0x00, 0x00, 0x10, 0x4F, 0x00, 0x00, 0x00, 0x10, 0x4F, 0x00, 0x00, 0x00, 0x10, 0x4F, 0x00, 0x00, // Unicode: [0x005A, Z] 0xF2, 0xFF, 0xFF, 0xFF, 0x01, 0x41, 0x44, 0x44, 0xDD, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xF4, 0x06, 0x00, 0x00, 0x10, 0xAD, 0x00, 0x00, 0x00, 0xA0, 0x1D, 0x00, 0x00, 0x00, 0xF6, 0x03, 0x00, 0x00, 0x30, 0x7F, 0x00, 0x00, 0x00, 0xD1, 0x0B, 0x00, 0x00, 0x00, 0xF8, 0x46, 0x44, 0x44, 0x01, 0xFB, 0xFF, 0xFF, 0xFF, 0x03, // Unicode: [0x005B, bracketleft] 0xF1, 0xAF, 0xF1, 0x14, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x03, 0xF1, 0x14, 0xF1, 0xAF, // Unicode: [0x005C, backslash] 0x2D, 0x00, 0x69, 0x00, 0xA5, 0x00, 0xD1, 0x00, 0xC0, 0x03, 0x80, 0x07, 0x40, 0x0B, 0x10, 0x0E, 0x00, 0x3B, 0x00, 0x77, 0x00, 0xB3, // Unicode: [0x005D, bracketright] 0xFB, 0x0F, 0x51, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x40, 0x0F, 0x51, 0x0F, 0xFB, 0x0F, // Unicode: [0x005E, asciicircum] 0x00, 0xE6, 0x01, 0x00, 0x00, 0xEC, 0x06, 0x00, 0x30, 0x6E, 0x0C, 0x00, 0x90, 0x18, 0x3E, 0x00, 0xE1, 0x03, 0x99, 0x00, 0xC6, 0x00, 0xE3, 0x01, // Unicode: [0x005F, underscore] 0xE3, 0xEE, 0xEE, 0xEE, 0x0D, // Unicode: [0x0060, grave] 0x10, 0x00, 0xD1, 0x08, 0x30, 0x0D, // Unicode: [0x0061, a] 0x30, 0xEB, 0xBE, 0x02, 0xE1, 0x28, 0xC3, 0x09, 0x71, 0x00, 0x70, 0x0C, 0x10, 0x96, 0xFB, 0x0C, 0xD1, 0x7C, 0x74, 0x0C, 0xE6, 0x00, 0x90, 0x0C, 0xF5, 0x14, 0xF6, 0x0C, 0x90, 0xEE, 0x6B, 0x1F, // Unicode: [0x0062, b] 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0xD7, 0x9E, 0x00, 0xF1, 0x4D, 0xD3, 0x09, 0xF1, 0x05, 0x50, 0x0F, 0xF1, 0x02, 0x20, 0x2F, 0xF1, 0x01, 0x10, 0x2F, 0xF1, 0x03, 0x40, 0x0E, 0xF1, 0x1B, 0xC1, 0x08, 0xF1, 0xD7, 0x9E, 0x00, // Unicode: [0x0063, c] 0x20, 0xEA, 0x8E, 0x00, 0xC0, 0x3B, 0xE4, 0x06, 0xF4, 0x01, 0x50, 0x05, 0xD6, 0x00, 0x00, 0x00, 0xD6, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x70, 0x0A, 0xC0, 0x2A, 0xE4, 0x06, 0x20, 0xFB, 0x7D, 0x00, // Unicode: [0x0064, d] 0x00, 0x00, 0x70, 0x0C, 0x00, 0x00, 0x70, 0x0C, 0x00, 0x00, 0x70, 0x0C, 0x30, 0xFB, 0x8B, 0x0C, 0xD0, 0x2A, 0xF6, 0x0C, 0xE5, 0x01, 0x90, 0x0C, 0xC7, 0x00, 0x60, 0x0C, 0xC7, 0x00, 0x60, 0x0C, 0xE5, 0x01, 0x90, 0x0C, 0xD0, 0x2A, 0xE5, 0x0C, 0x20, 0xEB, 0x8C, 0x0C, // Unicode: [0x0065, e] 0x20, 0xEA, 0x8D, 0x00, 0xC0, 0x3A, 0xC3, 0x09, 0xE4, 0x01, 0x30, 0x0F, 0xF6, 0xEE, 0xEE, 0x2F, 0xD6, 0x22, 0x22, 0x02, 0xF4, 0x02, 0x30, 0x1A, 0xC0, 0x3B, 0xC3, 0x0A, 0x20, 0xEA, 0x9E, 0x01, // Unicode: [0x0066, f] 0x30, 0xED, 0x04, 0xB0, 0x4B, 0x01, 0xC0, 0x07, 0x00, 0xFD, 0xDF, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x07, 0x00, // Unicode: [0x0067, g] 0x20, 0xFB, 0x7C, 0x0D, 0xD0, 0x2A, 0xE6, 0x0D, 0xE5, 0x01, 0x90, 0x0D, 0xC8, 0x00, 0x50, 0x0D, 0xC7, 0x00, 0x50, 0x0D, 0xE5, 0x01, 0x80, 0x0D, 0xD0, 0x29, 0xE5, 0x0D, 0x30, 0xFC, 0x9C, 0x0C, 0x41, 0x00, 0x80, 0x0B, 0xF2, 0x26, 0xE4, 0x06, 0x50, 0xFD, 0x7D, 0x00, // Unicode: [0x0068, h] 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0xD6, 0xBF, 0x01, 0xF1, 0x4D, 0xD4, 0x09, 0xF1, 0x05, 0x70, 0x0C, 0xF1, 0x03, 0x60, 0x0D, 0xF1, 0x02, 0x60, 0x0D, 0xF1, 0x02, 0x60, 0x0D, 0xF1, 0x02, 0x60, 0x0D, 0xF1, 0x02, 0x60, 0x0D, // Unicode: [0x0069, i] 0xF1, 0x02, 0x80, 0x01, 0x00, 0x00, 0xF1, 0x02, 0xF1, 0x02, 0xF1, 0x02, 0xF1, 0x02, 0xF1, 0x02, 0xF1, 0x02, 0xF1, 0x02, 0xF1, 0x02, // Unicode: [0x006A, j] 0x10, 0x2F, 0x10, 0x18, 0x00, 0x00, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x10, 0x2F, 0x61, 0x1F, 0xE8, 0x08, // Unicode: [0x006B, k] 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0xE6, 0x04, 0xF1, 0x42, 0x4E, 0x00, 0xF1, 0xE6, 0x05, 0x00, 0xF1, 0xFF, 0x03, 0x00, 0xF1, 0x97, 0x0C, 0x00, 0xF1, 0x12, 0x6E, 0x00, 0xF1, 0x02, 0xE7, 0x01, 0xF1, 0x02, 0xD0, 0x0A, // Unicode: [0x006C, l] 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, 0xF2, 0x02, // Unicode: [0x006D, m] 0xF1, 0xD5, 0xAE, 0xC3, 0xBE, 0x02, 0xF1, 0x1B, 0xF2, 0x3E, 0xC1, 0x09, 0xF1, 0x04, 0xC0, 0x09, 0x70, 0x0B, 0xF1, 0x03, 0xC0, 0x07, 0x70, 0x0C, 0xF1, 0x02, 0xC0, 0x07, 0x70, 0x0C, 0xF1, 0x02, 0xC0, 0x07, 0x70, 0x0C, 0xF1, 0x02, 0xC0, 0x07, 0x70, 0x0C, 0xF1, 0x02, 0xC0, 0x07, 0x70, 0x0C, // Unicode: [0x006E, n] 0xF1, 0xD6, 0xBE, 0x02, 0xF1, 0x2C, 0xC1, 0x09, 0xF1, 0x04, 0x70, 0x0C, 0xF1, 0x03, 0x60, 0x0C, 0xF1, 0x02, 0x60, 0x0C, 0xF1, 0x02, 0x60, 0x0C, 0xF1, 0x02, 0x60, 0x0C, 0xF1, 0x02, 0x60, 0x0C, // Unicode: [0x006F, o] 0x20, 0xEA, 0x9E, 0x00, 0xD0, 0x3B, 0xD4, 0x09, 0xE5, 0x01, 0x40, 0x1F, 0xC7, 0x00, 0x10, 0x3F, 0xC7, 0x00, 0x10, 0x3F, 0xE5, 0x01, 0x40, 0x1F, 0xD0, 0x2A, 0xD4, 0x0A, 0x20, 0xEB, 0x8E, 0x00, // Unicode: [0x0070, p] 0xF1, 0xC7, 0x9E, 0x01, 0xF1, 0x1C, 0xB1, 0x09, 0xF1, 0x04, 0x30, 0x1F, 0xF1, 0x01, 0x10, 0x3F, 0xF1, 0x01, 0x20, 0x2F, 0xF1, 0x04, 0x50, 0x0E, 0xF1, 0x3D, 0xD3, 0x08, 0xF1, 0xE7, 0x8E, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00, // Unicode: [0x0071, q] 0x20, 0xFB, 0x7C, 0x0C, 0xD0, 0x29, 0xE5, 0x0C, 0xE5, 0x01, 0x90, 0x0C, 0xC7, 0x00, 0x60, 0x0C, 0xC6, 0x00, 0x60, 0x0C, 0xE4, 0x01, 0x80, 0x0C, 0xC0, 0x2A, 0xE5, 0x0C, 0x20, 0xFB, 0x9C, 0x0C, 0x00, 0x00, 0x70, 0x0C, 0x00, 0x00, 0x70, 0x0C, 0x00, 0x00, 0x70, 0x0C, // Unicode: [0x0072, r] 0xF1, 0xE7, 0x09, 0xF1, 0x4C, 0x03, 0xF1, 0x05, 0x00, 0xF1, 0x03, 0x00, 0xF1, 0x02, 0x00, 0xF1, 0x02, 0x00, 0xF1, 0x02, 0x00, 0xF1, 0x02, 0x00, // Unicode: [0x0073, s] 0x60, 0xFD, 0x4C, 0x00, 0xE3, 0x24, 0xE8, 0x01, 0xE5, 0x02, 0x40, 0x00, 0xB1, 0xCF, 0x28, 0x00, 0x00, 0x84, 0xED, 0x02, 0x74, 0x00, 0xD0, 0x06, 0xF4, 0x25, 0xF5, 0x03, 0x60, 0xFD, 0x6D, 0x00, // Unicode: [0x0074, t] 0x30, 0x03, 0xD0, 0x06, 0xD0, 0x06, 0xFB, 0x9F, 0xD0, 0x06, 0xD0, 0x06, 0xD0, 0x06, 0xD0, 0x06, 0xD0, 0x06, 0xC0, 0x39, 0x60, 0xAE, // Unicode: [0x0075, u] 0xF2, 0x02, 0x70, 0x0C, 0xF2, 0x02, 0x70, 0x0C, 0xF2, 0x02, 0x70, 0x0C, 0xF2, 0x02, 0x70, 0x0C, 0xF2, 0x02, 0x70, 0x0C, 0xF1, 0x03, 0x90, 0x0C, 0xD0, 0x3A, 0xE6, 0x0C, 0x40, 0xFD, 0x6B, 0x0C, // Unicode: [0x0076, v] 0xAA, 0x00, 0x90, 0x0A, 0xE5, 0x00, 0xE0, 0x05, 0xE0, 0x04, 0xE4, 0x01, 0x90, 0x09, 0xA9, 0x00, 0x40, 0x0E, 0x4E, 0x00, 0x00, 0x7E, 0x0E, 0x00, 0x00, 0xE9, 0x09, 0x00, 0x00, 0xF4, 0x04, 0x00, // Unicode: [0x0077, w] 0x7C, 0x00, 0xCA, 0x00, 0xD5, 0xA8, 0x00, 0xFE, 0x01, 0x99, 0xE4, 0x30, 0xDD, 0x04, 0x4D, 0xE0, 0x63, 0x99, 0x28, 0x1F, 0xB0, 0xA7, 0x66, 0x6B, 0x0B, 0x60, 0xEA, 0x22, 0xAE, 0x07, 0x20, 0xEF, 0x00, 0xFE, 0x02, 0x00, 0xAD, 0x00, 0xDA, 0x00, // Unicode: [0x0078, x] 0xF6, 0x02, 0xE2, 0x06, 0xB0, 0x0B, 0xBB, 0x00, 0x20, 0xAF, 0x2E, 0x00, 0x00, 0xF7, 0x06, 0x00, 0x00, 0xFA, 0x0A, 0x00, 0x50, 0x4F, 0x5F, 0x00, 0xD1, 0x07, 0xD8, 0x01, 0xD9, 0x00, 0xD1, 0x09, // Unicode: [0x0079, y] 0xB9, 0x00, 0x80, 0x0B, 0xF4, 0x01, 0xD0, 0x05, 0xD0, 0x06, 0xE3, 0x01, 0x80, 0x0B, 0xA8, 0x00, 0x30, 0x1F, 0x5D, 0x00, 0x00, 0x8D, 0x0E, 0x00, 0x00, 0xF7, 0x09, 0x00, 0x00, 0xF2, 0x04, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x51, 0x8C, 0x00, 0x00, 0xE2, 0x1B, 0x00, 0x00, // Unicode: [0x007A, z] 0xF7, 0xFF, 0xFF, 0x07, 0x10, 0x11, 0xE8, 0x02, 0x00, 0x40, 0x4F, 0x00, 0x00, 0xE2, 0x07, 0x00, 0x00, 0xAC, 0x00, 0x00, 0x90, 0x1D, 0x00, 0x00, 0xF6, 0x24, 0x22, 0x01, 0xFB, 0xFF, 0xFF, 0x0B };
#include "SwapChainDX12.hpp" #include "Common/Logger.hpp" #include "Device.hpp" #include "HardwareManager.hpp" namespace engine { Bool SwapChain::Create(ComPtr<ID3D12CommandQueue>& commandQueue) { DXGI_MODE_DESC displayMode = m_hardwareManager->GetCurrentDisplayMode(); DXGI_SWAP_CHAIN_DESC1 swapChainDesc; swapChainDesc.Width = displayMode.Width; swapChainDesc.Height = displayMode.Height; swapChainDesc.BufferCount = m_swapChainBuffersNum; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;; swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED; swapChainDesc.Flags = 0; swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.Scaling = DXGI_SCALING_NONE; swapChainDesc.Stereo = FALSE; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; HRESULT result; ComPtr<IDXGISwapChain1> swapChain; if (m_window->IsFullscreen()) { DXGI_SWAP_CHAIN_FULLSCREEN_DESC swapChainFullScreenDesc; swapChainFullScreenDesc.RefreshRate = displayMode.RefreshRate; swapChainFullScreenDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; swapChainFullScreenDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; swapChainFullScreenDesc.Windowed = true; // NOTE I should not use this method in WindowsAP store result = m_factory->CreateSwapChainForHwnd( commandQueue.Get(), (HWND)(m_window->GetWindowId()), &swapChainDesc, &swapChainFullScreenDesc, NULL, &swapChain); } else { result = m_factory->CreateSwapChainForHwnd( commandQueue.Get(), (HWND)m_window->GetWindowId(), &swapChainDesc, NULL, NULL, &swapChain); } if (FAILED(result)) { LOGE("Could not create swap chain err: 0x%X", result); return false; } m_currentBufferIdx = 0; m_renderTargetDescriptorHeap = m_device->CreateRenderTargetDescriptorHeap(2); if (!m_renderTargetDescriptorHeap) { return false; } m_renderTargetDescriptorSize = m_device->GetRenderTargetDescriptorSize(); m_depthStencilDescriptorHeap = m_device->CreateDepthStencilDescriptorHeap(); if (!m_depthStencilDescriptorHeap) { return false; } m_depthStencilDescriptorSize = m_device->GetDepthStencilDescriptorSize(); return true; } } // namespace engine
#pragma once #include <string> #include <string_view> #include <vector> #include "dvc/log.h" namespace dvc { inline std::vector<std::byte> HexStringToByteArray(std::string_view hex_string); inline std::string ByteArrayToHexString(const std::byte* data, size_t size); inline std::string ByteArrayToHexString( const std::vector<std::byte>& byte_array) { return ByteArrayToHexString(byte_array.data(), byte_array.size()); } template <size_t size> inline std::string ByteArrayToHexString( const std::array<std::byte, size>& byte_array) { return ByteArrayToHexString(byte_array.data(), size); } inline std::string ByteArrayToHexString(std::string_view byte_array) { return ByteArrayToHexString((std::byte*)byte_array.data(), byte_array.size()); } inline int HexCharToInt(char hex_char) { switch (hex_char) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; case 'A': case 'a': return 0xA; case 'B': case 'b': return 0xB; case 'C': case 'c': return 0xC; case 'D': case 'd': return 0xD; case 'E': case 'e': return 0xE; case 'F': case 'f': return 0xF; default: DVC_FATAL("invalid hex char #", int(hex_char)); } } inline char IntToHexChar(int hex_int) { switch (hex_int) { case 0: return '0'; case 1: return '1'; case 2: return '2'; case 3: return '3'; case 4: return '4'; case 5: return '5'; case 6: return '6'; case 7: return '7'; case 8: return '8'; case 9: return '9'; case 0xA: return 'A'; case 0xB: return 'B'; case 0xC: return 'C'; case 0xD: return 'D'; case 0xE: return 'E'; case 0xF: return 'F'; default: DVC_FATAL("invalid hex int ", int(hex_int)); } } inline std::byte HexCharPairToByte(std::pair<char, char> hex_pair) { return std::byte(HexCharToInt(hex_pair.first) << 4 | HexCharToInt(hex_pair.second) << 0); } inline std::pair<char, char> ByteToHexCharPair(std::byte byte) { return {IntToHexChar((uint8_t(byte) & 0xF0) >> 4), IntToHexChar((uint8_t(byte) & 0x0F) >> 0)}; } inline std::vector<std::byte> HexStringToByteArray( std::string_view hex_string) { DVC_ASSERT_EQ(hex_string.size() % 2, 0u); const auto nbytes = hex_string.size() / 2; std::vector<std::byte> byte_array(nbytes); for (size_t i = 0; i < nbytes; i++) { byte_array[i] = HexCharPairToByte({hex_string[2 * i + 0], hex_string[2 * i + 1]}); } return byte_array; } inline std::string ByteArrayToHexString(const std::byte* data, size_t size) { std::string hex_string(size * 2, '\0'); for (size_t i = 0; i < size; ++i) { const auto char_pair = ByteToHexCharPair(data[i]); hex_string[2 * i + 0] = char_pair.first; hex_string[2 * i + 1] = char_pair.second; } return hex_string; } } // namespace dvc
#include <iostream> using namespace std; struct Stack{ int top=0; int a[100]; }; struct Queue{ int a[100]; int head=0; int tail=0; }; int deQueue(Queue* Q){ int val = Q->a[Q->head]; Q->head = Q->head + 1; cout<<"Element "<<val<<" dequeued from Q"<<endl; return val; }; void enQueue(Queue* Q,int value){ Q->a[Q->tail] = value; Q->tail = Q->tail + 1; cout<<"Element "<<value<<" enqued to Q"<<endl; }; void pushS(Stack* st,int v){ st->a[st->top] = v; st->top = st->top + 1; cout<<"Element "<<v<<" pushed to stack"<<endl; }; int popS(Stack* st){ int v; st->top = st->top - 1; v = st->a[st->top]; cout<<"Element "<<v<<" popped from stack"<<endl; return v; }; void fun(Queue* Q) { Stack S; int var; // Run while Q is not empty while ((Q->head)!=(Q->tail)) { // deQueue an item from Q and push the dequeued item to S var = deQueue(Q); pushS(&S,var); } // Run while Stack S is not empty while (S.top!=0) { // Pop an item from S and enqueue the poppped item to Q var = popS(&S); enQueue(Q,var); } }; int main(){ Queue* q = new Queue; for (int i = 0; i < 10; i++) { enQueue(q,i*10); } fun(q); return 0; }
#ifndef KATANA_LIBSUPPORT_KATANA_RESULT_H_ #define KATANA_LIBSUPPORT_KATANA_RESULT_H_ #include <cassert> #include <cerrno> #include <future> #include <boost/outcome/outcome.hpp> #include "katana/Logging.h" namespace katana { template <class T> using Result = BOOST_OUTCOME_V2_NAMESPACE::std_result<T>; static inline auto ResultSuccess() { return BOOST_OUTCOME_V2_NAMESPACE::success(); } static inline auto ResultErrno() { KATANA_LOG_DEBUG_ASSERT(errno); return std::error_code(errno, std::system_category()); } template <typename ResType, typename ErrType> static inline std::future<Result<ResType>> AsyncError(ErrType errCode) { // deferred to try and avoid dispatch since there's no async work to do return std::async(std::launch::deferred, [=]() -> katana::Result<ResType> { return errCode; }); } } // namespace katana #endif
#ifndef CONTROL_H #define CONTROL_H #include "Packet.h" #include "Config.h" /* Functions and time delay for activating parachute Solenoids */ extern volatile bool chuteDeployed; const int time_out = 75; void sealChuteLid() { analogWrite(PARACHUTE_PIN, 128); delay(time_out); analogWrite(PARACHUTE_PIN, 0); chuteDeployed = false; } void deployChute() { analogWrite(PARACHUTE_PIN, 250); delay(time_out); analogWrite(PARACHUTE_PIN, 0); chuteDeployed = true; } /* * Decides sorting of packets in the priority queue * Method: Checks the priority flag of the packet * if same priority sorts by time stap of first sensor read */ bool packetPriorityCalc(Packet a, Packet b) { if(a.getPriority() && !b.getPriority()) { return true; //a is priority, b is not, a has higher priority } else if(!a.getPriority()&& b.getPriority()) { return false; //a is not priority, b is, b has higher priority } else //have same priority flag compare time { //check time stamps and check if already packed for transmission //grab time stamps from a and b int timeA = a.getPackTime(); int timeB = b.getPackTime(); return timeA <= timeB; //priority goes to which ever was made first } } //Appends a 16 bit interger to a buffer, also increments //the provided location in the buffer void append(uint8_t *buf, size_t &loc, int16_t input) { buf[loc++] = input; buf[loc++] = input >> 8; } /* * Prints a message over Serial if the settings allow it w/o newline */ template<typename T> void printMessage(T s) { #if OUTPUT_MESSAGES Serial.print(s); #endif } /* * Prints a message over Serial if the settings allow it w newline */ template<typename T> void printMessageln(T s) { #if OUTPUT_MESSAGES Serial.println(s); #endif } /* * Prints a newline over Serial if the settings allow it w newline */ void printMessageln() { #if OUTPUT_MESSAGES Serial.println(); #endif } /* * Prints a packet to the serial port, so that it may be copied * onto a computer directly, avoiding sending it through comms */ void printPacket(Packet packet) { Serial.println(packet.getLength()); for(uint16_t i = 0; i < packet.getLength(); i++) { Serial.print(packet[i]); Serial.print(" "); } Serial.println(); } /* * Reads the pwr_pin and checks if a power off signal has been sent */ void checkPowerOffSignal() { if(analogRead(PWR_PIN) == 4095 && millis() > 20 * 1000) { while(analogRead(PWR_PIN) == 4095); //digitalWrite(13, LOW); digitalWrite(PWR_PIN, LOW); } } /* * blinks the LED on pin 13 numTime times with a pauseTime ms delay between */ void blinkLed(int numTimes, int pauseTime) { #if USE_LED for(int i = 0; i < numTimes; i++) { delay(pauseTime); digitalWrite(13, LOW); delay(pauseTime); digitalWrite(13,HIGH); } #endif } //external variables (from KRUPS_Software) for use with packStats() and checkSerialIn() //done as extern instead of parameters to lower overhead of function call extern uint8_t numRegular, numPriority, sendAttemptErrors; extern uint16_t bytesMade; extern double avgCompressR, avgCompressP, avgTimeSinceR, avgTimeSinceP; extern volatile bool GPS_Mode, splash_down, chuteDeployed; extern PriorityQueue<Packet> message_queue; extern size_t rloc, ploc; extern elapsedMillis timeSinceR, timeSinceP; extern IridiumSBD isbd; /* * Fills a packet from loc 2 to 12 with stats from current program run */ void packStats(Packet& p) { size_t loc = 2; //start after the decompress len //timeStamp uint16_t timeSeconds = millis()/1000; append(p.getArrayBase(), loc, timeSeconds); //num Regular packets p.getArrayBase()[int(loc)] = numRegular; loc++; //num p p.getArrayBase()[int(loc)] = numPriority; loc++; // r compress avg p.getArrayBase()[int(loc)] = uint8_t(avgCompressR/numRegular); loc++; // p compress avg p.getArrayBase()[int(loc)] = uint8_t(avgCompressP/numPriority); loc++; //r build time p.getArrayBase()[int(loc)] = uint8_t(avgTimeSinceR/numRegular); loc++; //p build time p.getArrayBase()[int(loc)] = uint8_t(avgTimeSinceP/numPriority); loc++; //failed sends p.getArrayBase()[int(loc)] = sendAttemptErrors; loc++; //bytes made append(p.getArrayBase(), loc, bytesMade); } /* *Checks the Serial port for inbound commands from KICC */ void checkSerialIn() { if(Serial.available()) { String command = Serial.readString(); if(command == "OFF\n") { blinkLed(2, 1000); digitalWrite(PWR_PIN, LOW); } else if(command == "STATUS\n") { Serial.println("ON"); if(GPS_Mode) { printMessageln("GPS Mode"); } else { printMessage("Total Packets: "); printMessageln(numRegular + numPriority); printMessage("In queue: "); printMessageln(message_queue.count()); printMessage("Regular Location: "); printMessageln(rloc); printMessage("Priority Location: "); printMessageln(ploc); printMessage("Average R Compression: "); printMessageln(uint8_t(avgCompressR/numRegular)); printMessage("Average P Compression: "); printMessageln(uint8_t(avgCompressP/numPriority)); printMessage("Time Since Last R: "); printMessageln(timeSinceR); printMessage("Time Since Last P: "); printMessageln(timeSinceP); if(splash_down) { printMessageln("Splash Down has occured"); } else { printMessageln("Splash Down has not occured"); } if(chuteDeployed) { printMessageln("Chute deploy has occured"); } else { printMessageln("Chute deploy has not occured"); } } } else if(command == "DEPLOY\n") { Serial.println("DEPLOY"); deployChute(); } else if(command == "SEAL\n") { Serial.println("SEALING LID"); sealChuteLid(); } else if(command == "TIME\n") { Serial.print("Time:"); Serial.println(millis()); Serial.print("Time till chute deploy:"); Serial.println((TIME_TO_DEPLOY - millis())/1000); Serial.print("Time till splash:"); Serial.println((TIME_TO_SPLASH_DOWN - millis())/1000); } else if(command == "CSQ\n") { int signalQuality; isbd.getSignalQuality(signalQuality); Serial.println(); Serial.println(); Serial.println(); Serial.println(); Serial.print("On a scale of 0 to 5, signal quality is currently "); Serial.print(signalQuality); Serial.println("."); Serial.println(); Serial.println(); Serial.println(); Serial.println(); } } } #endif
/* 15686. 치킨배달 다시풀기 */ #include <iostream> #include <vector> #include <math.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; int N, M; int board[50][50]; vector<pii> ch; vector<pii> h; bool selected[13]; int chicken_distance = 987654321; int distance(int r, int c, int rr, int cc) { return abs(r-rr) + abs(c-cc); } void calculate() { int sum = 0; for(int i = 0; i < h.size(); i++) { int len = 987654321; for(int j = 0; j < ch.size(); j++) { if(selected[j]) { int dis = distance(h[i].first, h[i].second, ch[j].first, ch[j].second); if(dis < len) len = dis; } } sum += len; } if(chicken_distance > sum) chicken_distance = sum; } void dfs(int n, int cnt) { if(n > ch.size()) return; if(cnt == M) { calculate(); return; } selected[n] = true; dfs(n+1, cnt+1); selected[n] = false; dfs(n+1, cnt); } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N >> M; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { cin >> board[i][j]; if(board[i][j] == 1) h.push_back(make_pair(i,j)); else if(board[i][j] == 2) ch.push_back(make_pair(i,j)); } } dfs(0, 0); cout << chicken_distance; return 0; }
#include "MotorPwm.hpp" extern "C" { extern void set_r_motor_mode(enum MotorMode mode); extern void set_r_motor_pwm(int pwm); } #include "motor_driver.h" MotorPwm::MotorPwm() { } void MotorPwm::setLevel(int level) { if (level > 0) { set_r_motor_mode(MOTOR_FORWARD); set_r_motor_pwm(level); } else if (level < 0) { set_r_motor_mode(MOTOR_REVERSE); set_r_motor_pwm(-level); } else { set_r_motor_mode(MOTOR_STOP); set_r_motor_pwm(0); } } MotorPwm::~MotorPwm() { }
// // Copyright Jason Rice 2016 // 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 NBDL_DEF_BUILDER_ENTITY_MESSAGE_IS_FROM_ROOT_HPP #define NBDL_DEF_BUILDER_ENTITY_MESSAGE_IS_FROM_ROOT_HPP #include <nbdl/def/directives.hpp> #include <nbdl/def/builder/entity_message_meta.hpp> #include <nbdl/message.hpp> #include <boost/hana.hpp> #include <utility> namespace nbdl_def { namespace builder { namespace hana = boost::hana; namespace detail { namespace tag = nbdl_def::tag; namespace channel = nbdl::message::channel; template<typename AccessPoint, typename Action> constexpr auto entity_message_is_from_root(AccessPoint/* access_point */, Action, channel::downstream) { return hana::type_c<hana::optional<bool>>; #if 0 // we only care if it is from root if we // have a local version of the object // UPDATE: Actually since we won't know // if the server might be sending downstream // messages that are confirmed by root then // all downstream messages should have this // bool. // FIXME return hana::type_c<decltype( hana::if_( hana::find(access_point, tag::UseLocalVersion).value_or(hana::false_c), hana::just(bool{}), hana::nothing ) )>; #endif } template<typename AccessPoint, typename Action> constexpr auto entity_message_is_from_root(AccessPoint, Action, channel::upstream) { return hana::decltype_(hana::nothing); } }//detail struct entity_message_is_from_root_fn { template<typename A, typename M> constexpr auto operator()(A access_point, M em_meta) const { return detail::entity_message_is_from_root( access_point, entity_message_meta::action(em_meta), entity_message_meta::channel(em_meta) ); } }; constexpr entity_message_is_from_root_fn entity_message_is_from_root{}; }//builder }//nbdl_def #endif
#include "Craftable.h" Craftable::Craftable() { height = 0; } Craftable::~Craftable() {} void Craftable::setCraft(Inventory& inv) { craft_position.clear(); std::map<std::string, std::vector<int>>::iterator it; //for the craft list std::vector<int>::iterator innerit; //for each weapon inside craft list std::vector<Item*>::iterator materialit; //for each materials for (it = craft_list.begin(); it != craft_list.end(); it++) { std::vector<int> materials = it->second; bool canCraft = true; for (innerit = materials.begin(); innerit != materials.end(); innerit++) { bool hasMaterial = false; for (materialit = inv.materials.begin(); materialit != inv.materials.end(); materialit++) { Item* mat = *materialit; if (typeid(*mat).name() == typeid(Material).name()) if (*innerit == mat->type) { hasMaterial = true; break; } } if (hasMaterial == false) { canCraft = false; break; } } if (canCraft) { craft_position.push_back(it->first); } } } void Craftable::render(sf::RenderWindow& window, sf::Vector2f player_position) { sf::Vector2f startingPosition = sf::Vector2f(player_position.x - 130, player_position.y + height); title.setPosition(startingPosition.x, startingPosition.y - 30); window.draw(title); for (int i = 0; i < craft_position.size(); i++) { weapon_list[craft_position[i]].setPosition(startingPosition.x + 10, startingPosition.y + i * 85 + 10); slot.setPosition(startingPosition.x, startingPosition.y + i * 85); window.draw(slot); window.draw(weapon_list[craft_position[i]]); for (int j = 0; j < craft_list[craft_position[i]].size(); j++) { material_list[craft_list[craft_position[i]][j]].setPosition(startingPosition.x + 10 + (j * 30), startingPosition.y + i * 85 + 30 + 10); window.draw(material_list[craft_list[craft_position[i]][j]]); } } }
#ifndef PERSON_H #define PERSON_H #include <iostream> #include <string> #include <sstream> #include <iomanip> #include <fstream> using namespace std; const string DATA_FILE = "data.txt"; class Person { private: string mName, mID, mPhoneNum, mEmail, mCourseName; static int mCount; public: Person(); ~Person(); string getName(); string getID(); string getPhoneNum(); string getEmail(); string getCourseName(); void setName(string newValue); void setID(string newValue); void setPhoneNum(string newValue); void setEmail(string newValue); void setCourseName(string newValue); bool operator==(string id); friend bool operator==(string id, Person person); friend istream &operator>>(istream &consoleInput, Person &person); //overload input for CONSOLE friend ifstream &operator>>(ifstream &fileInput, Person &person); //overload input for FILE friend ofstream &operator<<(ofstream &foutput, Person person); //overload output for FILE friend ostream &operator<<(ostream &coutput, Person person); //overload output for console }; #endif // !PERSON_H
#include "Node.h" Node::Node() {}; void Node::setNextNodes(set<int>& nodes) { this->nextNodes = nodes; } void Node::addNextNode(int nodeID) { this->nextNodes.insert(nodeID); } void Node::setVisited() { this->visited = true; } void Node::setPostOrder(int num) { this->postOrderNum = num; } string Node::toString() { ostringstream ss; vector<int> ruleNodes; for (int decendantNode : this->nextNodes) { ruleNodes.push_back(decendantNode); } for (size_t i = 0; i < ruleNodes.size(); ++i) { if (i != (ruleNodes.size() - 1)) { ss << "R" << ruleNodes.at(i) << ","; } else { ss << "R" << ruleNodes.at(i); } } return ss.str(); } set<int> Node::getNextNodes() { return this->nextNodes; } bool Node::Visited() { return this->visited; }
#ifndef WEBXX_WS_SESSION #define WEBXX_WS_SESSION #include <boost/asio.hpp> #include <boost/algorithm/string.hpp> #include <boost/uuid/sha1.hpp> #include "base64.hpp" #include "receiver.hh" #include <thread> namespace webxx { namespace ws { class Session { public: Session(std::string handshake, boost::asio::ip::tcp::socket &&); Session(const Session &) = delete; Session & operator = (const Session &) = delete; ~Session(); void start(); unsigned short port(); static bool isHandshake(const std::string &); static const std::string handshake_key_suffix; void onMessage(Receiver::Callback); void onNextMessage(Receiver::Callback); void onNextMessageExclusive(Receiver::Callback); private: boost::asio::ip::tcp::socket m_socket; Receiver m_receiver; std::thread m_receiver_thread; unsigned short m_port{4747}; void handshake(const std::string &msg); }; }}//namespace webxx::ws #endif
#include "Coins.h" #define screenWidth 1200 #define screenHeight 800 /** * \brief Konstruktor klasy Coins * \details Ustawienie odopowiedniej grafiki, pozycji, originu, skali. * \param x Współrzędna x nadawana podczas inicjalizacji obiektu. * \param y Współrzędna y nadawana podczas inicjalizacji obiektu. */ Coins::Coins(float x,float y) { texture.loadFromFile("Graphics/apple.png"); sprite.setTexture(texture); sprite.setPosition(x, y); sprite.setOrigin(sprite.getGlobalBounds().width/2, sprite.getGlobalBounds().height/2); sprite.setScale(0.5f, 0.5f); } /// \brief Metoda zwraca pole prywatne typu Sprite. Sprite Coins::getSprite() { return sprite; } /// \brief Zwraca pozycję lewej krawędzi. float Coins::left() { return sprite.getPosition().x - sprite.getGlobalBounds().width/2; } /// \brief Zwraca pozycję prawej krawędzi. float Coins::right() { return sprite.getPosition().x + sprite.getGlobalBounds().width/2; } /// \brief Zwraca pozycję górnej krawędzi. float Coins::top() { return sprite.getPosition().y - sprite.getGlobalBounds().height/2; } /// \brief Zwraca pozycję dolnej krawędzi. float Coins::bottom() { return sprite.getPosition().y + sprite.getGlobalBounds().height/2; } /// \brief Metoda zmienia wartość pola prywatnego disappeared na true. void Coins::disappear() { this->disappeared = true; } /// \brief Metoda zwraca wartość pola prywatnego disappeared. bool Coins::isDisappeared() { return this->disappeared; }
// AUTHOR: Sumit Prajapati #include <bits/stdc++.h> using namespace std; #define ull unsigned long long #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define mk make_pair #define ff first #define ss second #define all(a) a.begin(),a.end() #define trav(x,v) for(auto &x:v) #define debug(x) cerr<<#x<<" = "<<x<<'\n' #define llrand() distribution(generator) #define rep(i,n) for(int i=0;i<n;i++) #define repe(i,n) for(int i=1;i<=n;i++) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define printar(a,s,e) FOR(i,s,e)cout<<a[i]<<" ";cout<<'\n' #define endl '\n' #define curtime chrono::high_resolution_clock::now() #define timedif(start,end) chrono::duration_cast<chrono::nanoseconds>(end - start).count() #define INF 1'000'000'000 #define MD 1'000'000'007 #define MDL 998244353 #define MX 200'005 auto time0 = curtime; random_device rd; default_random_engine generator(rd()); uniform_int_distribution<ull> distribution(0,0xFFFFFFFFFFFFFFFF); //Is testcase present? int n,q; int segm[4*MX],lazy[4*MX],a[MX]; int query(int cur,int start,int end,int qs,int qe){ if(lazy[cur]!=0){ segm[cur]=lazy[cur]; if(start!=end){ lazy[2*cur]=lazy[cur]; lazy[2*cur+1]=lazy[cur]; } lazy[cur]=0; } if(start>=qs && end<=qe) return segm[cur]; if(start>qe || end<qs) return 0; //INVALID RETURN int mid=(start+end)>>1; int A=query(2*cur,start,mid,qs,qe); int B=query(2*cur+1,mid+1,end,qs,qe); int res=A+B ; //MERGING STEP return res; } void update(int cur,int start,int end,int l,int r,int val){ if(lazy[cur]!=0){ segm[cur]=lazy[cur]; if(start!=end){ lazy[2*cur]=lazy[cur]; lazy[2*cur+1]=lazy[cur]; } lazy[cur]=0; } if(start>=l && end<=r){ //DO UPDATE segm[cur]=val; if(start!=end){ lazy[2*cur]=val; lazy[2*cur+1]=val; } return; } if(start>r|| end<l) return; //OUT OF RANGE int mid=(start+end)>>1; update(cur<<1,start,mid,l,r,val); update((cur<<1)^1,mid+1,end,l,r,val); //MERGING STEP } //LAZY PROPAGATION void solve(){ cin>>n>>q; int l,r,x; while(q--){ cin>>l>>r>>x; update(1,1,n,l,r,x); // repe(i,2*n) // cerr<<segm[i]<<" \n"[i==2*n]; // repe(i,2*n) // cerr<<lazy[i]<<" \n"[i==2*n]; // cerr<<'\n'; } repe(i,n) cout<<query(1,1,n,i,i)<<'\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); time0 = curtime; solve(); //cerr<<"Execution Time: "<<timedif(time0,curtime)*1e-9<<" sec\n"; return 0; }
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. 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 University of Oxford 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. */ #ifndef _TESTPROPAGATIONPROPERTIESCALCULATOR_HPP_ #define _TESTPROPAGATIONPROPERTIESCALCULATOR_HPP_ #include <cxxtest/TestSuite.h> #include <iostream> #include <cassert> #include "PropagationPropertiesCalculator.hpp" class TestPropagationPropertiesCalculator : public CxxTest::TestSuite { public: void TestConductionVelocity1D(void) { Hdf5DataReader simulation_data("heart/test/data/Monodomain1d", "MonodomainLR91_1d", false); PropagationPropertiesCalculator ppc(&simulation_data); // Should throw because node 95 never crosses the threshold TS_ASSERT_THROWS_THIS(ppc.CalculateConductionVelocity(5,95,0.9), "AP did not occur, never descended past threshold voltage."); TS_ASSERT_THROWS_THIS(ppc.CalculateAllConductionVelocities(5,95,0.9), "AP did not occur, never descended past threshold voltage."); // Should throw because AP is not complete here TS_ASSERT_THROWS_THIS(ppc.CalculateActionPotentialDuration(50,5), "No full action potential was recorded"); // Should not throw because the upstroke propagated far enough in simulation time //for both methods of last conduction velocity and all of them TS_ASSERT_THROWS_NOTHING(ppc.CalculateConductionVelocity(20,40,0.1)); TS_ASSERT_THROWS_NOTHING(ppc.CalculateAllConductionVelocities(20,40,0.1)); //check some value TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(20,40,0.2),0.0498,0.01); //check both methods return the same value TS_ASSERT_EQUALS(ppc.CalculateConductionVelocity(20,40,0.2),ppc.CalculateAllConductionVelocities(20,40,0.2)[0]); //other parameters TS_ASSERT_DELTA(ppc.CalculateMaximumUpstrokeVelocity(1),343.9429,0.001); TS_ASSERT_DELTA(ppc.CalculatePeakMembranePotential(5),23.6271,0.001); } void TestConductionVelocityWithRepeatedStimuli(void) { Hdf5DataReader simulation_data("heart/test/data/Monodomain1d", "RepeatedStimuli", false); // These data were generated by a monodomain simulation of a 1D cable // of 100 nodes with a space step of 0.1mm. // Luo Rudy model with conductivity at 0.2 (unlike above test). // 405 ms were simulated. Two stimuli were applied at node 0, one at 2 ms // and the other at 402. // The file contains exported data at 3 nodes (5, 50 and 95). PropagationPropertiesCalculator ppc(&simulation_data); // Make sure that node 5 has 2 upstrokes, Node 50 and 95 only one TS_ASSERT_EQUALS (ppc.CalculateAllMaximumUpstrokeVelocities(5, -30.0).size(),2U); TS_ASSERT_EQUALS (ppc.CalculateAllMaximumUpstrokeVelocities(50, -30.0).size(),1U); TS_ASSERT_EQUALS (ppc.CalculateAllMaximumUpstrokeVelocities(95, -30.0).size(),1U); TS_ASSERT_EQUALS (ppc.CalculateUpstrokeTimes(5, -30.0).size(),2U); TS_ASSERT_EQUALS (ppc.CalculateUpstrokeTimes(50, -30.0).size(),1U); TS_ASSERT_EQUALS (ppc.CalculateUpstrokeTimes(95, -30.0).size(),1U); TS_ASSERT_DELTA(ppc.CalculateUpstrokeTimes(5,-30.0)[0],2.5100,0.01); TS_ASSERT_DELTA(ppc.CalculateUpstrokeTimes(5,-30.0)[1],402.5100,0.01); TS_ASSERT_DELTA(ppc.CalculateUpstrokeTimes(50, -30.0)[0],7.1300,0.01); TS_ASSERT_DELTA(ppc.CalculateUpstrokeTimes(95, -30.0)[0],11.7600,0.01); // Checking the velocity from a node with 2 upstrokes to a node with one only. // The method checks for the last AP that reached both, i.e. second from lasta t node 5. TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(5,95,0.9), 0.097, 0.003); // Then we test the calculator with calculations in both directions for both methods //i.e. from 5 to 95 is equals to the negative of from 95 to 5 TS_ASSERT_EQUALS(ppc.CalculateConductionVelocity(5,95,0.45),-ppc.CalculateConductionVelocity(95,5,0.45)); TS_ASSERT_EQUALS(ppc.CalculateAllConductionVelocities(5,95,0.45)[0],-ppc.CalculateAllConductionVelocities(95,5,0.45)[0]); // Then we check some values (should be rather uniform over the cable) TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(5,50,0.45), 0.097, 0.003); TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(50,95,0.45), 0.097, 0.003); //cover the case of conduction calculated from and to the same node, it should return 0 TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(5,5,0.0), 0.0, 0.000001); //faking half euclidian distance, check that it gets twice slower TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(5,50,0.225), 0.048, 0.003); TS_ASSERT_DELTA(ppc.CalculateConductionVelocity(50,95,0.225), 0.048, 0.003); //Finally make sure that the method that gets all the conduction velocities returns the same answers TS_ASSERT_EQUALS(ppc.CalculateAllConductionVelocities(5,95,0.45)[0],ppc.CalculateConductionVelocity(5,95,0.45)); TS_ASSERT_EQUALS(ppc.CalculateAllConductionVelocities(5,50,0.45)[0],ppc.CalculateConductionVelocity(5,50,0.45)); } void TestConductionBidomain3D() { //Note: these data files (from notforrelease/test/TestCardiacFastSlowProblem3D.hpp) are incomplete. unsigned middle_index = 14895U; unsigned rhs_index = 14910U; Hdf5DataReader simulation_data_fs("heart/test/data/BidomainFastSlow3D", "res", false); PropagationPropertiesCalculator properties_fs(&simulation_data_fs); /* * From Raf's Matlab/Octave script r4256_Bi_FastSlow_3d Mid APD90: 229.7 Mid dv/dt_max: 180.28 Mid dv/dt time: 3.2 RHS dv/dt time: 5.8 CV: 0.057692 * */ TS_ASSERT_DELTA(properties_fs.CalculateActionPotentialDuration(90, middle_index), 230.3917, 0.25); TS_ASSERT_DELTA(properties_fs.CalculateConductionVelocity(middle_index, rhs_index, 0.15), 0.057692, 0.001); TS_ASSERT_DELTA(properties_fs.CalculateMaximumUpstrokeVelocity(middle_index), 180.28, 0.01); //Testing the method that returns all APs TS_ASSERT_EQUALS(properties_fs.CalculateActionPotentialDuration(90, middle_index), properties_fs.CalculateAllActionPotentialDurations(90, middle_index, -30.0)[0]); //Throws because the percentage "0.9%" looks too small and is likely to be a mistake TS_ASSERT_THROWS_THIS(properties_fs.CalculateActionPotentialDuration(0.9, middle_index), "First argument of CalculateActionPotentialDuration() is expected to be a percentage"); //Throws because the percentage "100%" looks too big. TS_ASSERT_THROWS_THIS(properties_fs.CalculateActionPotentialDuration(100.0, middle_index), "First argument of CalculateActionPotentialDuration() is expected to be a percentage"); Hdf5DataReader simulation_data_bw("heart/test/data/BidomainBackwardToCompareWithFastSlow3D", "res", false); PropagationPropertiesCalculator properties_bw(&simulation_data_bw); /* * From Raf's Matlab/Octave script r4256_Bi_Back_3d Mid APD90: 229.2 Mid dv/dt_max: 173.02 Mid dv/dt time: 3.3 RHS dv/dt time: 6 CV: 0.055556 * */ TS_ASSERT_DELTA(properties_bw.CalculateActionPotentialDuration(90, middle_index), 229.9328, 0.25); TS_ASSERT_DELTA(properties_bw.CalculateConductionVelocity(middle_index, rhs_index, 0.15), 0.055556, 0.001); TS_ASSERT_DELTA(properties_bw.CalculateMaximumUpstrokeVelocity(middle_index), 173.02, 0.01); //Testing the method that returns all APs TS_ASSERT_EQUALS(properties_bw.CalculateActionPotentialDuration(90, middle_index), properties_bw.CalculateAllActionPotentialDurations(90, middle_index, -30.0)[0]); } void TestUpstrokeBidomain3D() { Hdf5DataReader mono_fs_reader("heart/test/data/MonodomainFastSlow3D", "res", false); //std::vector<double> voltage_fast_slow=mono_fs_reader.GetVariableOverTime("V", mMiddleIndex); //DumpVector(voltage_fast_slow, "middle_node_mfs.dat"); PropagationPropertiesCalculator ppc_fs(&mono_fs_reader); TS_ASSERT_DELTA(ppc_fs.CalculateMaximumUpstrokeVelocity(14895U), 174.9, 4.0); TS_ASSERT_DELTA(ppc_fs.CalculateActionPotentialDuration(90, 14895U), 231.739, 1.0); //Testing the mtehod that returns all APs TS_ASSERT_EQUALS(ppc_fs.CalculateActionPotentialDuration(90, 14895U), ppc_fs.CalculateAllActionPotentialDurations(90, 14895U, -30.0)[0]); Hdf5DataReader mono_bw_reader("heart/test/data/MonodomainBackwardToCompareWithFastSlow3D", "res", false); //std::vector<double> voltage_fast_slow=mono_fs_reader.GetVariableOverTime("V", mMiddleIndex); //DumpVector(voltage_fast_slow, "middle_node_mfs.dat"); PropagationPropertiesCalculator ppc_bw(&mono_bw_reader); TS_ASSERT_DELTA(ppc_bw.CalculateMaximumUpstrokeVelocity(14895U), 174.9, 4.0); TS_ASSERT_DELTA(ppc_bw.CalculateActionPotentialDuration(90, 14895U), 230.25, 1.0); } void TestAPDCalculatorOverMultipleNodes() { Hdf5DataReader mono_fs_reader("heart/test/data/Monodomain1dFullActionPotential", "Monodomain1dFullActionPotential", false); PropagationPropertiesCalculator ppc_fs(&mono_fs_reader); // hardcoded TS_ASSERT_DELTA(ppc_fs.CalculateActionPotentialDuration(90, 5u), 331.1516, 1e-3); // Testing the method that returns all APs (for a given node) TS_ASSERT_EQUALS(ppc_fs.CalculateActionPotentialDuration(90, 5), ppc_fs.CalculateAllActionPotentialDurations(90, 5u, -30.0)[0]); // Testing the method that returns all APs over a range over nodes std::vector<std::vector<double> > all_aps_for_node_range = ppc_fs.CalculateAllActionPotentialDurationsForNodeRange(90, 1u, 7u, -30.0); TS_ASSERT_EQUALS(all_aps_for_node_range.size(), 6u); for (unsigned i=0; i<all_aps_for_node_range.size(); i++) { TS_ASSERT_EQUALS(all_aps_for_node_range[i].size(), 1u); //std::cout << "Node " << i+1 << ", APD = " << all_aps_for_node_range[i][0] << "\n"; } // verify that the APDs for two of the nodes are definitely different assert(all_aps_for_node_range[4][0] != all_aps_for_node_range[5][0]); // Check that the CalculateAllActionPotentialDurationsForNodeRange() results // agrees with the single-node version, for both these nodes TS_ASSERT_EQUALS(ppc_fs.CalculateAllActionPotentialDurations(90, 5u, -30.0)[0], all_aps_for_node_range[4][0]); TS_ASSERT_EQUALS(ppc_fs.CalculateAllActionPotentialDurations(90, 6u, -30.0)[0], all_aps_for_node_range[5][0]); } void TestEadCalculation() { Hdf5DataReader ead_file("heart/test/data/PostProcessingWriter", "Ead", false); PropagationPropertiesCalculator ead_calc(&ead_file); TS_ASSERT_EQUALS(ead_calc.CalculateAllAboveThresholdDepolarisations(97u,-40.0)[0],1u); TS_ASSERT_EQUALS(ead_calc.CalculateAllAboveThresholdDepolarisations(97u,-40.0)[1],0u); TS_ASSERT_EQUALS(ead_calc.CalculateAllAboveThresholdDepolarisations(97u,-40.0)[2],3u); TS_ASSERT_EQUALS(ead_calc.CalculateAllAboveThresholdDepolarisations(97u,-40.0)[3],0u); TS_ASSERT_EQUALS(ead_calc.CalculateAboveThresholdDepolarisationsForLastAp(97u,-40.0), 0u); } }; #endif //_TESTPROPAGATIONPROPERTIESCALCULATOR_HPP_
/* * 说明:这是以字符串处理算法为主的库 * 编号:002 * 备注:字符串处理 */ #include "Header.h" namespace STRING { /* * 编号:002_1 * 函数名称:_Uppcase_Str * 描述:返回输入字符串的大写模式 */ string _Uppcase_Str(string _Dest_Str) { _FOR_(i, _Dest_Str.length()) { if (_Dest_Str[i] >= 'a'&&_Dest_Str[i] <= 'z') { _Dest_Str[i] = (char)('A' + _Dest_Str[i] - 'a'); } } return _Dest_Str; } /* * 编号:002_2 * 函数名称:_Lowcase_Str * 描述:返回输入字符串的小写模式 */ string _Lowcase_Str(string _Dest_Str) { _FOR_(i, _Dest_Str.length()) { if (_Dest_Str[i] >= 'A'&&_Dest_Str[i] <= 'Z') { _Dest_Str[i] = (char)('a' + _Dest_Str[i] - 'A'); } } return _Dest_Str; } /* * 编号:002_3 * 函数名称:_Count_of_Letter * 描述:返回总共出现了多少个不同的字符 */ int _Count_of_Letter(string _Dest_Str) { list<char> _List_Str; _FOR_(i, _Dest_Str.length()) { _List_Str.push_back(_Dest_Str[i]); } _List_Str.sort(); _List_Str.unique(); return _List_Str.size(); } /* * 编号:002_4 * 函数名称:_Count_of_Letter_if * 描述:返回指定字符在字符串中出现的次数 */ int _Count_of_Letter_if(string _Dest_Str, char _Dest_Ch) { int _Res_Num = 0; _FOR_(i, _Dest_Str.length()) { if (_Dest_Str[i] == _Dest_Ch) { _Res_Num++; } } return _Res_Num; } /* * 编号:002_5 * 函数名称:_Fist_Idex_Ch * 描述:返回指定字符在字符串中首次出现的位置 * 备注:返回-1表示没有这样的字符在字符串中出现 */ int _Fist_Idex_Ch(string _Dest_Str, char _Dest_Ch) { int _Res_Idex = -1; _FOR_(i, _Dest_Str.length()) { if (_Dest_Str[i] == _Dest_Ch) { _Res_Idex = i; break; } } return _Res_Idex; } /* * 编号:002_5 * 函数名称:_Last_Idex_Ch * 描述:返回指定字符在字符串中最后出现出现的位置 * 备注:返回-1表示没有这样的字符在字符串中出现 */ int _Last_Idex_Ch(string _Dest_Str, char _Dest_Ch) { int _Res_Idex = -1; _Re_For(i, _Dest_Str.length() - 1) { if (_Dest_Str[i] == _Dest_Ch) { _Res_Idex = i; break; } } return _Res_Idex; } /* * 编号:002_6 * 函数名称:_Next_Permutation * 描述:返回输入字符串按照字典序的全排列 * 备注:返回当前字符串开始的全排列 * 如果想要输出所有排列,去掉注释 */ vector<string> _Next_Permutation(string _Souce_Str) { vector<string> _Res_Set_Str; //sort(_Souce_Str.begin(), _Souce_Str.end()); //_Res_Set_Str.push_back(_Souce_Str); while (next_permutation(_Souce_Str.begin(), _Souce_Str.end())) { _Res_Set_Str.push_back(_Souce_Str); } return _Res_Set_Str; } /* * 编号:002_7 * 函数名称:_Get_Next_Array * 描述:返回输入字符串的next数组 * 备注:此函数可以单独使用 */ int* _Get_Next_Array(string _Pattern_Str) { int* _Next_Array; _Next_Array = new int[_Pattern_Str.length()]; _Next_Array[0] = -1; int i = 0, j = -1; while (i != _Pattern_Str.length()) { if (j == -1 || _Pattern_Str[i] == _Pattern_Str[j]) { i++, j++; _Next_Array[i] = j; } else{ j = _Next_Array[j]; } } return _Next_Array; } /* * 编号:002_8 * 函数名称:_Brute_Force * 描述:判断模式串是否在主串中出现 * 备注:如果匹配成功则返回第一次匹配成功的开始下标,否则返回-1 */ int _Brute_Force(string _Main_Str, string _Pattern_Str) { int _Res_Idex = 0; while (_Res_Idex != _Main_Str.length()) { int _Idex_of_Main_Str; int _Length_of_Pattern; for (_Idex_of_Main_Str = _Res_Idex, _Length_of_Pattern = 0; _Idex_of_Main_Str != _Main_Str.length() && _Length_of_Pattern != _Pattern_Str.length() && _Main_Str[_Idex_of_Main_Str] == _Pattern_Str[_Length_of_Pattern]; _Idex_of_Main_Str++, _Length_of_Pattern++); if (_Length_of_Pattern == _Pattern_Str.length()) { return _Res_Idex; } _Res_Idex++; } return -1; } /* * 编号:002_9 * 函数名称:_Kmp * 描述:判断模式串是否在主串中出现 * 备注:如果匹配成功则返回第一次匹配成功的开始下标,否则返回-1 */ int _Kmp(string _Main_Str, string _Pattern_Str) { int *_Next_array = _Get_Next_Array(_Pattern_Str); int _Idex_of_Main_str = 0; int _Idex_of_Pattern_str = 0; int _Res_Idex = -1; while (_Idex_of_Main_str != _Main_Str.length() && _Idex_of_Pattern_str != _Pattern_Str.length()) { if (_Idex_of_Pattern_str == -1 || _Main_Str[_Idex_of_Main_str] == _Pattern_Str[_Idex_of_Pattern_str]) { _Idex_of_Main_str++; _Idex_of_Pattern_str++; } else{ _Idex_of_Pattern_str = _Next_array[_Idex_of_Pattern_str]; } } if (_Idex_of_Pattern_str >= _Pattern_Str.length()) { _Res_Idex = _Idex_of_Main_str - _Pattern_Str.length(); } return _Res_Idex; } /* * 编号:002_10 * 函数名称:_Order_Str * 描述:判断给定字符串是不是有序 * 备注:该函数将忽略大小写 * 返回0代表无序,返回1代表从小到大有序 * 返回2代表从大到小有序,3代表只有一个字符 */ int _Order_Str(string _Dest_Str) { _Dest_Str = _Uppcase_Str(_Dest_Str); string _Temp_Sorted_Str = _Dest_Str; sort(_Temp_Sorted_Str.begin(), _Temp_Sorted_Str.end()); string _Reverse_Str = _Temp_Sorted_Str; reverse(_Reverse_Str.begin(), _Reverse_Str.end()); if (_Reverse_Str == _Temp_Sorted_Str) { return 2; } else if (_Dest_Str == _Temp_Sorted_Str) { return 1; } else if (_Dest_Str == _Reverse_Str) { return 2; } else{ return 0; } } /* * 编号:002_11 * 函数名称:_Delete_If_Ch * 描述:将给定的字符从字符串中删除 * 备注:该函数将不处理输入错误的情况 */ string _Delete_If_Ch(string _Dest_Str, char _Delete_Ch) { string _Res_Str = ""; _FOR_(i, _Dest_Str.length()) { if (_Dest_Str[i] != _Delete_Ch) { _Res_Str += _Dest_Str[i]; } } return _Res_Str; } /* * 编号:002_12 * 函数名称:_Delete_If_String * 描述:将给定的子字符串从字符串中删除 * 备注:该函数将不处理输入错误的情况 */ string _Delete_If_String(string _Dest_Str, string _Delete_Str) { //使用Kmp算法求出字串的位置,然后删除 Loop: int _Start_Idex = _Kmp(_Dest_Str, _Delete_Str); if (_Start_Idex != -1) { _Dest_Str = _Dest_Str.substr(0, _Start_Idex) + _Dest_Str.substr(_Start_Idex + _Delete_Str.length()); goto Loop; } else{ return _Dest_Str; } } /* * 编号:002_13 * 函数名称:_Count_If_String * 描述:该函数将返回给定字符串在源字符串中出现的次数 */ int _Count_If_String(string _Dest_Str, string _Count_Str) { int _Res_Num = 0; _Loop: int _Start_Idex = _Kmp(_Dest_Str, _Count_Str); if (_Start_Idex != -1) { _Res_Num++; _Dest_Str = _Dest_Str.substr(_Start_Idex + 1); goto _Loop; } else{ return _Res_Num; } } /* * 编号:002_14 * 函数名称:_First_Idex_Str * 描述:该函数将返回给定字符串在源字符串中首次出现的位置 * 备注:返回-1代表没有这样的字串存在于源字符串中 */ int _First_Idex_Str(string _Dest_Str, string _Find_Str) { return _Kmp(_Dest_Str, _Find_Str); } /* * 编号:002_15 * 函数名称:_Last_Idex_Str * 描述:该函数将返回给定字符串在源字符串中最后出现的位置 * 备注:返回-1代表没有这样的字串存在于源字符串中 */ int _Last_Idex_Str(string _Dest_Str, string _Find_Str) { int _Res_Idex; reverse(_Dest_Str.begin(), _Dest_Str.end()); reverse(_Find_Str.begin(), _Find_Str.end()); _Res_Idex = _Kmp(_Dest_Str, _Find_Str); _Res_Idex += (_Find_Str.length()); return (_Dest_Str.length() - _Res_Idex); } /* * 编号:002_16 * 函数名称:_Longest_Sub_Str * 描述:该函数将求出给定的两个字符串的最大公共子序列的长度 * 备注:所谓子序列不要求连续,只要在两个串中都存在即可 */ int _Longest_Sub_Str(string _Dest_Str_1, string _Dest_Str_2) { //动态申请内存 int** _Longest_Length; _Longest_Length = new int*[_Dest_Str_1.length() + 1]; _FOR_(i, _Dest_Str_1.length() + 1) { _Longest_Length[i] = new int[_Dest_Str_2.length() + 1]; } _FOR_(i, _Dest_Str_1.length() + 1) _FOR_(j, _Dest_Str_2.length() + 1){ _Longest_Length[i][j] = 0; } _FFOR_(i, _Dest_Str_1.length()) _FFOR_(j, _Dest_Str_2.length()){ if (_Dest_Str_1[i - 1] == _Dest_Str_2[j - 1]) { _Longest_Length[i][j] = _Longest_Length[i - 1][j - 1] + 1; } else{ _Longest_Length[i][j] = max(_Longest_Length[i - 1][j], _Longest_Length[i][j - 1]); } } int Res_Num = _Longest_Length[_Dest_Str_1.length()][_Dest_Str_2.length()]; _FOR_(i, _Dest_Str_1.length() + 1) { delete[] _Longest_Length[i]; } delete[]_Longest_Length; return Res_Num; } /* * 编号:002_17 * 函数名称:Is_Palindrome * 描述:该函数判断给定的一个字符串是否构成回文 */ bool Is_Palindrome(string _Dest_Str) { string _Temp_Str = _Dest_Str; reverse(_Temp_Str.begin(), _Temp_Str.end()); return (_Dest_Str == _Temp_Str); } /* * 编号:002_18 * 函数名称:Min_Change_Time_To_Palindrome * 描述:该函数将给出最少加入几个字符可以使得其变为回文 */ int Min_Change_Time_To_Palindrome(string _Dest_Str) { string _Reverse_Str = _Dest_Str; reverse(_Reverse_Str.begin(), _Reverse_Str.end()); return (_Dest_Str.length() - _Longest_Sub_Str(_Dest_Str, _Reverse_Str)); } }/*end of namespace STRING*/
/* * common.h * * Created on: 2013-4-2 * Author: chunwei */ #ifndef COMMON_H_ #define COMMON_H_ #include <iostream> #include <string> #include <vector> #include <math.h> #include <ostream> #include <sstream> #include <algorithm> #include <fstream> #include <time.h> using namespace std; // 包含数据类型定义等 // size of dataset // TODO change the sizes #define TRAIN_SIZE 10000 #define TEST_SIZE 10000 #define PREDICT_SIZE 1000 // size of other meta info #define USER_NUM 9772 #define ITEM_NUM 7899 typedef unsigned int uint; typedef unsigned short ushort; typedef unsigned long ulong; typedef uint UidType; typedef uint ItemType; typedef ushort RateType; typedef struct Time{ int day; int hour; int minute; int second; }Time; // for trainset ---------------------------------------- typedef struct rateNode { ItemType item; RateType rate; } rateNode; typedef struct testNode { UidType user; ItemType item; RateType rate; }testSetNode; // for predictset typedef struct predictNode{ UidType user; ItemType item; }predictNode; // functions ------------------------------------------ void show_status(string info, uint cur=0, uint size=0); float dot(float *p, float *qLocal,int dim); void setRand(float *p, int dim, float base); #endif /* COMMON_H_ */
#pragma once #include <VulkanWrapper/VulkanBaseApp.h> #include <map> #include <Base/VertexTypes.h> #include <Base/Camera.h> //Application to test Mesh generation/loading using debug render pipelines class Mesh; namespace vkw { class GraphicsPipeline; class Buffer; class DescriptorPool; class DescriptorSet; class VertexBuffer; class IndexBuffer; class DebugUI; class DebugWindow; template<class T> class SelectableList; } class App : vkw::VulkanBaseApp { public: App(vkw::VulkanDevice* pDevice):VulkanBaseApp(pDevice, "MeshDebugRendering"){}; ~App() {}; void Init(uint32_t width, uint32_t height) override; bool Update(float dTime) override; void Render() override; void Cleanup() override; protected: void AllocateDrawCommandBuffers() override; void BuildDrawCommandBuffers() override; void FreeDrawCommandBuffers() override; private: //Initializes graphicspipelines, vertexbuffers, index buffer and descriptorset for all render modes void InitRenderModes(); vkw::DebugUI* m_pDebugUI = nullptr; vkw::DebugWindow* m_pDebugWindow = nullptr; vkw::SelectableList<std::vector<VkCommandBuffer>>* m_pRenderModeSelector = nullptr; std::map<std::string, vkw::GraphicsPipeline*> m_pRenderPipelines{}; std::map<std::string, std::vector<VkCommandBuffer>> m_DrawCommandBuffers{}; std::map<std::string, std::vector<VertexAttribute>> m_VertexAttributes{}; std::map<std::string, vkw::VertexBuffer*> m_pVertexBuffers{}; vkw::IndexBuffer* m_pIndexBuffer{}; vkw::Buffer* m_pUniformBuffer = nullptr; vkw::DescriptorPool* m_pDescriptorPool = nullptr; vkw::DescriptorSet* m_pDescriptorSet = nullptr; Mesh* m_pPlaneMesh = nullptr; //Camera stuff Camera m_Camera{}; glm::vec2 m_PrevMousePos{}; float m_ElapsedSec{}; float m_CameraSpeed = 20.f; bool m_ShouldCaptureMouse = true; struct CameraInfo { glm::mat4x4 projection{}; glm::mat4x4 view{}; }m_UniformBufferData; };
#include <iostream> using namespace std; struct Stack{ int top=0; int a[100]; }; void pushS(Stack* st,int v){ st->a[st->top] = v; st->top = st->top + 1; }; char popS(Stack* st){ int v; st->top = st->top - 1; v = st->a[st->top]; return v; }; int main(){ Stack S; Stack P; int a[10] = {5,3,8,9,1,7,0,2,6,4}; for (int i = 0; i < 10; i++) { pushS(&S,a[i]); } int i=0; int var,temp; var = popS(&S); pushS(&P,var); while ((S.top)!=0) { var = popS(&S); while ((var<P.a[P.top-1])&&((P.top)!=0)) { temp = popS(&P); pushS(&S,temp); } pushS(&P,var); } for (int i = 0; i < 10; i++) { cout<<popS(&P)<<" "; } cout<<endl; return 0; }
#ifndef _PARALIGN_OPTIONS_H_ #define _PARALIGN_OPTIONS_H_ #include <iosfwd> #include <string> namespace paralign { // Options for controlling the alignment struct Options { // Reverse estimation (swap source and target during training) bool reverse; // Use a static alignment distribution that assigns higher probabilities to alignments near the diagonal bool favor_diagonal; // When `favor_diagonal` is set, what's the probability of a null alignment? double prob_align_null; // How sharp or flat around the diagonal is the alignment distribution (<1 = flat >1 = sharp) double diagonal_tension; // Optimize diagonal tension during EM bool optimize_tension; // Infer VB estimate of parameters under a symmetric Dirichlet prior bool variational_bayes; // Hyperparameter for optional Dirichlet prior double alpha; // Do not generate from a null token bool no_null_word; // Directory of translation tables std::string ttable_dir; // Number of translation table pieces int ttable_parts; // Default values Options() : reverse(false), favor_diagonal(true), prob_align_null(0.08), diagonal_tension(4.0), optimize_tension(true), variational_bayes(true), alpha(0.01), no_null_word(false), ttable_dir("."), ttable_parts(0) {} // Construct from environment variables static Options FromEnv(); // Show options friend std::ostream &operator<<(std::ostream &, const Options &); // Check for invalid combination of options void Check() const; }; std::ostream &operator<<(std::ostream &, const Options &); } // namespace paralign #endif // _PARALIGN_OPTIONS_H_
#ifndef DWIZ_COMMON_PROTOCOLS_V0_PROTOCOL_V0_FACTORY_H #define DWIZ_COMMON_PROTOCOLS_V0_PROTOCOL_V0_FACTORY_H #include <common/dwiz_std.h> #include <common/protocols/protocol_factory_interface.h> namespace dwiz { class ProtocolV0Factory : public ProtocolFactoryInterface { public: virtual std::unique_ptr<LoginProtocolInterface> createLoginProtocol() override; }; // class ProtocolV0Factory } // namespace dwiz #endif
#pragma once #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <cmath> #include <tuple> #include "../../EngineLayer/PeptideSpectralMatch.h" #include "../../EngineLayer/ProteinParsimony/ProteinGroup.h" #include "Chemistry/Chemistry.h" using namespace Chemistry; using namespace EngineLayer; #include "MzLibUtil.h" using namespace MzLibUtil; #include "Proteomics/Proteomics.h" using namespace Proteomics; using namespace Proteomics::ProteolyticDigestion; #include "MzIdentML/mzIdentML110.h" namespace TaskLayer { class MzIdentMLWriter final { public: static void WriteMzIdentMl(std::vector<PeptideSpectralMatch*> &psms, std::vector<EngineLayer::ProteinGroup*> &groups, std::vector<Modification*> &variableMods, std::vector<Modification*> &fixedMods, std::vector<Protease*> &proteases, double qValueFilter, Tolerance *productTolerance, Tolerance *parentTolerance, int missedCleavages, const std::string &outputPath); private: static mzIdentML110::CVParamType *GetUnimodCvParam(Modification *mod); }; }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "google/cacheinvalidation/types.pb.h" #include "sync/notifier/mock_sync_notifier_observer.h" #include "sync/notifier/sync_notifier_registrar.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { namespace { using testing::InSequence; using testing::Mock; using testing::StrictMock; class SyncNotifierRegistrarTest : public testing::Test { protected: SyncNotifierRegistrarTest() : kObjectId1(ipc::invalidation::ObjectSource::TEST, "a"), kObjectId2(ipc::invalidation::ObjectSource::TEST, "b"), kObjectId3(ipc::invalidation::ObjectSource::TEST, "c"), kObjectId4(ipc::invalidation::ObjectSource::TEST, "d") { } const invalidation::ObjectId kObjectId1; const invalidation::ObjectId kObjectId2; const invalidation::ObjectId kObjectId3; const invalidation::ObjectId kObjectId4; }; // Register a handler, register some IDs for that handler, and then unregister // the handler, dispatching invalidations in between. The handler should only // see invalidations when its registered and its IDs are registered. TEST_F(SyncNotifierRegistrarTest, Basic) { StrictMock<MockSyncNotifierObserver> handler; SyncNotifierRegistrar registrar; registrar.RegisterHandler(&handler); ObjectIdPayloadMap payloads; payloads[kObjectId1] = "1"; payloads[kObjectId2] = "2"; payloads[kObjectId3] = "3"; // Should be ignored since no IDs are registered to |handler|. registrar.DispatchInvalidationsToHandlers(payloads, REMOTE_NOTIFICATION); Mock::VerifyAndClearExpectations(&handler); ObjectIdSet ids; ids.insert(kObjectId1); ids.insert(kObjectId2); registrar.UpdateRegisteredIds(&handler, ids); { ObjectIdPayloadMap expected_payloads; expected_payloads[kObjectId1] = "1"; expected_payloads[kObjectId2] = "2"; EXPECT_CALL(handler, OnIncomingNotification(expected_payloads, REMOTE_NOTIFICATION)); } registrar.DispatchInvalidationsToHandlers(payloads, REMOTE_NOTIFICATION); Mock::VerifyAndClearExpectations(&handler); ids.erase(kObjectId1); ids.insert(kObjectId3); registrar.UpdateRegisteredIds(&handler, ids); { ObjectIdPayloadMap expected_payloads; expected_payloads[kObjectId2] = "2"; expected_payloads[kObjectId3] = "3"; EXPECT_CALL(handler, OnIncomingNotification(expected_payloads, REMOTE_NOTIFICATION)); } // Removed object IDs should not be notified, newly-added ones should. registrar.DispatchInvalidationsToHandlers(payloads, REMOTE_NOTIFICATION); Mock::VerifyAndClearExpectations(&handler); registrar.UnregisterHandler(&handler); // Should be ignored since |handler| isn't registered anymore. registrar.DispatchInvalidationsToHandlers(payloads, REMOTE_NOTIFICATION); } // Register handlers and some IDs for those handlers, register a handler with // no IDs, and register a handler with some IDs but unregister it. Then, // dispatch some notifications and invalidations. Handlers that are registered // should get notifications, and the ones that have registered IDs should // receive invalidations for those IDs. TEST_F(SyncNotifierRegistrarTest, MultipleHandlers) { StrictMock<MockSyncNotifierObserver> handler1; EXPECT_CALL(handler1, OnNotificationsEnabled()); { ObjectIdPayloadMap expected_payloads; expected_payloads[kObjectId1] = "1"; expected_payloads[kObjectId2] = "2"; EXPECT_CALL(handler1, OnIncomingNotification(expected_payloads, REMOTE_NOTIFICATION)); } EXPECT_CALL(handler1, OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); StrictMock<MockSyncNotifierObserver> handler2; EXPECT_CALL(handler2, OnNotificationsEnabled()); { ObjectIdPayloadMap expected_payloads; expected_payloads[kObjectId3] = "3"; EXPECT_CALL(handler2, OnIncomingNotification(expected_payloads, REMOTE_NOTIFICATION)); } EXPECT_CALL(handler2, OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); StrictMock<MockSyncNotifierObserver> handler3; EXPECT_CALL(handler3, OnNotificationsEnabled()); EXPECT_CALL(handler3, OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); StrictMock<MockSyncNotifierObserver> handler4; SyncNotifierRegistrar registrar; registrar.RegisterHandler(&handler1); registrar.RegisterHandler(&handler2); registrar.RegisterHandler(&handler3); registrar.RegisterHandler(&handler4); { ObjectIdSet ids; ids.insert(kObjectId1); ids.insert(kObjectId2); registrar.UpdateRegisteredIds(&handler1, ids); } { ObjectIdSet ids; ids.insert(kObjectId3); registrar.UpdateRegisteredIds(&handler2, ids); } // Don't register any IDs for handler3. { ObjectIdSet ids; ids.insert(kObjectId4); registrar.UpdateRegisteredIds(&handler4, ids); } registrar.UnregisterHandler(&handler4); registrar.EmitOnNotificationsEnabled(); { ObjectIdPayloadMap payloads; payloads[kObjectId1] = "1"; payloads[kObjectId2] = "2"; payloads[kObjectId3] = "3"; payloads[kObjectId4] = "4"; registrar.DispatchInvalidationsToHandlers(payloads, REMOTE_NOTIFICATION); } registrar.EmitOnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR); } // Multiple registrations by different handlers on the same object ID should // cause a CHECK. TEST_F(SyncNotifierRegistrarTest, MultipleRegistration) { SyncNotifierRegistrar registrar; StrictMock<MockSyncNotifierObserver> handler1; registrar.RegisterHandler(&handler1); MockSyncNotifierObserver handler2; registrar.RegisterHandler(&handler2); ObjectIdSet ids; ids.insert(kObjectId1); ids.insert(kObjectId2); registrar.UpdateRegisteredIds(&handler1, ids); registrar.DetachFromThreadForTest(); EXPECT_DEATH({ registrar.UpdateRegisteredIds(&handler2, ids); }, "Duplicate registration: .*"); } // Make sure that passing an empty set to UpdateRegisteredIds clears the // corresponding entries for the handler. TEST_F(SyncNotifierRegistrarTest, EmptySetUnregisters) { StrictMock<MockSyncNotifierObserver> handler1; EXPECT_CALL(handler1, OnNotificationsEnabled()); EXPECT_CALL(handler1, OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); // Control observer. StrictMock<MockSyncNotifierObserver> handler2; EXPECT_CALL(handler2, OnNotificationsEnabled()); { ObjectIdPayloadMap expected_payloads; expected_payloads[kObjectId3] = "3"; EXPECT_CALL(handler2, OnIncomingNotification(expected_payloads, REMOTE_NOTIFICATION)); } EXPECT_CALL(handler2, OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); SyncNotifierRegistrar registrar; registrar.RegisterHandler(&handler1); registrar.RegisterHandler(&handler2); { ObjectIdSet ids; ids.insert(kObjectId1); ids.insert(kObjectId2); registrar.UpdateRegisteredIds(&handler1, ids); } { ObjectIdSet ids; ids.insert(kObjectId3); registrar.UpdateRegisteredIds(&handler2, ids); } // Unregister the IDs for the first observer. It should not receive any // further invalidations. registrar.UpdateRegisteredIds(&handler1, ObjectIdSet()); registrar.EmitOnNotificationsEnabled(); { ObjectIdPayloadMap payloads; payloads[kObjectId1] = "1"; payloads[kObjectId2] = "2"; payloads[kObjectId3] = "3"; registrar.DispatchInvalidationsToHandlers(payloads, REMOTE_NOTIFICATION); } registrar.EmitOnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR); } } // namespace } // namespace syncer
#include <iostream> #include "../../src/mutex_thread/mutex_thread.h" class Q: public mutex_thread::mutex_thread { public: Q() : mutex_thread::mutex_thread() {}; virtual ~Q() { } private: void do_job(); }; void Q::do_job() { std::cout << "ASD"; } int main() { Q a; a(); a.stop(); }
#ifndef __FLYWEIGHT_FACTORY_H__ #define __FLYWEIGHT_FACTORY_H__ #include "Flyweight.h" #include <map> #include <memory> class FlyweightFactory { public: std::shared_ptr<Flyweight> getCode(const int key); private: std::map<int, std::shared_ptr<Flyweight>> m_list; }; #endif // __FLYWEIGHT_FACTORY_H__
#pragma once #include <string> #include "ReClassNET_Plugin.hpp" #include "PipeStream/BinaryReader.hpp" #include "PipeStream/BinaryWriter.hpp" class MessageClient; enum class MessageType { StatusResponse = 1, OpenProcessRequest = 2, CloseProcessRequest = 3, IsValidRequest = 4, ReadMemoryRequest = 5, ReadMemoryResponse = 6, WriteMemoryRequest = 7, EnumerateRemoteSectionsAndModulesRequest = 8, EnumerateRemoteSectionResponse = 9, EnumerateRemoteModuleResponse = 10, EnumerateProcessHandlesRequest = 11, EnumerateProcessHandlesResponse = 12, ClosePipeRequest = 13 }; //--------------------------------------------------------------------------- class IMessage { public: virtual ~IMessage() = default; virtual MessageType GetMessageType() const = 0; virtual void ReadFrom(BinaryReader& br) = 0; virtual void WriteTo(BinaryWriter& bw) const = 0; virtual bool Handle(MessageClient& client) { return true; } }; //--------------------------------------------------------------------------- class StatusResponse : public IMessage { public: MessageType GetMessageType() const override { return MessageType::StatusResponse; } bool GetSuccess() const { return success; } StatusResponse() : success(false) { } StatusResponse(bool _success) : success(_success) { } void ReadFrom(BinaryReader& reader) override { success = reader.ReadBoolean(); } void WriteTo(BinaryWriter& writer) const override { writer.Write(success); } private: bool success; }; //--------------------------------------------------------------------------- class OpenProcessRequest : public IMessage { public: MessageType GetMessageType() const override { return MessageType::OpenProcessRequest; } void ReadFrom(BinaryReader& reader) override { } void WriteTo(BinaryWriter& writer) const override { } bool Handle(MessageClient& client) override; }; //--------------------------------------------------------------------------- class CloseProcessRequest : public IMessage { public: MessageType GetMessageType() const override { return MessageType::CloseProcessRequest; } void ReadFrom(BinaryReader& reader) override { } void WriteTo(BinaryWriter& writer) const override { } bool Handle(MessageClient& client) override; }; //--------------------------------------------------------------------------- class IsValidRequest : public IMessage { public: MessageType GetMessageType() const override { return MessageType::IsValidRequest; } void ReadFrom(BinaryReader& reader) override { } void WriteTo(BinaryWriter& writer) const override { } bool Handle(MessageClient& client) override; }; //--------------------------------------------------------------------------- class ReadMemoryRequest : public IMessage { public: MessageType GetMessageType() const override { return MessageType::ReadMemoryRequest; } const void* GetAddress() const { return address; } int GetSize() const { return size; } ReadMemoryRequest() : address(nullptr), size(0) { } ReadMemoryRequest(const void* _address, int _size) : address(_address), size(_size) { } void ReadFrom(BinaryReader& reader) override { address = reader.ReadIntPtr(); size = reader.ReadInt32(); } void WriteTo(BinaryWriter& writer) const override { writer.Write(address); writer.Write(size); } bool Handle(MessageClient& client) override; private: const void* address; int size; }; //--------------------------------------------------------------------------- class ReadMemoryResponse : public IMessage { public: MessageType GetMessageType() const override { return MessageType::ReadMemoryResponse; } const std::vector<uint8_t>& GetData() const { return data; } ReadMemoryResponse() { } ReadMemoryResponse(std::vector<uint8_t>&& _data) : data(std::move(_data)) { } void ReadFrom(BinaryReader& reader) override { const auto size = reader.ReadInt32(); data = reader.ReadBytes(size); } void WriteTo(BinaryWriter& writer) const override { writer.Write(static_cast<int>(data.size())); writer.Write(data.data(), 0, static_cast<int>(data.size())); } private: std::vector<uint8_t> data; }; //--------------------------------------------------------------------------- class WriteMemoryRequest : public IMessage { public: MessageType GetMessageType() const override { return MessageType::WriteMemoryRequest; } const void* GetAddress() const { return address; } const std::vector<uint8_t>& GetData() const { return data; } WriteMemoryRequest() : address(nullptr) { } WriteMemoryRequest(const void* _address, std::vector<uint8_t>&& _data) : address(_address), data(std::move(_data)) { } void ReadFrom(BinaryReader& reader) override { address = reader.ReadIntPtr(); const auto size = reader.ReadInt32(); data = reader.ReadBytes(size); } void WriteTo(BinaryWriter& writer) const override { writer.Write(address); writer.Write(static_cast<int>(data.size())); writer.Write(data.data(), 0, static_cast<int>(data.size())); } bool Handle(MessageClient& client) override; private: const void* address; std::vector<uint8_t> data; }; //--------------------------------------------------------------------------- class EnumerateRemoteSectionsAndModulesRequest : public IMessage { public: MessageType GetMessageType() const override { return MessageType::EnumerateRemoteSectionsAndModulesRequest; } void ReadFrom(BinaryReader& reader) override { } void WriteTo(BinaryWriter& writer) const override { } bool Handle(MessageClient& client) override; }; //--------------------------------------------------------------------------- class EnumerateRemoteSectionResponse : public IMessage { public: MessageType GetMessageType() const override { return MessageType::EnumerateRemoteSectionResponse; } RC_Pointer GetBaseAddress() const { return baseAddress; } RC_Pointer GetRegionSize() const { return size; } SectionType GetType() const { return type; } SectionCategory GetCategory() const { return category; } SectionProtection GetProtection() const { return protection; } const std::wstring& GetName() const { return name; } const std::wstring& GetModulePath() const { return modulePath; } EnumerateRemoteSectionResponse() : baseAddress(nullptr), size(nullptr), type(SectionType::Unknown), category(SectionCategory::Unknown), protection(SectionProtection::NoAccess) { } EnumerateRemoteSectionResponse(RC_Pointer _baseAddress, RC_Pointer _size, SectionType _type, SectionCategory _category, SectionProtection _protection, std::wstring&& _name, std::wstring&& _modulePath) : baseAddress(_baseAddress), size(_size), type(_type), category(_category), protection(_protection), name(std::move(_name)), modulePath(std::move(_modulePath)) { } void ReadFrom(BinaryReader& reader) override { baseAddress = reader.ReadIntPtr(); size = reader.ReadIntPtr(); type = static_cast<SectionType>(reader.ReadInt32()); category = static_cast<SectionCategory>(reader.ReadInt32()); protection = static_cast<SectionProtection>(reader.ReadInt32()); name = reader.ReadString(); modulePath = reader.ReadString(); } void WriteTo(BinaryWriter& writer) const override { writer.Write(baseAddress); writer.Write(size); writer.Write(static_cast<int>(type)); writer.Write(static_cast<int>(category)); writer.Write(static_cast<int>(protection)); writer.Write(name); writer.Write(modulePath); } private: RC_Pointer baseAddress; RC_Pointer size; SectionType type; SectionCategory category; SectionProtection protection; std::wstring name; std::wstring modulePath; }; //--------------------------------------------------------------------------- class EnumerateRemoteModuleResponse : public IMessage { public: MessageType GetMessageType() const override { return MessageType::EnumerateRemoteModuleResponse; } const void* GetBaseAddress() const { return baseAddress; } const void* GetRegionSize() const { return size; } const std::wstring& GetModulePath() const { return modulePath; } EnumerateRemoteModuleResponse() : baseAddress(nullptr), size(nullptr) { } EnumerateRemoteModuleResponse(const void* _baseAddress, const void* _regionSize, std::wstring&& _modulePath) : baseAddress(_baseAddress), size(_regionSize), modulePath(std::move(_modulePath)) { } void ReadFrom(BinaryReader& reader) override { baseAddress = reader.ReadIntPtr(); size = reader.ReadIntPtr(); modulePath = reader.ReadString(); } void WriteTo(BinaryWriter& writer) const override { writer.Write(baseAddress); writer.Write(size); writer.Write(modulePath); } private: const void* baseAddress; const void* size; std::wstring modulePath; }; //---------------------------------------------------------------------------
/************************************************************* Author : qmeng MailTo : qmeng1128@163.com QQ : 1163306125 Blog : http://blog.csdn.net/Mq_Go/ Create : 2018-03-22 16:56:55 Version: 1.0 **************************************************************/ #include <cstdio> #include <iostream> using namespace std; int main(){ int y,m,d; int sum = 0; cin >> y >> m >> d; for(int i = 1777 ; i < y ; i++){ if(i%4==0&&i%400!=0){ sum += 366; }else{ sum += 365; } } cout << sum << endl; int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; for(int i = 1 ; i < m ; i++){ sum += month[i]; } if(m>2){ if(y%4==0&&y%400!=0)sum+=1; } sum = sum + d; sum = sum - 31-28-31-30+1; cout << sum ; return 0; }
#ifdef FASTCG_OPENGL #if defined FASTCG_WINDOWS #include <FastCG/Platform/Windows/WindowsApplication.h> #elif defined FASTCG_LINUX #include <FastCG/Platform/Linux/X11Application.h> #endif #include <FastCG/Graphics/OpenGL/OpenGLUtils.h> #include <FastCG/Graphics/OpenGL/OpenGLGraphicsSystem.h> #include <FastCG/Graphics/OpenGL/OpenGLExceptions.h> #include <FastCG/Core/Macros.h> #include <FastCG/Core/Exception.h> #include <FastCG/Assets/AssetSystem.h> #if defined FASTCG_LINUX #include <X11/extensions/Xrender.h> #endif #include <iostream> #include <algorithm> namespace { #ifdef FASTCG_LINUX int GLXContextErrorHandler(Display *dpy, XErrorEvent *ev) { FASTCG_THROW_EXCEPTION(FastCG::Exception, "Error creating GLX context (error_code: %d)", ev->error_code); return 0; } #endif void OpenGLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) { std::cout << "[OPENGL]" << " - " << FastCG::GetOpenGLDebugOutputMessageSeverity(severity) << " - " << FastCG::GetOpenGLDebugOutputMessageSourceString(source) << " - " << FastCG::GetOpenGLDebugOutputMessageTypeString(type) << " - " << id << " - " << message << std::endl; } } namespace FastCG { OpenGLGraphicsSystem::OpenGLGraphicsSystem(const GraphicsSystemArgs &rArgs) : BaseGraphicsSystem(rArgs) { } OpenGLGraphicsSystem::~OpenGLGraphicsSystem() = default; void OpenGLGraphicsSystem::OnInitialize() { BaseGraphicsSystem::OnInitialize(); InitializeGlew(); CreateOpenGLContext(); #ifdef _DEBUG glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallbackARB(OpenGLDebugCallback, nullptr); glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PUSH_GROUP, GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, false); glDebugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_POP_GROUP, GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, false); #endif QueryDeviceProperties(); #ifdef _DEBUG glGenQueries(1, &mPresentTimestampQuery); #endif } void OpenGLGraphicsSystem::OnPostFinalize() { for (const auto &rKvp : mFboIds) { glDeleteFramebuffers(1, &rKvp.second); } mFboIds.clear(); for (const auto &rKvp : mVaoIds) { glDeleteVertexArrays(1, &rKvp.second); } mVaoIds.clear(); #ifdef _DEBUG glDeleteQueries(1, &mPresentTimestampQuery); #endif DestroyOpenGLContext(); BaseGraphicsSystem::OnPostFinalize(); } #define DECLARE_DESTROY_METHOD(className, containerMember) \ void OpenGLGraphicsSystem::Destroy##className(const OpenGL##className *p##className) \ { \ assert(p##className != nullptr); \ auto it = std::find(containerMember.cbegin(), containerMember.cend(), p##className); \ if (it != containerMember.cend()) \ { \ containerMember.erase(it); \ delete p##className; \ } \ else \ { \ FASTCG_THROW_EXCEPTION(Exception, "Couldn't destroy " #className " '%s'", p##className->GetName().c_str()); \ } \ } void OpenGLGraphicsSystem::DestroyTexture(const OpenGLTexture *pTexture) { assert(pTexture != nullptr); // Delete fbos that reference the texture to be deleted { auto it = mTextureToFboHashes.find(*pTexture); if (it != mTextureToFboHashes.end()) { for (auto fboHash : it->second) { if (mFboIds.find(fboHash) != mFboIds.end()) { glDeleteFramebuffers(1, &mFboIds[fboHash]); mFboIds.erase(fboHash); } } } } BaseGraphicsSystem::DestroyTexture(pTexture); } GLuint OpenGLGraphicsSystem::GetOrCreateFramebuffer(const OpenGLTexture *const *pRenderTargets, uint32_t renderTargetCount, const OpenGLTexture *pDepthStencilBuffer) { size_t fboHash; { auto size = (renderTargetCount + 1) * sizeof(OpenGLTexture *); auto *pData = (const OpenGLTexture **)alloca(size); for (uint32_t i = 0; i < renderTargetCount; ++i) { pData[i] = pRenderTargets[i]; } pData[renderTargetCount] = pDepthStencilBuffer; fboHash = (size_t)FNV1a((const uint8_t *)pData, size); } auto it = mFboIds.find(fboHash); if (it != mFboIds.end()) { return it->second; } GLint oldFboId; glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFboId); GLuint fboId; glGenFramebuffers(1, &fboId); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId); #ifdef _DEBUG { auto framebufferLabel = std::string("FBO ") + std::to_string(mFboIds.size()) + " (GL_FRAMEBUFFER)"; glObjectLabel(GL_FRAMEBUFFER, fboId, (GLsizei)framebufferLabel.size(), framebufferLabel.c_str()); } #endif std::for_each(pRenderTargets, pRenderTargets + renderTargetCount, [i = 0](const auto *pRenderTarget) mutable { glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + (i++), GetOpenGLTarget(pRenderTarget->GetType()), *pRenderTarget, 0); }); if (pDepthStencilBuffer != nullptr) { GLenum attachment; if (pDepthStencilBuffer->GetFormat() == TextureFormat::DEPTH) { attachment = GL_DEPTH_ATTACHMENT; } else { attachment = GL_DEPTH_STENCIL_ATTACHMENT; } glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GetOpenGLTarget(pDepthStencilBuffer->GetType()), *pDepthStencilBuffer, 0); } glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldFboId); auto status = glCheckNamedFramebufferStatusEXT(fboId, GL_DRAW_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { FASTCG_THROW_EXCEPTION(OpenGLException, "Error creating FBO: 0x%x\n", status); } mFboIds.emplace(fboHash, fboId); std::for_each(pRenderTargets, pRenderTargets + renderTargetCount, [&](const auto *pRenderTarget) { mTextureToFboHashes[*pRenderTarget].emplace_back(fboHash); }); if (pDepthStencilBuffer != nullptr) { mTextureToFboHashes[*pDepthStencilBuffer].emplace_back(fboHash); } return fboId; } GLuint OpenGLGraphicsSystem::GetOrCreateVertexArray(const OpenGLBuffer *const *pBuffers, uint32_t bufferCount) { assert(bufferCount > 0); assert(std::all_of(pBuffers, pBuffers + bufferCount, [](const auto *pBuffer) { assert(pBuffer != nullptr); const auto& rVbDescs = pBuffer->GetVertexBindingDescriptors(); return (pBuffer->GetUsage() & BufferUsageFlagBit::VERTEX_BUFFER) != 0 && std::all_of(rVbDescs.cbegin(), rVbDescs.cend(), [](const auto& rVbDesc) { return rVbDesc.IsValid(); }); })); auto vaoHash = (size_t)FNV1a(reinterpret_cast<const uint8_t *>(pBuffers), bufferCount * sizeof(OpenGLBuffer *)); auto it = mVaoIds.find(vaoHash); if (it != mVaoIds.end()) { return it->second; } GLuint vaoId; glGenVertexArrays(1, &vaoId); glBindVertexArray(vaoId); #ifdef _DEBUG { auto vertexArrayLabel = std::string("VAO ") + std::to_string(mVaoIds.size()) + " (GL_VERTEX_ARRAY)"; glObjectLabel(GL_VERTEX_ARRAY, vaoId, (GLsizei)vertexArrayLabel.size(), vertexArrayLabel.c_str()); } #endif std::for_each(pBuffers, pBuffers + bufferCount, [](const auto *pBuffer) { glBindBuffer(GetOpenGLTarget(pBuffer->GetUsage()), *pBuffer); for (const auto &rVbDesc : pBuffer->GetVertexBindingDescriptors()) { glEnableVertexAttribArray(rVbDesc.binding); glVertexAttribPointer(rVbDesc.binding, rVbDesc.size, GetOpenGLType(rVbDesc.type), (GLboolean)rVbDesc.normalized, rVbDesc.stride, (const GLvoid*)(uintptr_t)rVbDesc.offset); } }); mVaoIds.emplace(vaoHash, vaoId); return vaoId; } void OpenGLGraphicsSystem::InitializeGlew() { #if defined FASTCG_WINDOWS auto hWnd = WindowsApplication::GetInstance()->GetWindow(); assert(hWnd != 0); mHDC = GetDC(hWnd); assert(mHDC != 0); PIXELFORMATDESCRIPTOR pixelFormatDescr = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, // color bits 0, 0, 0, 0, 0, 0, 0, 0, // per-channel color bits and shifts (RGBA) 0, // accum bits 0, 0, 0, 0, // per-channel accum bits 0, // depth bits 0, // stencil bits 0, // auxiliary buffers PFD_MAIN_PLANE, // layer type 0, // reserved 0, 0, 0, // layer mask, visible mask, damage mask }; auto pixelFormat = ChoosePixelFormat(mHDC, &pixelFormatDescr); if (!SetPixelFormat(mHDC, pixelFormat, &pixelFormatDescr)) { FASTCG_THROW_EXCEPTION(FastCG::Exception, "Error setting current pixel format"); } mHGLRC = wglCreateContext(mHDC); if (mHGLRC == 0) { FASTCG_THROW_EXCEPTION(Exception, "Error creating a temporary WGL context"); } if (!wglMakeCurrent(mHDC, mHGLRC)) { FASTCG_THROW_EXCEPTION(Exception, "Error making a temporary WGL context current"); } #elif defined FASTCG_LINUX auto *pDisplay = X11Application::GetInstance()->GetDisplay(); assert(pDisplay != nullptr); auto &rWindow = X11Application::GetInstance()->CreateSimpleWindow(); XWindowAttributes windowAttribs; XGetWindowAttributes(pDisplay, rWindow, &windowAttribs); XVisualInfo visualInfoTemplate; visualInfoTemplate.visualid = XVisualIDFromVisual(windowAttribs.visual); int numItems; auto *pVisualInfo = XGetVisualInfo(pDisplay, VisualIDMask, &visualInfoTemplate, &numItems); auto *pOldErrorHandler = XSetErrorHandler(&GLXContextErrorHandler); mpRenderContext = glXCreateContext(pDisplay, pVisualInfo, 0, true); XSetErrorHandler(pOldErrorHandler); glXMakeCurrent(pDisplay, rWindow, mpRenderContext); #endif GLenum glewInitRes; if ((glewInitRes = glewInit()) != GLEW_OK) { FASTCG_THROW_EXCEPTION(Exception, "Error intializing Glew: %s", glewGetErrorString(glewInitRes)); } } void OpenGLGraphicsSystem::CreateOpenGLContext() { #if defined FASTCG_WINDOWS const int attribs[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 4, WGL_CONTEXT_MINOR_VERSION_ARB, 3, WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB #ifdef _DEBUG | WGL_CONTEXT_DEBUG_BIT_ARB #endif , 0}; auto oldHGLRC = mHGLRC; mHGLRC = wglCreateContextAttribsARB(mHDC, mHGLRC, attribs); if (mHGLRC == 0) { FASTCG_THROW_EXCEPTION(Exception, "Error creating the WGL context"); } if (!wglMakeCurrent(mHDC, mHGLRC)) { FASTCG_THROW_EXCEPTION(Exception, "Error making the WGL context current"); } wglDeleteContext(oldHGLRC); wglSwapIntervalEXT(mArgs.vsync ? 1 : 0); #elif defined FASTCG_LINUX auto *pDisplay = X11Application::GetInstance()->GetDisplay(); assert(pDisplay != nullptr); const int attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 4, GLX_CONTEXT_MINOR_VERSION_ARB, 3, GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB #ifdef _DEBUG | GLX_CONTEXT_DEBUG_BIT_ARB #endif , 0}; int dummy; if (!glXQueryExtension(pDisplay, &dummy, &dummy)) { FASTCG_THROW_EXCEPTION(Exception, "OpenGL not supported by X server"); } const int fbAttribs[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_DOUBLEBUFFER, True, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 0, None}; auto defaultScreen = DefaultScreen(pDisplay); int numFbConfigs; auto fbConfigs = glXChooseFBConfig(pDisplay, defaultScreen, fbAttribs, &numFbConfigs); GLXFBConfig fbConfig; XVisualInfo *pVisualInfo; for (int i = 0; i < numFbConfigs; i++) { auto *pCurrVisualInfo = (XVisualInfo *)glXGetVisualFromFBConfig(pDisplay, fbConfigs[i]); if (pCurrVisualInfo == nullptr) { continue; } auto *pVisualFormat = XRenderFindVisualFormat(pDisplay, pCurrVisualInfo->visual); if (pVisualFormat == nullptr) { continue; } if (pVisualFormat->direct.alphaMask == 0) { fbConfig = fbConfigs[i]; pVisualInfo = pCurrVisualInfo; break; } XFree(pCurrVisualInfo); } if (fbConfig == nullptr) { FASTCG_THROW_EXCEPTION(Exception, "No matching framebuffer config"); } auto &rWindow = X11Application::GetInstance()->CreateWindow(pVisualInfo); XFree(pVisualInfo); glXDestroyContext(pDisplay, mpRenderContext); auto *pOldErrorHandler = XSetErrorHandler(&GLXContextErrorHandler); mpRenderContext = glXCreateContextAttribsARB(pDisplay, fbConfig, 0, True, attribs); XSetErrorHandler(pOldErrorHandler); if (mpRenderContext == nullptr) { FASTCG_THROW_EXCEPTION(Exception, "Error creating the GLX context"); } XSync(pDisplay, False); if (!glXMakeContextCurrent(pDisplay, rWindow, rWindow, mpRenderContext)) { FASTCG_THROW_EXCEPTION(Exception, "Error making the GLX context current"); } glXSwapIntervalEXT(pDisplay, rWindow, mArgs.vsync ? 1 : 0); #else #error FastCG::OpenGLRenderingSystem::CreateOpenGLContext() is not implemented on the current platform #endif } void OpenGLGraphicsSystem::QueryDeviceProperties() { glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &mDeviceProperties.maxColorAttachments); glGetIntegerv(GL_MAX_DRAW_BUFFERS, &mDeviceProperties.maxDrawBuffers); glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mDeviceProperties.maxTextureUnits); } void OpenGLGraphicsSystem::DestroyOpenGLContext() { #if defined FASTCG_WINDOWS if (mHGLRC != 0) { wglMakeCurrent(mHDC, nullptr); wglDeleteContext(mHGLRC); mHGLRC = 0; } if (mHDC != 0) { auto hWnd = WindowsApplication::GetInstance()->GetWindow(); assert(hWnd != 0); ReleaseDC(hWnd, mHDC); mHDC = 0; } #elif defined FASTCG_LINUX auto *pDisplay = X11Application::GetInstance()->GetDisplay(); assert(pDisplay != nullptr); if (mpRenderContext != nullptr) { glXMakeContextCurrent(pDisplay, None, None, nullptr); glXDestroyContext(pDisplay, mpRenderContext); mpRenderContext = nullptr; } #else #error "FastCG::OpenGLRenderingSystem::DestroyOpenGLContext() is not implemented on the current platform" #endif } void OpenGLGraphicsSystem::Present() { #ifdef _DEBUG GLint64 presentStart; glQueryCounter(mPresentTimestampQuery, GL_TIMESTAMP); glGetInteger64v(GL_TIMESTAMP, &presentStart); #endif #if defined FASTCG_WINDOWS SwapBuffers(mHDC); #elif defined FASTCG_LINUX auto *pDisplay = X11Application::GetInstance()->GetDisplay(); auto &rWindow = X11Application::GetInstance()->GetWindow(); glXSwapBuffers(pDisplay, rWindow); #else #error "OpenGLRenderingSystem::Present() not implemented on the current platform" #endif #ifdef _DEBUG GLint done = 0; while (!done) { glGetQueryObjectiv(mPresentTimestampQuery, GL_QUERY_RESULT_AVAILABLE, &done); } GLuint64 presentEnd; glGetQueryObjectui64v(mPresentTimestampQuery, GL_QUERY_RESULT, &presentEnd); mPresentElapsedTime = (presentEnd - (GLuint64)presentStart) * 1e-9; for (auto *pGraphicsContext : GetGraphicsContexts()) { pGraphicsContext->RetrieveElapsedTime(); } #endif } double OpenGLGraphicsSystem::GetPresentElapsedTime() const { #ifdef _DEBUG return mPresentElapsedTime; #else return 0; #endif } double OpenGLGraphicsSystem::GetGpuElapsedTime() const { #ifdef _DEBUG double elapsedTime = 0; for (auto *pGraphicsContext : GetGraphicsContexts()) { elapsedTime += pGraphicsContext->GetElapsedTime(); } return elapsedTime; #else return 0; #endif } } #endif
#include<iostream> using namespace std; int main() { float a; cin >> a; if (a >= 20 && a <= 30) { cout << 1; } else { cout << 0; } }
/* Lowest common ancestor in a BST */ #include<iostream> using namespace std; struct node { int data; node *l,*r; }*root; node *insert(int a,node *ptr) { if(ptr==NULL) { ptr=new node; ptr->data=a; ptr->l=ptr->r=NULL; } else if(a>ptr->data) ptr->r=insert(a,ptr->r); else ptr->l=insert(a,ptr->l); return ptr; } void inorder(node *ptr) { if(ptr) { inorder(ptr->l); cout<<ptr->data<<" ";; inorder(ptr->r); } } int LCA(int l,int h,node *ptr) { if(ptr==NULL) return -1; if(l<ptr->data&&ptr->data<h) return ptr->data; else if(l>ptr->data) return LCA(l,h,ptr->r); else return LCA(l,h,ptr->l); } int main() { root=NULL; int n; cin>>n; while(n) { root=insert(n,root); cin>>n; } //inorder(root); cout<<endl<<LCA(1,7,root); system("pause"); return 0; }
/* * Warrior.h * * Created on: Dec 27, 2018 * Author: ise */ #ifndef WARRIOR_H_ #define WARRIOR_H_ #include "Hero.h" class Warrior : public Hero{ public: Warrior(); virtual ~Warrior() {}; Warrior(string name); Warrior(string name,double newgold,int bd,int wiz, int arch, int vamp, int zomb, int tot); void SpecialSkill(Hero* heroToStole=NULL); }; #endif /* WARRIOR_H_ */
#include "StreamParser.h" #include "Registry.h" using RegistryeHandlerRegistry = Registry<Type,Parser>; template<>template<> bool RegistryeHandlerRegistry::SelfRegister<StreamParser>::_registered = RegistryeHandlerRegistry::SelfRegister<StreamParser>::selfRegister(); StreamParser::StreamParser() {} const Type& StreamParser::getRegistryType() const { static Type type = Type::Stream; return type; } std::string StreamParser::parse(std::string& str) { return "StreamParser:" + str; }
#include "Widget.h" #include <QtGui> Widget::Widget( QWidget * parent ) : QWidget( parent ) { createWidgets(); setWindowTitle( tr("Echo client %1").arg( PORT ) ); connect( &socket, SIGNAL( connected() ), SLOT( slotConnected() ) ); connect( &socket, SIGNAL( disconnected() ), SLOT( slotDisconnected() ) ); connect( &socket, SIGNAL( readyRead() ), SLOT( slotRead() ) ); tcpConnect(); } void Widget::createWidgets() { editData = new QLineEdit( this ); editData->setEnabled( false ); editText = new QLineEdit( this ); editText->setEnabled( false ); QPushButton * buttonSend = new QPushButton( tr("&Send"), this ), * buttonExit = new QPushButton( tr("E&xit"), this ); connect( buttonSend, SIGNAL( clicked() ), SLOT( slotSend() ) ); connect( buttonExit, SIGNAL( clicked() ), SLOT( slotClose() ) ); QHBoxLayout * horLayout = new QHBoxLayout(); horLayout->addWidget( editText ); horLayout->addStretch(); horLayout->addWidget( buttonSend ); QVBoxLayout * layout = new QVBoxLayout( this ); layout->addWidget( editData ); layout->addLayout( horLayout ); layout->addStretch(); layout->addWidget( buttonExit ); } void Widget::slotSend() { socket.write( editText->text().toAscii() ); } void Widget::slotRead() { editData->setText( QString::fromAscii( socket.readLine().trimmed() ) ); } void Widget::tcpConnect() { socket.connectToHost( "localhost", PORT ); } void Widget::slotConnected() { editText->setEnabled( true ); } void Widget::slotDisconnected() { editText->setEnabled( false ); } void Widget::slotClose() { socket.close(); close(); }
/** * [Question] * - 合計すると与えられた数字と同じになる整数の配列のすべての組み合わせを探すにはどうすればよいですか? * * [Solution] * - 再帰関数で深さ優先探索を実装 * - 分岐は "足した" or "足していない" の2つ * - 一度計算した値を保持する,メモ化再帰で実装 * - 部分和が与えたれた値を超えるとそれ以降計算する必要がないので,枝狩りを実装 */ #include <iostream> #include <vector> /* INPUT */ int n = 17; std::vector<int> v = {2, 4, 6, 9}; // DPの準備 const int IND_MAX = 10000; const int SUM_MAX = 10000; int dp[IND_MAX+1][SUM_MAX+1]; bool dfs(int ind, int p_sum) { // ベースケース if (ind == v.size()) { if (p_sum == n) return dp[ind][p_sum] = true; else return dp[ind][p_sum] = false; } // 枝狩り if (p_sum > n) return dp[ind][p_sum] = false; // メモを参照 if (dp[ind][p_sum] != -1) return dp[ind][p_sum]; // 足す・足さないで分岐 if (dfs(ind+1, p_sum)) return dp[ind][p_sum] = true; if (dfs(ind+1, p_sum+v[ind])) return dp[ind][p_sum] = true; // 両方ダメだったら return dp[ind][p_sum] = false; } int main() { /* SOLVE */ // dpを初期化 (未探索は-1で初期化) for (int i = 0; i <= IND_MAX; i++) { for (int j = 0; j <= SUM_MAX; j++) { dp[i][j] = -1; } } // 部分和が与えられた値になりうるか再帰関数で確認 bool ans = dfs(0, 0); std::cout << ans << std::endl; return 0; }
/* GPA2 - IFC Criado Por: Natalia Kelim Thiel Data: 06/04/2016 Descrição: Cabeçalho (header) da biblioteca para uso do Teclado Analógico */ #ifndef Teclado_h #define Teclado_h #include "Arduino.h" #include "Registro.h" #include "Ajuste.h" class Teclado{ public: Teclado(); int static ler(); void static apertar(int botao); void static deixarApertado(int botao); // 0 - Inicial, 1 - Atual int static menu; // Posição na horizontal (Esquerda, Direita) int static x; // Posição na vertical (Topo, Baixo) int static y; // Se houve mudança nos menus boolean static mudanca; private: // Pino analógico int static _pino; // Posição máxima na horizontal (Esquerda, Direita) int static _xMax; // Posição máxima na vertical (Topo, Baixo) int static _yMax; // Faz as configurações quando entra em algum menu void static _entrar(); }; #endif
#import <vector> #import <iostream> void PrintVector(const std::vector<int> &vec) { std::cout << "[ "; for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << "]" << std::endl; } void Swap(std::vector<int> &vec, int x, int y) { int temp = vec[x]; vec[x] = vec[y]; vec[y] = temp; } void SelectionSort(std::vector<int> &vec) { for (int i = 0; i < vec.size(); i++) { int min_index = i; for (int j = i + 1; j < vec.size(); j++) { if (vec[j] < vec[min_index]) { min_index = j; } } Swap(vec, i, min_index); PrintVector(vec); } } int main() { std::vector<int> vec = {8, 3, 4, 1, 2}; PrintVector(vec); SelectionSort(vec); return 0; }
class Solution { public: string convert(string s, int numRows) { if(s.empty()) return ""; if (numRows == 1 || s.length() == 1) return s; string res; int cur_line = 1; int start = 0; while (cur_line <= numRows && res.length() < s.length()) { int tmp = start; res += s[tmp]; if(numRows == cur_line) { while(tmp + 2 * (numRows - 1) < s.length()) { tmp = tmp + 2* (numRows - 1); res += s[tmp]; } break; } while (tmp + 2 * (numRows - cur_line) < s.length()) { tmp = tmp + 2 * (numRows - cur_line); res += s[tmp]; if (cur_line > 1 && tmp + 2 * (cur_line - 1) < s.length()) { tmp = tmp + 2 * (cur_line - 1); res += s[tmp]; } else tmp = tmp + 2 * (cur_line - 1); } cur_line++; start++; } return res; return res; } }; // Pay attention to the first line and the last line. These two are special cases