void dumpDebug(const char* filenamePattern) const { ScalarFieldArray N; char filename[256]; FluidMixture::Outputs outputs(&N,0,0); fluidMixture->getFreeEnergy(outputs); //Save sphericalized site densities for(const auto& c: fsp.components) for(unsigned j=0; j<c->molecule.sites.size(); j++) { const Molecule::Site& s = *(c->molecule.sites[j]); ostringstream oss; oss << "Nspherical_" << c->molecule.name; if(c->molecule.sites.size()>1) oss << "_" << s.name; sprintf(filename, filenamePattern, oss.str().c_str()); logPrintf("Dumping %s... ", filename); logFlush(); saveSphericalized(&N[c->offsetDensity+j], 1, filename); logPrintf("Done.\n"); logFlush(); } //Adiel components string fname(filenamePattern); fname.replace(fname.find("%s"), 2, "Debug"); logPrintf("Dumping '%s'... \t", fname.c_str()); logFlush(); if(mpiUtil->isHead()) { FILE* fp = fopen(fname.c_str(), "w"); if(!fp) die("Error opening %s for writing.\n", fname.c_str()); fprintf(fp, "\nComponents of Adiel:\n"); Adiel.print(fp, true, " %18s = %25.16lf\n"); fclose(fp); } logPrintf("Done.\n"); logFlush(); //--------- if any, add additional explicit fluid debug output here! }
bool ImageBuffer::openWriteFiles(cv::Size frameSize) { if(!writeFileFlag) { writer = new cv::VideoWriter(saveFileName[0],CV_FOURCC('P','I','M','1'),30,frameSize); if(!writer->isOpened()) { //printf("cannot open the %s file\n",saveFileName[0]); std::stringstream msgStr; msgStr << "cannot open the "<< saveFileName[0] << "file"; logPrintf(logLevelInfo_e,"ImageBuffer",msgStr.str().c_str()); return false; } writeFp = fopen(saveFileName[1],"w"); if(writeFp == NULL) { //printf("cannot open the %s file\n",saveFileName[1]); std::stringstream msgStr; msgStr << "cannot open the "<< saveFileName[1] << "file"; logPrintf(logLevelInfo_e,"ImageBuffer",msgStr.str().c_str()); return false; } writeFileFlag = true; } return true; }
void databaseInVehicle::reduceFurnitureTlv(IN uint8* tlvBuff, IN uint32 buffLen) { void* inputLoc = tlvBuff; void** input = &inputLoc; uint8 segExistFlag; segAttributes_t segAttr; _mEndPosition = tlvBuff + buffLen; furAttributesInVehicle_t furAttr; readTlvToFurniture(input, memory_e, &furAttr); getSegmentByGps(&(furAttr.location), &segExistFlag, &segAttr); if(segExistFlag == 1) { reduceFurnitureByFurId(&furAttr); string furTypeString = "Furniture \""; furTypeString += ID2Name(furAttr.type); logPrintf(logLevelInfo_e, "DB_UPDATE", furTypeString, FOREGROUND_BLUE | FOREGROUND_GREEN); } else { logPrintf(logLevelError_e, "DATABASE", "Segment ID not found when reduce", FOREGROUND_RED); } }
bool ImageBuffer::openReadFiles_nofilter(void) { if(!readFileFlag) { reader.open(saveFileName[0]); if(!reader.isOpened()) { //printf("cannot open reader %s file\n",saveFileName[0]); std::stringstream msgStr; msgStr << "cannot open reader "<< saveFileName[0] << "file"; logPrintf(logLevelInfo_e,"ImageBuffer",msgStr.str().c_str()); return false; } readFp = fopen(saveFileName[1],"r"); if(readFp == NULL) { //printf("cannot open the reader %s file\n",saveFileName[1]); std::stringstream msgStr; msgStr << "cannot open reader "<< saveFileName[1] << "file"; logPrintf(logLevelInfo_e,"ImageBuffer",msgStr.str().c_str()); return false; } readFileFlag = true; return true; } return false; }
void App::onInit() { setScene(Scene::create()); logPrintf("App::onInit()\n"); createDeveloperHUD(); showRenderingStats = false; developerWindow->cameraControlWindow->setVisible(false); developerWindow->setVisible(false); developerWindow->videoRecordDialog->setCaptureGui(false); m_debugCamera->filmSettings().setAntialiasingEnabled(true); if (filename != "") { window()->setCaption(filenameBaseExt(filename) + " - G3D Viewer"); } lighting = shared_ptr<LocalLightingEnvironment>(new LocalLightingEnvironment()); lighting->lightArray.clear(); // The spot light is designed to just barely fit the 3D models. Note that it has no attenuation lighting->lightArray.append(Light::spotTarget("Light", Point3(20, 200, 20), Point3::zero(), 8 * units::degrees(), Power3(25.0f), 1, 0, 0, true, 8192)); lighting->environmentMapArray.append(ScaledTexture(Texture::fromFile(System::findDataFile("uffizi/uffizi*.jpg"), ImageFormat::SRGB8(), Texture::DIM_CUBE_MAP, Texture::Settings::cubeMap()), 0.65f)); lighting->ambientOcclusionSettings.numSamples = 24; // High-quality AO lighting->ambientOcclusionSettings.radius = 1.6f * units::meters(); lighting->ambientOcclusionSettings.intensity = 1.0f; lighting->ambientOcclusionSettings.bias = 0.002f * units::meters(); m_debugCamera->setFarPlaneZ(-1000); m_debugCamera->setNearPlaneZ(-0.05f); // Don't clip to the near plane glDisable(GL_DEPTH_CLAMP); colorClear = Color3::white() * 0.9f; //modelController = ThirdPersonManipulator::create(); setViewer(filename); logPrintf("Done App::onInit()\n"); }
EwaldPeriodic(const matrix3<>& R, int nAtoms) : R(R), G((2*M_PI)*inv(R)), RTR((~R)*R), GGT(G*(~G)) { logPrintf("\n---------- Setting up ewald sum ----------\n"); //Determine optimum gaussian width for Ewald sums: // From below, the number of reciprocal cells ~ Prod_k |R.column[k]| // and number of real space cells ~ Prod_k |G.row[k]| // including the fact that the real space cost ~ Natoms^2/cell // and the reciprocal space cost ~ Natoms/cell sigma = 1.; for(int k=0; k<3; k++) sigma *= R.column(k).length() / G.row(k).length(); sigma = pow(sigma/std::max(1,nAtoms), 1./6); logPrintf("Optimum gaussian width for ewald sums = %lf bohr.\n", sigma); //Carry real space sums to Rmax = 10 sigma and Gmax = 10/sigma //This leads to relative errors ~ 1e-22 in both sums, well within double precision limits for(int k=0; k<3; k++) { Nreal[k] = 1+ceil(CoulombKernel::nSigmasPerWidth * G.row(k).length() * sigma / (2*M_PI)); Nrecip[k] = 1+ceil(CoulombKernel::nSigmasPerWidth * R.column(k).length() / (2*M_PI*sigma)); } logPrintf("Real space sum over %d unit cells with max indices ", (2*Nreal[0]+1)*(2*Nreal[1]+1)*(2*Nreal[2]+1)); Nreal.print(globalLog, " %d "); logPrintf("Reciprocal space sum over %d terms with max indices ", (2*Nrecip[0]+1)*(2*Nrecip[1]+1)*(2*Nrecip[2]+1)); Nrecip.print(globalLog, " %d "); }
void matrix::svd(matrix& U, diagMatrix& S, matrix& Vdag) const { static StopWatch watch("matrix::svd"); watch.start(); //Initialize input and outputs: matrix A = *this; //destructible copy int M = A.nRows(); int N = A.nCols(); U.init(M,M); Vdag.init(N,N); S.resize(std::min(M,N)); //Initialize temporaries: char jobz = 'A'; //full SVD (return complete unitary matrices) int lwork = 2*(M*N + M + N); std::vector<complex> work(lwork); std::vector<double> rwork(S.nRows() * std::max(5*S.nRows()+7, 2*(M+N)+1)); std::vector<int> iwork(8*S.nRows()); //Call LAPACK and check errors: int info=0; zgesdd_(&jobz, &M, &N, A.data(), &M, S.data(), U.data(), &M, Vdag.data(), &N, work.data(), &lwork, rwork.data(), iwork.data(), &info); if(info>0) //convergence failure; try the slower stabler version { int info=0; matrix A = *this; //destructible copy zgesvd_(&jobz, &jobz, &M, &N, A.data(), &M, S.data(), U.data(), &M, Vdag.data(), &N, work.data(), &lwork, rwork.data(), &info); if(info<0) { logPrintf("Argument# %d to LAPACK SVD routine ZGESVD is invalid.\n", -info); stackTraceExit(1); } if(info>0) { logPrintf("Error code %d in LAPACK SVD routine ZGESVD.\n", info); stackTraceExit(1); } } if(info<0) { logPrintf("Argument# %d to LAPACK SVD routine ZGESDD is invalid.\n", -info); stackTraceExit(1); } watch.stop(); }
double LatticeMinimizer::compute(matrix3<>* grad) { //Check for large lattice strain if(sqrt(dot(strain, strain)) > GridInfo::maxAllowedStrain) { logPrintf("\nBacking of lattice step since strain tensor has become enormous:\n"); strain.print(globalLog, "%10lg "); logPrintf("If this is a physical strain, restart calculation with these lattice vectors to prevent Pulay errors:\n"); e.gInfo.printLattice(); logPrintf("\n"); return NAN; } if(not e.iInfo.checkPositions()) { logPrintf("\nBacking off lattice step since it caused pseudopotential core overlaps.\n"); return NAN; } //! Run an ionic minimizer at the current strain IonicMinimizer ionicMinimizer(e); ionicMinimizer.minimize(e.ionicMinParams); //! If asked for, returns the gradient of the strain tensor if(grad) { //! Loop over all basis vectors and get the gradient. *grad = matrix3<>(); auto stress = calculateStress(); for(size_t i=0; i<strainBasis.size(); i++) *grad += stress[i]*strainBasis[i]; e.gInfo.R = Rorig + Rorig*strain; updateLatticeDependent(); } return relevantFreeEnergy(e); }
bool RUHandlerConfig::Load (CfgList *sidecfg) { CfgList *c = dynamic_cast<CfgList*>(sidecfg->GetValue ("ResourceInfo")); BuildTable *tbl = &buildTable; if (c) { EnergyBuildRatio = c->GetNumeric ("EnergyBuildRatio", 1.4); MetalBuildRatio = c->GetNumeric ("MetalBuildRatio", 0.8); CfgList *ebh = dynamic_cast<CfgList*>(c->GetValue ("EnergyBuildHeuristic")); if (ebh) EnergyHeuristic.Load (ebh); CfgList *mbh = dynamic_cast<CfgList*>(c->GetValue ("MetalBuildHeuristic")); if (mbh) MetalHeuristic.Load (mbh); ParseDefList (c->GetValue ("EnergyMakers"), EnergyMakers, tbl); ParseDefList (c->GetValue ("MetalMakers"), MetalMakers, tbl); ParseDefList (c->GetValue ("MetalExtracters"), MetalExtracters, tbl); // Read storage config CfgList *st = dynamic_cast<CfgList*>(c->GetValue("Storage")); if (st) { ParseDefList (st->GetValue ("MetalStorage"), StorageConfig.MetalStorage, tbl); if (StorageConfig.MetalStorage.empty ()) { logPrintf ("Error: No metal storage unit type given"); return false; } ParseDefList (st->GetValue ("EnergyStorage"), StorageConfig.EnergyStorage, tbl); if (StorageConfig.EnergyStorage.empty ()) { logPrintf ("Error: No energy storage unit type given"); return false; } StorageConfig.MaxRatio = st->GetNumeric ("MaxRatio", 0.9); StorageConfig.MinEnergyIncome = st->GetNumeric ("MinEnergyIncome", 60); StorageConfig.MinMetalIncome = st->GetNumeric ("MinMetalIncome", 5); StorageConfig.MaxEnergyFactor = st->GetNumeric ("MaxEnergyStorageFactor", 20); StorageConfig.MaxMetalFactor = st->GetNumeric ("MaxMetalStorageFactor", 20); } CfgList *ep = dynamic_cast<CfgList*>(c->GetValue("EnablePolicy")); if (ep) { EnablePolicy.MaxEnergy = ep->GetNumeric ("MaxEnergy"); EnablePolicy.MinEnergy = ep->GetNumeric ("MinEnergy"); EnablePolicy.MinUnitEnergyUsage = ep->GetNumeric ("MinUnitEnergyUsage"); } } else { logPrintf ("Error: No list node named \'ResourceInfo\' was found.\n"); return false; } return true; }
void printStatus(Everything& e, int iRep) { const Phonon& phonon = ((const PhononEverything&)e).phonon; logPrintf(" \\\n\tsupercell %d %d %d", phonon.sup[0], phonon.sup[1], phonon.sup[2]); logPrintf(" \\\n\tdr %lg", phonon.dr); logPrintf(" \\\n\tT %lg", phonon.T/Kelvin); logPrintf(" \\\n\tFcut %lg", phonon.Fcut); }
unsigned int __stdcall Thread_Receive_Message(void *data) { uint8 recvBuff[RECV_MAX_BYTE_NUM]; messageProcessClass msgRecv; while(1) { int len = sizeof(struct sockaddr); // receive message from clients sockaddr_in from; int recvRet = recvfrom(sockServer,(char*)recvBuff,RECV_MAX_BYTE_NUM,0,(SOCKADDR*)&from,&len); if ((recvRet == INVALID_SOCKET) || (recvRet == 0)) { logPrintf(logLevelError_e,"RECEIVE_MESSAGE","Receive message from client failed!"); } else { int32 msgType = *((uint32*)recvBuff); char charBuff[10]; logPrintf(logLevelInfo_e,"RECEIVE_MESSAGE","Receive message from client OK"); // process received message msgRecv.prcocessRecvMsg((uint32*)recvBuff); messageQueue_gp->push(&msgRecv); ReleaseSemaphore(g_readySema_msgQueue,1,NULL); } } return 0; }
void wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt) { bss_t *bss, *nextBss; A_UINT8 myBssid[IEEE80211_ADDR_LEN]; A_UINT32 timeoutValue = 0; A_UINT32 now = A_GET_MS(0); timeoutValue = nt->nt_nodeAge; wmi_get_current_bssid(nt->nt_wmip, myBssid); bss = nt->nt_node_first; while (bss != NULL) { nextBss = bss->ni_list_next; if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) { if (((now - bss->ni_tstamp) > timeoutValue) || --bss->ni_actcnt == 0) { PBYTE pIE; char a[128]; A_UINT32 length, ch, freq; //wchar_t b[128] = {0}; pIE = bss->ni_cie.ie_ssid; length = pIE[1]; memcpy( a, &pIE[2], length ); a[length] = '\0'; //MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, a, 32, b, 64 ); freq = bss->ni_cie.ie_chan; if (freq == 2484) ch = 14; else if (freq < 2484) ch = (freq - 2407) / 5; else if (freq < 5000) ch = 15 + ((freq - 2512) / 20); else ch = (freq - 5000) / 5; RETAIL_DEBUG_PRINTF(debugBssInfo, (TEXT("builder:ar6k2: remove bss info, SSID = %S, RSSI = %d, CHANNEL = %d\r\n"), a, bss->ni_rssi, ch)); RETAIL_DEBUG_PRINTF(debugBssInfo, (TEXT("builder:ar6k2: BSSID = %02x:%02x:%02x:%02x:%02x:%02x \r\n") , bss->ni_macaddr[0], bss->ni_macaddr[1], bss->ni_macaddr[2], bss->ni_macaddr[3], bss->ni_macaddr[4], bss->ni_macaddr[5])); logPrintf( (debugFileLog && debugBssInfo), "builder:ar6k2: remove bss info, SSID = %s, RSSI = %d, CHANNEL = %d\r\n", a, bss->ni_rssi, ch); logPrintf( (debugFileLog && debugBssInfo), "builder:ar6k2: BSSID = %02x:%02x:%02x:%02x:%02x:%02x \r\n", bss->ni_macaddr[0], bss->ni_macaddr[1], bss->ni_macaddr[2], bss->ni_macaddr[3], bss->ni_macaddr[4], bss->ni_macaddr[5]); /* * free up all but the current bss - if set */ wlan_node_reclaim(nt, bss); } } bss = nextBss; } }
bool NetworkDevice::init() { debugAssert(! initialized); logPrintf("Network Startup"); logPrintf("Starting WinSock networking.\n"); WSADATA wsda; WSAStartup(MAKEWORD(G3D_WINSOCK_MAJOR_VERSION, G3D_WINSOCK_MINOR_VERSION), &wsda); std::string hostname = "localhost"; { char ac[128]; if (gethostname(ac, sizeof(ac)) == -1) { logPrintf("Warning: Error while getting local host name\n"); } else { hostname = gethostbyname(ac)->h_name; } } EthernetAdapter a; a.hostname = hostname; a.name = ""; a.ip = NetAddress(hostname, 0).ip(); // TODO: Find subnet on Win32 a.subnet = 0x0000FFFF; // TODO: Find broadcast on Win32 a.broadcast = 0xFFFFFFFF; // TODO: find MAC on Win32 addAdapter(a); std::string machine = localHostName(); std::string addr = NetAddress(machine, 0).ipString(); logPrintf( "Network:\n" " Status: %s\n" " Loaded winsock specification version %d (%d is " "the highest available)\n" " %d sockets available\n" " Largest UDP datagram packet size is %d bytes\n\n", wsda.szDescription, wsda.szSystemStatus, wsda.wVersion, wsda.wHighVersion, wsda.iMaxSockets, wsda.iMaxUdpDg); // TODO: WSAIoctl for subnet and broadcast addresses // http://msdn.microsoft.com/en-us/library/ms741621(VS.85).aspx // // TODO: SIO_GET_INTERFACE_LIST initialized = true; return true; }
void NetworkDevice::_cleanup() { debugAssert(initialized); logPrintf("Network Cleanup"); # ifdef G3D_WIN32 WSACleanup(); # endif logPrintf("Network cleaned up."); }
void convergeEmptyStates(Everything& e) { logPrintf("Converging empty states (this may take a while): "); logFlush(); std::vector<diagMatrix> eigsPrev = e.eVars.Hsub_eigs; logSuspend(); e.elecMinParams.fpLog = nullLog; bandMinimize(e); //this will also set state to eigenvectors logResume(); e.elecMinParams.fpLog = globalLog; e.ener.Eband = 0.; //only affects printing (if non-zero Energies::print assumes band structure calc) logPrintf("|deigs|: %.3e\n", SCF::eigDiffRMS(e.eVars.Hsub_eigs, eigsPrev, e)); logFlush(); }
bool LatticeMinimizer::report(int iter) { logPrintf("\n"); e.gInfo.printLattice(); e.gInfo.printReciprocalLattice(); logPrintf("\nStrain Tensor = \n"); strain.print(globalLog, "%10lg "); logPrintf("\n"); e.dump(DumpFreq_Lattice, iter); return false; }
void CALLBACK midiCallback(HMIDIIN handle, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) { debugPrintf(1, "callback called %d, handle %p\n", uMsg, handle); switch (uMsg) { case MIM_DATA: midiReceive(SHORT_MSG_STATUS(dwParam1)); midiReceive(SHORT_MSG_BYTE1(dwParam1)); midiReceive(SHORT_MSG_BYTE2(dwParam1)); break; case MIM_LONGDATA: { MIDIHDR *midiHdr = (MIDIHDR *)dwParam1; if (midiHdr->dwBytesRecorded == 0) { return; } unsigned int len = 0; sleepCount = 0; for (len = 0; len < midiHdr->dwBufferLength; len++) { midiReceive(midiHdr->lpData[len]); if (((unsigned char)midiHdr->lpData[len]) == 0xF7) break; } midiInUnprepareHeader(handle, midiHdr, sizeof(*midiHdr)); midiInPrepareHeader(handle, midiHdr, sizeof(*midiHdr)); midiInAddBuffer(handle, midiHdr, sizeof(*midiHdr)); } break; case MIM_MOREDATA: // XXX set IO_STATUS flag to midiInOpen() debugPrintf(1, "midi driver is throwing away received data: %x %x %x\n", SHORT_MSG_STATUS(dwParam1), SHORT_MSG_BYTE1(dwParam1), SHORT_MSG_BYTE2(dwParam1)); break; case MIM_ERROR: logPrintf(LOG_ERROR, "error\n"); break; case MIM_LONGERROR: { logPrintf(LOG_ERROR, "long error\n"); } break; default: debugPrintf(1, "received event %x\n", uMsg); /* ignore */ return; } }
void App::onInit() { GApp::onInit(); renderDevice->setSwapBuffersAutomatically(true); logPrintf("App::onInit()\n"); createDeveloperHUD(); showRenderingStats = false; developerWindow->cameraControlWindow->setVisible(false); developerWindow->setVisible(false); developerWindow->videoRecordDialog->setCaptureGui(false); m_debugCamera->filmSettings().setBloomStrength(0.20f); m_debugCamera->filmSettings().setBloomRadiusFraction(0.017f); m_debugCamera->filmSettings().setAntialiasingEnabled(true); m_debugCamera->filmSettings().setCelluloidToneCurve(); if (! filename.empty()) { window()->setCaption(filenameBaseExt(filename) + " - G3D Viewer"); } lighting = shared_ptr<LightingEnvironment>(new LightingEnvironment()); lighting->lightArray.clear(); // The spot light is designed to just barely fit the 3D models. Note that it has no attenuation lighting->lightArray.append(Light::spotTarget("Light", Point3(40, 120, 80), Point3::zero(), 10 * units::degrees(), Power3(50.0f), 1, 0, 0, true, 8192)); lighting->lightArray.last()->shadowMap()->setBias(0.1f); Texture::Encoding e; e.readMultiplyFirst = Color4(Color3(0.5f)); e.format = ImageFormat::RGB32F(); lighting->environmentMapArray.append(Texture::fromFile(System::findDataFile("uffizi/uffizi-*.exr"), e, Texture::DIM_CUBE_MAP)); lighting->ambientOcclusionSettings.numSamples = 24; lighting->ambientOcclusionSettings.radius = 0.75f * units::meters(); lighting->ambientOcclusionSettings.intensity = 2.0f; lighting->ambientOcclusionSettings.bias = 0.06f * units::meters(); lighting->ambientOcclusionSettings.useDepthPeelBuffer = true; m_debugCamera->setFarPlaneZ(-finf()); m_debugCamera->setNearPlaneZ(-0.05f); // Don't clip to the near plane glDisable(GL_DEPTH_CLAMP); colorClear = Color3::white() * 0.9f; //modelController = ThirdPersonManipulator::create(); m_gbufferSpecification.encoding[GBuffer::Field::CS_POSITION_CHANGE].format = NULL; gbuffer()->setSpecification(m_gbufferSpecification); setViewer(filename); developerWindow->sceneEditorWindow->setVisible(false); logPrintf("Done App::onInit()\n"); }
std::vector< double > LatticeMinimizer::calculateStress() { std::vector<double> stress(strainBasis.size()); logPrintf("\nCalculating stress tensor... "); logFlush(); for(size_t i=0; i<strainBasis.size(); i++) stress[i] = centralDifference(strainBasis[i]); logPrintf(" done!\n"); return stress; }
void CAR6KMini::WMIReadyIndication( IN PBYTE pMacAddress, IN A_UINT8 phyCap, IN A_UINT32 vers) { memcpy(m_PermanentAddress, pMacAddress, ETHERNET_MAC_ADDRESS_LENGTH); memcpy(m_CurrentAddress, pMacAddress, ETHERNET_MAC_ADDRESS_LENGTH); switch (phyCap) { case WMI_11A_CAPABILITY: m_NetworkTypeInUse = Ndis802_11OFDM5; m_80211PhyCapability = mode_11aOnly; break; case WMI_11G_CAPABILITY: m_NetworkTypeInUse = Ndis802_11OFDM24; m_80211PhyCapability = mode_11g; break; case WMI_11AG_CAPABILITY: m_NetworkTypeInUse = Ndis802_11OFDM5; m_80211PhyCapability = mode_11ag; break; default: m_NetworkTypeInUse = Ndis802_11DS; m_80211PhyCapability = mode_11g; break; } if(m_80211PhyCapability == mode_11g) { m_queryphyMode = WMI_11G_MODE; } if(m_80211PhyCapability == mode_11ag) { m_queryphyMode = WMI_11AG_MODE; } ATHR_DISPLAY_MSG (L"WLAN ID VERSION ==> %x\n", vers); logPrintf (ATH_LOG_INF, "WLAN ID VERSION ==> %x\n", vers); //if ((AR6K_SW_VERSION == vers) || (0x270F == (vers & 0xFFFF))) if ( ((AR6K_SW_VERSION & 0xffff00ff) == vers) || (0x270F == (vers & 0xFFFF))) { m_WMIReady = TRUE; NdisSetEvent(&m_WMIReadyEvent); } else { ATHR_DISPLAY_MSG (L"*** Driver (%x) WLAN (%x) version mismatch ***\n", AR6K_SW_VERSION, vers); logPrintf (ATH_LOG_INF, "*** Driver (%x) WLAN (%x) version mismatch ***\n", AR6K_SW_VERSION, vers); } }
OPENGL_API GLint WINAPI glRenderMode(GLenum mode) { switch (mode) { default: case GL_RENDER: return 0; case GL_SELECT: logPrintf("WARNING: glRenderMode: GL_SELECT is not supported\n"); return 0; case GL_FEEDBACK: logPrintf("WARNING: glRenderMode: GL_FEEDBACK is not supported\n"); return 0; } }
void databaseInVehicle::reduceFurnitureByFurId(IN furAttributesInVehicle_t* furnitureAttr) { WaitForSingleObject(_hMutexMemory,INFINITE); uint8 furExistFlag = 0; if(furnitureAttr->furId_used == 1) { list<list<furAttributesInVehicle_t>>::iterator segIter = _furnitureList.begin(); // For each segment while(segIter != _furnitureList.end()) { list<furAttributesInVehicle_t>::iterator furIter = (*segIter).begin(); // For each furniture in the segment while(furIter != (*segIter).end()) { if((*furIter).furId == furnitureAttr->furId) { // Update furniture to existing furniturelist in database furExistFlag = 1; *furIter = *furnitureAttr; break; } furIter++; } if(furExistFlag == 1) { break; } segIter++; } if(furExistFlag == 0) { logPrintf(logLevelNotice_e, "DATABASE", "Furniture ID not found when reduce", FOREGROUND_RED); } }else { logPrintf(logLevelNotice_e, "DATABASE", "Furniture ID is invalid when reduce", FOREGROUND_RED); } ReleaseMutex(_hMutexMemory); }
void printStatus(Everything& e, int iRep) { CoulombParams& cp = e.coulombParams; logPrintf("%s", truncationTypeMap.getString(cp.geometry)); if(cp.geometry==CoulombParams::Periodic) return; //no parameters //Print direction for the partially periodic modes: if(cp.geometry==CoulombParams::Slab || cp.geometry==CoulombParams::Wire || cp.geometry==CoulombParams::Cylindrical) logPrintf(" %s", truncationDirMap.getString(cp.iDir)); //Print optional radius for the cylindrical/spherical modes: if(cp.geometry==CoulombParams::Cylindrical || cp.geometry==CoulombParams::Spherical) logPrintf(" %lg", cp.Rc); }
/* * logMemManInfo */ static void logMemManInfo( DWORD procid ) { MemByType imageinfo; MemInfo meminfo; SYSTEM_INFO sysinfo; DWORD i; logPrintf( STR_VIRTUAL_MEM_INFO ); GetSystemInfo( &sysinfo ); logPrintf( STR_VIRTUAL_PAGE_SIZE, INDENT, "", sysinfo.dwPageSize, sysinfo.dwPageSize / 1024 ); if( GetMemInfo( procid, &meminfo ) ) { logPrintf( STR_RESERVED_MEM, INDENT, "" ); logMemManClass( &meminfo.res ); logPrintf( STR_COMMITTED_MEM, INDENT, "" ); logMemManClass( &meminfo.mapped ); logPrintf( STR_IMAGE_ADDR_SPACE_FOR, INDENT, "", TOTAL_MEM_STR ); logMemManClass( &meminfo.image ); for( i=0; i < meminfo.modcnt; i++ ) { logPrintf( STR_IMAGE_ADDR_SPACE_FOR, INDENT, "", meminfo.modlist[i] ); if( GetImageMemInfo( procid, meminfo.modlist[i], &imageinfo ) ) { logMemManClass( &imageinfo ); } else { logPrintf( STR_NOT_AVAILABLE, 2 * INDENT, "" ); } } FreeModuleList( meminfo.modlist, meminfo.modcnt ); } else { logPrintf( STR_NOT_AVAILABLE, INDENT, "" ); } }
void onTimer(int value) { int len = sizeof(struct sockaddr); if(portToVehiList.size() != 0) { list<portToVehi_t>::iterator portListIdx = portToVehiList.begin(); while(portListIdx != portToVehiList.end()) { //int vehicleIdx; //for(vehicleIdx = 0;vehicleIdx < portListIdx->vehiNum; ++vehicleIdx) { uint64 clientId = portListIdx->vehicleId; diffMsgHeader_t* msgTempPtr = (diffMsgHeader_t*)(sendBuff[value - TIMER_START_VALUE]); msgTempPtr->vehicleID = clientId; int sendRet = sendto(sockClient,(char*)sendBuff[value - TIMER_START_VALUE],sendMsgLen[value - TIMER_START_VALUE],0,(SOCKADDR*)&(portListIdx->client),len); if ((sendRet == INVALID_SOCKET)|| (sendRet == 0)) { logPrintf(logLevelError_e,"UPDATE_MSG","Send message to client failed!"); } else { logPrintf(logLevelInfo_e,"UPDATE_MSG","<<<< Send message to client OK"); } } ++portListIdx; } } else { list<SOCKADDR_IN>::iterator clientListIdx = clientList.begin(); while(clientListIdx != clientList.end()) { //uint64 clientId = clientListIdx->vehicleId; diffMsgHeader_t* msgTempPtr = (diffMsgHeader_t*)(sendBuff[value - TIMER_START_VALUE]); msgTempPtr->vehicleID = 0; int sendRet = sendto(sockClient,(char*)sendBuff[value - TIMER_START_VALUE],sendMsgLen[value - TIMER_START_VALUE],0,(SOCKADDR*)&(*clientListIdx),len); if ((sendRet == INVALID_SOCKET)|| (sendRet == 0)) { logPrintf(logLevelError_e,"UPDATE_MSG","Send message to client failed!"); } else { logPrintf(logLevelInfo_e,"UPDATE_MSG","<<<< Send message to client OK"); } ++clientListIdx; } } }
void midiInitialize(char *inputDeviceStr, char *outputDeviceStr) { int inputDevice = atoi(inputDeviceStr); int outputDevice = atoi(outputDeviceStr); char name[256]; getOutDeviceName(outputDevice, name, sizeof(name)); unsigned long result = midiOutOpen(&outHandle, outputDevice, 0, 0, CALLBACK_NULL); if (result) { logPrintf(LOG_ERROR, "Error opening output device %s with ID %d, aborting\n", name, outputDevice); exit(-1); } else { debugPrintf(1, "Opened output device %s.\n", name); } getInDeviceName(inputDevice, name, sizeof(name)); result = midiInOpen(&inHandle, inputDevice, (DWORD)midiCallback, 0, CALLBACK_FUNCTION); if (result) { logPrintf(LOG_ERROR, "Error opening input device %s with ID %d, aborting\n", name, inputDevice); exit(-1); } else { debugPrintf(1, "Opened input device %s.\n", name); } sleepCount = 0; midiHdr.lpData = inputBuffer; midiHdr.dwBufferLength = sizeof(inputBuffer); midiHdr.dwFlags = 0; result = midiInPrepareHeader(inHandle, &midiHdr, sizeof(MIDIHDR)); if (result) { logPrintf(LOG_ERROR, "Could not prepare input buffer\n"); exit(-1); } result = midiInAddBuffer(inHandle, &midiHdr, sizeof(MIDIHDR)); if (result) { logPrintf(LOG_ERROR, "could not add input buffer\n"); exit(-1); } result = midiInStart(inHandle); if (result) { logPrintf(LOG_ERROR, "Could not start recording on input\n"); exit(-1); } }
bool findAndRenamePrefix(const std::vector<std::string>& files, const std::string& oldPrefix, const std::string& newPrefix) { const size_t oldPrefixLen = oldPrefix.length(); for (std::string file : files) { logPrintf("Considering %s\n", file.c_str()); if (hasPrefix(file, oldPrefix)) { std::string newName = PayloadPath + newPrefix + file.substr(oldPrefixLen); file = PayloadPath + file; logPrintf("%s -> %s", file.c_str(), newName.c_str()); if (std::rename(file.c_str(), newName.c_str()) != 0) { std::perror((std::string("Could not rename ") + newName).c_str()); } } } return true; }
bool ForceConfig::ParseForceGroup (CfgList *cfg, const string& name) { groups.push_front (Group()); Group& g = groups.front (); g.name = name; CfgBuildOptions *units = dynamic_cast <CfgBuildOptions*> (cfg->GetValue ("units")); if (units) { if (!units->InitIDs ()) { groups.pop_front(); return false; } } else { logPrintf ("Error: Force group %s has no units\n", name.c_str()); groups.pop_front(); return false; } g.units = units; g.name = name; g.category = cfg->GetInt ("category", 0); g.level = cfg->GetInt ("level", 0); g.batchsize = cfg->GetInt ("batchsize", 1); g.minenergy = cfg->GetNumeric ("minenergy", -1.0f); g.minmetal = cfg->GetNumeric ("minmetal",-1.0f); g.maxspread = cfg->GetNumeric ("maxspread",defaultSpread); g.groupdist = cfg->GetNumeric ("groupdist",g.maxspread * 0.5f); if (g.minenergy == -1.0f && g.minmetal == -1.0f) logPrintf ("Warning: minmetal or minenergy not set for force group %s\n", name.c_str()); if (g.minenergy < 0.0f) g.minenergy = 0.0f; if (g.minmetal < 0.0f) g.minmetal = 0.0f; const char *str = cfg->GetLiteral ("task", "attackdefend"); for (int a=0;forcetasktbl [a].name; a++) if (!STRCASECMP (forcetasktbl [a].name, str)) { g.task=forcetasktbl[a].task; break; } logPrintf ("Parsed force group: %s\n", name.c_str()); return true; }
// // places a fully produced instance of the vehicle // type based on type of vehicle and current other // vehicles locations // void CAIInitPos::PlaceVehicle( CAIUnit *pUnit, int iVeh ) { // yield for the music's sake theApp.BaseYield(); CHexCoord hexPlace(0,0); GetVehInitPosHex( iVeh, hexPlace ); if( !hexPlace.Y() && !hexPlace.X() ) return; // BUGBUG place fake vehicle in map array m_pMap->PlaceFakeVeh( hexPlace, iVeh ); // only placement updates the unit's params pUnit->SetParam( CAI_TYPEVEHICLE, iVeh ); pUnit->SetParam( CAI_LOC_X, hexPlace.X() ); pUnit->SetParam( CAI_LOC_Y, hexPlace.Y() ); #ifdef _LOGOUT logPrintf(LOG_PRI_ALWAYS, LOG_AI_MISC, "PlaceVehicle:: id=%ld type=%d at %d,%d ", pUnit->GetID(), iVeh, hexPlace.X(), hexPlace.Y() ); #endif // message to place unit and cause CVehicle to be created //CMsgPlaceVeh (int iType, CHexCoord const & hex, CHexCoord const & hexDest); //CMsgPlaceVeh (CHexCoord const & hexVeh, CHexCoord const & hexDest, //int iPlyr, int iType); CMsgPlaceVeh msg( hexPlace, hexPlace, m_iPlayer, iVeh ); msg.m_dwID = pUnit->GetID(); theGame.PostToServer( (CNetCmd *)&msg, sizeof(CMsgPlaceVeh) ); // send message to self that this is a new vehicle }
/* * logDumpMemItem */ static void logDumpMemItem( HANDLE prochdl, MEMORY_BASIC_INFORMATION *mbi ) { char data[MEM_DMP_WIDTH + 1]; DWORD offset; DWORD limit; DWORD bytesleft; BOOL ret; offset = (DWORD)mbi->BaseAddress; limit = offset + mbi->RegionSize; data[ MEM_DMP_WIDTH ] = '\0'; ret = ReadProcessMemory( prochdl, (void *)offset, data, MEM_DMP_WIDTH, NULL ); if( !ret ) { logPrintf( STR_CANT_READ_MEM ); return; } for( ;; ) { logMemLine( data, offset, MEM_DMP_WIDTH ); offset += MEM_DMP_WIDTH; if( offset + MEM_DMP_WIDTH > limit ) break; ReadProcessMemory( prochdl, (void *)offset, data, MEM_DMP_WIDTH, NULL ); } if( offset < limit ) { bytesleft = limit - offset; ReadProcessMemory( prochdl, (void *)offset, data, bytesleft, NULL ); logMemLine( data, offset, bytesleft ); } }