int main(void) { int64 t0,t1; d(); s=(int64*)calloc(q,sizeof(int64)); gw(0,2,99); _1: if(gr(0,2)!=1000)goto _2;else goto _47; _2: t0=gr(0,2)+1; t1=gr(0,2)+1; gw(0,2,gr(0,2)+1); t1%=2; t1=(t1!=0)?0:1; if((t1)!=0)goto _1;else goto _3; _3: t0%=5; t0=(t0!=0)?0:1; if((t0)!=0)goto _1;else goto _4; _4: gw(1,2,3); _5: t0=gr(1,2)+1; gw(1,2,gr(1,2)+1); t0-=14; t0=(t0!=0)?0:1; if((t0)!=0)goto _1;else goto _6; _6: gw(2,2,0); if(((gr(0,gr(1,2))-48)+gr(2,2))!=0)goto _8;else goto _7; _7: t0=gr(2,2)+1; gw(2,2,gr(2,2)+1); t0-=3; t0=(t0!=0)?0:1; if((t0)!=0)goto _5;else goto _8; _8: gw(4,2,gr(0,2)); sa(5); sa(gr(5,gr(1,2))-48); _9: if(sp()!=0)goto _10;else goto _46; _10: sa(sr()); sa((tm(gr(4,2),10))+48); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+7LL); sa(gr(1,2)); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} gw(4,2,td(gr(4,2),10)); _11: sa(sr()); sa((sp()!=0)?0:1); if(sp()!=0)goto _12;else goto _45; _12: sp(); sa(gr(12,gr(1,2))-48); sa(4); _13: sa(sr()+7); sa(gr(1,2)); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-48LL); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sr()); if(sp()!=0)goto _44;else goto _14; _14: sp(); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sr()); gw(7,2,sp()); if(tm(sr(),2)!=0)goto _16;else goto _15; _15: sp(); goto _7; _16: if(tm(sr(),3)!=0)goto _17;else goto _15; _17: gw(5,2,sp()); sa(7); sa(tm(gr(5,2),7)); _18: if(sp()!=0)goto _19;else goto _15; _19: if(sr()>(td(gr(5,2),2)))goto _22;else goto _20; _20: sa(sr()-2); sa(gr(5,2)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(tm(sp(),v0));} sa((sp()!=0)?0:1); if(sp()!=0)goto _15;else goto _21; _21: sa(sp()+6LL); sa(sr()); sa(gr(5,2)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(tm(sp(),v0));} goto _18; _22: gw(8,2,1); gw(9,2,gr(2,2)); gw(9,2,gr(9,2)+1); gw(4,2,gr(0,2)); sp(); _23: sa(5); sa(gr(5,gr(1,2))-48); _24: if(sp()!=0)goto _25;else goto _43; _25: sa(sr()); sa((tm(gr(4,2),10))+48); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+7LL); sa(gr(9,2)+4); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} gw(4,2,td(gr(4,2),10)); _26: sa(sr()); if(sp()!=0)goto _42;else goto _27; _27: sp(); sa(gr(12,gr(9,2)+4)-48); sa(4); _28: sa(sr()+7); sa(gr(9,2)+4); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-48LL); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sr()); if(sp()!=0)goto _41;else goto _29; _29: sp(); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); sa(sp()*10LL); sa(sp()+sp()); if(tm(sr(),2)!=0)goto _34;else goto _30; _30: sp(); if(gr(9,2)!=9)goto _31;else goto _32; _31: gw(9,2,gr(9,2)+1); gw(4,2,gr(0,2)); goto _23; _32: if(gr(8,2)!=8)goto _7;else goto _33; _33: printf("%lld", gr(7,2)); return 0; _34: if(tm(sr(),3)!=0)goto _35;else goto _30; _35: gw(5,2,sp()); sa(7); sa(tm(gr(5,2),7)); _36: if(sp()!=0)goto _37;else goto _30; _37: if(sr()>(td(gr(5,2),2)))goto _40;else goto _38; _38: sa(sr()-2); sa(gr(5,2)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(tm(sp(),v0));} sa((sp()!=0)?0:1); if(sp()!=0)goto _30;else goto _39; _39: sa(sp()+6LL); sa(sr()); sa(gr(5,2)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(tm(sp(),v0));} goto _36; _40: gw(8,2,gr(8,2)+1); goto _30; _41: sa(sp()-1LL); goto _28; _42: sa(sp()-1LL); sa(sr()); sa(gr(1,2)); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-48LL); goto _24; _43: sa(sr()); sa(gr(9,2)+48); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+7LL); sa(gr(9,2)+4); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} goto _26; _44: sa(sp()-1LL); goto _13; _45: sa(sp()-1LL); sa(sr()); sa(gr(1,2)); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-48LL); goto _9; _46: sa(sr()); sa(gr(2,2)+48); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+7LL); sa(gr(1,2)); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} goto _11; _47: return 0; }
int main(int argc, const char ** argv) { // Read the command line options if (getOptions(argc, argv) == false) { exit (-1); } // Log file creation in /tmp/$USERNAME/log.dat // This file contains by line: // - the 6 computed camera velocities (m/s, rad/s) to achieve the task // - the 6 values of s - s* std::string username; // Get the user login name vpIoTools::getUserName(username); // Create a log filename to save velocities... std::string logdirname; #ifdef WIN32 logdirname ="C:/temp/" + username; #else logdirname ="/tmp/" + username; #endif // Test if the output path exist. If no try to create it if (vpIoTools::checkDirectory(logdirname) == false) { try { // Create the dirname vpIoTools::makeDirectory(logdirname); } catch (...) { std::cerr << std::endl << "ERROR:" << std::endl; std::cerr << " Cannot create " << logdirname << std::endl; exit(-1); } } std::string logfilename; logfilename = logdirname + "/log.dat"; // Open the log file name std::ofstream flog(logfilename.c_str()); vpServo task ; vpRobotCamera robot ; std::cout << std::endl ; std::cout << "-------------------------------------------------------" << std::endl ; std::cout << " Test program for vpServo " <<std::endl ; std::cout << " Eye-in-hand task control, velocity computed in the camera frame" << std::endl ; std::cout << " Simulation " << std::endl ; std::cout << " task : 3D visual servoing " << std::endl ; std::cout << "-------------------------------------------------------" << std::endl ; std::cout << std::endl ; // Sets the initial camera location vpPoseVector c_r_o(// Translation tx,ty,tz 0.1, 0.2, 2, // ThetaU rotation vpMath::rad(20), vpMath::rad(10), vpMath::rad(50) ) ; // From the camera pose build the corresponding homogeneous matrix vpHomogeneousMatrix cMo(c_r_o) ; // Set the robot initial position robot.setPosition(cMo) ; // Sets the desired camera location vpPoseVector cd_r_o(// Translation tx,ty,tz 0, 0, 1, // ThetaU rotation vpMath::rad(0),vpMath::rad(0),vpMath::rad(0)) ; // From the camera desired pose build the corresponding homogeneous matrix vpHomogeneousMatrix cdMo(cd_r_o) ; // Compute the homogeneous transformation from the desired camera position to the initial one vpHomogeneousMatrix cdMc ; cdMc = cdMo*cMo.inverse() ; // Build the current visual features s = (c*tc, thetaU_c*Rc)^T vpFeatureTranslation t(vpFeatureTranslation::cdMc) ; vpFeatureThetaU tu(vpFeatureThetaU::cdRc); // current feature t.buildFrom(cdMc) ; tu.buildFrom(cdMc) ; // Sets the desired rotation (always zero !) since s is the // rotation that the camera has to achieve. Here s* = (0, 0)^T vpFeatureTranslation td(vpFeatureTranslation::cdMc) ; vpFeatureThetaU tud(vpFeatureThetaU::cdRc); // desired feature // Define the task // - we want an eye-in-hand control law // - the robot is controlled in the camera frame task.setServo(vpServo::EYEINHAND_CAMERA) ; // - we use here the interaction matrix computed with the // current features task.setInteractionMatrixType(vpServo::CURRENT); // Add the current and desired visual features task.addFeature(t,td) ; // 3D translation task.addFeature(tu,tud) ; // 3D rotation // - set the constant gain to 1.0 task.setLambda(1) ; // Display task information task.print() ; int iter=0 ; // Start the visual servoing loop. We stop the servo after 200 iterations while(iter++ < 200) { std::cout << "-----------------------------------" << iter <<std::endl ; vpColVector v ; // get the robot position robot.getPosition(cMo) ; // new displacement to achieve cdMc = cdMo*cMo.inverse() ; // Update the current visual features t.buildFrom(cdMc) ; tu.buildFrom(cdMc) ; // Compute the control law v = task.computeControlLaw() ; // Display task information if (iter==1) task.print() ; // Send the camera velocity to the controller robot.setVelocity(vpRobot::CAMERA_FRAME, v) ; // Retrieve the error std::cout << task.error.sumSquare() <<std::endl ; // Save log flog << v.t() << " " << task.error.t() << std::endl; } // Display task information task.print() ; // Kill the task task.kill(); // Close the log file flog.close(); }
int main(void) { int64 t0,t1,t2; d(); srand(time(NULL)); s=(int64*)calloc(q,sizeof(int64)); gw(4,0,0); gw(41,1,0); sa(1000000); sa(38); _1: sa(sr()+2); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(1); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); if(sp()!=0)goto _97;else goto _2; _2: sp(); _3: sa(gr(4,0)); gw(gr(4,0)+2,1,gr(gr(4,0)+2,1)+1); if(rd()){if(rd()){goto _96;}else{goto _95;}}else{if(rd()){goto _94;}else{goto _5;}} _5: sa(2); _6: if(rd()){if(rd()){goto _93;}else{goto _92;}}else{if(rd()){goto _91;}else{goto _7;}} _7: sa(sp()+3LL); _8: sa(sp()+sp()); sa(tm(sp(),40)); sa(sr()); gw(4,0,sp()); if(rd()){if(rd()){goto _90;}else{goto _89;}}else{if(rd()){goto _88;}else{goto _10;}} _10: sa(8); _11: if(rd()){if(rd()){goto _87;}else{goto _86;}}else{if(rd()){goto _85;}else{goto _12;}} _12: sa(sp()+2LL); _13: sa(sp()*4LL); if(rd()){if(rd()){goto _84;}else{goto _83;}}else{if(rd()){goto _82;}else{goto _15;}} _15: sa(sp()+2LL); _16: if(sp()!=0)goto _28;else goto _17; _17: gw(4,0,10); sp(); _18: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _3;else goto _19; _19: gw(41,2,39); sp(); sa(38); _20: sa(sr()); sa(sr()+2); sa(2); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); if(sp()!=0)goto _27;else goto _21; _21: sp(); sa(0); _22: sa(sr()); if(sp()!=0)goto _25;else goto _23; _23: sa(sp()+1LL); if(sr()<40)goto _22;else goto _24; _24: printf("%lld", gr(2,2)); printf("%lld", gr(3,2)); printf("%lld", gr(4,2)); sp(); return 0; _25: sa(sr()); sa(sr()+1); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()+2LL); sa(1); {int64 v0=sp();t0=gr(sp(),v0);} sa(sp()+2LL); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()+2LL); sa(1); {int64 v0=sp();t1=gr(sp(),v0);} t2=t0<t1?1:0; if((t2)!=0)goto _26;else goto _23; _26: sa(sr()+2); sa(2); {int64 v0=sp();t0=gr(sp(),v0);} gw(5,0,t0); sa(sr()); sa(sr()+1); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+2LL); sa(2); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()-1LL); sa(sr()+2); sa(gr(5,0)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(2); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()-1LL); goto _22; _27: sa(sp()-1LL); goto _20; _28: if(sr()!=30)goto _29;else goto _17; _29: if(sr()!=2)goto _44;else goto _30; _30: sp(); if(rd()){if(rd()){goto _43;}else{goto _42;}}else{if(rd()){goto _41;}else{goto _32;}} _32: sa(8); _33: if(rd()){if(rd()){goto _40;}else{goto _39;}}else{if(rd()){goto _38;}else{goto _34;}} _34: sa(sp()+2LL); _35: sa(sr()); if(sp()!=0)goto _36;else goto _17; _36: sa(sp()-1LL); if(sp()!=0)goto _18;else goto _37; _37: gw(4,0,0); goto _18; _38: sa(sp()+1LL); goto _35; _39: sa(sp()+0LL); goto _35; _40: sa(sp()+3LL); goto _35; _41: sa(4); goto _33; _42: sa(0); goto _33; _43: sa(12); goto _33; _44: if(sr()!=17)goto _45;else goto _30; _45: if(sr()!=33)goto _46;else goto _30; _46: if(sr()!=7)goto _80;else goto _47; _47: sp(); if(rd()){if(rd()){goto _79;}else{goto _78;}}else{if(rd()){goto _77;}else{goto _49;}} _49: sa(8); _50: if(rd()){if(rd()){goto _76;}else{goto _75;}}else{if(rd()){goto _74;}else{goto _51;}} _51: sa(sp()+2LL); _52: sa(sr()); if(sp()!=0)goto _53;else goto _73; _53: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _54;else goto _72; _54: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _55;else goto _71; _55: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _56;else goto _70; _56: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _57;else goto _69; _57: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _58;else goto _68; _58: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _59;else goto _67; _59: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _60;else goto _67; _60: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _61;else goto _64; _61: sa(sp()-1LL); sa(sr()); if(sp()!=0)goto _62;else goto _63; _62: sp(); goto _18; _63: gw(4,0,gr(4,0)-3); goto _62; _64: if(gr(4,0)!=22)goto _65;else goto _66; _65: gw(4,0,12); goto _62; _66: gw(4,0,28); goto _62; _67: gw(4,0,(10*(td((tm(gr(4,0),6))+1,2)))+5); goto _62; _68: gw(4,0,0); goto _62; _69: gw(4,0,5); goto _62; _70: gw(4,0,39); goto _62; _71: gw(4,0,24); goto _62; _72: gw(4,0,11); goto _62; _73: gw(4,0,10); goto _62; _74: sa(sp()+1LL); goto _52; _75: sa(sp()+3LL); goto _52; _76: sa(sp()+0LL); goto _52; _77: sa(4); goto _50; _78: sa(12); goto _50; _79: sa(0); goto _50; _80: if(sr()!=22)goto _81;else goto _47; _81: if(sr()!=36)goto _62;else goto _47; _82: sa(sp()+1LL); goto _16; _83: sa(sp()+3LL); goto _16; _84: sa(sp()+0LL); goto _16; _85: sa(sp()+1LL); goto _13; _86: sa(sp()+3LL); goto _13; _87: sa(sp()+0LL); goto _13; _88: sa(4); goto _11; _89: sa(12); goto _11; _90: sa(0); goto _11; _91: sa(sp()+2LL); goto _8; _92: sa(sp()+1LL); goto _8; _93: sa(sp()+4LL); goto _8; _94: sa(1); goto _6; _95: sa(4); goto _6; _96: sa(3); goto _6; _97: sa(sp()-1LL); goto _1; }
int main(void) { int64 t0,t1,t2; int64 x0=2; int64 x1=1; int64 x2=0; int64 x3=35; int64 x4=35; int64 x5=35; int64 x6=35; int64 x7=35; int64 x8=35; int64 x9=35; s=(int64*)calloc(q,sizeof(int64)); sa(3); sa(3); sa(0); _1: if(sp()!=0)goto _2;else goto _8; _2: sp(); _3: t0=x1+1; x1++; t0=t0<(x2*10)?1:0; if((t0)!=0)goto _4;else goto _7; _4: sa(sp()+x0); if((x1%4)!=0)goto _5;else goto _6; _5: sa(sr()); sa(sr()<2?1:0); goto _1; _6: x0+=2; sa(sr()); sa(sr()<2?1:0); goto _1; _7: printf("%lld ", (((x1-2)/4)*2)+3); sp(); return 0; _8: if(sr()!=2)goto _10;else goto _9; _9: sp(); x2++; goto _3; _10: if((sr()%2)!=0)goto _11;else goto _2; _11: if(sr()<9)goto _9;else goto _12; _12: if((sr()%3)!=0)goto _13;else goto _2; _13: if((sr()%5)!=0)goto _14;else goto _2; _14: x4=1; sa(-2); _15: if(sp()!=0)goto _16;else goto _9; _16: t0=x4+1; x4++; sa(sr()); x3=sr(); t1=0; sa(sp()-1LL); _17: if((sr()%2)!=0)goto _18;else goto _35; _18: x5=t1; x7=x3; x6=sp(); x8=t0; x9=1; sa(0); sa(x6); sa(x6); _19: if(sp()!=0)goto _34;else goto _20; _20: sp(); sa(1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} _21: sa(sr()); if(sp()!=0)goto _22;else goto _25; _22: {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sr()); sa(sp()*sp()); sa(tm(sp(),x7)); t0=x9/2; x9/=2; t1=x6; t2=td(t1,t0); t2%=2; if((t2)!=0)goto _24;else goto _23; _23: {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()-1LL); goto _21; _24: sa(sp()*x8); sa(tm(sp(),x7)); goto _23; _25: sp(); sa(x5); sa(x5); _26: if(sp()!=0)goto _27;else goto _33; _27: {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sr()); sa(sr()); sa(sr()); sa(sp()*sp()); t0=sp(); t0%=x3; t0--; t0=(t0!=0)?0:1; t1=(sr()-1!=0)?1:0; sa(sp()-x3); sa(sp()+1LL); sa((sp()!=0)?0:1); sa((sp()!=0)?0:1); sa(t1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+sp()); t2=sp(); t1=t0+t2; t1-=3; if((t1)!=0)goto _32;else goto _28; _28: sp(); sp(); sa(x4); sa(1); _29: if(sp()!=0)goto _30;else goto _31; _30: sp(); sp(); goto _3; _31: sa(sp()-3LL); goto _15; _32: sa(sr()); sa(sp()*sp()); sa(tm(sp(),x3)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()-1LL); sa(sr()); goto _26; _33: sp(); sa(sp()-1LL); sa((sp()!=0)?0:1); sa((sp()!=0)?0:1); sa(x4); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} goto _29; _34: x9*=2; {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+1LL); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()/2LL); sa(sr()); goto _19; _35: t1++; sa(sp()/2LL); goto _17; }
// 随机模型1 Model randomModel(double length, double width, double margin, double sMaxH, double sMinH, double sMaxW, double sMinW, double surfaceInterval, double vRange, int dFlag) { Direction* tdp; Direction* rdp; switch(dFlag) { case 1: tdp = new Direction(0, 1, 0); rdp = new Direction(0, 1, 0); break; case 2: tdp = new Direction(0, -1, 0); rdp = new Direction(0, -1, 0); break; case 3: tdp = new Direction(0, 1, 0); rdp = new Direction(0, -1, 0); break; case 4: tdp = new Direction(0, -1, 0); rdp = new Direction(0, 1, 0); break; default: double ty = plusOrMinus(); double ry = plusOrMinus(); Direction td(0, ty, 0); Direction rd(0, ry, 0); break; } Vehicle tx = randomVehicle(0, width, *tdp, vRange); Vehicle rx = randomVehicle(length, width, *rdp, vRange); vector<Material> materials = materialList(); vector<Surface> surfaces; double totalLength = 0; srand((int)time(0)); while (totalLength <= length) { double x0 = (width / 2) + random((int)margin); double y0 = totalLength; double z0 = sMinH + random(int(sMaxH - sMinH)); Point p0(x0, y0, z0); double sWidth = sMinW + random((int)(sMaxW - sMinW)); double x1 = x0; double y1 = y0 + sWidth; double z1 = 0; Point p1(x1, y1, z1); Surface s(p0, p1); surfaces.push_back(s); totalLength = y0 + sWidth + random((int)surfaceInterval); } totalLength = 0; while (totalLength <= length) { double x0 = -((width / 2) + random((int)margin)); double y0 = totalLength; double z0 = sMinH + random(int(sMaxH - sMinH)); Point p0(x0, y0, z0); double sWidth = sMinW + random((int)(sMaxW - sMinW)); double x1 = x0; double y1 = y0 + sWidth; double z1 = 0; Point p1(x1, y1, z1); Surface s(p0, p1); surfaces.push_back(s); totalLength = y0 + sWidth + random((int)surfaceInterval); } int sizeM = materials.size(); for (int i = 0; i < (int)surfaces.size(); i++) { int indexM = random(sizeM); surfaces[i].setMaterial(materials[indexM]); surfaces[i].init(); } Direction tad(0,0,1); Direction tarp(0,0,0); Direction taPolar(sqrt(double(2))/2, 0, sqrt(double(2))/2); Antenna ta(tad, tarp, taPolar, 10); vector<Antenna> tas; tas.push_back(ta); Direction rad(0,0,1); Direction rarp(0,0,0); Direction raVPolar(1, 0, 0); Direction raHPolar(0, 0, 1); Antenna ra(rad, rarp, raVPolar, raHPolar); vector<Antenna> ras; ras.push_back(ra); Model model(tx, rx, surfaces, tas, ras); return model; }
static std::string str (const ptime& start, const ptime& end) { boost::posix_time::time_duration td(start.time_of_day()); return boost::posix_time::to_iso_string(start - boost::posix_time::time_duration(0,0,0,td.fractional_seconds() % 1000)); }
static std::string str (const local_date_time& start, const local_date_time& end) { boost::posix_time::time_duration td(start.local_time().time_of_day()); return (start - boost::posix_time::time_duration(0,0,0,td.fractional_seconds())).to_iso_string(); }
/*static*/ Stringp DescribeTypeClass::getQualifiedSuperclassName(ScriptObject* self, Atom v) { TypeDescriber td(self->toplevel()); return td.getQualifiedSuperclassName(v); }
void Foam::fishParticleCloud::move(const dimensionedVector& g, int check) { // Particle Diameter scalar d = 1e-3; if(check == 1){ // Injector 1 vector pos1 = vector(-0.5,0.1,0.05); //Set initial velocity vector vector vel1=vector(1,0,0); // Find cell at specified injection position and add particle here label cell1=mesh_.findCell(pos1); if(cell1>=0) { fishParticle* ptr= new fishParticle(*this,pos1,cell1,d,vel1); Cloud<fishParticle>::addParticle(ptr); } // Injector 2 vector pos2 = vector(-0.5,0.08,0.05); //Set initial velocity vector vector vel2=vector(1,0,0); // Find cell at specified injection position and add particle here label cell2=mesh_.findCell(pos2); if(cell2>=0) { fishParticle* ptr= new fishParticle(*this,pos2,cell2,d,vel2); Cloud<fishParticle>::addParticle(ptr); } // Injector 3 vector pos3 = vector(-0.5,0.06,0.05); //Set initial velocity vector vector vel3=vector(1,0,0); // Find cell at specified injection position and add particle here label cell3=mesh_.findCell(pos3); if(cell3>=0) { fishParticle* ptr= new fishParticle(*this,pos3,cell3,d,vel3); Cloud<fishParticle>::addParticle(ptr); } // Injector 4 vector pos4 = vector(-0.5,0.04,0.05); //Set initial velocity vector vector vel4=vector(1,0,0); // Find cell at specified injection position and add particle here label cell4=mesh_.findCell(pos4); if(cell4>=0) { fishParticle* ptr= new fishParticle(*this,pos4,cell4,d,vel4); Cloud<fishParticle>::addParticle(ptr); } // Injector 5 vector pos5 = vector(-0.5,0.02,0.05); //Set initial velocity vector vector vel5=vector(1,0,0); // Find cell at specified injection position and add particle here label cell5=mesh_.findCell(pos5); if(cell5>=0) { fishParticle* ptr= new fishParticle(*this,pos5,cell5,d,vel5); Cloud<fishParticle>::addParticle(ptr); } // Injector 6 vector pos6 = vector(-0.5,0,0.05); //Set initial velocity vector vector vel6=vector(1,0,0); // Find cell at specified injection position and add particle here label cell6=mesh_.findCell(pos6); if(cell6>=0) { fishParticle* ptr= new fishParticle(*this,pos6,cell6,d,vel6); Cloud<fishParticle>::addParticle(ptr); } // Injector 7 vector pos7 = vector(-0.5,-0.02,0.05); //Set initial velocity vector vector vel7=vector(1,0,0); // Find cell at specified injection position and add particle here label cell7=mesh_.findCell(pos7); if(cell7>=0) { fishParticle* ptr= new fishParticle(*this,pos7,cell7,d,vel7); Cloud<fishParticle>::addParticle(ptr); } // Injector 7 vector pos8 = vector(-0.5,-0.04,0.05); //Set initial velocity vector vector vel8=vector(1,0,0); // Find cell at specified injection position and add particle here label cell8=mesh_.findCell(pos8); if(cell8>=0) { fishParticle* ptr= new fishParticle(*this,pos8,cell8,d,vel8); Cloud<fishParticle>::addParticle(ptr); } // Injector 8 vector pos9 = vector(-0.5,-0.06,0.05); //Set initial velocity vector vector vel9=vector(1,0,0); // Find cell at specified injection position and add particle here label cell9=mesh_.findCell(pos9); if(cell9>=0) { fishParticle* ptr= new fishParticle(*this,pos9,cell9,d,vel9); Cloud<fishParticle>::addParticle(ptr); } // Injector 9 vector pos10 = vector(-0.5,-0.08,0.05); //Set initial velocity vector vector vel10=vector(1,0,0); // Find cell at specified injection position and add particle here label cell10=mesh_.findCell(pos10); if(cell10>=0) { fishParticle* ptr= new fishParticle(*this,pos10,cell10,d,vel10); Cloud<fishParticle>::addParticle(ptr); } // Injector 11 vector pos11 = vector(-0.5,-0.1,0.05); //Set initial velocity vector vector vel11=vector(1,0,0); // Find cell at specified injection position and add particle here label cell11=mesh_.findCell(pos11); if(cell11>=0) { fishParticle* ptr= new fishParticle(*this,pos11,cell11,d,vel11); Cloud<fishParticle>::addParticle(ptr); } } const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho"); const volVectorField& U = mesh_.lookupObject<const volVectorField>("U"); const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu"); interpolationCellPoint<scalar> rhoInterp(rho); interpolationCellPoint<vector> UInterp(U); interpolationCellPoint<scalar> nuInterp(nu); fishParticle::trackData td(*this, rhoInterp, UInterp, nuInterp, g.value()); Cloud<fishParticle>::move(td); }
void testTrace(Pooma::Tester &tester) { // Create the physical Domains: const int nVerts = 6; const int nCells = nVerts - 1; int nCellsTot = 1; Interval<Dim> vertexDomain; for (int d = 0; d < Dim; d++) { vertexDomain[d] = Interval<1>(nVerts); nCellsTot *= nCells; } // Create the (uniform, logically rectilinear) mesh. Vector<Dim> origin(0.0), spacings(0.2); typedef UniformRectilinearMesh<Dim> Mesh_t; DomainLayout<Dim> layout(vertexDomain, GuardLayers<Dim>(0)); // Create the Fields: Centering<Dim> cell = canonicalCentering<Dim>(CellType, Continuous); // Full, Antisymmetric, Symmetric, Diagonal Tensor Fields: Field<Mesh_t,Tensor<Dim,double,Full> > tff(cell, layout, origin, spacings); Field<Mesh_t,Tensor<Dim,double,Antisymmetric> > tfa(cell, layout, origin, spacings); Field<Mesh_t,Tensor<Dim,double,Symmetric> > tfs(cell, layout, origin, spacings); Field<Mesh_t,Tensor<Dim,double,Diagonal> > tfd(cell, layout, origin, spacings); // Assign values: Tensor<Dim,double,Full> tf(0.0); Tensor<Dim,double,Antisymmetric> ta(0.0); Tensor<Dim,double,Symmetric> ts(0.0); Tensor<Dim,double,Diagonal> td(0.0); double fullSymDiagTrace = 0.0; for (int i = 0; i < Dim; i++) { for (int j = 0; j < Dim; j++) { tf(i,j) = (i+1)*(i+1) + (j+1)*(j+1) + (i+4)*(j+4) + i; if (i == j) fullSymDiagTrace += tf(i,j); } } // tester.out() << "tf = " << tf << std::endl; ta = symmetrize<Antisymmetric>(tf); ts = symmetrize<Symmetric>(tf); td = symmetrize<Diagonal>(tf); tff = tf; tfa = ta; tfs = ts; tfd = td; // Test trace of Full Tensor: double traceValue; traceValue = sum(trace(tff)); tester.out() << "traceValue = sum(trace(tff)): " << traceValue << std::endl; tester.check("traceValue", traceValue, fullSymDiagTrace*nCellsTot); // Test trace of Symmetric Tensor: traceValue = sum(trace(tfs)); if (!tester.check("traceValue", traceValue, fullSymDiagTrace*nCellsTot)) { tester.out() << Dim << "D, sum(trace(tfs)): " << traceValue << " != fullSymDiagTrace*nCellsTot = " << fullSymDiagTrace*nCellsTot << std::endl; } // Test trace of Antisymmetric Tensor: traceValue = sum(trace(tfa)); if (!tester.check("traceValue", traceValue, 0.0*nCellsTot)) { tester.out() << Dim << "D, sum(trace(tfa)): " << traceValue << " != 0.0" << std::endl; } // Test trace of Diagonal Tensor: traceValue = sum(trace(tfd)); if (!tester.check("traceValue", traceValue, fullSymDiagTrace*nCellsTot)) { tester.out() << Dim << "D, sum(trace(tfd)): " << traceValue << " != fullSymDiagTrace*nCellsTot = " << fullSymDiagTrace*nCellsTot << std::endl; } }
/*static*/ Atom DescribeTypeClass::describeTypeJSON(ScriptObject* self, Atom v, uint32_t flags) { TypeDescriber td(self->toplevel()); ScriptObject* o = td.describeType(v, flags); return o ? o->atom() : nullObjectAtom; }
data_type_t typecheck_default(node_t* root) { return td(root); }
std::vector<int> PictureMatchingCore::Connect(int srcRow, int srcCol, int destRow, int destCol) { // 线程锁 LockClass lock(&m_mutex); std::vector<int> result; result.clear(); if (m_invalid) { return result; } // 不符合的行 if (((srcRow < 1) || (srcRow > m_row - 1)) || ((destRow < 1) || (destRow > m_row - 1))) { return result; } // 不符合的列 if (((srcCol < 1) || (srcCol > m_col - 1)) || ((destCol < 1) || (destCol > m_col - 1))) { return result; } // 单元格值为空 if (CELL_NO_HAS_IMAGE == m_map[srcRow * m_col + srcCol]) { return result; } // 单元格值不同 if (m_map[srcRow * m_col + srcCol] != m_map[destRow * m_col + destCol]) { return result; } // Src 点 struct CellPoint src; src.m_row = srcRow; src.m_col = srcCol; src.m_direction = To_No; src.m_lineNumber = 0; // Dest 点 struct CellPoint dest; dest.m_row = destRow; dest.m_col = destCol; src.m_direction = To_No; // 用来储存下次要访问的节点 std::list<std::vector<struct CellPoint>> pop; // 用来存储本次找到的新节点 std::list<std::vector<struct CellPoint>> push; // 线程锁 std::mutex mutex; // 添加src点 std::vector<struct CellPoint> fristNode; fristNode.push_back(src); pop.push_back(fristNode); // 地图的镜像 std::vector<int> map = m_map; { // 将地图镜像反转, 有效值改为无效值 std::vector<int>::iterator it; for (it = map.begin(); it != map.end(); it++) { int value = *it; if (value != CELL_NO_HAS_IMAGE) { *it = CELL_INVALID; } } // 将终点的值改为0, 这样在搜索时可以在新节点中看到这点 map[destRow * m_col + destCol] = CELL_NO_HAS_IMAGE; } // 遍历 std::list<std::vector<struct CellPoint>>::iterator it; while (true) { // 不存在没有扫描的节点 if (pop.empty()) { return result; } // 通过已找到的节点去搜索未找到的新节点 for (it = pop.begin(); it != pop.end(); it++) { std::vector<struct CellPoint> node = *it; std::thread td(&PictureMatchingCore::FindNext, this, &mutex, node, &push, &map); // td.detach(); td.join(); } // 线程锁 LockClass lock(&mutex); // 在新找到的节点中判断是否找到终点 for (it = push.begin(); it != push.end(); it++) { std::vector<struct CellPoint> node = *it; int size = node.size(); struct CellPoint cell = node[size - 1]; // 找到终点了 if ((cell.m_col == destCol) && (cell.m_row == destRow)) { // 直线数 result.push_back(cell.m_lineNumber); result.push_back(0); for (int i = 0; i < size; i++) { result.push_back(node[i].m_row); result.push_back(node[i].m_col); } return result; } } // 清空已扫描的节点 pop.clear(); // 将扫描到的新节点作为下一次扫描的节点 pop = push; // 清空新节点 push.clear(); } // std::thread td(&PictureMatchingCore::FindNext, this, node, &mutex); return result; }
bool FFmpegDecoder::handleVideoPacket( const AVPacket& packet, double& videoClock, VideoParseContext& context) { enum { MAX_SKIPPED = 4 }; const double MAX_DELAY = 0.2; const int ret = avcodec_send_packet(m_videoCodecContext, &packet); if (ret < 0) return false; AVFramePtr videoFrame(av_frame_alloc()); while (avcodec_receive_frame(m_videoCodecContext, videoFrame.get()) == 0) { const int64_t duration_stamp = videoFrame->best_effort_timestamp; //av_frame_get_best_effort_timestamp(m_videoFrame); // compute the exact PTS for the picture if it is omitted in the stream // pts1 is the dts of the pkt / pts of the frame if (duration_stamp != AV_NOPTS_VALUE) { videoClock = duration_stamp * av_q2d(m_videoStream->time_base); } const double pts = videoClock; // update video clock for next frame // for MPEG2, the frame can be repeated, so we update the clock accordingly const double frameDelay = av_q2d(m_videoCodecContext->time_base) * (1. + videoFrame->repeat_pict * 0.5); videoClock += frameDelay; boost::posix_time::time_duration td(boost::posix_time::pos_infin); bool inNextFrame = false; const bool haveVideoPackets = !m_videoPacketsQueue.empty(); { boost::lock_guard<boost::mutex> locker(m_isPausedMutex); inNextFrame = m_isPaused && m_isVideoSeekingWhilePaused; if (!context.initialized || inNextFrame) { m_videoStartClock = (m_isPaused ? m_pauseTimer : GetHiResTime()) - pts; } // Skipping frames if (context.initialized && !inNextFrame && haveVideoPackets) { const double curTime = GetHiResTime(); if (m_videoStartClock + pts <= curTime) { if (m_videoStartClock + pts < curTime - MAX_DELAY) { InterlockedAdd(m_videoStartClock, MAX_DELAY); } if (++context.numSkipped > MAX_SKIPPED) { context.numSkipped = 0; } else { CHANNEL_LOG(ffmpeg_sync) << "Hard skip frame"; // pause if (m_isPaused && !m_isVideoSeekingWhilePaused) { break; } continue; } } else { int speedNumerator, speedDenominator; std::tie(speedNumerator, speedDenominator) = static_cast<const std::pair<int, int>&>(m_speedRational); context.numSkipped = 0; td = boost::posix_time::milliseconds( int((m_videoStartClock + pts - curTime) * 1000. * speedDenominator / speedNumerator) + 1); } } } context.initialized = true; { boost::unique_lock<boost::mutex> locker(m_videoFramesMutex); if (!m_videoFramesCV.timed_wait(locker, td, [this] { return m_isPaused && !m_isVideoSeekingWhilePaused || m_videoFramesQueue.canPush(); })) { continue; } } { boost::lock_guard<boost::mutex> locker(m_isPausedMutex); if (m_isPaused && !m_isVideoSeekingWhilePaused) { break; } m_isVideoSeekingWhilePaused = false; } if (inNextFrame) { m_isPausedCV.notify_all(); } VideoFrame& current_frame = m_videoFramesQueue.back(); handleDirect3dData(videoFrame.get()); if (!frameToImage(current_frame, videoFrame, m_imageCovertContext, m_pixelFormat)) { continue; } current_frame.m_pts = pts; current_frame.m_duration = duration_stamp; { boost::lock_guard<boost::mutex> locker(m_videoFramesMutex); m_videoFramesQueue.pushBack(); } m_videoFramesCV.notify_all(); } return true; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { try { CoInitialize(NULL); string common_programs = get_special_folder_path(NULL, CSIDL_COMMON_PROGRAMS, true) + "\\Command & Conquer"; CreateDirectory(common_programs.c_str(), NULL); Creg_key key_ea_games(HKEY_LOCAL_MACHINE, "SOFTWARE\\Electronic Arts\\EA Games", KEY_QUERY_VALUE | KEY_SET_VALUE); Creg_key key_tfd(HKEY_LOCAL_MACHINE, "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer The First Decade", KEY_QUERY_VALUE); Creg_key key_westwood(HKEY_LOCAL_MACHINE, "SOFTWARE\\Westwood", KEY_QUERY_VALUE | KEY_SET_VALUE); try { Cgame td(key_tfd, "cc_"); Creg_key(key_westwood, "Command & Conquer Windows 95 Edition", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", td.m_folder + "\\" + td.m_executable); create_shortcut(td.m_folder + "\\" + td.m_executable, td.m_args, common_programs + "\\Tiberian Dawn.lnk"); } catch (exception&) { } try { Cgame ra(key_tfd, "ra_"); Creg_key(key_westwood, "Red Alert Windows 95 Edition", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", ra.m_folder + "\\" + ra.m_executable); create_shortcut(ra.m_folder + "\\" + ra.m_executable, ra.m_args, common_programs + "\\Red Alert.lnk"); } catch (exception&) { } try { Cgame ts(key_tfd, "ts_"); Creg_key(key_westwood, "Tiberian Sun", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", ts.m_folder + "\\" + ts.m_executable); create_shortcut(ts.m_folder + "\\" + ts.m_executable, ts.m_args, common_programs + "\\Tiberian Sun.lnk"); DeleteFile((ts.m_folder + "\\woldata.key").c_str()); } catch (exception&) { } try { Cgame ra2(key_tfd, "r2_"); Creg_key(key_westwood, "Red Alert 2", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", ra2.m_folder + "\\" + ra2.m_executable); create_shortcut(ra2.m_folder + "\\" + ra2.m_executable, ra2.m_args, common_programs + "\\Red Alert 2.lnk"); DeleteFile((ra2.m_folder + "\\woldata.key").c_str()); } catch (exception&) { } try { Cgame ra2_yr(key_tfd, "yr_"); Creg_key(key_westwood, "Yuri's Revenge", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", ra2_yr.m_folder + "\\" + ra2_yr.m_executable); create_shortcut(ra2_yr.m_folder + "\\" + ra2_yr.m_executable, ra2_yr.m_args, common_programs + "\\Yuri's Revenge.lnk"); DeleteFile((ra2_yr.m_folder + "\\woldata.key").c_str()); } catch (exception&) { } try { Cgame rg(key_tfd, "rn_"); Creg_key(key_westwood, "Renegade", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", rg.m_folder + "\\" + rg.m_executable); create_shortcut(rg.m_folder + "\\" + rg.m_executable, rg.m_args, common_programs + "\\Renegade.lnk"); DeleteFile((rg.m_folder + "\\woldata.key").c_str()); } catch (exception&) { } try { Cgame gr(key_tfd, "gr_"); Creg_key(key_ea_games, "Generals", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", gr.m_folder + "\\"); create_shortcut(gr.m_folder + "\\" + gr.m_executable, gr.m_args, common_programs + "\\Generals.lnk"); } catch (exception&) { } try { Cgame gr_zh(key_tfd, "zh_"); Creg_key(key_ea_games, "Command and Conquer Generals Zero Hour", KEY_QUERY_VALUE | KEY_SET_VALUE).set_value("InstallPath", gr_zh.m_folder + "\\" + gr_zh.m_executable); create_shortcut(gr_zh.m_folder + "\\" + gr_zh.m_executable, gr_zh.m_args, common_programs + "\\Zero Hour.lnk"); } catch (exception&) { } } catch (exception&) { return 1; } return 0; }
void testobject::test<2>() { set_test_name("Check traff types"); TARIFF_DATA td("test"); td.tariffConf.fee = 1; td.tariffConf.free = 2; td.tariffConf.traffType = TARIFF::TRAFF_UP; td.tariffConf.passiveCost = 4; td.dirPrice[0].mDay = 30; td.dirPrice[0].hDay = 9; td.dirPrice[0].mNight = 30; td.dirPrice[0].hNight = 21; td.dirPrice[0].priceDayA = 0; td.dirPrice[0].priceDayB = 1; td.dirPrice[0].priceNightA = 2; td.dirPrice[0].priceNightB = 3; td.dirPrice[0].threshold = 4; td.dirPrice[0].singlePrice = 0; td.dirPrice[0].noDiscount = 0; TARIFF_IMPL tariff(td); ensure("traffType = TRAFF_UP", tariff.GetTraffType() == TARIFF::TRAFF_UP); ensure_equals("traffByType(6, 0) = 6 for UP", tariff.GetTraffByType(6, 0), 6); ensure_equals("traffByType(5, 1) = 5 for UP", tariff.GetTraffByType(5, 1), 5); ensure_equals("traffByType(4, 2) = 4 for UP", tariff.GetTraffByType(4, 2), 4); ensure_equals("traffByType(3, 3) = 3 for UP", tariff.GetTraffByType(3, 3), 3); ensure_equals("traffByType(2, 4) = 2 for UP", tariff.GetTraffByType(2, 4), 2); ensure_equals("traffByType(1, 5) = 1 for UP", tariff.GetTraffByType(1, 5), 1); ensure_equals("traffByType(0, 6) = 0 for UP", tariff.GetTraffByType(0, 6), 0); td.tariffConf.traffType = TARIFF::TRAFF_DOWN; tariff = td; ensure("traffType = TRAFF_DOWN", tariff.GetTraffType() == TARIFF::TRAFF_DOWN); ensure_equals("traffByType(6, 0) = 0 for DOWN", tariff.GetTraffByType(6, 0), 0); ensure_equals("traffByType(5, 1) = 1 for DOWN", tariff.GetTraffByType(5, 1), 1); ensure_equals("traffByType(4, 2) = 2 for DOWN", tariff.GetTraffByType(4, 2), 2); ensure_equals("traffByType(3, 3) = 3 for DOWN", tariff.GetTraffByType(3, 3), 3); ensure_equals("traffByType(2, 4) = 4 for DOWN", tariff.GetTraffByType(2, 4), 4); ensure_equals("traffByType(1, 5) = 5 for DOWN", tariff.GetTraffByType(1, 5), 5); ensure_equals("traffByType(0, 6) = 6 for DOWN", tariff.GetTraffByType(0, 6), 6); td.tariffConf.traffType = TARIFF::TRAFF_MAX; tariff = td; ensure("traffType = TRAFF_MAX", tariff.GetTraffType() == TARIFF::TRAFF_MAX); ensure_equals("traffByType(6, 0) = 6 for MAX", tariff.GetTraffByType(6, 0), 6); ensure_equals("traffByType(5, 1) = 5 for MAX", tariff.GetTraffByType(5, 1), 5); ensure_equals("traffByType(4, 2) = 4 for MAX", tariff.GetTraffByType(4, 2), 4); ensure_equals("traffByType(3, 3) = 3 for MAX", tariff.GetTraffByType(3, 3), 3); ensure_equals("traffByType(2, 4) = 4 for MAX", tariff.GetTraffByType(2, 4), 4); ensure_equals("traffByType(1, 5) = 5 for MAX", tariff.GetTraffByType(1, 5), 5); ensure_equals("traffByType(0, 6) = 6 for MAX", tariff.GetTraffByType(0, 6), 6); td.tariffConf.traffType = TARIFF::TRAFF_UP_DOWN; tariff = td; ensure("traffType = TRAFF_UP_DOWN", tariff.GetTraffType() == TARIFF::TRAFF_UP_DOWN); ensure_equals("traffByType(6, 0) = 6 for UP_DOWN", tariff.GetTraffByType(6, 0), 6); ensure_equals("traffByType(5, 1) = 6 for UP_DOWN", tariff.GetTraffByType(5, 1), 6); ensure_equals("traffByType(4, 2) = 6 for UP_DOWN", tariff.GetTraffByType(4, 2), 6); ensure_equals("traffByType(3, 3) = 6 for UP_DOWN", tariff.GetTraffByType(3, 3), 6); ensure_equals("traffByType(2, 4) = 6 for UP_DOWN", tariff.GetTraffByType(2, 4), 6); ensure_equals("traffByType(1, 5) = 6 for UP_DOWN", tariff.GetTraffByType(1, 5), 6); ensure_equals("traffByType(0, 6) = 6 for UP_DOWN", tariff.GetTraffByType(0, 6), 6); }
dng_hue_sat_map * dng_camera_profile::HueSatMapForWhite (const dng_xy_coord &white) const { if (fHueSatDeltas1.IsValid ()) { // If we only have the first table, just use it for any color temperature. if (!fHueSatDeltas2.IsValid ()) { return new dng_hue_sat_map (fHueSatDeltas1); } // Else we need to interpolate based on color temperature. real64 temperature1 = CalibrationTemperature1 (); real64 temperature2 = CalibrationTemperature2 (); if (temperature1 <= 0.0 || temperature2 <= 0.0 || temperature1 == temperature2) { return new dng_hue_sat_map (fHueSatDeltas1); } bool reverseOrder = temperature1 > temperature2; if (reverseOrder) { real64 temp = temperature1; temperature1 = temperature2; temperature2 = temp; } // Convert to temperature/offset space. dng_temperature td (white); // Find fraction to weight the first calibration. real64 g; if (td.Temperature () <= temperature1) g = 1.0; else if (td.Temperature () >= temperature2) g = 0.0; else { real64 invT = 1.0 / td.Temperature (); g = (invT - (1.0 / temperature2)) / ((1.0 / temperature1) - (1.0 / temperature2)); } // Fix up if we swapped the order. if (reverseOrder) { g = 1.0 - g; } // Do the interpolation. return dng_hue_sat_map::Interpolate (HueSatDeltas1 (), HueSatDeltas2 (), g); } return NULL; }
int main(void) { int64 t0; d(); s=(int64*)calloc(q,sizeof(int64)); gw(7,0,1); gw(1,0,80); gw(2,0,3); gw(4,0,240); gw(3,0,2); _1: gw(0,1,32); gw(1,1,32); gw(8,0,1073741824); gw(tm(gr(3,0),gr(1,0)),(td(gr(3,0),gr(1,0)))+1,88); sa(gr(3,0)+gr(3,0)); sa((gr(3,0)+gr(3,0))<gr(4,0)?1:0); _2: if(sp()!=0)goto _15;else goto _3; _3: sp(); _4: sa(gr(3,0)+1); gw(3,0,gr(3,0)+1); sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+1LL); {int64 v0=sp();t0=gr(sp(),v0);} t0-=32; if((t0)!=0)goto _6;else goto _4; _6: if(gr(4,0)>gr(3,0))goto _1;else goto _7; _7: gw(3,0,0); gw(5,0,0); _8: if(gr(tm(gr(3,0),gr(1,0)),(td(gr(3,0),gr(1,0)))+1)!=32)goto _14;else goto _9; _9: t0=gr(3,0)+1; gw(3,0,gr(3,0)+1); t0-=gr(4,0); if((t0)!=0)goto _8;else goto _10; _10: gw(6,0,1000000); sa(0); sa(gr(0,1)*gr(7,0)); sa((gr(0,1)*gr(7,0))>gr(6,0)?1:0); _11: if(sp()!=0)goto _13;else goto _12; _12: gw(7,0,sp()); sa(sp()+1LL); sa(sr()); sa(1); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()*gr(7,0)); sa(sr()>gr(6,0)?1:0); goto _11; _13: printf("%lld", gr(7,0)); sp(); sp(); return 0; _14: gw(gr(5,0),1,gr(3,0)); gw(5,0,gr(5,0)+1); goto _9; _15: sa(sr()); sa(32); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+1LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()+gr(3,0)); sa(sr()<gr(4,0)?1:0); goto _2; }
static std::string str (const ptime& start, const ptime& end) { boost::posix_time::time_duration td(start.time_of_day()); return boost::posix_time::to_iso_string(ptime(start.date(), boost::posix_time::time_duration(td.hours(), td.minutes(), td.seconds()))); }
texture_data make_texture_data(ID3D11Device* p_device, ID3D11DeviceContext* p_ctx, texture_type type, ID3D11Texture2D* p_tex) { assert(p_device); assert(p_ctx); assert(type != texture_type::unknown); assert(p_tex); // create a staging texture & fill it with p_tex data. D3D11_TEXTURE2D_DESC desc; p_tex->GetDesc(&desc); desc.Usage = D3D11_USAGE_STAGING; desc.BindFlags = 0; desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; desc.MiscFlags = desc.MiscFlags & (~D3D11_RESOURCE_MISC_GENERATE_MIPS); com_ptr<ID3D11Texture2D> p_tex_staging; HRESULT hr = p_device->CreateTexture2D(&desc, nullptr, &p_tex_staging.ptr); assert(hr == S_OK); p_ctx->CopyResource(p_tex_staging, p_tex); #ifdef SPARKI_DEBUG if (type == texture_type::texture_cube) assert(desc.ArraySize == 6); #endif // SPAKIR_DEBUG // create a texture_data object texture_data td(type, uint3(desc.Width, desc.Height, 1), desc.MipLevels, desc.ArraySize, make_pixel_format(desc.Format)); const size_t fmt_byte_count = byte_count(td.format); uint8_t* ptr = td.buffer.data(); // for each array slice // for each mipmap level of the slice // map p_tex_tmp[array_slice][mipmap_level] and copy its' contents into the texture_data object. for (UINT a = 0; a < desc.ArraySize; ++a) { for (UINT m = 0; m < desc.MipLevels; ++m) { const UINT index = D3D11CalcSubresource(m, a, desc.MipLevels); D3D11_MAPPED_SUBRESOURCE map; hr = p_ctx->Map(p_tex_staging, index, D3D11_MAP_READ, 0, &map); assert(hr == S_OK); const UINT w = desc.Width >> m; const UINT h = desc.Height >> m; const size_t mip_bc = w * h * fmt_byte_count; assert(mip_bc > 0); assert(mip_bc <= map.DepthPitch); if (mip_bc == map.DepthPitch) { std::memcpy(ptr, map.pData, mip_bc); ptr += mip_bc; } else { uint8_t* p_src = reinterpret_cast<uint8_t*>(map.pData); const size_t row_bc = w * fmt_byte_count; // Note(MSDN): The runtime might assign values to RowPitch and DepthPitch // that are larger than anticipated because there might be padding between rows and depth. // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476182(v=vs.85).aspx for (size_t row = 0; row < h; ++row) { std::memcpy(ptr, p_src, row_bc); p_src += map.RowPitch; ptr += row_bc; } } p_ctx->Unmap(p_tex_staging, index); } } return td; }
inline void MacroAssembler::trap_ic_miss_check(Register a, Register b) { td(traptoGreaterThanUnsigned | traptoLessThanUnsigned, a, b); }
int main(void) { int64 t0,t1; d(); s=(int64*)calloc(q,sizeof(int64)); gw(1,9,1000); gw(2,9,1017); gw(3,9,1000000); gw(1,2,0); gw(1,4,0); gw(1,5,gr(3,9)); sa(gr(3,9)-1); gw((td(gr(3,9)-1,gr(1,9)))+9,tm(gr(3,9)-1,gr(1,9)),0); _1: sa(sr()); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa((td(sr(),gr(1,9)))+gr(2,9)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); if(sp()!=0)goto _28;else goto _2; _2: gw(1,3,1); sp(); sa(1); _3: sa(2); sa(2*gr(1,3)); sa((2*gr(1,3))<gr(3,9)?1:0); _4: if(sp()!=0)goto _27;else goto _5; _5: sp(); sp(); sa(sp()+1LL); if(sr()!=gr(3,9))goto _6;else goto _7; _6: sa(sr()); gw(1,3,sp()); goto _3; _7: gw(2,3,6); sp(); sa(((gr((td(6,gr(1,9)))+9,tm(6,gr(1,9))))!=0)?0:1); _8: if(sp()!=0)goto _12;else goto _9; _9: sa(gr(2,3)+1); if((gr(2,3)+1)!=gr(3,9))goto _10;else goto _11; _10: sa(sr()); gw(2,3,sp()); sa((td(sr(),gr(1,9)))+9); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();sa(gr(sp(),v0));} sa((sp()!=0)?0:1); goto _8; _11: printf("%lld", gr(1,5)); sp(); return 0; _12: sa(gr(2,3)); gw(7,0,gr(2,3)); gw(1,2,1); sa((td(sr(),gr(1,9)))+gr(2,9)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();t0=gr(sp(),v0);} gw(2,2,t0); _13: t0=gr(2,2); if(gr(2,2)>0)goto _14;else goto _9; _14: if(t0<gr(3,9))goto _15;else goto _9; _15: if(t0!=gr(2,3))goto _16;else goto _9; _16: gw(3,1,0); gw(3,2,0); sa(0); sa(gr(7,0)-gr(2,2)); _17: if(sp()!=0)goto _23;else goto _18; _18: gw(3,1,1); sa(sr()); t0=gr(1,2); sa(t0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(sp()-v0);} t1=sp(); gw(3,2,t1); if(gr(3,2)>gr(1,4))goto _22;else goto _19; _19: sp(); if((gr(3,1))!=0)goto _9;else goto _20; _20: if((gr((td(gr(2,2),gr(1,9)))+9,tm(gr(2,2),gr(1,9))))==0)goto _21;else goto _9; _21: sa(gr(2,2)); sa(gr(2,2)); sa(7); sa(gr(1,2)); gw(1,2,gr(1,2)+1); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa((td(sr(),gr(1,9)))+9); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} gw(2,2,gr((td(gr(2,2),gr(1,9)))+gr(2,9),tm(gr(2,2),gr(1,9)))); goto _13; _22: gw(1,4,gr(3,2)); sa(sr()); sa(7); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();t0=gr(sp(),v0);} gw(1,5,t0); _23: sa(sr()); sa(7); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();t0=gr(sp(),v0);} t0=t0<gr(1,5)?1:0; t0*=gr(3,1); if((t0)!=0)goto _26;else goto _24; _24: sa(sp()+1LL); if(sr()!=gr(1,2))goto _25;else goto _19; _25: sa(sr()); sa(7); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-gr(2,2)); goto _17; _26: sa(sr()); sa(7); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();t0=gr(sp(),v0);} gw(1,5,t0); goto _24; _27: sa(sr()); sa((td(sr(),gr(1,9)))+gr(2,9)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()+gr(1,3)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa((td(sr(),gr(1,9)))+gr(2,9)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()+1LL); sa(sr()*gr(1,3)); sa(sr()<gr(3,9)?1:0); goto _4; _28: sa(sp()-1LL); sa(sr()); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa((td(sr(),gr(1,9)))+9); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sp(),gr(1,9))); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} goto _1; }
int main(void) { int64 t0,t1,t2; d(); s=(int64*)calloc(q,sizeof(int64)); gw(5,0,1); t0=gr(5,0); gw(5,0,gr(5,0)+gr(5,0)); gw(0,1,t0); sa(1); _1: if(sr()!=62)goto _2;else goto _3; _2: sa(sr()); sa(gr(5,0)); gw(5,0,gr(5,0)+gr(5,0)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(1); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()+1LL); goto _1; _3: gw(2,0,8); gw(1,0,1000); gw(3,0,8000); gw(4,0,0); sp(); sa(2); sa(gr(tm(2,gr(1,0)),(td(2,gr(1,0)))+2)-32); _4: if(sp()!=0)goto _24;else goto _5; _5: sa(sp()+1LL); sa(sr()); sa(sr()); if((sr()-gr(3,0))!=0)goto _23;else goto _6; _6: gw(2,0,999); sp(); sp(); sp(); sa((999*gr(1,0))-1); sa(0); sa((999*gr(1,0))-1); sa((999*gr(1,0))-1); gw(3,0,999*gr(1,0)); gw(8,0,909); gw(5,0,0); _7: sa(tm(sp(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()-1LL); if(sr()!=-1)goto _8;else goto _9; _8: sa(sr()); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sr()); goto _7; _9: gw(9,0,50000000); gw(6,0,gr(0,2)*gr(0,2)); sp(); sa(0); _10: sa(0); sa(0<gr(8,0)?1:0); _11: if(sp()!=0)goto _15;else goto _12; _12: sp(); sa(sp()+1LL); if((sr()-gr(8,0))!=0)goto _13;else goto _14; _13: sa(sr()); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} sa(sr()); sa(sp()*sp()); t0=sp(); gw(6,0,t0); goto _10; _14: printf("%lld ", gr(5,0)); sp(); return 0; _15: sa(sr()); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} sa(sr()); sa(sr()); sa(sp()*sp()); t0=sp(); sa(sp()*t0); sa(sp()+gr(6,0)); sa(sr()); gw(7,0,sp()); sa((sp()>gr(9,0))?1:0); if(sp()!=0)goto _12;else goto _16; _16: sa(0); sa(0<gr(8,0)?1:0); _17: if(sp()!=0)goto _18;else goto _22; _18: sa(sr()); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} sa(sr()); sa(sp()*sp()); sa(sr()); sa(sp()*sp()); sa(sp()+gr(7,0)); if(sr()>gr(9,0))goto _22;else goto _19; _19: sa(sr()); sa(sr()); sa(sr()/60); sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();t0=gr(sp(),v0);} sa(sp()%60LL); sa(sp()+1LL); sa(1); {int64 v0=sp();t1=gr(sp(),v0);} t2=tm(t0,t1); sa(sp()%60LL); sa(1); {int64 v0=sp();t0=gr(sp(),v0);} t1=td(t2,t0); if((t1)!=0)goto _21;else goto _20; _20: sa(sr()); sa(sr()/60); sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();t0=gr(sp(),v0);} sa(sp()%60LL); sa(1); {int64 v0=sp();t1=gr(sp(),v0);} sa(t0+t1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()/60LL); sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} gw(5,0,gr(5,0)+1); sa(0); _21: sp(); sa(sp()+1LL); sa(sr()<gr(8,0)?1:0); goto _17; _22: sp(); sp(); sa(sp()+1LL); sa(sr()<gr(8,0)?1:0); goto _11; _23: sa(tm(sp(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+2LL); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-32LL); goto _4; _24: sa(sr()); sa(88); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+2LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); sa(gr(4,0)); sa(gr(4,0)); gw(4,0,gr(4,0)+1); sa(tm(sp(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+2LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); sa(sr()); sa(sr()); gw(5,0,sp()); sa(sp()+sp()); _25: if(sr()<gr(3,0))goto _26;else goto _27; _26: sa(sr()); sa(32); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+2LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()+gr(5,0)); goto _25; _27: sp(); goto _5; }
void CaelumDefaultTypeDescriptorData::load() { if (!CaelumSystemTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); // Timing settings. td->add("time_scale", new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(&Caelum::CaelumSystem::getTimeScale, &Caelum::CaelumSystem::setTimeScale)); td->add("julian_day", new AccesorPropertyDescriptor<Caelum::CaelumSystem, LongReal, LongReal, LongReal>(&Caelum::CaelumSystem::getJulianDay, &Caelum::CaelumSystem::setJulianDay)); // Latitude/longitude td->add("latitude", new AccesorPropertyDescriptor<Caelum::CaelumSystem, Degree, Degree, const Degree>(&Caelum::CaelumSystem::getObserverLatitude, &Caelum::CaelumSystem::setObserverLatitude)); td->add("longitude", new AccesorPropertyDescriptor<Caelum::CaelumSystem, Degree, Degree, const Degree>(&Caelum::CaelumSystem::getObserverLongitude, &Caelum::CaelumSystem::setObserverLongitude)); // Fog settings. td->add("global_fog_density_multiplier", new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(&Caelum::CaelumSystem::getGlobalFogDensityMultiplier, &Caelum::CaelumSystem::setGlobalFogDensityMultiplier)); td->add("global_fog_colour_multiplier", new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(&Caelum::CaelumSystem::getGlobalFogColourMultiplier, &Caelum::CaelumSystem::setGlobalFogColourMultiplier)); td->add("manage_scene_fog", new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(&Caelum::CaelumSystem::getManageSceneFog, &Caelum::CaelumSystem::setManageSceneFog)); td->add("scene_fog_density_multiplier", new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(&Caelum::CaelumSystem::getSceneFogDensityMultiplier, &Caelum::CaelumSystem::setSceneFogDensityMultiplier)); td->add("scene_fog_colour_multiplier", new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(&Caelum::CaelumSystem::getSceneFogColourMultiplier, &Caelum::CaelumSystem::setSceneFogColourMultiplier)); td->add("ground_fog_density_multiplier", new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(&Caelum::CaelumSystem::getGroundFogDensityMultiplier, &Caelum::CaelumSystem::setGroundFogDensityMultiplier)); td->add("ground_fog_colour_multiplier", new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(&Caelum::CaelumSystem::getGroundFogColourMultiplier, &Caelum::CaelumSystem::setGroundFogColourMultiplier)); // Lighting settings. td->add("manage_ambient_light", new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(&Caelum::CaelumSystem::getManageAmbientLight, &Caelum::CaelumSystem::setManageAmbientLight)); td->add("minimum_ambient_light", new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(&Caelum::CaelumSystem::getMinimumAmbientLight, &Caelum::CaelumSystem::setMinimumAmbientLight)); td->add("ensure_single_light_source", new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(&Caelum::CaelumSystem::getEnsureSingleLightSource, &Caelum::CaelumSystem::setEnsureSingleLightSource)); td->add("ensure_single_shadow_source", new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(&Caelum::CaelumSystem::getEnsureSingleShadowSource, &Caelum::CaelumSystem::setEnsureSingleShadowSource)); CaelumSystemTypeDescriptor = td.release(); } if (!PointStarfieldTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); td->add("magnitude_scale", new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(&Caelum::PointStarfield::getMagnitudeScale, &Caelum::PointStarfield::setMagnitudeScale)); td->add("mag0_pixel_size", new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(&Caelum::PointStarfield::getMag0PixelSize, &Caelum::PointStarfield::setMag0PixelSize)); td->add("min_pixel_size", new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(&Caelum::PointStarfield::getMinPixelSize, &Caelum::PointStarfield::setMinPixelSize)); td->add("max_pixel_size", new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(&Caelum::PointStarfield::getMaxPixelSize, &Caelum::PointStarfield::setMaxPixelSize)); td->add("latitude", new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(&Caelum::PointStarfield::getObserverLatitude, &Caelum::PointStarfield::setObserverLatitude)); td->add("longitude", new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(&Caelum::PointStarfield::getObserverLongitude, &Caelum::PointStarfield::setObserverLongitude)); td->add("observer_position_rebuild_delta", new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(&Caelum::PointStarfield::getObserverPositionRebuildDelta, &Caelum::PointStarfield::setObserverPositionRebuildDelta)); PointStarfieldTypeDescriptor = td.release(); } if (!BaseSkyLightTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); td->add("ambient_multiplier", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(&Caelum::BaseSkyLight::getAmbientMultiplier, &Caelum::BaseSkyLight::setAmbientMultiplier)); td->add("specular_multiplier", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(&Caelum::BaseSkyLight::getSpecularMultiplier, &Caelum::BaseSkyLight::setSpecularMultiplier)); td->add("diffuse_multiplier", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(&Caelum::BaseSkyLight::getDiffuseMultiplier, &Caelum::BaseSkyLight::setDiffuseMultiplier)); td->add("light_colour", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(&Caelum::BaseSkyLight::getLightColour, &Caelum::BaseSkyLight::setLightColour)); td->add("body_colour", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(&Caelum::BaseSkyLight::getBodyColour, &Caelum::BaseSkyLight::setBodyColour)); td->add("auto_disable_threshold", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, Real, Real, Real>(&Caelum::BaseSkyLight::getAutoDisableThreshold, &Caelum::BaseSkyLight::setAutoDisableThreshold)); td->add("auto_disable", new AccesorPropertyDescriptor<Caelum::BaseSkyLight, bool, bool, bool>(&Caelum::BaseSkyLight::getAutoDisable, &Caelum::BaseSkyLight::setAutoDisable)); BaseSkyLightTypeDescriptor = td.release(); } if (!GroundFogTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); td->add("density", new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(&Caelum::GroundFog::getDensity, &Caelum::GroundFog::setDensity)); td->add("vertical_decay", new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(&Caelum::GroundFog::getVerticalDecay, &Caelum::GroundFog::setVerticalDecay)); td->add("ground_level", new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(&Caelum::GroundFog::getGroundLevel, &Caelum::GroundFog::setGroundLevel)); td->add("colour", new AccesorPropertyDescriptor<Caelum::GroundFog, ColourValue>(&Caelum::GroundFog::getColour, &Caelum::GroundFog::setColour)); GroundFogTypeDescriptor = td.release(); } if (!DepthComposerTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); td->add("debug_depth_render", new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(&Caelum::DepthComposer::getDebugDepthRender, &Caelum::DepthComposer::setDebugDepthRender)); // Legacy haze td->add("haze_enabled", new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(&Caelum::DepthComposer::getSkyDomeHazeEnabled, &Caelum::DepthComposer::setSkyDomeHazeEnabled)); td->add("haze_colour", new AccesorPropertyDescriptor<Caelum::DepthComposer, ColourValue>(&Caelum::DepthComposer::getHazeColour, &Caelum::DepthComposer::setHazeColour)); td->add("haze_sun_direction", new AccesorPropertyDescriptor<Caelum::DepthComposer, Vector3>(&Caelum::DepthComposer::getSunDirection, &Caelum::DepthComposer::setSunDirection)); // Ground fog td->add("ground_fog_enabled", new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(&Caelum::DepthComposer::getGroundFogEnabled, &Caelum::DepthComposer::setGroundFogEnabled)); td->add("ground_fog_density", new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(&Caelum::DepthComposer::getGroundFogDensity, &Caelum::DepthComposer::setGroundFogDensity)); td->add("ground_fog_vertical_decay", new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(&Caelum::DepthComposer::getGroundFogVerticalDecay, &Caelum::DepthComposer::setGroundFogVerticalDecay)); td->add("ground_fog_base_level", new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(&Caelum::DepthComposer::getGroundFogBaseLevel, &Caelum::DepthComposer::setGroundFogBaseLevel)); td->add("ground_fog_colour", new AccesorPropertyDescriptor<Caelum::DepthComposer, ColourValue>(&Caelum::DepthComposer::getGroundFogColour, &Caelum::DepthComposer::setGroundFogColour)); DepthComposerTypeDescriptor = td.release(); } if (!PrecipitationTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); td->add("texture", new AccesorPropertyDescriptor<Caelum::PrecipitationController, String>(&Caelum::PrecipitationController::getTextureName, &Caelum::PrecipitationController::setTextureName)); td->add("precipitation_colour", new AccesorPropertyDescriptor<Caelum::PrecipitationController, ColourValue>(&Caelum::PrecipitationController::getColour, &Caelum::PrecipitationController::setColour)); td->add("falling_speed", new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(&Caelum::PrecipitationController::getSpeed, &Caelum::PrecipitationController::setSpeed)); td->add("wind_speed", new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(&Caelum::PrecipitationController::getWindSpeed, &Caelum::PrecipitationController::setWindSpeed)); td->add("camera_speed_scale", new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(&Caelum::PrecipitationController::getCameraSpeedScale, &Caelum::PrecipitationController::setCameraSpeedScale)); td->add("intensity", new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(&Caelum::PrecipitationController::getIntensity, &Caelum::PrecipitationController::setIntensity)); td->add("auto_disable_intensity", new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(&Caelum::PrecipitationController::getAutoDisableThreshold, &Caelum::PrecipitationController::setAutoDisableThreshold)); td->add("falling_direction", new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(&Caelum::PrecipitationController::getFallingDirection, &Caelum::PrecipitationController::setFallingDirection)); PrecipitationTypeDescriptor = td.release(); } if (!FlatCloudLayerTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); // Height. td->add("height", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getHeight, &Caelum::FlatCloudLayer::setHeight)); // Coverage parameters. td->add("coverage", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getCloudCover, &Caelum::FlatCloudLayer::setCloudCover)); td->add("cloud_cover_visibility_threshold", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getCloudCoverVisibilityThreshold, &Caelum::FlatCloudLayer::setCloudCoverVisibilityThreshold)); td->add("cloud_cover_lookup", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, String>(&Caelum::FlatCloudLayer::getCloudCoverLookupFileName, &Caelum::FlatCloudLayer::setCloudCoverLookup)); // Overwritten by CaelumSystem; included for completeness. td->add("sun_direction", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector3>(&Caelum::FlatCloudLayer::getSunDirection, &Caelum::FlatCloudLayer::setSunDirection)); td->add("sun_light_colour", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, ColourValue>(&Caelum::FlatCloudLayer::getSunLightColour, &Caelum::FlatCloudLayer::setSunLightColour)); td->add("sun_sphere_colour", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, ColourValue>(&Caelum::FlatCloudLayer::getSunSphereColour, &Caelum::FlatCloudLayer::setSunSphereColour)); td->add("fog_colour", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, ColourValue>(&Caelum::FlatCloudLayer::getFogColour, &Caelum::FlatCloudLayer::setFogColour)); // Moving noise textures. td->add("cloud_speed", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector2>(&Caelum::FlatCloudLayer::getCloudSpeed, &Caelum::FlatCloudLayer::setCloudSpeed)); // Blending time between noise textures. td->add("blend_time", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getCloudBlendTime, &Caelum::FlatCloudLayer::setCloudBlendTime)); // Mesh properties td->add("mesh_width", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getMeshWidth, &Caelum::FlatCloudLayer::setMeshWidth)); td->add("mesh_height", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getMeshHeight, &Caelum::FlatCloudLayer::setMeshHeight)); td->add("mesh_width_segments", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, int, int, int>(&Caelum::FlatCloudLayer::getMeshWidthSegments, &Caelum::FlatCloudLayer::setMeshWidthSegments)); td->add("mesh_height_segments", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, int, int, int>(&Caelum::FlatCloudLayer::getMeshHeightSegments, &Caelum::FlatCloudLayer::setMeshHeightSegments)); // Misc hacks td->add("cloud_uv_factor", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getCloudUVFactor, &Caelum::FlatCloudLayer::setCloudUVFactor)); td->add("height_red_factor", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getHeightRedFactor, &Caelum::FlatCloudLayer::setHeightRedFactor)); // Fading td->add("near_fade_dist", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getNearFadeDist, &Caelum::FlatCloudLayer::setNearFadeDist)); td->add("far_fade_dist", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(&Caelum::FlatCloudLayer::getFarFadeDist, &Caelum::FlatCloudLayer::setFarFadeDist)); td->add("fade_dist_measurement_vector", new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector3>(&Caelum::FlatCloudLayer::getFadeDistMeasurementVector, &Caelum::FlatCloudLayer::setFadeDistMeasurementVector)); FlatCloudLayerTypeDescriptor = td.release(); } if (!SkyDomeTypeDescriptor) { std::auto_ptr<DefaultTypeDescriptor> td(new DefaultTypeDescriptor()); // SkyDome is slightly special because most properties are write-only. // Reset by CaelumSystem every frame anyway td->add("sun_direction", new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::Vector3>(0, &Caelum::SkyDome::setSunDirection)); td->add("haze_colour", new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::ColourValue>(0, &Caelum::SkyDome::setHazeColour)); // Different files not supported anyway td->add("sky_gradients_image", new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::String>(0, &Caelum::SkyDome::setSkyGradientsImage)); td->add("atmosphere_depth_image", new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::String>(0, &Caelum::SkyDome::setAtmosphereDepthImage)); // This does actually make sense. td->add("haze_enabled", new AccesorPropertyDescriptor<Caelum::SkyDome, bool, bool, bool>(&Caelum::SkyDome::getHazeEnabled, &Caelum::SkyDome::setHazeEnabled)); SkyDomeTypeDescriptor = td.release(); } }
int main(void) { int64 t0,t1; d(); s=(int64*)calloc(q,sizeof(int64)); gw(2,1,67108864); gw(3,1,3); gw(1,3,0); gw(24,8,0); sa(15); sa(15); _1: if(sp()!=0)goto _55;else goto _2; _2: sp(); _3: t0=gr(3,1); sa(gr(3,1)); sa(gr(3,1)); gw(1,0,0); gw(2,0,t0); _4: gw(3,0,sp()); t0=gr(2,0); sa(sr()); sa(t0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} {int64 v0=sp();sa(td(sp(),v0));} t1=sp(); sa(sp()+t1); sa(sp()/2LL); if((sr()-gr(3,0))!=0)goto _53;else goto _5; _5: t0=gr(3,0)*gr(3,0); gw(4,1,gr(3,0)); t0-=gr(3,1); sp(); if((t0)!=0)goto _6;else goto _52; _6: gw(24,5,0); gw(24,4,0); gw(24,1,0); gw(24,0,0); sa(15); sa(15); _7: if(sp()!=0)goto _51;else goto _8; _8: gw(24,1,1); gw(24,4,1); gw(1,2,0); gw(2,2,1); sp(); _9: gw(3,2,td(gr(4,1)+gr(1,2),gr(2,2))); sa(15); sa(15); sa(gr(24,0)+(gr(24,1)*gr(3,2))+gr(1,3)); gw(1,3,td(gr(24,0)+(gr(24,1)*gr(3,2))+gr(1,3),gr(2,1))); _10: sa(tm(sp(),gr(2,1))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(2); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} if(sp()!=0)goto _50;else goto _11; _11: sp(); sa(15); sa(15); sa(gr(24,4)+(gr(24,5)*gr(3,2))+gr(1,3)); gw(1,3,td(gr(24,4)+(gr(24,5)*gr(3,2))+gr(1,3),gr(2,1))); _12: sa(tm(sp(),gr(2,1))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(6); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} if(sp()!=0)goto _13;else goto _14; _13: sa(sr()); sa(sr()); t0=gr(sr()+9,4); sa(sp()+9LL); sa(5); {int64 v0=sp();t1=gr(sp(),v0);} t1*=gr(3,2); sa(t0+t1+gr(1,3)); gw(1,3,td(sr(),gr(2,1))); goto _12; _14: gw(1,4,1); gw(24,9,0); sp(); sa(14); sa(15); _15: if(sp()!=0)goto _49;else goto _16; _16: gw(2,4,15); sp(); _17: gw(3,4,gr(2,4)+9); sa(15); sa((gr(24,6)*gr(gr(2,4)+9,6)*gr(3,1))+gr(1,4)+gr(gr(3,4),9)); gw(1,4,td((gr(24,6)*gr(gr(2,4)+9,6)*gr(3,1))+gr(1,4)+gr(gr(3,4),9),gr(2,1))); _18: sa(tm(sp(),gr(2,1))); gw(gr(3,4),9,sp()); sa(sp()-1LL); if(gr(3,4)!=9)goto _48;else goto _19; _19: t0=gr(2,4)-1; sp(); if((gr(2,4))!=0)goto _47;else goto _20; _20: gw(1,4,0); gw(24,7,0); sa(14); sa(15); _21: if(sp()!=0)goto _46;else goto _22; _22: gw(2,4,15); sp(); _23: gw(3,4,gr(2,4)+9); sa(15); sa((gr(24,2)*gr(gr(2,4)+9,2))+gr(1,4)+gr(gr(3,4),7)); gw(1,4,td((gr(24,2)*gr(gr(2,4)+9,2))+gr(1,4)+gr(gr(3,4),7),gr(2,1))); _24: sa(tm(sp(),gr(2,1))); gw(gr(3,4),7,sp()); sa(sp()-1LL); if(gr(3,4)!=9)goto _45;else goto _25; _25: t0=gr(2,4)-1; sp(); if((gr(2,4))!=0)goto _44;else goto _26; _26: sa(15); sa(gr(24,7)-gr(24,9)); _27: if(sp()!=0)goto _40;else goto _28; _28: sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} if(sp()!=0)goto _29;else goto _30; _29: sa(sr()); t0=gr(sr()+9,7); sa(sp()+9LL); sa(9); {int64 v0=sp();t1=gr(sp(),v0);} sa(t0-t1); goto _27; _30: t0=1; t1=1; sp(); sa(0); sa(gr(9,2)-gr(9,8)); sa(gr(9,2)-gr(9,8)); _31: if(sp()!=0)goto _36;else goto _32; _32: sp(); sa(sp()+1LL); if(sr()!=17)goto _35;else goto _33; _33: t0=gr(3,1)-999; gw(3,1,gr(3,1)+1); sp(); if((t0)!=0)goto _3;else goto _34; _34: printf("%lld ", gr(1,1)); return 0; _35: sa(sr()); t0=gr(sr()+9,2); sa(sp()+9LL); sa(8); {int64 v0=sp();t1=gr(sp(),v0);} sa(t0-t1); sa(t0-t1); goto _31; _36: sa((sp()>0)?1:0); if(sp()!=0)goto _37;else goto _33; _37: gw(1,1,gr(3,1)); gw(24,8,gr(24,2)); sp(); sa(14); sa(15); _38: if(sp()!=0)goto _39;else goto _33; _39: sa(sr()); sa(gr(sr()+9,2)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(8); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} goto _38; _40: gw(1,2,(gr(3,2)*gr(2,2))-gr(1,2)); gw(2,2,td(gr(3,1)-(gr(1,2)*gr(1,2)),gr(2,2))); sp(); sa(15); sa(0); _41: if(sp()!=0)goto _42;else goto _43; _42: sp(); goto _9; _43: sa(sr()); sa(gr(sr()+9,1)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(0); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); sa(gr(sr()+9,2)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(1); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); sa(gr(sr()+9,5)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(4); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); sa(gr(sr()+9,6)); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(sp()+9LL); sa(5); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa((sp()!=0)?0:1); goto _41; _44: gw(2,4,t0); goto _23; _45: sa(sr()); gw(3,4,(sr()+gr(2,4))-6); sa(sp()+9LL); sa(2); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()*gr(gr(2,4)+9,2)); sa(sp()+gr(1,4)); sa(sp()+gr(gr(3,4),7)); gw(1,4,td(sr(),gr(2,1))); goto _24; _46: sa(sr()+9); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(7); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} goto _21; _47: gw(2,4,t0); goto _17; _48: sa(sr()); gw(3,4,(sr()+gr(2,4))-6); sa(sp()+9LL); sa(6); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()*gr(gr(2,4)+9,6)*gr(3,1)); sa(sp()+gr(1,4)); sa(sp()+gr(gr(3,4),9)); gw(1,4,td(sr(),gr(2,1))); goto _18; _49: sa(sr()+9); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(9); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()-1); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} goto _15; _50: sa(sr()); sa(sr()); t0=gr(sr()+9,0); sa(sp()+9LL); sa(1); {int64 v0=sp();t1=gr(sp(),v0);} t1*=gr(3,2); sa(t0+t1+gr(1,3)); gw(1,3,td(sr(),gr(2,1))); goto _10; _51: sa(sr()+8); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(5); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()+8); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(4); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()+8); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(1); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()+8); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(0); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()-1LL); sa(sr()); goto _7; _52: gw(3,1,gr(3,1)+1); t0=gr(3,1); sa(gr(3,1)); sa(gr(3,1)); gw(1,0,0); gw(2,0,t0); goto _4; _53: if((sr()-gr(1,0))!=0)goto _54;else goto _5; _54: gw(1,0,gr(3,0)); sa(sr()); goto _4; _55: sa(sr()+8); sa(0); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(8); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()-1LL); sa(sr()); goto _1; }
int main(void) { int64 t0,t1,t2; int64 x0=1073741824; int64 x1=2; int64 x2=37; int64 x3=37; int64 x4=37; int64 x5=5; int64 x6=37; s=(int64*)calloc(q,sizeof(int64)); sa(2); sa(5); _1: sa(x1-1); sa(x1-1); _2: if(sp()!=0)goto _4;else goto _3; _3: sp(); sp(); sa(sp()+1LL); sa(sr()); x1=sr(); t0=(sr()*3)-1; sa(sp()*t0); sa(td(sp(),2)); x5=sr(); goto _1; _4: x2=sr(); t0=(sr()*3)-1; sa(sp()*t0); t1=sp(); t1/=2; x3=t1; x6=0; sa(sp()-t1); sa(sp()*24LL); sa(sp()+1LL); x4=sr(); sa(x0); sa(x0>x4?1:0); _5: if(sp()!=0)goto _24;else goto _6; _6: sa(sr()); if(sp()!=0)goto _21;else goto _7; _7: sp(); sa(sp()-(x6*x6)); t0=x6; if(sp()!=0)goto _16;else goto _8; _8: t0%=6; t0-=5; t0=(t0!=0)?0:1; if((t0)!=0)goto _9;else goto _16; _9: sa(((x3+x5)*24)+1); t0=((x3+x5)*24)+1; x6=0; x4=t0; sa(x0); sa(x0>x4?1:0); _10: if(sp()!=0)goto _20;else goto _11; _11: sa(sr()); _12: if(sp()!=0)goto _17;else goto _13; _13: sp(); sa(sp()-(x6*x6)); t0=x6; if(sp()!=0)goto _16;else goto _14; _14: t0%=6; t0-=5; if((t0)!=0)goto _16;else goto _15; _15: printf("%lld", x5-x3); sp(); return 0; _16: sa(x5); sa(x2-1); sa(x2-1); goto _2; _17: if((sr()+x6)<=x4)goto _19;else goto _18; _18: x6/=2; sa(td(sp(),4)); sa(sr()); goto _12; _19: t0=sr()+x6; t1=x4; t2=t1-t0; x4=t2; t0=(sr()*2)+x6; x6=t0; x6/=2; sa(td(sp(),4)); goto _11; _20: sa(td(sp(),4)); sa(sr()>x4?1:0); goto _10; _21: if((sr()+x6)<=x4)goto _23;else goto _22; _22: x6/=2; sa(td(sp(),4)); sa(sr()); if(sp()!=0)goto _21;else goto _7; _23: t0=sr()+x6; t1=x4; t2=t1-t0; x4=t2; t0=(sr()*2)+x6; x6=t0; x6/=2; sa(td(sp(),4)); goto _6; _24: sa(td(sp(),4)); sa(sr()>x4?1:0); goto _5; }
inline time_duration str_from_delimited_time_duration(const std::basic_string<char_type>& s) { unsigned short min=0, sec =0; int hour =0; bool is_neg = (s.at(0) == '-'); boost::int64_t fs=0; int pos = 0; typedef typename std::basic_string<char_type>::traits_type traits_type; typedef boost::char_separator<char_type, traits_type> char_separator_type; typedef boost::tokenizer<char_separator_type, typename std::basic_string<char_type>::const_iterator, std::basic_string<char_type> > tokenizer; typedef typename boost::tokenizer<char_separator_type, typename std::basic_string<char_type>::const_iterator, typename std::basic_string<char_type> >::iterator tokenizer_iterator; char_type sep_chars[5] = {'-',':',',','.'}; char_separator_type sep(sep_chars); tokenizer tok(s,sep); for(tokenizer_iterator beg=tok.begin(); beg!=tok.end();++beg){ switch(pos) { case 0: { hour = boost::lexical_cast<int>(*beg); break; } case 1: { min = boost::lexical_cast<unsigned short>(*beg); break; } case 2: { sec = boost::lexical_cast<unsigned short>(*beg); break; }; case 3: { int digits = static_cast<int>(beg->length()); //Works around a bug in MSVC 6 library that does not support //operator>> thus meaning lexical_cast will fail to compile. #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) // msvc wouldn't compile 'time_duration::num_fractional_digits()' // (required template argument list) as a workaround a temp // time_duration object was used time_duration td(hour,min,sec,fs); int precision = td.num_fractional_digits(); // _atoi64 is an MS specific function if(digits >= precision) { // drop excess digits fs = _atoi64(beg->substr(0, precision).c_str()); } else { fs = _atoi64(beg->c_str()); } #else int precision = time_duration::num_fractional_digits(); if(digits >= precision) { // drop excess digits fs = boost::lexical_cast<boost::int64_t>(beg->substr(0, precision)); } else { fs = boost::lexical_cast<boost::int64_t>(*beg); } #endif if(digits < precision){ // trailing zeros get dropped from the string, // "1:01:01.1" would yield .000001 instead of .100000 // the power() compensates for the missing decimal places fs *= power(10, precision - digits); } break; } default: break; }//switch pos++; } if(is_neg) { return -time_duration(hour, min, sec, fs); } else { return time_duration(hour, min, sec, fs); } }
int main(int argc, char* argv[]) { TExeTm ExeTm; PGconn *conn; PGresult *res; int id,start,rec_count,row,indx,end; unsigned int q; int total_number_tweets = 0; double tweet_date = 0; TStr TweetStr(""); TStr TweetStrLc(""); if(argc > 1) { start = atoi(argv[1]); } else { printf("YOU SHOULD SET THE INDICES...\n\n"); return 1; } indx = start * LENGTH; end = indx + LENGTH; printf(":::::::: Find Cascades of Quotes In Twitter Separately ::::::::\n"); const TStr StartDate = Env.GetIfArgPrefixStr("-sd:", "2008-08-01 00:00:00", "Starting date"); const TStr EndDate = Env.GetIfArgPrefixStr("-ed:", "2009-10-01 00:00:00", "Ending date"); Env = TEnv(argc, argv, TNotify::StdNotify); Env.PrepArgs(TStr::Fmt("\nFinding the cascades of the desired quotes. build: %s, %s. Time: %s", __TIME__, __DATE__, TExeTm::GetCurTm())); try { while(indx < end) { TStr qContentFname = TStr::Fmt("QuotesData/Q%d.rar",indx); TStr resultFname = TStr::Fmt("QuotesCascResult/R%d.rar",indx++); if(fileExists(resultFname)) { if(fileExists(qContentFname)) { // removing the quotes' content file system(TStr::Fmt("rm %s",qContentFname.CStr()).CStr()); } } else { if(fileExists(qContentFname)) { THash<TStr,TInt> quotesContent; THash<TInt,TSecTmV> CascadesOnTwitter; TZipIn ZquotesIn(qContentFname); quotesContent.Load(ZquotesIn); printf("Q%d loading done, it contains %d quotes.\n",indx-1,quotesContent.Len()); conn = PQconnectdb("dbname=twitter host=postgresql01.mpi-sws.org user=twitter password=tweet@84"); if (PQstatus(conn) == CONNECTION_BAD) { printf("We were unable to connect to the database"); return 1; } // we use cursors/fetch to speed up the process; batch of 10000 tweets PQexec(conn, "begin work"); PQexec(conn,TStr::Fmt("declare mycursor cursor for select tweettext, extract(epoch from tweettime) from tweets where tweettime >= timestamp '%s' and tweettime < timestamp '%s'", StartDate.CStr(), EndDate.CStr()).CStr()); do { res = PQexec(conn, "FETCH 1000000 IN mycursor"); // all of them are: 1675401026 if (PQresultStatus(res) == PGRES_TUPLES_OK) { rec_count = PQntuples(res); total_number_tweets += rec_count; printf("Adding %d tweets... (total: %d)\n", rec_count, total_number_tweets); for (row=0; row<rec_count; row++) { TweetStr = PQgetvalue(res, row, 0); tweet_date = TStr(PQgetvalue(res, row, 1)).GetFlt(); TweetStrLc = TweetStr.ToLc(); for(q=0;q<quotesContent.Len();q++) { if (TweetStrLc.SearchStr(quotesContent.GetKey(q)) > -1) { TSecTm td(tweet_date); id = CascadesOnTwitter.GetKeyId(quotesContent[q]); if(id == -1) { CascadesOnTwitter.AddDat(quotesContent[q]).Add(td); } else { CascadesOnTwitter.GetDat(quotesContent[q]).AddSorted(td); } } } } PQclear(res); } else { rec_count = 0; } } while (rec_count); PQexec(conn, "close mycursor"); PQexec(conn, "commit work"); PQfinish(conn); // Save the results TZipOut zout(resultFname); CascadesOnTwitter.Save(zout); // Remove the qoutes' content file system(TStr::Fmt("rm %s",qContentFname.CStr()).CStr()); } } } printf("\n\nD O N E\n\n"); } catch(exception& ex) { printf("\nError1 happened, it was: %s\n\n",ex.what()); } catch(TPt<TExcept>& ex) { printf("\nError2 happened: %s\n\n",ex[0].GetStr().CStr()); } printf("\nrun time: %s (%s)\n", ExeTm.GetTmStr(), TSecTm::GetCurTm().GetTmStr().CStr()); return 0; }
static time_duration_type local_to_utc_base_offset() { time_duration_type td(hours,minutes,0); return td.invert_sign(); }
int main(void) { int64 t0; d(); s=(int64*)calloc(q,sizeof(int64)); gw(1,0,600); gw(2,0,150); gw(9,0,90000); gw(3,0,2); gw(4,0,1000); gw(3,1,0); _1: gw(tm(gr(3,0),gr(1,0)),(td(gr(3,0),gr(1,0)))+3,88); sa(gr(3,0)+gr(3,0)); sa((gr(3,0)+gr(3,0))<gr(9,0)?1:0); _2: if(sp()!=0)goto _21;else goto _3; _3: sp(); _4: sa(gr(3,0)+1); gw(3,0,gr(3,0)+1); sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();t0=gr(sp(),v0);} t0-=32; if((t0)!=0)goto _6;else goto _4; _6: if(gr(9,0)>gr(3,0))goto _1;else goto _7; _7: gw(0,3,32); gw(1,3,32); gw(5,0,1-gr(4,0)); gw(6,0,2); _8: gw(7,0,0); sa((gr(5,0)*gr(7,0))+gr(6,0)); sa(((gr(5,0)*gr(7,0))+gr(6,0))>1?1:0); _9: if(sp()!=0)goto _10;else goto _20; _10: sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();t0=gr(sp(),v0);} t0-=32; if((t0)!=0)goto _19;else goto _11; _11: t0=gr(7,0); if(gr(7,0)>gr(3,1))goto _18;else goto _12; _12: t0=gr(5,0)+2; gw(5,0,gr(5,0)+2); t0=t0>gr(4,0)?1:0; t0=(t0!=0)?0:1; if((t0)!=0)goto _8;else goto _13; _13: gw(5,0,1-gr(4,0)); _14: sa(gr(6,0)+1); gw(6,0,gr(6,0)+1); sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();t0=gr(sp(),v0);} t0-=32; t0=(t0!=0)?0:1; if((t0)!=0)goto _14;else goto _16; _16: if(gr(6,0)<=gr(4,0))goto _8;else goto _17; _17: printf("%lld", gr(1,1)*gr(2,1)); return 0; _18: gw(3,1,t0); gw(1,1,gr(5,0)); gw(2,1,gr(6,0)); goto _12; _19: sa(gr(7,0)+1); gw(7,0,gr(7,0)+1); sa(sr()); sa(sp()*sp()); sa(sp()+(gr(5,0)*gr(7,0))+gr(6,0)); sa(sr()>1?1:0); goto _9; _20: sp(); goto _11; _21: sa(sr()); sa(32); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(tm(sr(),gr(1,0))); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(td(sp(),gr(1,0))); sa(sp()+3LL); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()+gr(3,0)); sa(sr()<gr(9,0)?1:0); goto _2; }