void btGImpactCollisionAlgorithm::shape_vs_shape_collision( btDispatcher* dispatcher, const btCollider* body0, const btCollider* body1, const btCollisionShape* shape0, const btCollisionShape* shape1 ) { const btCollisionShape* tmpShape0 = body0->getCollisionShape(); const btCollisionShape* tmpShape1 = body1->getCollisionShape(); btCollider new0(body0, tmpShape0, body0->getCollisionObject(), body0->getWorldTransform()); btCollider new1(body1, tmpShape1, body1->getCollisionObject(), body1->getWorldTransform()); { btCollisionAlgorithm* algor = newAlgorithm(dispatcher, body0, body1); // post : checkManifold is called m_resultOut->setShapeIdentifiersA(m_part0,m_triface0); m_resultOut->setShapeIdentifiersB(m_part1,m_triface1); btCollisionProcessInfo processInfo(new0, new1, *m_dispatchInfo, m_resultOut, dispatcher); algor->processCollision(processInfo); algor->nihilize(dispatcher); algor->~btCollisionAlgorithm(); dispatcher->freeCollisionAlgorithm(algor); } }
// virtual int MLMessenger::acceptADT(MHL7Msg& message, const MString& event) { MLogClient logClient; logClient.log(MLogClient::MLOG_CONVERSATION, (this->mHandler)->getPeerName(), "MLMessenger::acceptADT", __LINE__, MString("Accepting ADT event ")+event); MHL7DomainXlate xLate; MPatient patient; MVisit visit; xLate.translateHL7(message, patient); xLate.translateHL7(message, visit); MString patientString = patient.patientID() + ":" + patient.issuerOfPatientID() + ":" + patient.patientName(); logClient.log(MLogClient::MLOG_CONVERSATION, this->mHandler->getPeerName(), "MLMessenger::acceptADT", __LINE__, MString("Patient is: ")+patientString); processInfo( event, patient, visit); MHL7Msg* ack = mFactory.produceACK(message); this->sendHL7Message(*ack); delete ack; return 0; }
// virtual int MLDispatchOrderPlacerJapanese::acceptORR(MHL7Msg& message, const MString& event) { MLogClient logClient; logClient.log(MLogClient::MLOG_CONVERSATION, "peer", "MLDispatchOrderPlacerJapanese::acceptORR", __LINE__, MString("Accepting ORR event ")+event); MHL7DomainXlate xLate; MPatient patient; MVisit visit; MPlacerOrder placerOrder; xLate.issuer1("ADT1"); xLate.issuer2("OF1"); xLate.translateHL7(message, patient); xLate.translateHL7(message, placerOrder); // send order control information down processInfo(message, event, patient, placerOrder); // Let the base class see the ORR; it will generate the ACK MHL7Dispatcher::acceptORR(message, event); return 0; }
ProcDataList processList(const ProcDataList & /*previous*/) { ProcDataList rc; PROCESSENTRY32 pe; pe.dwSize = sizeof(PROCESSENTRY32); HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (snapshot == INVALID_HANDLE_VALUE) return rc; for (bool hasNext = Process32First(snapshot, &pe); hasNext; hasNext = Process32Next(snapshot, &pe)) { ProcData procData; procData.ppid = QString::number(pe.th32ProcessID); procData.name = QString::fromUtf16(reinterpret_cast<ushort *>(pe.szExeFile)); const ProcessInfo processInf = processInfo(pe.th32ProcessID); procData.image = processInf.imageName; procData.user = processInf.processOwner; procData.abi = s_abiDetector.abiForProcess(pe.th32ProcessID); rc.push_back(procData); } CloseHandle(snapshot); return rc; }
virtual void processNode(int nodeSubPart, int nodeShapeIndex) { const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(m_compoundCollider.getCollisionShape()); const btCollisionShape* childShape = compoundShape->getChildShape(nodeShapeIndex); //backup btTransform orgTrans = m_compoundCollider.getWorldTransform(); const btTransform& childTrans = compoundShape->getChildTransform(nodeShapeIndex); btTransform newChildWorldTrans = orgTrans*childTrans ; //the contactpoint is still projected back using the original inverted worldtrans btCollider childCollider(&m_compoundCollider, childShape,m_compoundCollider.getCollisionObject(), newChildWorldTrans); if (!m_childCollisionAlgorithms[nodeShapeIndex]) m_childCollisionAlgorithms[nodeShapeIndex] = m_dispatcher->findAlgorithm(&childCollider,&m_collidingObj,m_sharedManifold); ///detect swapping case if (m_resultOut->getBody0Internal() == m_compoundCollider.getCollisionObject()) { m_resultOut->setShapeIdentifiersA(-1,nodeShapeIndex); } else { m_resultOut->setShapeIdentifiersB(-1,nodeShapeIndex); } btCollisionProcessInfo processInfo(childCollider, m_collidingObj, m_dispatchInfo, m_resultOut, m_dispatcher); m_childCollisionAlgorithms[nodeShapeIndex]->processCollision(processInfo); }
//virtual int MLDispatchOrderFillerJapanese::acceptORM(MHL7Msg& message, const MString& event) { MLogClient logClient; logClient.log(MLogClient::MLOG_CONVERSATION, "peer", "MLDispatchOrderFillerJapanese::acceptORM", __LINE__, MString("Accepting ORM event ")+event); MHL7DomainXlate xLate; MPatient patient; MVisit visit; MPlacerOrder placerOrder; MFillerOrder fillerOrder; xLate.issuer1("ADT1"); xLate.issuer2("OP1"); xLate.translateHL7(message, patient); xLate.translateHL7(message, visit); xLate.translateHL7(message, placerOrder); MString patientString = patient.patientID() + ":" + patient.issuerOfPatientID() + ":" + patient.patientName(); logClient.log(MLogClient::MLOG_VERBOSE, "peer", "MLDispatchOrderFillerJapanese::acceptORM", __LINE__, MString("Patient is: ")+patientString); for (int inx = 0; inx < placerOrder.numOrders(); inx++) { MOrder& order = placerOrder.order(inx); MString orderTxt = order.placerOrderNumber() + ":" + order.fillerOrderNumber() + ":" + order.orderControl() + ":" + order.universalServiceID(); logClient.log(MLogClient::MLOG_VERBOSE, "peer", "MLDispatchOrderFillerJapanese::acceptORM", __LINE__, MString("Order Informaition: ")+orderTxt); } MString orderControl = message.getValue("ORC", 1, 1); processInfo(event, orderControl, patient, placerOrder, fillerOrder); // Let the base class see the ORM; it will generate the ACK MHL7Dispatcher::acceptORM(message, event); return 0; }
void FtpDataSource::onFinished(int id, bool err) { qDebug() << "FtpDataSource::onFinished(" << id << "," << err << ")"; if(id == infoId) { if(!err) { QByteArray bytes; if(ftp->bytesAvailable()) bytes = ftp->readAll(); processInfo(bytes); infoId = 0; } else emit error(ftp->errorString()); { QMutexLocker lock(&datesMutex); if(dates.isEmpty()) emit finished(); else { ids.clear(); for(QMap<QDate,bool>::iterator i = dates.begin(); i != dates.end(); ++i) ids[ftp->get("base/" + i.key().toString("yyyyMMdd") + ".npd")] = i.key(); } } } else { QMutexLocker lock(&datesMutex); if(ids.contains(id)) { QDate dt = ids[id]; dates.remove(dt); if(!err) { QByteArray bytes; if(ftp->bytesAvailable()) bytes = ftp->readAll(); processNPD(dt, bytes); } else { ids.clear(); for(QMap<QDate,bool>::iterator i = dates.begin(); i != dates.end(); ++i) ids[ftp->get("base/" + i.key().toString("yyyyMMdd") + ".npd")] = i.key(); } if(iv.days()) emit progress(int(100.0*iv.from().date().daysTo(dt)/iv.days())); else emit progress(100); if(dates.isEmpty()) emit finished(); return; } } //if(err) emit error(ftp->errorString()); }
void ProcessChildShape(const btCollisionShape* childShape,int index) { btAssert(index>=0); const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(m_compoundColObj->getCollisionShape()); btAssert(index<compoundShape->getNumChildShapes()); //backup btTransform orgTrans = m_compoundColObj->getWorldTransform(); const btTransform& childTrans = compoundShape->getChildTransform(index); btTransform newChildWorldTrans = orgTrans*childTrans ; //perform an AABB check first btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1; childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0); m_otherObj->getCollisionShape()->getAabb(m_otherObj->getWorldTransform(),aabbMin1,aabbMax1); if (TestAabbAgainstAabb2(aabbMin0,aabbMax0,aabbMin1,aabbMax1)) { //the contactpoint is still projected back using the original inverted worldtrans btCollider childCollider(m_compoundColObj, childShape, m_compoundColObj->getCollisionObject(), newChildWorldTrans); if (!m_childCollisionAlgorithms[index]) m_childCollisionAlgorithms[index] = m_dispatcher->findAlgorithm(&childCollider,m_otherObj,m_sharedManifold); ///detect swapping case if (m_resultOut->getBody0Internal() == m_compoundColObj->getCollisionObject()) { m_resultOut->setShapeIdentifiersA(-1,index); } else { m_resultOut->setShapeIdentifiersB(-1,index); } btCollisionProcessInfo processInfo(childCollider, *m_otherObj, m_dispatchInfo, m_resultOut, m_dispatcher); m_childCollisionAlgorithms[index]->processCollision(processInfo); if (m_dispatchInfo.m_debugDraw && (m_dispatchInfo.m_debugDraw->getDebugMode() & btIDebugDraw::DBG_DrawAabb)) { btVector3 worldAabbMin,worldAabbMax; m_dispatchInfo.m_debugDraw->drawAabb(aabbMin0,aabbMax0,btVector3(1,1,1)); m_dispatchInfo.m_debugDraw->drawAabb(aabbMin1,aabbMax1,btVector3(1,1,1)); } } }
void btGImpactCollisionAlgorithm::convex_vs_convex_collision( btDispatcher* dispatcher, const btCollider* body0, const btCollider* body1, const btCollisionShape* shape0, const btCollisionShape* shape1 ) { const btCollisionShape* tmpShape0 = body0->getCollisionShape(); const btCollisionShape* tmpShape1 = body1->getCollisionShape(); btCollider new0(body0, tmpShape0, body0->getCollisionObject(), body0->getWorldTransform()); btCollider new1(body1, tmpShape1, body1->getCollisionObject(), body1->getWorldTransform()); m_resultOut->setShapeIdentifiersA(m_part0,m_triface0); m_resultOut->setShapeIdentifiersB(m_part1,m_triface1); btCollisionProcessInfo processInfo(new0, new1, *m_dispatchInfo, m_resultOut, dispatcher); checkConvexAlgorithm(dispatcher, &new0, &new1); m_convex_algorithm->processCollision(processInfo); }
//virtual int MLDispatchOrderFillerJapanese::acceptORR(MHL7Msg& message, const MString& event) { MLogClient logClient; logClient.log(MLogClient::MLOG_CONVERSATION, "peer", "MLDispatchOrderFillerJapanese::acceptORR", __LINE__, MString("Accepting ORR event ")+event); MHL7DomainXlate xLate; MPatient patient; MPlacerOrder placerOrder; MFillerOrder fillerOrder; xLate.issuer1("ADT1"); xLate.issuer2("OP1"); xLate.translateHL7(message, patient); xLate.translateHL7(message, fillerOrder); xLate.translateHL7(message, placerOrder); MString patientString = patient.patientID() + ":" + patient.issuerOfPatientID() + ":" + patient.patientName(); logClient.log(MLogClient::MLOG_VERBOSE, "peer", "MLDispatchOrderFillerJapanese::acceptORR", __LINE__, MString("Patient is: ")+patientString); MString orderControl = message.getValue("ORC", 1, 1); processInfo(event, orderControl, patient, placerOrder, fillerOrder); // Let the base class see the ORM; it will generate the ACK MHL7Dispatcher::acceptORR(message, event); return 0; }
void parseDict(char* txt, int len, int *i , bt_info_t * inf){ if(txt[*i]!='d'){ fprintf(stderr,"wrong seed file format, exiting\n"); exit(-1); } *i=(*i)+1; char * temp; while(*i<len){ switch(txt[*i]){ case '0' ... '9': temp=parseString(txt, len, i); processInfo(txt, temp, i, len, inf); free(temp); break; case 'e': return; default: fprintf(stderr, "invalid dictionary, quitting\n"); exit(-1); } } }
// virtual int MLDispatchOrderFillerJapanese::acceptADT(MHL7Msg& message, const MString& event) { MLogClient logClient; logClient.log(MLogClient::MLOG_CONVERSATION, "peer", "MLDispatchOrderFillerJapanese::acceptADT", __LINE__, MString("Accepting ADT event ")+event); MHL7DomainXlate xLate; MPatient patient; MVisit visit; xLate.issuer1("ADT1"); xLate.issuer2("OP1"); xLate.translateHL7(message, patient); xLate.translateHL7(message, visit); MString patientString = patient.patientID() + ":" + patient.issuerOfPatientID() + ":" + patient.patientName(); logClient.log(MLogClient::MLOG_VERBOSE, "peer", "MLDispatchOrderFillerJapanese::acceptADT", __LINE__, MString("Patient is: ")+patientString); processInfo( event, patient, visit); // Let the base class see the ADT; it will generate the ACK MHL7Dispatcher::acceptADT(message, event); return 0; }
int cbDebuggerPlugin::RunNixConsole(wxString &consoleTty) { consoleTty = wxEmptyString; #ifndef __WXMSW__ // Start a terminal and put the shell to sleep with -e sleep 80000. // Fetch the terminal's tty, so we can tell the debugger what TTY to use, // thus redirecting program's stdin/stdout/stderr to the terminal. wxString cmd; int consolePid = 0; // Use the terminal specified by the user in the Settings -> Environment. wxString term = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/console_terminal"), DEFAULT_CONSOLE_TERM); term.Replace(_T("$TITLE"), wxString(wxT("'"))+_("Program Console")+wxT("'")); cmd << term << _T(" "); const wxString &sleepCommand = MakeSleepCommand(); cmd << sleepCommand; Manager::Get()->GetMacrosManager()->ReplaceEnvVars(cmd); // The lifetime of wxProcess objects is very uncertain, so we are using a shared pointer to // prevent us accessing deleted objects. cb::shared_ptr<ConsoleProcessTerminationInfo> processInfo(new ConsoleProcessTerminationInfo); ConsoleProcess *process = new ConsoleProcess(processInfo); consolePid = wxExecute(cmd, wxEXEC_ASYNC, process); if (consolePid <= 0) return -1; // Try to find the TTY. We're using a loop, because some slow machines might make the check fail due // to a slow starting terminal. for (int ii = 0; ii < 100; ++ii) { // First, wait for the terminal to settle down, else PS won't see the sleep task Manager::Yield(); ::wxMilliSleep(200); // Try to detect if the terminal command is present or its parameters are valid. if (processInfo->FailedToStart() /*&& ii > 0*/) { Log(F(wxT("Failed to execute terminal command: '%s' (exit code: %d)"), cmd.wx_str(), processInfo->status), Logger::error); break; } // Try to find tty path and pid for the sleep command we've just executed. const ConsoleInfo &info = GetConsoleTty(consolePid); // If there is no sleep command yet, do another iteration after a small delay. if (!info.IsValid()) continue; // Try to find if the console window is still alive. Newer terminals like gnome-terminal // try to be easier on resources and use a shared server process. For these terminals the // spawned terminal process exits immediately, but the sleep command is still executed. // If we detect such case we will return the PID for the sleep command instead of the PID // for the terminal. if (kill(consolePid, 0) == -1 && errno == ESRCH) { DebugLog(F(wxT("Using sleep command's PID as console PID %d, TTY %s"), info.sleepPID, info.ttyPath.wx_str())); consoleTty = info.ttyPath; return info.sleepPID; } else { DebugLog(F(wxT("Using terminal's PID as console PID %d, TTY %s"), info.sleepPID, info.ttyPath.wx_str())); consoleTty = info.ttyPath; return consolePid; } } // failed to find the console tty if (consolePid != 0) ::wxKill(consolePid); #endif // !__WWXMSW__ return -1; }
/* check on command and return 1 if command got * or 0 if didn't */ int checkServerBufferOnInfo() { int len = (cli.sbuf)->count; int slen = 0; char * buf = flushBuffer(cli.sbuf); char * c; char * sek = buf; uint32_t * pnum; if (len == 0) { debugl(9, "checkServerBufferOnInfo: No string to analyze\n"); free(buf); return 0; } debugl(6, "checkServerBufferOnInfo: Analyzing string with len=%d: ", len); for (c = buf; (c - buf) < len; c++) debugl(6, "%hhu ", *c); debugl(6, "\n"); switch (*sek++) { case 1: /* ok */ processResponse(RESP_OK, NULL, 0); if (len > 1) addnStr(cli.sbuf, sek, len - 1); free(buf); return 1; case 2: /* error N */ if (len < 2) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } processResponse(RESP_ERROR, sek, 1); if (len > 2) addnStr(cli.sbuf, sek+1, len - 2); free(buf); return 1; case 3: /* stat N */ if (len < 5) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } pnum = (uint32_t *)malloc(sizeof(uint32_t)); *pnum = ntohl(*(uint32_t *)sek); processResponse(RESP_STAT, pnum, 4); free(pnum); if (len > 5) addnStr(cli.sbuf, sek+4, len - 5); free(buf); return 1; case 4: /* games GAMES */ if (len < 5) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } slen = ntohl(*(uint32_t *)sek); if (len < (5 + slen)) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } processResponse(RESP_GAMES, sek+4, slen); if (len > (5 + slen)) addnStr(cli.sbuf, sek+4+slen, len - 5 - slen); free(buf); return 1; case 5: /* players PLAYERS */ if (len < 5) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } slen = ntohl(*(uint32_t *)sek); if (len < (5 + slen)) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } processResponse(RESP_PLAYERS, sek+4, slen); if (len > (5 + slen)) addnStr(cli.sbuf, sek+4+slen, len - 5 - slen); free(buf); return 1; case 6: /* player PLAYER */ if (len < 5) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } slen = ntohl(*(uint32_t *)sek); if (len < (5 + slen)) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } processResponse(RESP_PLAYER, sek+4, slen); if (len > (5 + slen)) addnStr(cli.sbuf, sek+4+slen, len - 5 - slen); free(buf); return 1; case 7: /* info MES */ if (len < 5) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } slen = ntohl(*(uint32_t *)sek); if (len < (5 + slen)) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } processInfo(sek+4, slen); if (len > (5 + slen)) addnStr(cli.sbuf, sek+4+slen, len - 5 - slen); free(buf); return 1; case 8: /* market Players Turn sellCount:minPrice buyCount:maxPrice */ if (len < 25) { addnStr(cli.sbuf, buf, len); free(buf); return 0; } processResponse(RESP_MARKET, sek, 24); if (len > 25) addnStr(cli.sbuf, sek + 24, len - 25); free(buf); return 1; default: error("Recieved unknown sequence from server, abort!\n"); cli.clientFin = 1; return 0; } }
// virtual int MLDispatchOrderPlacerJapanese::acceptADT(MHL7Msg& message, const MString& event) { MLogClient logClient; logClient.log(MLogClient::MLOG_CONVERSATION, "peer", "MLDispatchOrderPlacerJapanese::acceptADT", __LINE__, MString("Accepting ADT event ")+event); MString charSet = message.getValue("MSH", 18, 0); MString charSetRep1 = ""; MString charSetRep2 = ""; if (charSet.tokenExists('~', 0)) { charSetRep1 = charSet.getToken('~', 0); } if (charSet.tokenExists('~', 1)) { charSetRep2 = charSet.getToken('~', 1); } if (charSetRep1 != "ISO IR6") { logClient.log(MLogClient::MLOG_ERROR, "peer", "MLDispatchOrderPlacerJapanese::acceptADT", __LINE__, MString("Wrong value in MSH.18 (Character set)") + charSet); MHL7Dispatcher::acceptMessageApplicationError(message, event, "AE", "207"); return 0; } else if (charSetRep2 != "ISO IR87") { logClient.log(MLogClient::MLOG_ERROR, "peer", "MLDispatchOrderPlacerJapanese::acceptADT", __LINE__, MString("Wrong value in MSH.18 (Character set)") + charSet); MHL7Dispatcher::acceptMessageApplicationError(message, event, "AE", "207"); return 0; } MHL7DomainXlate xLate; MPatient patient; MVisit visit; xLate.issuer1("ADT1"); xLate.issuer2("MPI"); xLate.translateHL7(message, patient); xLate.translateHL7(message, visit); MString patientString = patient.patientID() + ":" + patient.issuerOfPatientID() + ":" + patient.patientName(); logClient.log(MLogClient::MLOG_VERBOSE, "peer", "MLDispatchOrderPlacerJapanese::acceptADT", __LINE__, MString("Patient is: ")+patientString); processInfo( event, patient, visit); // Let the base class see the ADT; it will generate the ACK MHL7Dispatcher::acceptADT(message, event); return 0; }