?? avc_e00read.c
字號:
AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileARC; psInfo->pasSections[iSect].pszName = CPLStrdup("ARC"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * CNT section (cnt.adf) *----------------------------------------------------------------*/ szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "cnt.adf": "cnt"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 && (psFile = AVCBinReadOpen(psInfo->pszCoverPath, szFname, psInfo->eCoverType, AVCFileCNT, psInfo->psDBCSInfo)) != NULL) { if (nCoverPrecision == AVC_DEFAULT_PREC) nCoverPrecision = psFile->nPrecision; AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileCNT; psInfo->pasSections[iSect].pszName = CPLStrdup("CNT"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * LAB section (lab.adf) *----------------------------------------------------------------*/ szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "lab.adf": "lab"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 && (psFile = AVCBinReadOpen(psInfo->pszCoverPath, szFname, psInfo->eCoverType, AVCFileLAB, psInfo->psDBCSInfo)) != NULL) { if (nCoverPrecision == AVC_DEFAULT_PREC) nCoverPrecision = psFile->nPrecision; AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileLAB; psInfo->pasSections[iSect].pszName = CPLStrdup("LAB"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * PAL section (pal.adf) *----------------------------------------------------------------*/ szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "pal.adf": "pal"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 && (psFile = AVCBinReadOpen(psInfo->pszCoverPath, szFname, psInfo->eCoverType, AVCFilePAL, psInfo->psDBCSInfo)) != NULL) { if (nCoverPrecision == AVC_DEFAULT_PREC) nCoverPrecision = psFile->nPrecision; AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFilePAL; psInfo->pasSections[iSect].pszName = CPLStrdup("PAL"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * TOL section (tol.adf for single precision, par.adf for double) *----------------------------------------------------------------*/ szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "tol.adf": "tol"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 && (psFile = AVCBinReadOpen(psInfo->pszCoverPath, szFname, psInfo->eCoverType, AVCFileTOL, psInfo->psDBCSInfo)) != NULL) { if (nCoverPrecision == AVC_DEFAULT_PREC) nCoverPrecision = psFile->nPrecision; AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileTOL; psInfo->pasSections[iSect].pszName = CPLStrdup("TOL"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "par.adf": "par"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 && (psFile = AVCBinReadOpen(psInfo->pszCoverPath, szFname, psInfo->eCoverType, AVCFileTOL, psInfo->psDBCSInfo)) != NULL) { if (nCoverPrecision == AVC_DEFAULT_PREC) nCoverPrecision = psFile->nPrecision; AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileTOL; psInfo->pasSections[iSect].pszName = CPLStrdup("TOL"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * TXT section (txt.adf) *----------------------------------------------------------------*/ szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "txt.adf": "txt"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 && (psFile = AVCBinReadOpen(psInfo->pszCoverPath, szFname, psInfo->eCoverType, AVCFileTXT, psInfo->psDBCSInfo)) != NULL) { if (nCoverPrecision == AVC_DEFAULT_PREC) nCoverPrecision = psFile->nPrecision; AVCBinReadClose(psFile); iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileTXT; psInfo->pasSections[iSect].pszName = CPLStrdup("TXT"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * TX6 section (*.txt) * Scan the directory for files with a ".txt" extension. * Note: Never seen those in a PC Arc/Info coverage! * In weird coverages, the filename ends with "txt" but there is no "." *----------------------------------------------------------------*/ if (psInfo->eCoverType == AVCCoverV7) nCoverPrecision = _AVCE00ReadAddJabberwockySection(psInfo, AVCFileTX6, "TX6", nCoverPrecision, ".txt", papszCoverDir); else if (psInfo->eCoverType == AVCCoverWeird) nCoverPrecision = _AVCE00ReadAddJabberwockySection(psInfo, AVCFileTX6, "TX6", nCoverPrecision, "txt", papszCoverDir); /*----------------------------------------------------------------- * At this point, we should have read the coverage precsion... and if * we haven't yet then we'll just use single by default. * We'll need cPrecisionCode for some of the sections that follow. *----------------------------------------------------------------*/ if (nCoverPrecision == AVC_DOUBLE_PREC) cPrecisionCode = '3'; else cPrecisionCode = '2'; /*----------------------------------------------------------------- * SIN 2/3 and EOX lines ... ??? *----------------------------------------------------------------*/ iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 2); psInfo->pasSections[iSect].eType = AVCFileUnknown; psInfo->pasSections[iSect].pszName = CPLStrdup("SIN X"); psInfo->pasSections[iSect].pszName[5] = cPrecisionCode; iSect++; psInfo->pasSections[iSect].eType = AVCFileUnknown; psInfo->pasSections[iSect].pszName = CPLStrdup("EOX"); iSect++; /*----------------------------------------------------------------- * LOG section (log.adf) (ends with EOL) *----------------------------------------------------------------*/ /*----------------------------------------------------------------- * PRJ section (prj.adf) (ends with EOP) *----------------------------------------------------------------*/ szFname = (psInfo->eCoverType==AVCCoverV7 || psInfo->eCoverType==AVCCoverPC2 ) ? "prj.adf": "prj"; if ( (iFile=CSLFindString(papszCoverDir, szFname)) != -1 ) { iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFilePRJ; psInfo->pasSections[iSect].pszName = CPLStrdup("PRJ"); psInfo->pasSections[iSect].pszFilename=CPLStrdup(papszCoverDir[iFile]); } /*----------------------------------------------------------------- * RXP section (*.rxp) * Scan the directory for files with a ".rxp" extension. *----------------------------------------------------------------*/ if (psInfo->eCoverType == AVCCoverV7) _AVCE00ReadAddJabberwockySection(psInfo, AVCFileRXP, "RXP", nCoverPrecision,".rxp",papszCoverDir); else if (psInfo->eCoverType == AVCCoverWeird) _AVCE00ReadAddJabberwockySection(psInfo, AVCFileRXP, "RXP", nCoverPrecision,"rxp",papszCoverDir); /*----------------------------------------------------------------- * RPL section (*.pal) * Scan the directory for files with a ".rpl" extension. *----------------------------------------------------------------*/ if (psInfo->eCoverType == AVCCoverV7) _AVCE00ReadAddJabberwockySection(psInfo, AVCFileRPL, "RPL", nCoverPrecision,".pal",papszCoverDir); else if (psInfo->eCoverType == AVCCoverWeird) _AVCE00ReadAddJabberwockySection(psInfo, AVCFileRPL, "RPL", nCoverPrecision,"rpl",papszCoverDir); /*----------------------------------------------------------------- * IFO section (tables) *----------------------------------------------------------------*/ papszTables = papszFiles = NULL; if (psInfo->eCoverType == AVCCoverV7 || psInfo->eCoverType == AVCCoverWeird) { /*------------------------------------------------------------- * Unix coverages: get tables from the ../info/arc.dir * Weird coverages: the arc.dir is similar but called "arcdr9" *------------------------------------------------------------*/ papszTables = AVCBinReadListTables(psInfo->pszInfoPath, psInfo->pszCoverName, &papszFiles, psInfo->eCoverType, psInfo->psDBCSInfo); } else if (psInfo->eCoverType == AVCCoverPC || psInfo->eCoverType == AVCCoverPC2) { /*------------------------------------------------------------- * PC coverages: look for "???.dbf" in the coverage directory * and build the table name using the coverage name * as the table basename, and the dbf file basename * as the table extension. *------------------------------------------------------------*/ for(iFile=0; papszCoverDir && papszCoverDir[iFile]; iFile++) { if ((nLen = strlen(papszCoverDir[iFile])) == 7 && EQUAL(papszCoverDir[iFile] + nLen -4, ".dbf")) { papszCoverDir[iFile][nLen - 4] = '\0'; szFname = CPLSPrintf("%s.%s", psInfo->pszCoverName, papszCoverDir[iFile]); pcTmp = (char*)szFname; for( ; *pcTmp != '\0'; pcTmp++) *pcTmp = toupper(*pcTmp); papszCoverDir[iFile][nLen - 4] = '.'; papszTables = CSLAddString(papszTables, szFname); papszFiles = CSLAddString(papszFiles, papszCoverDir[iFile]); } } } if ((numTables = CSLCount(papszTables)) > 0) { iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), numTables+2); psInfo->pasSections[iSect].eType = AVCFileUnknown; psInfo->pasSections[iSect].pszName = CPLStrdup("IFO X"); psInfo->pasSections[iSect].pszName[5] = cPrecisionCode; iSect++; for(iTable=0; iTable<numTables; iTable++) { psInfo->pasSections[iSect].eType = AVCFileTABLE; psInfo->pasSections[iSect].pszName=CPLStrdup(papszTables[iTable]); if (papszFiles) { psInfo->pasSections[iSect].pszFilename= CPLStrdup(papszFiles[iTable]); } iSect++; } psInfo->pasSections[iSect].eType = AVCFileUnknown; psInfo->pasSections[iSect].pszName = CPLStrdup("EOI"); iSect++; } CSLDestroy(papszTables); CSLDestroy(papszFiles); /*----------------------------------------------------------------- * File ends with EOS *----------------------------------------------------------------*/ iSect = _AVCIncreaseSectionsArray(&(psInfo->pasSections), &(psInfo->numSections), 1); psInfo->pasSections[iSect].eType = AVCFileUnknown; psInfo->pasSections[iSect].pszName = CPLStrdup("EOS"); return nCoverPrecision;}/********************************************************************** * _AVCE00ReadScanE00() * * Processes an entire E00 file to find all the interesting sections. **********************************************************************/static void _AVCE00ReadScanE00(AVCE00ReadE00Ptr psRead){ AVCE00ParseInfo *psInfo = psRead->hParseInfo; const char *pszLine; const char *pszName = 0; void *obj; int iSect = 0; while (CPLGetLastErrorNo() == 0 && (pszLine = CPLReadLine(psRead->hFile) ) != NULL ) { obj = _AVCE00ReadNextLineE00(psRead, pszLine); if (obj) { pszName = 0; switch (psInfo->eFileType) { case AVCFileARC:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -