void voina(int p1[],int p2[],int *b1,int *b2,int *p12,int *p22,int i) { printf("\n VOINA!!!\n\n"); i++; getchar(); himikal(p1,p2,p12,p22,i); i++; getchar(); himikal(p1,p2,p12,p22,i); i++; getchar(); himikal(p1,p2,p12,p22,i); if(p1[i]-*p12>p2[i]-*p22) { pe(p1,p2,b1,b2); pe(p1,p2,b1,b2); pe(p1,p2,b1,b2); pe(p1,p2,b1,b2); getchar(); }else if(p1[i]-*p12<p2[i]-*p22) { pd(p1,p2,b1,b2); pd(p1,p2,b1,b2); pd(p1,p2,b1,b2); pd(p1,p2,b1,b2); getchar(); }else voina(p1,p2,b1,b2,p12,p22,i); }
void TSharedArray<T>::scatter(TGridIndex i0, const TGridIndexVector& iv, TGridIndex mult, const T* source, TGridIndex source_stride) { smallnat v; const int n = iv.length(); if (sizeof(T) == 4) { static short indexbuff[VECLEN]; static T sourcebuff[VECLEN]; # pragma _CRI cache_align indexbuff,sourcebuff unroll4; for (v=0; v<n; v++) indexbuff[v] = iv(v)*mult; // check that all map to same PE const int pe_i0 = pe(i0+indexbuff[0]); for (v=0; v<n; v++) if (pe(i0+indexbuff[v]) != pe_i0) {cerr << "*** TSharedArray::scatter32 error\n"; exit(1);} // localize indexbuff for (v=0; v<n; v++) indexbuff[v] = iL(i0+indexbuff[v]) - iL(i0); unroll4; for (v=0; v<n; v++) sourcebuff[v] = source[v*source_stride]; shmem_ixput32(ptr+iL(i0),sourcebuff,indexbuff,n,pe_i0); } else { static long indexbuff[VECLEN]; static T sourcebuff[VECLEN]; # pragma _CRI cache_align indexbuff,sourcebuff unroll4; for (v=0; v<n; v++) indexbuff[v] = iv(v)*mult; // check that all map to same PE const int pe_i0 = pe(i0+indexbuff[0]); for (v=0; v<n; v++) if (pe(i0+indexbuff[v]) != pe_i0) {cerr << "*** TSharedArray::scatter64 error\n"; exit(1);} // localize indexbuff for (v=0; v<n; v++) indexbuff[v] = iL(i0+indexbuff[v]) - iL(i0); unroll4; for (v=0; v<n; v++) sourcebuff[v] = source[v*source_stride]; shmem_ixput64(ptr+iL(i0),sourcebuff,indexbuff,n,pe_i0); } }
static int BLOreloBase() { char *path, *file, err[1000]; int r; if(!game) game = new gameC(0,0,0,0); path = dataFindPath("everborn.game"); if(path == NULL) { pe("can't find game\n"); return -1; } file = txtLoad(path); free(path); if(file == NULL) { pe("can't load game\n"); return -1; } r = game->Read(file, err); free(file); if(r) { pe("error: %s\n", err); return -1;; } return 0; }
static int BLOrelo() { char *fn, *path, *file, err[1000]; raceC* r; fn = envGet("BLOrace"); path = dataFindPath(fn); if(path == NULL) { pe("can't find race file %s\n", fn); return -1; } file = txtLoad(path); free(path); if(file == NULL) { pe("can't load race file %s\n", fn); return -1; } r = raceLoad(file, err); free(file); if(r == NULL) { pe("error: %s\n", err); return -1; } BLOrace(r); return 0; }
void TSharedArray<T>::gather(TGridIndex i0,const TGridIndexVector& iv, TGridIndex mult, T* result, TGridIndex result_stride) const { smallnat v; const int n = iv.length(); if (sizeof(T) == 4) { static short indexbuff[VECLEN]; static T resultbuff[VECLEN]; # pragma _CRI cache_align indexbuff,resultbuff unroll4; for (v=0; v<n; v++) indexbuff[v] = (iv(v) > 0 ? iv(v) : 0)*mult; // allow for iv(v)==NOINDEX without causing problems // check that all map to same PE const int pe_i0 = pe(i0+indexbuff[0]); for (v=0; v<n; v++) if (pe(i0+indexbuff[v]) != pe_i0) {cerr << "*** TSharedArray::gather32 error\n"; exit(1);} // localize indexbuff for (v=0; v<n; v++) indexbuff[v] = iL(i0+indexbuff[v]) - iL(i0); shmem_ixget32(resultbuff,ptr+iL(i0),indexbuff,n,pe_i0); unroll4; for (v=0; v<n; v++) result[v*result_stride] = resultbuff[v]; } else { static long indexbuff[VECLEN]; static T resultbuff[VECLEN]; # pragma _CRI cache_align indexbuff,resultbuff unroll4; for (v=0; v<n; v++) indexbuff[v] = (iv(v) > 0 ? iv(v) : 0)*mult; // allow for iv(v)==NOINDEX without causing problems // check that all map to same PE const int pe_i0 = pe(i0+indexbuff[0]); for (v=0; v<n; v++) if (pe(i0+indexbuff[v]) != pe_i0) {cerr << "*** TSharedArray::gather64 error\n"; exit(1);} // localize indexbuff for (v=0; v<n; v++) indexbuff[v] = iL(i0+indexbuff[v]) - iL(i0); shmem_ixget64(resultbuff,ptr+iL(i0),indexbuff,n,pe_i0); unroll4; for (v=0; v<n; v++) result[v*result_stride] = resultbuff[v]; } }
/*============================================================================= * PACK IO */ static int racePackRead(connectionC* sv, netReqC* req) { char fe[] = "racePackRead: "; char ebf[200]; char *c; raceC *r; c = (char*)req->data; // check string termination if(c[req->size -1] != '\0') { pe("%sunterminated string from server.\n", fe); return -1; } // load txtStrip(c); r = raceLoad(c, ebf); if(r == NULL) { pe("bad race '%s' from server: %s.\n", req->item, ebf); return -1; } // done pf("from server: race %s\n", r->Name); dataLoadMissing(); return 0; }
static int cmdCQueue() { cellC* c = cmdGetBrain()->Focus; if(!c) return pe("NOFOCUS\n"), -1; if(!c->City) return pe("NOCITY in %d %d %d\n", c->X, c->Y, c->Z), -1; // no city present if(c->City->Owner != cmdGetBrain()) return pe("NOTOWNER\n"), -1; // owner only!! return 0; }
void _set_empty() { ps().x() = 0.0; pe().x() = 0.0; ps().y() = 0.0; pe().y() = 0.0; if (Dim == 3) { ps().z() = 0.0; pe().z() = 0.0; } }
static void nomatch(const char *mac) { int i, j; /* * Look for a match further down on stack * If we find one, it suggests that the stuff in * between is supposed to match itself. */ for (j = stktop; j >= 0; j--) { if (eq(mac, br[stk[j].opno].clbr)) { /* Found. Make a good diagnostic. */ if (j == stktop - 2) { /* * Check for special case \fx..\fR and don't * complain. */ if (stk[j + 1].opno == FT && stk[j + 1].parm != 'R' && stk[j + 2].opno == FT && stk[j + 2].parm == 'R') { stktop = j - 1; return; } /* * We have two unmatched frobs. Chances are * they were intended to match, so we mention * them together. */ pe(stk[j + 1].lno); prop(j + 1); printf(" does not match %d: ", stk[j + 2].lno); prop(j + 2); printf("\n"); } else { for (i = j + 1; i <= stktop; i++) { complain(i); } } stktop = j - 1; return; } } /* Didn't find one. Throw this away. */ pe(lineno); printf("Unmatched .%s\n", mac); }
void main() { int i,b1=26,b2=26,k[52],p1[52],p2[52],p12,p22; srand((unsigned)time(NULL)); kart(k); for(i=0;i<26;i++) { p1[i]=k[i]; p2[i]=k[i+26]; } getchar(); do { i=0; system("clear"); rez(b1,b2); himikal(p1,p2,&p12,&p22,i); printf("\n"); getchar(); if(p1[i]-p12>p2[i]-p22) pe(p1,p2,&b1,&b2); else if(p1[i]-p12<p2[i]-p22) pd(p1,p2,&b1,&b2); else voina(p1,p2,&b1,&b2,&p12,&p22,i); } while((b1!=0)&&(b2!=0)); system("clear"); rez(b1,b2); if(b1==0) printf("\n\n POBEDITEL E PLAYER2!!!\n"); else printf("\n\n POBEDITEL E PLAYER1\n"); }
CObject *Evaluate(const CObject_Vector &jj) { if (p_v->V()->id.back()==0) { const CVec4Type &a(*jj[0]->template Get<CVec4Type>()); const CVec4Type &b(*jj[1]->template Get<CVec4Type>()); const CVec4Type &c(*jj[2]->template Get<CVec4Type>()); Vec4D pa(p_v->J(0)->P()), pb(p_v->J(1)->P()), pc(p_v->J(2)->P()); CScalarType *j(CScalarType::New ((a*b)*(c*(pa-pb))+ (b*c)*(a*(pb-pc))+ (c*a)*(b*(pc-pa)))); j->SetS(a.S()|b.S()|c.S()); return j; } const CVec4Type &a(*jj[m_n[1]]->template Get<CVec4Type>()); const CVec4Type &b(*jj[m_n[2]]->template Get<CVec4Type>()); const CScalarType &e(*jj[m_n[0]]->template Get<CScalarType>()); Vec4D pa(p_v->J(m_n[1])->P()), pb(p_v->J(m_n[2])->P()); Vec4D pe(p_v->J(m_n[0])->P()); CVec4Type *j(CVec4Type::New (e[0]*((a*b)*CVec4Type(pa-pb) +(a*ATOOLS::Vec4<SType>(pb+pb+pa+pe))*b -(b*ATOOLS::Vec4<SType>(pa+pa+pb+pe))*a))); j->SetS(a.S()|b.S()|e.S()); return j; }
int main() { std::string solution[100], team[100]; for(int cas = 1;; ++cas) { unsigned int n = readUInt(); if(n == 0) return 0; std::stack<char> solutionStack, teamStack; for(unsigned int i = 0; i < n; ++i) solution[i] = readLine(solutionStack); unsigned int m = readUInt(); for(unsigned int i = 0; i < m; ++i) team[i] = readLine(teamStack); std::cout << "Run #" << cas << ": "; if(accept(solution, n, team, m)) { std::cout << "Accepted" << std::endl; } else if(pe(solutionStack, teamStack)) { std::cout << "Presentation Error" << std::endl; } else { std::cout << "Wrong Answer" << std::endl; } } }
void Pdb(const po::variables_map& variables, int& retcode) { retcode = 1; if (!variables.count("input")) { std::wcerr << L"Error parsing options: must have some input files." << std::endl; return; } auto out = OpenOutput<wchar_t>(variables); if (!out) return; auto inputs = variables["input"].as<std::vector<std::wstring>>(); for (auto& input : inputs) { PEParser pe(input); pe.Open(); if (!pe.IsValidPE() || pe.PDBPath().empty()) continue; *out << pe.PDBGUID() << " " << pe.PDBPath() << L'\n'; } *out << std::flush; retcode = 0; }
void Info(const po::variables_map& variables, int& retcode) { retcode = 1; if (!variables.count("input")) { std::wcerr << L"Error parsing options: must have some input files." << std::endl; return; } auto out = OpenOutput<wchar_t>(variables); if (!out) return; retcode = 0; auto inputs = variables["input"].as<std::vector<std::wstring>>(); for (auto& input : inputs) { *out << input << L":\n\n"; PEParser pe(input); pe.Open(); pe.PrintInfo(*out, true); if (!pe.IsValidPE()) retcode = 1; *out << L"\n\n"; } }
void DumpSection(const po::variables_map& variables, int& retcode) { retcode = 1; if (!variables.count("input")) { std::wcerr << L"Error parsing options: must have one input file." << std::endl; return; } auto out = OpenOutput<char>(variables); if (!out) return; retcode = 0; auto inputs = variables["input"].as<std::vector<std::wstring>>(); PEParser pe(inputs[0]); pe.Open(); if (!pe.IsValidPE()) { retcode = 1; std::wcerr << L"Invalid PE format." << std::endl; return; } auto sectionName = variables["dump-section"].as<std::wstring>(); *out << pe.SectionData(sectionName) << std::flush; }
void Signature(const po::variables_map& variables, int& retcode) { auto foo = { 1, 2, 3 }; foo.size(); retcode = 1; if (!variables.count("input")) { std::wcerr << L"Error parsing options: must have some input files." << std::endl; return; } auto out = OpenOutput<wchar_t>(variables); if (!out) return; retcode = 0; auto inputs = variables["input"].as<std::vector<std::wstring>>(); for (auto& input : inputs) { PEParser pe(input); pe.Open(); if (!pe.IsSigned()) retcode = 1; *out << ((pe.IsSigned()) ? L"signed" : L"unsigned") << L" : " << input << std::endl; } }
void Imports(const po::variables_map& variables, int& retcode) { retcode = 1; if (variables.count("input") != 1) { std::wcerr << L"Error parsing options: must have one input file." << std::endl; return; } auto out = OpenOutput<wchar_t>(variables); if (!out) return; retcode = 0; auto inputs = variables["input"].as<std::vector<std::wstring>>(); PEParser pe(inputs[0]); pe.Open(); if (!pe.IsValidPE()) { retcode = 1; return; } auto imports = pe.AllDllImports(); for (auto& import : imports) *out << MultiByteToWideString(import) << L'\n'; }
int main(int argc, char** argv) { if (argc < 2) { printf("%s\n", "path to file not define"); return 1; } else printf("%s\n", argv[1]); PEprinter pe(argv[1]); if(pe.getState() == 0) { pe.setFormat(16); pe.printAddressOfEntryPoint(); pe.printImageBase(); pe.printSections(); pe.printImportTable(); } else pe.printError(); return 0; }
bool QPixmapIconEngine::read(QDataStream &in) { int num_entries; QPixmap pm; QString fileName; QSize sz; uint mode; uint state; in >> num_entries; for (int i=0; i < num_entries; ++i) { if (in.atEnd()) { pixmaps.clear(); return false; } in >> pm; in >> fileName; in >> sz; in >> mode; in >> state; if (pm.isNull()) { addFile(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); } else { QPixmapIconEngineEntry pe(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); pe.pixmap = pm; pixmaps += pe; } } return true; }
void pes (Edges &edges) { cerr << "("; for (int i = 0; i < edges.size(); ++i) pe(edges[i]); cerr << ")" << endl; }
Demarc::Port Demarc::pick(const InetAddress &to) const throw() { Mutex::Lock _l(_ports_m); try { std::vector< std::map< Port,DemarcPortObj >::const_iterator > possibilities; for(std::map< Port,DemarcPortObj >::const_iterator pe(_ports.begin());pe!=_ports.end();++pe) { switch (pe->second.type) { case PORT_TYPE_UDP_SOCKET_V4: if (to.isV4()) possibilities.push_back(pe); break; case PORT_TYPE_UDP_SOCKET_V6: if (to.isV6()) possibilities.push_back(pe); break; default: break; } } if (possibilities.size()) return possibilities[_r->prng->next32() % possibilities.size()]->first; else return NULL_PORT; } catch ( ... ) { return NULL_PORT; } }
void XSDSchemaParser::parseXSD(const std::string &filename) { pt::ptree xsdTree; std::string fpath = m_basePath + filename; try { pt::read_xml(fpath, xsdTree, pt::xml_parser::trim_whitespace | pt::xml_parser::no_comments); } catch (const std::exception &e) { std::string xmlError = e.what(); ParseException pe("Unable to read/parse file. Check that file is formatted correctly. Error = " + xmlError); pe.addFilename(filename); throw(pe); } try { auto schemaIt = xsdTree.find("xs:schema"); pt::ptree emptyTree; const pt::ptree &keys = schemaIt->second.get_child("", emptyTree); parseXSD(keys); } catch (ParseException &pe) { pe.addFilename(filename); throw(pe); } }
void * GetProcAddress(HMODULE module, std::function<bool(LPCSTR)> comp) { assert(module != NULL); assert(comp); PeDecoder::PeImage pe(module, true); if (!pe.IsPe()) { return nullptr; } auto& exportDir = pe.GetExportDirectory(); if (!exportDir) { return nullptr; } auto end = exportDir->end(); auto result = _STD find_if(exportDir->begin(), end, [&comp] (PeDecoder::ExportIteratorNode& node) { return comp(node.NamePtr()); }); if (end == result) { return nullptr; } return result->FuncPtr(); }
void * GetProcAddress(HMODULE module, const void * lpProcName, std::function<int(LPCSTR, const void*)> comp) { assert(module != NULL); PeDecoder::PeImage pe(module, true); if (!pe.IsPe()) { return nullptr; } auto& exportDir = pe.GetExportDirectory(); if (!exportDir) { return nullptr; } auto end = exportDir->end(); auto result = _STD lower_bound(exportDir->begin(), end, lpProcName, [&comp] (PeDecoder::ExportIteratorNode& node, const void* val) { return comp(node.NamePtr(), val) < 0; }); if (result == end || comp(result->NamePtr(), lpProcName) != 0) { return nullptr; } return result->FuncPtr(); }
void UnicodeTest::TestBidiPairedBracketType() { // BidiBrackets-6.3.0.txt says: // // The set of code points listed in this file was originally derived // using the character properties General_Category (gc), Bidi_Class (bc), // Bidi_Mirrored (Bidi_M), and Bidi_Mirroring_Glyph (bmg), as follows: // two characters, A and B, form a pair if A has gc=Ps and B has gc=Pe, // both have bc=ON and Bidi_M=Y, and bmg of A is B. Bidi_Paired_Bracket // maps A to B and vice versa, and their Bidi_Paired_Bracket_Type // property values are Open and Close, respectively. IcuTestErrorCode errorCode(*this, "TestBidiPairedBracketType()"); UnicodeSet bpt("[:^bpt=n:]", errorCode); assertTrue("bpt!=None is not empty", !bpt.isEmpty()); // The following should always be true. UnicodeSet mirrored("[:Bidi_M:]", errorCode); UnicodeSet other_neutral("[:bc=ON:]", errorCode); assertTrue("bpt!=None is a subset of Bidi_M", mirrored.containsAll(bpt)); assertTrue("bpt!=None is a subset of bc=ON", other_neutral.containsAll(bpt)); // The following are true at least initially in Unicode 6.3. UnicodeSet bpt_open("[:bpt=o:]", errorCode); UnicodeSet bpt_close("[:bpt=c:]", errorCode); UnicodeSet ps("[:Ps:]", errorCode); UnicodeSet pe("[:Pe:]", errorCode); assertTrue("bpt=Open is a subset of Ps", ps.containsAll(bpt_open)); assertTrue("bpt=Close is a subset of Pe", pe.containsAll(bpt_close)); }
GameSolution::GameSolution() { //timer = new Timer(); //FPSTimer.Initialize(); Vector2 startPosition(512.0f,364.0f); Vector2 firstEnemyStartingPosition(0.0f,MyRandomNumber::RandomInRange(0.0f,728.0f)); /*ParticleEffect* pe = new ParticleEffect(500,2,startPosition,startPosition,myDT); pe->TunnelEffect(); AddToList(*pe);*/ //Profiler::getInstance().startUp("ProfileTest.csv"); meShip = SpaceShip(*this); meShip.position = Vector2(500,300); //meLerp.position = Vector2(+50.0f,50.0f); cm = new CollisionManager(); for(int i = 0 ; i < 20; i++) { ParticleEffect pe(myDT,3); pe.isFinished = true; listOfParticleEffects[i] = pe; } }
void Widget::paintChild( Widget* w, GFX& gfx, const Recti& rect ) const { if( w->parent() != this ) return; /* get current cliprect and translation */ Recti cliprect = gfx.clipRect(); Vector2i gtransold; gfx.getTranslationGlobal( gtransold ); /* get child rectangle in global coords */ Recti newcliprect = w->rect(); Recti childrect = newcliprect; newcliprect.intersect( cliprect ); /* set new clipping */ gfx.setClipRect( newcliprect ); /* do painting with default GFX, only paint currently visible part */ newcliprect.intersect( rect ); PaintEvent pe( newcliprect ); gfx.setTranslationGlobal( Vector2i( childrect.x, childrect.y ) ); gfx.setDefault(); w->paintEvent( pe, gfx ); /* restore old viewport */ gfx.setTranslationGlobal( gtransold ); gfx.setDefault(); gfx.setClipRect( cliprect ); }
void Version(const po::variables_map& variables, int& retcode) { retcode = 1; if (!variables.count("input")) { std::wcerr << L"Error parsing options: must have one input file." << std::endl; return; } auto out = OpenOutput<wchar_t>(variables); if (!out) return; auto inputs = variables["input"].as<std::vector<std::wstring>>(); PEParser pe(inputs[0]); pe.Open(); if (!pe.IsValidPE()) return; *out << pe.FileVersion() << std::endl; retcode = 0; }
void KTabBar::resizeEvent(QResizeEvent *) { //debug("KTabBar, resizing"); setSizes(); if(ptab->leftscroll) { ptab->left->setGeometry( 0, 0, ptab->tw_height, ptab->tw_height); ptab->left->show(); } else ptab->left->hide(); if(ptab->rightscroll) { ptab->right->setGeometry( width()-ptab->tw_height, 0, ptab->tw_height, ptab->tw_height); ptab->right->show(); } else ptab->right->hide(); ptab->tabw->setGeometry( ptab->tw_start, 0, ptab->tw_width, ptab->tw_height); ptab->qtab->setGeometry( ptab->tpos, 0, ptab->qtab->sizeHint().width(), ptab->tw_height); //debug("KTabBar\ntabw: %dx%d\nqtab: %dx%d", tw_width, tw_height, // qtab->sizeHint().width(), tw_height); QPaintEvent pe(geometry()); paintEvent( &pe ); //debug("KTabBar, resize - done"); }
void QQuickPinchArea::clearPinch() { Q_D(QQuickPinchArea); d->touchPoints.clear(); if (d->inPinch) { d->inPinch = false; QPointF pinchCenter = mapFromScene(d->sceneLastCenter); QQuickPinchEvent pe(pinchCenter, d->pinchLastScale, d->pinchLastAngle, d->pinchRotation); pe.setStartCenter(d->pinchStartCenter); pe.setPreviousCenter(pinchCenter); pe.setPreviousAngle(d->pinchLastAngle); pe.setPreviousScale(d->pinchLastScale); pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); pe.setPoint1(mapFromScene(d->lastPoint1)); pe.setPoint2(mapFromScene(d->lastPoint2)); emit pinchFinished(&pe); if (d->pinch && d->pinch->target()) d->pinch->setActive(false); } d->pinchStartDist = 0; d->pinchActivated = false; d->initPinch = false; d->pinchRejected = false; d->stealMouse = false; d->id1 = -1; QQuickWindow *win = window(); if (win && win->mouseGrabberItem() == this) ungrabMouse(); setKeepMouseGrab(false); }