/* * Class: uniquantum_search_SearchModule * Method: GetCatePoiCount * Signature: (Ljava/lang/String;IZ)I */ JNIEXPORT jint JNICALL Java_kr_co_uniquantum_search_SearchModule_GetCatePoiCount (JNIEnv * env, jobject obj, jstring code, jint cateType, jboolean addData ) { m_pPoiDatas = NULL; //m_pPoiDatasIterator = NULL; m_bChangedPoiIterator = true; g_poiHeaderIdx = -1; int nSidoIdx = -1; DONG_DATA * pDong = NULL; u32 nMeshCode = 0; CString strCode( env, &code ); char * cateCode = ( char * ) strCode.toString(); char * pCode1 = strtok( cateCode, "-"); char * pCode2 = strtok( NULL, "-"); char * pCode3 = strtok( NULL, "-"); u16 code1 = pCode1[0] - 'A'; u16 code2 = (u16) atoi( pCode2 ); u16 code3 = pCode3 == NULL ? 0 : strlen( pCode3 ) < 1 ? 0 : (u16)atoi( pCode3 ); switch( cateType ) { case 0 : // 시도 // 현재 시도가 어딘지 찾는다. nSidoIdx = 0; m_pPoiDatas = g_pSearchModule->SearchPoiCateSido( nSidoIdx, code1, code2, code3, !addData ); break; case 1 : // 동 // 현재 동이 어딘지 찾는다. pDong = NULL; m_pPoiDatas = g_pSearchModule->SearchPoiCateDong( pDong, code1, code2, code3, !addData ); break; case 2 : // 메쉬 // 현재 메쉬 주변값을 찾는다. nMeshCode = 0; m_pPoiDatas = g_pSearchModule->SearchPoiCateMesh( nMeshCode, code1, code2, code3, !addData ); break; } if( m_pPoiDatas == NULL ) return 0; return (jint)(*m_pPoiDatas).size(); }
int CStockManager::RecvServerCalcData(AnsSeverCalculate* pData) { if (pData == NULL || ::IsBadReadPtr(pData, sizeof(AnsSeverCalculate))) { return -1; } CSingleLock lock(&m_mutexStock); if (lock.Lock()) { int nCount = pData->m_nSize; SeverCalculateData* pSrvCalData = (SeverCalculateData*)pData->m_cData; for (int i = 0; i < nCount; i ++) { SeverCalculateData* pDataCur = &pSrvCalData[i]; if ( pDataCur == NULL ) continue; int nIndex = -1; char cCode[7]; memset(cCode,0,7); strncpy_s(cCode,pDataCur->m_cCode,6); CString strCode(cCode); m_mapIndex.Lookup(strCode, (CObject*&)nIndex); if ( nIndex >= 0 && nIndex < m_ayStocks.GetCount()) { CHSDSStockInfoIntact* pStock = m_ayStocks.GetAt(nIndex); if (pStock != NULL && memcmp(pStock->m_stockInfo.m_ciStockCode.m_cCode, pDataCur->m_cCode, sizeof(pStock->m_stockInfo.m_ciStockCode.m_cCode)) == 0 && pStock->m_stockInfo.m_ciStockCode.m_cCodeType == pDataCur->m_cCodeType) { pStock->m_stockInfo.m_fDownPrice = pDataCur->m_fDownPrice; pStock->m_stockInfo.m_fUpPrice = pDataCur->m_fUpPrice; } } } lock.Unlock(); } return 0; }
Shader(GLenum type, const std::string &filename, const std::string &defines) { RefCountedPtr<FileSystem::FileData> filecode = FileSystem::gameDataFiles.ReadFile(filename); if (!filecode.Valid()) Error("Could not load %s", filename.c_str()); std::string strCode(filecode->AsStringRange().ToString()); size_t found = strCode.find("#include"); while (found != std::string::npos) { // find the name of the file to include const size_t begFilename = strCode.find_first_of("\"", found + 8) + 1; const size_t endFilename = strCode.find_first_of("\"", begFilename + 1); const std::string incFilename = strCode.substr(begFilename, endFilename - begFilename); // check we haven't it already included it (avoids circular dependencies) const std::set<std::string>::const_iterator foundIt = previousIncludes.find(incFilename); if (foundIt != previousIncludes.end()) { Error("Circular, or multiple, include of %s\n", incFilename.c_str()); } else { previousIncludes.insert(incFilename); } // build path for include const std::string incPathBuffer = stringf("shaders/opengl/%0", incFilename); // read included file RefCountedPtr<FileSystem::FileData> incCode = FileSystem::gameDataFiles.ReadFile(incPathBuffer); assert(incCode.Valid()); if (incCode.Valid()) { // replace the #include and filename with the included files text strCode.replace(found, (endFilename + 1) - found, incCode->GetData(), incCode->GetSize()); found = strCode.find("#include"); } else { Error("Could not load %s", incPathBuffer.c_str()); } } // Store the modified text with the included files (if any) const StringRange code(strCode.c_str(), strCode.size()); // Build the final shader text to be compiled AppendSource(s_glslVersion); AppendSource(defines.c_str()); if (type == GL_VERTEX_SHADER) { AppendSource("#define VERTEX_SHADER\n"); } else { AppendSource("#define FRAGMENT_SHADER\n"); } AppendSource(code.StripUTF8BOM()); #if 0 static bool s_bDumpShaderSource = true; if (s_bDumpShaderSource) { const char SHADER_OUT_DIR_NAME[] = "shaders"; const char SHADER_OGL_OUT_DIR_NAME[] = "shaders/opengl"; FileSystem::userFiles.MakeDirectory(SHADER_OUT_DIR_NAME); FileSystem::userFiles.MakeDirectory(SHADER_OGL_OUT_DIR_NAME); const std::string outFilename(FileSystem::GetUserDir() + "/" + filename); FILE *tmp = fopen(outFilename.c_str(), "wb"); if(tmp) { Output("%s", filename); for( Uint32 i=0; i<blocks.size(); i++ ) { const char *block = blocks[i]; const GLint sizes = block_sizes[i]; if(block && sizes>0) { fprintf(tmp, "%.*s", sizes, block); } } fclose(tmp); } else { Output("Could not open file %s", outFilename.c_str()); } } #endif shader = glCreateShader(type); if(glIsShader(shader)!=GL_TRUE) throw ShaderException(); Compile(shader); // CheckGLSL may use OS::Warning instead of Error so the game may still (attempt to) run if (!check_glsl_errors(filename.c_str(), shader)) throw ShaderException(); };
PIN_GameControllerManager::PIN_GameControllerManager(PIN_ControlType* controlType, PIN_MappingList* mappingList, PIN_ControllerBaseList* masterControllerList ) : PIN_ManagerBase(controlType, mappingList, masterControllerList) { InitEvents(); std::string strKeyList(/*"\\b(?:"*/""); std::string strAxisList(""); bool firstItem = true; for(int x = SDL_CONTROLLER_BUTTON_A; x < SDL_CONTROLLER_BUTTON_MAX; x++) { PIN_String strButton = SDL_GameControllerGetStringForButton((SDL_GameControllerButton)x); if(!boost::equals(strButton,"")) { if(!firstItem) { strKeyList += "|"; } else { firstItem = false; } std::string strCode(strButton); strCode = PAUX_Extensors::regex_escape(strCode); strKeyList+= "(?:\\b" + strCode + "\\b)"; } } firstItem = true; for(int x = SDL_CONTROLLER_AXIS_LEFTX; x < SDL_CONTROLLER_AXIS_MAX; x++) { PIN_String strAxis = SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)x); if(!boost::equals(strAxis,"")) { strKeyList += "|"; if(!firstItem) { strAxisList += "|"; } else { firstItem = false; } std::string strCode(strAxis); strCode = PAUX_Extensors::regex_escape(strCode); strCode = "(?:(?<func>POS|NEG)\\()?(?<axis>\\b"+strCode+"\\b)\\)?";// //strCode = "(?:(?:(<func>POS|NEG)\\()?(<axis>" + strCode + ")(?'func'\\))?)"; //printf("Axis code: %s\n",strCode.c_str()); strAxisList += strCode; strKeyList+= strCode; } } //strKeyList+=")\\b"; _keyListRegex = boost::regex(strKeyList,boost::regex::perl|boost::regex::icase); _regexAxisString = boost::regex(strAxisList,boost::regex::perl|boost::regex::icase); //printf("Main regex: %s\n",_keyListRegex.str().c_str()); //printf("Axis regex: %s\n",_regexAxisString.str().c_str()); }
PIN_KeyboardManager::PIN_KeyboardManager(PIN_ControlType* controlType, PIN_MappingList* mappingList, PIN_ControllerBaseList* masterControllerList) : PIN_ManagerBase(controlType, mappingList, masterControllerList) { std::string strKeyList("\\b(?:"); bool firstItem = true; for(int x = SDL_SCANCODE_A; x <= SDL_SCANCODE_SLEEP; x++) { PIN_String strScanCode = SDL_GetScancodeName((SDL_Scancode)x); if(!boost::equals(strScanCode,"")) { if(!firstItem) { strKeyList += "|"; } else { firstItem = false; } std::string strCode(strScanCode); strCode = PAUX_Extensors::regex_escape(strCode); strKeyList+= "(?:" + strCode + ")"; } } strKeyList+=")\\b"; _keyListRegex = boost::regex(strKeyList,boost::regex::perl|boost::regex::icase); PIN_KeyList lstDef = controlType->DEFAULT_KEYS; if(_mappingList->size() == 0) { printf("No keyboard mappings. Assuming 1 controller.\n"); PIN_KeyboardController* ctrl = CreateKeyboardController(); ctrl->GlobalKeys[PIN_GK_UP] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_UP)); ctrl->GlobalKeys[PIN_GK_DOWN] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_DOWN)); ctrl->GlobalKeys[PIN_GK_LEFT] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_LEFT)); ctrl->GlobalKeys[PIN_GK_RIGHT] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_RIGHT)); ctrl->GlobalKeys[PIN_GK_ENTER] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_RETURN)); ctrl->GlobalKeys[PIN_GK_BACK] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE)); printf("Setting control type definitions...\n"); AssignKey(&(ctrl->GlobalKeys),PIN_GK_UP,lstDef,PIN_KEY_UP); AssignKey(&(ctrl->GlobalKeys),PIN_GK_DOWN,lstDef,PIN_KEY_DOWN); AssignKey(&(ctrl->GlobalKeys),PIN_GK_LEFT,lstDef,PIN_KEY_LEFT); AssignKey(&(ctrl->GlobalKeys),PIN_GK_RIGHT,lstDef,PIN_KEY_RIGHT); AssignKey(&(ctrl->GlobalKeys),PIN_GK_ENTER,lstDef,PIN_KEY_ENTER); AssignKey(&(ctrl->GlobalKeys),PIN_GK_BACK,lstDef,PIN_KEY_BACK); AddController(ctrl); printf("Done.\n"); } else { PIN_MappingList::iterator it; for(it = _mappingList->begin(); it!=_mappingList->end(); ++it) { PIN_Mapping* m = *it; PIN_KeyList m_keys = m->DEFAULT_KEYS; PIN_KeyboardController* ctrl = CreateKeyboardController(); printf("Creating controller ID 0x%xl for '%s'...\n",ctrl->ControllerID, m->NAME); ctrl->SourceMapping = m; ctrl->GlobalKeys[PIN_GK_UP] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_UP)); ctrl->GlobalKeys[PIN_GK_DOWN] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_DOWN)); ctrl->GlobalKeys[PIN_GK_LEFT] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_LEFT)); ctrl->GlobalKeys[PIN_GK_RIGHT] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_RIGHT)); ctrl->GlobalKeys[PIN_GK_ENTER] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_RETURN)); ctrl->GlobalKeys[PIN_GK_BACK] = BuildComboSet(SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE)); printf("Setting control type definitions...\n"); AssignKey(&(ctrl->GlobalKeys),PIN_GK_UP,lstDef,PIN_KEY_UP); AssignKey(&(ctrl->GlobalKeys),PIN_GK_DOWN,lstDef,PIN_KEY_DOWN); AssignKey(&(ctrl->GlobalKeys),PIN_GK_LEFT,lstDef,PIN_KEY_LEFT); AssignKey(&(ctrl->GlobalKeys),PIN_GK_RIGHT,lstDef,PIN_KEY_RIGHT); AssignKey(&(ctrl->GlobalKeys),PIN_GK_ENTER,lstDef,PIN_KEY_ENTER); AssignKey(&(ctrl->GlobalKeys),PIN_GK_BACK,lstDef,PIN_KEY_BACK); printf("Setting mapping-specific definitions...\n"); AssignKey(&(ctrl->GlobalKeys),PIN_GK_UP,m_keys,PIN_KEY_UP); AssignKey(&(ctrl->GlobalKeys),PIN_GK_DOWN,m_keys,PIN_KEY_DOWN); AssignKey(&(ctrl->GlobalKeys),PIN_GK_LEFT,m_keys,PIN_KEY_LEFT); AssignKey(&(ctrl->GlobalKeys),PIN_GK_RIGHT,m_keys,PIN_KEY_RIGHT); AssignKey(&(ctrl->GlobalKeys),PIN_GK_ENTER,m_keys,PIN_KEY_ENTER); AssignKey(&(ctrl->GlobalKeys),PIN_GK_BACK,m_keys,PIN_KEY_BACK); AddController(ctrl); } } }