DBManagerThreadData::DBManagerThreadData(void) { Clear(); }
CodeBook::~CodeBook() { Clear(); }
void ToDoListView::Parse() { // wxBusyCursor busy; // based on user prefs, parse files for todo items if (m_Ignore || (m_pPanel && !m_pPanel->IsShownOnScreen()) ) return; // Reentrancy Clear(); m_ItemsMap.clear(); m_Items.Clear(); switch (m_pSource->GetSelection()) { case 0: // current file only { // this is the easiest selection ;) cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(Manager::Get()->GetEditorManager()->GetActiveEditor()); ParseEditor(ed); break; } case 1: // open files { // easy too; parse all open editor files... for (int i = 0; i < Manager::Get()->GetEditorManager()->GetEditorsCount(); ++i) { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(Manager::Get()->GetEditorManager()->GetEditor(i)); ParseEditor(ed); } break; } case 2: // active target files { // loop all project files // but be aware: if a file is opened, use the open file because // it might not be the same on the disk... cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject(); if (!prj) return; ProjectBuildTarget *target = prj->GetBuildTarget(prj->GetActiveBuildTarget()); if (!target) return; wxProgressDialog pd(_T("Todo Plugin: Processing all files in the active target.."), _T("Processing a target of a big project may take large amount of time.\n\n" "Please be patient!\n"), target->GetFilesCount(), Manager::Get()->GetAppWindow(), wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); int i = 0; for (FilesList::iterator it = target->GetFilesList().begin(); it != target->GetFilesList().end(); ++it) { ProjectFile* pf = *it; wxString filename = pf->file.GetFullPath(); cbEditor* ed = Manager::Get()->GetEditorManager()->IsBuiltinOpen(filename); if (ed) ParseEditor(ed); else ParseFile(filename); if (!pd.Update(i++)) { break; } } break; } case 3: // all project files { // loop all project files // but be aware: if a file is opened, use the open file because // it might not be the same on the disk... cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject(); if (!prj) return; wxProgressDialog pd(_T("Todo Plugin: Processing all files.."), _T("Processing a big project may take large amount of time.\n\n" "Please be patient!\n"), prj->GetFilesCount(), Manager::Get()->GetAppWindow(), wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); int i = 0; for (FilesList::iterator it = prj->GetFilesList().begin(); it != prj->GetFilesList().end(); ++it) { ProjectFile* pf = *it; wxString filename = pf->file.GetFullPath(); cbEditor* ed = Manager::Get()->GetEditorManager()->IsBuiltinOpen(filename); if (ed) ParseEditor(ed); else ParseFile(filename); if (!pd.Update(i++)) { break; } } break; } default: break; } FillList(); }
plFontCache::~plFontCache() { Clear(); fInstance = nil; }
bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ) { DebugMessage(M64MSG_INFO, "Initializing OpenGL Device Context."); Lock(); CGraphicsContext::Get()->m_supportTextureMirror = false; CGraphicsContext::Initialize(dwWidth, dwHeight, bWindowed ); if( bWindowed ) { windowSetting.statusBarHeightToUse = windowSetting.statusBarHeight; windowSetting.toolbarHeightToUse = windowSetting.toolbarHeight; } else { windowSetting.statusBarHeightToUse = 0; windowSetting.toolbarHeightToUse = 0; } int depthBufferDepth = options.OpenglDepthBufferSetting; int colorBufferDepth = 32; int bVerticalSync = windowSetting.bVerticalSync; if( options.colorQuality == TEXTURE_FMT_A4R4G4B4 ) colorBufferDepth = 16; /* // init sdl & gl DebugMessage(M64MSG_VERBOSE, "Initializing video subsystem..."); if (CoreVideo_Init() != M64ERR_SUCCESS) return false; */ /* hard-coded attribute values */ const int iDOUBLEBUFFER = 1; /* set opengl attributes */ // CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, iDOUBLEBUFFER); // CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, bVerticalSync); // CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, colorBufferDepth); // CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, depthBufferDepth); // // /* set multisampling */ // if (options.multiSampling > 0) // { // CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1); // if (options.multiSampling <= 2) // CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 2); // else if (options.multiSampling <= 4) // CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 4); // else if (options.multiSampling <= 8) // CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 8); // else // CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 16); // } // // /* Set the video mode */ // m64p_video_mode ScreenMode = bWindowed ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN; // if (CoreVideo_SetVideoMode(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode) != M64ERR_SUCCESS) // { // DebugMessage(M64MSG_ERROR, "Failed to set %i-bit video mode: %ix%i", colorBufferDepth, (int)windowSetting.uDisplayWidth, (int)windowSetting.uDisplayHeight); // CoreVideo_Quit(); // return false; // } // //#ifdef WIN32 // GLenum err = glewInit(); // if (GLEW_OK != err) // { // /* Problem: glewInit failed, something is seriously wrong. */ // fprintf(stderr, "Error: %s\n", glewGetErrorString(err)); // } //#endif // // char caption[500]; // sprintf(caption, "%s v%i.%i.%i", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION)); // CoreVideo_SetCaption(caption); // SetWindowMode(); /* SDL_Surface* screen; SDL_Init(SDL_INIT_VIDEO); if (!(screen = SDL_SetVideoMode(1024, 768, 16, SDL_SWSURFACE ))) { SDL_QuitSubSystem( SDL_INIT_VIDEO ); return FALSE; } EGLNativeWindowType EGL_handle; EGLContext EGL_context; HDC EGL_device; EGLint EGL_version_major,EGL_version_minor; EGLint nConfigs; EGLConfig EGL_config; GLint success; const EGLint ConfigAttribs[] = { EGL_LEVEL, 0, EGL_DEPTH_SIZE, 16, EGL_STENCIL_SIZE, 0, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NATIVE_RENDERABLE, EGL_FALSE, EGL_NONE }; const EGLint ContextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; SDL_SysWMinfo info; SDL_VERSION(&info.version); SDL_GetWMInfo(&info); EGL_handle = (EGLNativeWindowType) info.window; EGL_device = GetDC(EGL_handle); printf("EGL Context Creation\n"); EGL_display = eglGetDisplay((EGLNativeDisplayType) EGL_device); if (EGL_display == EGL_NO_DISPLAY){ printf( "EGL Display Get failed: %s \n", EGLErrorString()); return FALSE; } if (!eglInitialize(EGL_display, &EGL_version_major, &EGL_version_minor)){ printf( "EGL Display Initialize failed: %s \n", EGLErrorString()); return FALSE; } if (!eglChooseConfig(EGL_display, ConfigAttribs, &EGL_config, 1, &nConfigs)){ printf( "EGL Configuration failed: %s \n", EGLErrorString()); return FALSE; } else if (nConfigs != 1){ printf( "EGL Configuration failed: nconfig %i, %s \n", nConfigs, EGLErrorString()); return FALSE; } EGL_surface = eglCreateWindowSurface(EGL_display, EGL_config, EGL_handle, NULL); if (EGL_surface == EGL_NO_SURFACE){ printf("EGL Surface Creation failed: %s will attempt without window... \n", EGLErrorString()); EGL_surface = eglCreateWindowSurface(EGL_display, EGL_config, NULL, NULL); if (EGL_surface == EGL_NO_SURFACE){ printf( "EGL Surface Creation failed: %s \n", EGLErrorString()); return FALSE; } } eglBindAPI(EGL_OPENGL_ES_API); EGL_context = eglCreateContext(EGL_display, EGL_config, EGL_NO_CONTEXT, ContextAttribs); if (EGL_context == EGL_NO_CONTEXT){ printf( "EGL Context Creation failed: %s \n", EGLErrorString()); return FALSE; } if (!eglMakeCurrent(EGL_display, EGL_surface, EGL_surface, EGL_context)){ printf( "EGL Make Current failed: %s \n", EGLErrorString()); return FALSE; }; eglSwapInterval(EGL_display, 1); */ #ifdef USE_SDL //// paulscode, added for switching between RGBA8888 and RGB565 // (part of the color banding fix) int bitsPP; if( Android_JNI_UseRGBA8888() ) bitsPP = 32; else bitsPP = 16; /* Set the video mode */ SDL_Surface* hScreen; printf( "Setting video mode %dx%d...\n", windowSetting.uDisplayWidth, windowSetting.uDisplayHeight ); // TODO: I should actually check what the pixelformat is, rather than assuming 16 bpp (RGB_565) or 32 bpp (RGBA_8888): // if (!(hScreen = SDL_SetVideoMode( windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, 16, SDL_HWSURFACE ))) if (!(hScreen = SDL_SetVideoMode( windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, bitsPP, SDL_HWSURFACE ))) { printf( "Problem setting videomode %dx%d: %s\n", windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, SDL_GetError() ); SDL_QuitSubSystem( SDL_INIT_VIDEO ); return false; } #endif InitState(); InitOGLExtension(); sprintf(m_strDeviceStats, "%.60s - %.128s : %.60s", m_pVendorStr, m_pRenderStr, m_pVersionStr); TRACE0(m_strDeviceStats); DebugMessage(M64MSG_INFO, "Using OpenGL: %s", m_strDeviceStats); GLint precision,range; glGetShaderPrecisionFormat(GL_VERTEX_SHADER,GL_LOW_FLOAT,&precision,&range); DebugMessage(M64MSG_INFO,"GLSL Vertex Shader lowp precision:%i range:%i",precision,range); glGetShaderPrecisionFormat(GL_VERTEX_SHADER,GL_MEDIUM_FLOAT,&precision,&range); DebugMessage(M64MSG_INFO,"GLSL Vertex Shader mediump precision:%i range:%i",precision,range); glGetShaderPrecisionFormat(GL_VERTEX_SHADER,GL_HIGH_FLOAT,&precision,&range); DebugMessage(M64MSG_INFO,"GLSL Vertex Shader highp precision:%i range:%i",precision,range); glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER ,GL_LOW_FLOAT,&precision,&range); DebugMessage(M64MSG_INFO,"GLSL Fragment Shader lowp precision:%i range:%i",precision,range); glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER,GL_MEDIUM_FLOAT,&precision,&range); DebugMessage(M64MSG_INFO,"GLSL Fragment Shader mediump precision:%i range:%i",precision,range); glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER,GL_HIGH_FLOAT,&precision,&range); DebugMessage(M64MSG_INFO,"GLSL Fragment Shader highp precision:%i range:%i",precision,range); Unlock(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); // Clear buffers UpdateFrame(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); UpdateFrame(); m_bReady = true; status.isVertexShaderEnabled = false; return true; }
void ShaderManagerVulkan::ClearShaders() { Clear(); DirtyShader(); gstate_c.Dirty(DIRTY_ALL_UNIFORMS | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE); }
/** * name: MAnnivDate * class: MAnnivDate * desc: default constructor * param: none * return: nothing **/ MAnnivDate::MAnnivDate() { Clear(); }
TextEventDispatcher::PendingComposition::PendingComposition() { Clear(); }
TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) { Clear(); base.CopyTo( this ); return *this; }
virtual ~Grid_Array (void) { Clear (); }
cPrefabPiecePool::~cPrefabPiecePool() { Clear(); }
virtual ~Grid_Data (void) { Clear (); }
CLevel::~CLevel( ) { Clear( ); }
void CInsideSocket::Reset() { m_nSocketAttr = enmSocketAttr_Inside; Clear(); }
bool cBlockArea::Read(cWorld * a_World, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes) { // Normalize the coords: if (a_MinBlockX > a_MaxBlockX) { std::swap(a_MinBlockX, a_MaxBlockX); } if (a_MinBlockY > a_MaxBlockY) { std::swap(a_MinBlockY, a_MaxBlockY); } if (a_MinBlockZ > a_MaxBlockZ) { std::swap(a_MinBlockZ, a_MaxBlockZ); } // Include the Max coords: a_MaxBlockX += 1; a_MaxBlockY += 1; a_MaxBlockZ += 1; // Check coords validity: if (a_MinBlockY < 0) { LOGWARNING("%s: MinBlockY less than zero, adjusting to zero", __FUNCTION__); a_MinBlockY = 0; } else if (a_MinBlockY >= cChunkDef::Height) { LOGWARNING("%s: MinBlockY more than chunk height, adjusting to chunk height", __FUNCTION__); a_MinBlockY = cChunkDef::Height - 1; } if (a_MaxBlockY < 0) { LOGWARNING("%s: MaxBlockY less than zero, adjusting to zero", __FUNCTION__); a_MaxBlockY = 0; } else if (a_MaxBlockY >= cChunkDef::Height) { LOGWARNING("%s: MaxBlockY more than chunk height, adjusting to chunk height", __FUNCTION__); a_MaxBlockY = cChunkDef::Height - 1; } // Allocate the needed memory: Clear(); if (!SetSize(a_MaxBlockX - a_MinBlockX, a_MaxBlockY - a_MinBlockY, a_MaxBlockZ - a_MinBlockZ, a_DataTypes)) { return false; } m_OriginX = a_MinBlockX; m_OriginY = a_MinBlockY; m_OriginZ = a_MinBlockZ; cChunkReader Reader(*this); // Convert block coords to chunks coords: int MinChunkX, MaxChunkX; int MinChunkZ, MaxChunkZ; cChunkDef::AbsoluteToRelative(a_MinBlockX, a_MinBlockY, a_MinBlockZ, MinChunkX, MinChunkZ); cChunkDef::AbsoluteToRelative(a_MaxBlockX, a_MaxBlockY, a_MaxBlockZ, MaxChunkX, MaxChunkZ); // Query block data: if (!a_World->ForEachChunkInRect(MinChunkX, MaxChunkX, MinChunkZ, MaxChunkZ, Reader)) { Clear(); return false; } return true; }
TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) { Clear(); copy.CopyTo( this ); return *this; }
defList::defList() { Clear() ; }
TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) { Clear(); copy.CopyTo( this ); return *this; }
void ScheddStatistics::Init(int fOtherPool) { static const int64_t sizes[] = { (int64_t)0x10000 * 0x1, (int64_t)0x10000 * 0x4, // 64Kb, 256Kb (int64_t)0x10000 * 0x10, (int64_t)0x10000 * 0x40, // 1Mb, 4Mb (int64_t)0x10000 * 0x100, (int64_t)0x10000 * 0x400, // 16Mb, 64Mb (int64_t)0x10000 * 0x1000, (int64_t)0x10000 * 0x4000, //256Mb, 1Gb (int64_t)0x10000 * 0x10000, (int64_t)0x10000 * 0x40000, // 4Gb, 16Gb (int64_t)0x10000 * 0x100000, (int64_t)0x10000 * 0x400000, // 64Gb, 256Gb }; JobsRunningSizes.set_levels(sizes, COUNTOF(sizes)); JobsCompletedSizes.set_levels(sizes, COUNTOF(sizes)); JobsBadputSizes.set_levels(sizes, COUNTOF(sizes)); static const time_t lifes[] = { (time_t)30, (time_t) 1 * 60, // 30 Sec, 1 Min (time_t) 3 * 60, (time_t)10 * 60, // 3 Min, 10 Min, (time_t)30 * 60, (time_t) 1 * 60*60, // 30 Min, 1 Hr, (time_t) 3 * 60*60, (time_t) 6 * 60*60, // 3 Hr 6 Hr, (time_t)12 * 60*60, (time_t) 1 * 24*60*60, // 12 Hr 1 Day, (time_t) 2 * 24*60*60, (time_t) 4 * 24*60*60, // 2 Day 4 Day, (time_t) 8 * 24*60*60, (time_t)16 * 24*60*60, // 8 Day 16 Day, }; JobsRunningRuntimes.set_levels(lifes, COUNTOF(lifes)); JobsCompletedRuntimes.set_levels(lifes, COUNTOF(lifes)); JobsBadputRuntimes.set_levels(lifes, COUNTOF(lifes)); Clear(); // default window size to 1 quantum, we may set it to something else later. this->RecentWindowMax = schedd_stats_window_quantum; // insert static items into the stats pool so we can use the pool // to Advance and Clear. these items also publish the overall value SCHEDD_STATS_ADD_RECENT(Pool, JobsSubmitted, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsStarted, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsExited, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsCompleted, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumTimeToStart, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumBadputTime, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumRunningTime, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumExecuteTime, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumPreExecuteTime, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumPostExecuteTime, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumChurnTime, IF_VERBOSEPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsAccumExecuteAltTime, IF_VERBOSEPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsWierdTimestamps, IF_VERBOSEPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsExitedNormally, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsKilled, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsExitException, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsExecFailed, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsCheckpointed, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsShadowNoMemory, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsShouldRequeue, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsNotStarted, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsShouldHold, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsShouldRemove, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsCoredumped, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsMissedDeferralTime, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsExitedAndClaimClosing, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsDebugLogError, IF_BASICPUB | IF_NONZERO); SCHEDD_STATS_ADD_RECENT(Pool, JobsCompletedSizes, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsBadputSizes, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsCompletedRuntimes, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, JobsBadputRuntimes, IF_BASICPUB); SCHEDD_STATS_ADD_VAL(Pool, JobsRunningSizes, IF_BASICPUB); SCHEDD_STATS_ADD_VAL(Pool, JobsRunningRuntimes, IF_BASICPUB); if ( ! fOtherPool){ SCHEDD_STATS_ADD_RECENT(Pool, ShadowsStarted, IF_BASICPUB); SCHEDD_STATS_ADD_RECENT(Pool, ShadowsRecycled, IF_VERBOSEPUB); SCHEDD_STATS_ADD_RECENT(Pool, ShadowsReconnections, IF_VERBOSEPUB); SCHEDD_STATS_ADD_VAL(Pool, ShadowsRunning, IF_BASICPUB); SCHEDD_STATS_PUB_PEAK(Pool, ShadowsRunning, IF_BASICPUB); //SCHEDD_STATS_PUB_DEBUG(Pool, JobsSubmitted, IF_BASICPUB); //SCHEDD_STATS_PUB_DEBUG(Pool, JobsStarted, IF_BASICPUB); //SCHEDD_STATS_PUB_DEBUG(Pool, JobsCompleted, IF_BASICPUB); //SCHEDD_STATS_PUB_DEBUG(Pool, JobsCompletedSizes, IF_BASICPUB); } }
bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) { if ( !file ) { SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; } // Delete the existing data: Clear(); location.Clear(); // Get the file size, so we can pre-allocate the string. HUGE speed impact. long length = 0; fseek( file, 0, SEEK_END ); length = ftell( file ); fseek( file, 0, SEEK_SET ); // Strange case, but good to handle up front. if ( length <= 0 ) { SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; } // Subtle bug here. TinyXml did use fgets. But from the XML spec: // 2.11 End-of-Line Handling // <snip> // <quote> // ...the XML processor MUST behave as if it normalized all line breaks in external // parsed entities (including the document entity) on input, before parsing, by translating // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to // a single #xA character. // </quote> // // It is not clear fgets does that, and certainly isn't clear it works cross platform. // Generally, you expect fgets to translate from the convention of the OS to the c/unix // convention, and not work generally. /* while( fgets( buf, sizeof(buf), file ) ) { data += buf; } */ char* buf = new char[ length+1 ]; buf[0] = 0; if ( fread( buf, length, 1, file ) != 1 ) { delete [] buf; SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; } // Process the buffer in place to normalize new lines. (See comment above.) // Copies from the 'p' to 'q' pointer, where p can advance faster if // a newline-carriage return is hit. // // Wikipedia: // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 const char* p = buf; // the read head char* q = buf; // the write head const char CR = 0x0d; const char LF = 0x0a; buf[length] = 0; while( *p ) { assert( p < (buf+length) ); assert( q <= (buf+length) ); assert( q <= p ); if ( *p == CR ) { *q++ = LF; p++; if ( *p == LF ) { // check for CR+LF (and skip LF) p++; } } else { *q++ = *p++; } } assert( q <= (buf+length) ); *q = 0; Parse( buf, 0, encoding ); delete [] buf; return !Error(); }
CLineInput::CLineInput() { Clear(); }
PathSolver::~PathSolver() { Clear(); }
//_____________________________________________________________________________________________ void SAMCEvent::Init(){ Clear(); }
inline Mesh::~Mesh(void) { Clear(); }
CReadData::CReadData(void) { Clear(); }
cBlockArea::~cBlockArea() { Clear(); }
bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ) { DebugMessage(M64MSG_INFO, "Initializing OpenGL Device Context."); Lock(); CGraphicsContext::Get()->m_supportTextureMirror = false; CGraphicsContext::Initialize(dwWidth, dwHeight, bWindowed ); if( bWindowed ) { windowSetting.statusBarHeightToUse = windowSetting.statusBarHeight; windowSetting.toolbarHeightToUse = windowSetting.toolbarHeight; } else { windowSetting.statusBarHeightToUse = 0; windowSetting.toolbarHeightToUse = 0; } int depthBufferDepth = options.OpenglDepthBufferSetting; int colorBufferDepth = 32; int bVerticalSync = windowSetting.bVerticalSync; if( options.colorQuality == TEXTURE_FMT_A4R4G4B4 ) colorBufferDepth = 16; // init sdl & gl DebugMessage(M64MSG_VERBOSE, "Initializing video subsystem..."); if (CoreVideo_Init() != M64ERR_SUCCESS) return false; /* hard-coded attribute values */ const int iDOUBLEBUFFER = 1; /* set opengl attributes */ CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, iDOUBLEBUFFER); CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, bVerticalSync); CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, colorBufferDepth); CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, depthBufferDepth); /* set multisampling */ if (options.multiSampling > 0) { CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1); if (options.multiSampling <= 2) CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 2); else if (options.multiSampling <= 4) CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 4); else if (options.multiSampling <= 8) CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 8); else CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 16); } /* Set the video mode */ m64p_video_mode ScreenMode = bWindowed ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN; m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; if (CoreVideo_SetVideoMode(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode, flags) != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "Failed to set %i-bit video mode: %ix%i", colorBufferDepth, (int)windowSetting.uDisplayWidth, (int)windowSetting.uDisplayHeight); CoreVideo_Quit(); return false; } /* check that our opengl attributes were properly set */ int iActual; if (CoreVideo_GL_GetAttribute(M64P_GL_DOUBLEBUFFER, &iActual) == M64ERR_SUCCESS) if (iActual != iDOUBLEBUFFER) DebugMessage(M64MSG_WARNING, "Failed to set GL_DOUBLEBUFFER to %i. (it's %i)", iDOUBLEBUFFER, iActual); if (CoreVideo_GL_GetAttribute(M64P_GL_SWAP_CONTROL, &iActual) == M64ERR_SUCCESS) if (iActual != bVerticalSync) DebugMessage(M64MSG_WARNING, "Failed to set GL_SWAP_CONTROL to %i. (it's %i)", bVerticalSync, iActual); if (CoreVideo_GL_GetAttribute(M64P_GL_BUFFER_SIZE, &iActual) == M64ERR_SUCCESS) if (iActual != colorBufferDepth) DebugMessage(M64MSG_WARNING, "Failed to set GL_BUFFER_SIZE to %i. (it's %i)", colorBufferDepth, iActual); if (CoreVideo_GL_GetAttribute(M64P_GL_DEPTH_SIZE, &iActual) == M64ERR_SUCCESS) if (iActual != depthBufferDepth) DebugMessage(M64MSG_WARNING, "Failed to set GL_DEPTH_SIZE to %i. (it's %i)", depthBufferDepth, iActual); #if SDL_VIDEO_OPENGL /* Get function pointers to OpenGL extensions (blame Microsoft Windows for this) */ OGLExtensions_Init(); #endif char caption[500]; sprintf(caption, "%s v%i.%i.%i", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION)); CoreVideo_SetCaption(caption); SetWindowMode(); InitState(); InitOGLExtension(); sprintf(m_strDeviceStats, "%.60s - %.128s : %.60s", m_pVendorStr, m_pRenderStr, m_pVersionStr); TRACE0(m_strDeviceStats); DebugMessage(M64MSG_INFO, "Using OpenGL: %s", m_strDeviceStats); Unlock(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); // Clear buffers UpdateFrame(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); UpdateFrame(); m_bReady = true; status.isVertexShaderEnabled = false; return true; }
bool cBlockArea::LoadFromSchematicNBT(cParsedNBT & a_NBT) { int TMaterials = a_NBT.FindChildByName(a_NBT.GetRoot(), "Materials"); if ((TMaterials > 0) && (a_NBT.GetType(TMaterials) == TAG_String)) { AString Materials = a_NBT.GetString(TMaterials); if (Materials.compare("Alpha") != 0) { LOG("Materials tag is present and \"%s\" instead of \"Alpha\". Possibly a wrong-format schematic file.", Materials.c_str()); return false; } } int TSizeX = a_NBT.FindChildByName(a_NBT.GetRoot(), "Width"); int TSizeY = a_NBT.FindChildByName(a_NBT.GetRoot(), "Height"); int TSizeZ = a_NBT.FindChildByName(a_NBT.GetRoot(), "Length"); if ( (TSizeX < 0) || (TSizeY < 0) || (TSizeZ < 0) || (a_NBT.GetType(TSizeX) != TAG_Short) || (a_NBT.GetType(TSizeY) != TAG_Short) || (a_NBT.GetType(TSizeZ) != TAG_Short) ) { LOG("Dimensions are missing from the schematic file (%d, %d, %d), (%d, %d, %d)", TSizeX, TSizeY, TSizeZ, a_NBT.GetType(TSizeX), a_NBT.GetType(TSizeY), a_NBT.GetType(TSizeZ) ); return false; } int SizeX = a_NBT.GetShort(TSizeX); int SizeY = a_NBT.GetShort(TSizeY); int SizeZ = a_NBT.GetShort(TSizeZ); if ((SizeX < 1) || (SizeY < 1) || (SizeZ < 1)) { LOG("Dimensions are invalid in the schematic file: %d, %d, %d", SizeX, SizeY, SizeZ); return false; } int TBlockTypes = a_NBT.FindChildByName(a_NBT.GetRoot(), "Blocks"); int TBlockMetas = a_NBT.FindChildByName(a_NBT.GetRoot(), "Data"); if ((TBlockTypes < 0) || (a_NBT.GetType(TBlockTypes) != TAG_ByteArray)) { LOG("BlockTypes are invalid in the schematic file: %d", TBlockTypes); return false; } bool AreMetasPresent = (TBlockMetas > 0) && (a_NBT.GetType(TBlockMetas) == TAG_ByteArray); Clear(); SetSize(SizeX, SizeY, SizeZ, AreMetasPresent ? (baTypes | baMetas) : baTypes); // Copy the block types and metas: int NumBytes = m_SizeX * m_SizeY * m_SizeZ; if (a_NBT.GetDataLength(TBlockTypes) < NumBytes) { LOG("BlockTypes truncated in the schematic file (exp %d, got %d bytes). Loading partial.", NumBytes, a_NBT.GetDataLength(TBlockTypes) ); NumBytes = a_NBT.GetDataLength(TBlockTypes); } memcpy(m_BlockTypes, a_NBT.GetData(TBlockTypes), NumBytes); if (AreMetasPresent) { int NumBytes = m_SizeX * m_SizeY * m_SizeZ; if (a_NBT.GetDataLength(TBlockMetas) < NumBytes) { LOG("BlockMetas truncated in the schematic file (exp %d, got %d bytes). Loading partial.", NumBytes, a_NBT.GetDataLength(TBlockMetas) ); NumBytes = a_NBT.GetDataLength(TBlockMetas); } memcpy(m_BlockMetas, a_NBT.GetData(TBlockMetas), NumBytes); } return true; }
void TiXmlComment::operator=( const TiXmlComment& base ) { Clear(); base.CopyTo( this ); }
bool ModelFactory::Uninitialize() { Clear(); return true; }