Bool RootsLoadFile (char * pFilename) { /* typedef int HANDLE;*/ HANDLE hFile; ROOT RootRecord; RootsFreeData (); hFile = (HANDLE)open (pFilename, O_RDONLY | O_BINARY); if (hFile == (HANDLE)(-1)) { ErrorFile (); return (FALSE); } while (read (hFile, &RootRecord, sizeof (ROOT)) == sizeof (ROOT)) { RootRecord.bReached = FALSE; if (nRoots % ROOTS_MEMORY_QUANTUM == 0) { pRoots = realloc (pRoots, (size_t) ((nRoots / ROOTS_MEMORY_QUANTUM + 1) * ROOTS_MEMORY_QUANTUM * sizeof (ROOT))); } nRoots++; if (pRoots == NULL) { ErrorNoEnoughMemory ("in LTROOTS.C,RootsLoadFile,part 1"); nRoots = 0; close (hFile); return (FALSE); } pRoots [nRoots - 1] = RootRecord; } close (hFile); return (TRUE); }
void LT_FreeAllData (void) { WSB_FreeData (); SmartBreakingFreeData (); HystogramFreeData (); SeparatorsFreeData (); BlocksFreeData (); InitialBreakingFreeData (); PageMatrixFreeData (); CompsFreeData (); IntervalsFreeData (); // InclinesFreeData (); RootsFreeData (); # ifdef LT_DEBUG LT_GraphicsClose (); # endif LayoutBackupFreeData (); }
Bool32 ReadRoots(Handle hCCOM) { CCOM_comp * comp = NULL; Handle pPage; PAGEINFO pInfo; uint32_t i; int max_h=50; exthCCOM = hCCOM; RootsFreeData (); nRoots = 0; pPage = CPAGE_GetHandlePage(CPAGE_GetCurrentPage( )); CPAGE_GetPageData( pPage, PT_PAGEINFO, (void*)&pInfo, sizeof(pInfo)); max_h=(max_h*(pInfo.DPIY+1))/300; nBigLetters = 0; pBigLetters = NULL; FillBigLetters(hCCOM, pPage); FillPicsInTables(hCCOM, pPage); //************************************** for(i=0;i<MaxHeightOfLetter;i++) { pBlockHystogram[i] = 0; } comp = CCOM_GetFirst(hCCOM,NULL); int h; while (comp) { h=comp->h; if((h > MinHeightOfLetter) && (h < MaxHeightOfLetter)) { nComps++; pBlockHystogram[h]++; } if(comp->scale>1) { if(comp->scale>2||h>max_h) { if(IsNotBigLetter(comp)) goto lNextComp; } } AddRoot(comp, TRUE) ; lNextComp: comp = CCOM_GetNext(comp,NULL); } //*********** Rom 08-02-99 ************* nBigLetters = 0; if(pBigLetters!=NULL) { free(pBigLetters); pBigLetters = NULL; } //************************************** return (TRUE); }