📄 avc.h
字号:
typedef struct AVCBinFile_t{ AVCRawBinFile *psRawBinFile; char *pszFilename; AVCRawBinFile *psIndexFile; /* Index file, Write mode only */ DBFHandle hDBFFile; /* Used for AVCCoverPC DBF TABLES only */ int nCurDBFRecord; /* 0-based record index in DBF file */ AVCCoverType eCoverType; AVCFileType eFileType; int nPrecision; /* AVC_SINGLE/DOUBLE_PREC */ union { AVCTableDef *psTableDef; }hdr; /* cur.* : temp. storage used to read one record (ARC, PAL, ... or * Table record) from the file. */ union { AVCArc *psArc; AVCPal *psPal; AVCCnt *psCnt; AVCLab *psLab; AVCTol *psTol; AVCTxt *psTxt; AVCRxp *psRxp; AVCField *pasFields; char **papszPrj; }cur;}AVCBinFile;/*--------------------------------------------------------------------- * Stuff related to the generation of E00 *--------------------------------------------------------------------*//*--------------------------------------------------------------------- * AVCE00GenInfo structure * This structure is used by the E00 generator functions to store * their buffer and their current state in case they need to be * called more than once for a given object type (i.e. ARC, PAL and IFO). *--------------------------------------------------------------------*/typedef struct AVCE00GenInfo_t{ char *pszBuf; int nBufSize; int nPrecision; /* AVC_SINGLE/DOUBLE_PREC */ int iCurItem; int numItems;}AVCE00GenInfo;/*--------------------------------------------------------------------- * Stuff related to the parsing of E00 *--------------------------------------------------------------------*//*--------------------------------------------------------------------- * AVCE00ParseInfo structure * This structure is used by the E00 parser functions to store * their buffer and their current state while parsing an object. *--------------------------------------------------------------------*/typedef struct AVCE00ParseInfo_t{ AVCFileType eFileType; int nPrecision; /* AVC_SINGLE/DOUBLE_PREC */ int iCurItem; int numItems; int nCurObjectId; GBool bForceEndOfSection; /* For sections that don't have an */ /* explicit end-of-section line. */ AVCFileType eSuperSectionType;/* For sections containing several files*/ char *pszSectionHdrLine; /* Used by supersection types */ union { AVCTableDef *psTableDef; }hdr; GBool bTableHdrComplete; /* FALSE until table header is */ /* finished parsing */ int nTableE00RecLength; /* cur.* : temp. storage used to store current object (ARC, PAL, ... or * Table record) from the file. */ union { AVCArc *psArc; AVCPal *psPal; AVCCnt *psCnt; AVCLab *psLab; AVCTol *psTol; AVCTxt *psTxt; AVCRxp *psRxp; AVCField *pasFields; char **papszPrj; }cur; char *pszBuf; /* Buffer used only for TABLEs */ int nBufSize;}AVCE00ParseInfo;/*--------------------------------------------------------------------- * Stuff related to the transparent binary -> E00 conversion *--------------------------------------------------------------------*/typedef struct AVCE00Section_t{ AVCFileType eType; /* File Type */ char *pszName; /* E00 section or Table Name */ char *pszFilename; /* Binary file filename */}AVCE00Section;typedef struct AVCE00ReadInfo_t{ char *pszCoverPath; char *pszInfoPath; char *pszCoverName; AVCCoverType eCoverType; /* pasSections is built when the coverage is opened and describes * the squeleton of the E00 file. */ AVCE00Section *pasSections; int numSections; /* If bReadAllSections=TRUE then reading automatically continues to * the next section when a section finishes. (This is the default) * Otherwise, you can use AVCE00ReadGotoSection() to read one section * at a time... this will set bReadAllSections=FALSE. */ GBool bReadAllSections; /* Info about the file (or E00 section) currently being processed */ int iCurSection; AVCBinFile *hFile; int iCurStep; /* AVC_GEN_* values, see below */ AVCE00GenInfo *hGenInfo; /* Info related to multibyte character encoding */ AVCDBCSInfo *psDBCSInfo;} *AVCE00ReadPtr;/* E00 generation steps... tells the AVCE00Read*() functions which * parts of the given E00 file are currently being processed. */#define AVC_GEN_NOTSTARTED 0#define AVC_GEN_DATA 1#define AVC_GEN_ENDSECTION 2#define AVC_GEN_TABLEHEADER 3#define AVC_GEN_TABLEDATA 4/*--------------------------------------------------------------------- * Stuff related to the transparent E00 -> binary conversion *--------------------------------------------------------------------*/typedef struct AVCE00WriteInfo_t{ char *pszCoverPath; char *pszInfoPath; char *pszCoverName; AVCCoverType eCoverType; /* Info about the file (or E00 section) currently being processed */ AVCFileType eCurFileType; AVCBinFile *hFile; /* Requested precision for the new coverage... may differ from the * precision of the E00 input lines. (AVC_SINGLE_PREC or AVC_DOUBLE_PREC) */ int nPrecision; AVCE00ParseInfo *hParseInfo; /* Info related to multibyte character encoding */ AVCDBCSInfo *psDBCSInfo;} *AVCE00WritePtr;/* Coverage generation steps... used to store the current state of the * AVCE00WriteNextLine() function. */#define AVC_WR_TOPLEVEL 0#define AVC_WR_READING_SECTION/*===================================================================== Function prototypes (lower-level lib. functions) =====================================================================*//*--------------------------------------------------------------------- * Functions related to buffered reading of raw binary files (and writing) *--------------------------------------------------------------------*/AVCRawBinFile *AVCRawBinOpen(const char *pszFname, const char *pszAccess, AVCByteOrder eFileByteOrder, AVCDBCSInfo *psDBCSInfo);void AVCRawBinClose(AVCRawBinFile *psInfo);void AVCRawBinFSeek(AVCRawBinFile *psInfo, int nOffset, int nFrom);GBool AVCRawBinEOF(AVCRawBinFile *psInfo);void AVCRawBinSetFileDataSize(AVCRawBinFile *psInfo, int nDataSize);void AVCRawBinReadBytes(AVCRawBinFile *psInfo, int nBytesToRead, GByte *pBuf);GInt16 AVCRawBinReadInt16(AVCRawBinFile *psInfo);GInt32 AVCRawBinReadInt32(AVCRawBinFile *psInfo);float AVCRawBinReadFloat(AVCRawBinFile *psInfo);double AVCRawBinReadDouble(AVCRawBinFile *psInfo);void AVCRawBinReadString(AVCRawBinFile *psFile, int nBytesToRead, GByte *pBuf);void AVCRawBinWriteBytes(AVCRawBinFile *psFile, int nBytesToWrite, GByte *pBuf);void AVCRawBinWriteInt16(AVCRawBinFile *psFile, GInt16 n16Value);void AVCRawBinWriteInt32(AVCRawBinFile *psFile, GInt32 n32Value);void AVCRawBinWriteFloat(AVCRawBinFile *psFile, float fValue);void AVCRawBinWriteDouble(AVCRawBinFile *psFile, double dValue);void AVCRawBinWriteZeros(AVCRawBinFile *psFile, int nBytesToWrite);void AVCRawBinWritePaddedString(AVCRawBinFile *psFile, int nFieldSize, const char *pszString);/*--------------------------------------------------------------------- * Functions related to reading the binary coverage files *--------------------------------------------------------------------*/AVCBinFile *AVCBinReadOpen(const char *pszPath, const char *pszName, AVCCoverType eCoverType, AVCFileType eType, AVCDBCSInfo *psDBCSInfo);void AVCBinReadClose(AVCBinFile *psFile);int AVCBinReadRewind(AVCBinFile *psFile);void *AVCBinReadObject(AVCBinFile *psFile, int iObjIndex );void *AVCBinReadNextObject(AVCBinFile *psFile);AVCArc *AVCBinReadNextArc(AVCBinFile *psFile);AVCPal *AVCBinReadNextPal(AVCBinFile *psFile);AVCCnt *AVCBinReadNextCnt(AVCBinFile *psFile);AVCLab *AVCBinReadNextLab(AVCBinFile *psFile);AVCTol *AVCBinReadNextTol(AVCBinFile *psFile);AVCTxt *AVCBinReadNextTxt(AVCBinFile *psFile);AVCRxp *AVCBinReadNextRxp(AVCBinFile *psFile);AVCField *AVCBinReadNextTableRec(AVCBinFile *psFile);char **AVCBinReadNextPrj(AVCBinFile *psFile);char **AVCBinReadListTables(const char *pszInfoPath, const char *pszCoverName, char ***ppapszArcDatFiles, AVCCoverType eCoverType, AVCDBCSInfo *psDBCSInfo);/*--------------------------------------------------------------------- * Functions related to writing the binary coverage files *--------------------------------------------------------------------*/AVCBinFile *AVCBinWriteCreate(const char *pszPath, const char *pszName, AVCCoverType eCoverType, AVCFileType eType, int nPrecision, AVCDBCSInfo *psDBCSInfo);AVCBinFile *AVCBinWriteCreateTable(const char *pszInfoPath, const char *pszCoverName, AVCTableDef *psSrcTableDef, AVCCoverType eCoverType, int nPrecision, AVCDBCSInfo *psDBCSInfo);void AVCBinWriteClose(AVCBinFile *psFile);int AVCBinWriteHeader(AVCBinFile *psFile);int AVCBinWriteObject(AVCBinFile *psFile, void *psObj);int AVCBinWriteArc(AVCBinFile *psFile, AVCArc *psArc);int AVCBinWritePal(AVCBinFile *psFile, AVCPal *psPal);int AVCBinWriteCnt(AVCBinFile *psFile, AVCCnt *psCnt);int AVCBinWriteLab(AVCBinFile *psFile, AVCLab *psLab);int AVCBinWriteTol(AVCBinFile *psFile, AVCTol *psTol);int AVCBinWritePrj(AVCBinFile *psFile, char **papszPrj);int AVCBinWriteTxt(AVCBinFile *psFile, AVCTxt *psTxt);int AVCBinWriteRxp(AVCBinFile *psFile, AVCRxp *psRxp);int AVCBinWriteTableRec(AVCBinFile *psFile, AVCField *pasFields);/*--------------------------------------------------------------------- * Functions related to the generation of E00 *--------------------------------------------------------------------*/AVCE00GenInfo *AVCE00GenInfoAlloc(int nCoverPrecision);void AVCE00GenInfoFree(AVCE00GenInfo *psInfo);void AVCE00GenReset(AVCE00GenInfo *psInfo);const char *AVCE00GenStartSection(AVCE00GenInfo *psInfo, AVCFileType eType, const char *pszFilename);const char *AVCE00GenEndSection(AVCE00GenInfo *psInfo, AVCFileType eType, GBool bCont);const char *AVCE00GenObject(AVCE00GenInfo *psInfo, AVCFileType eType, void *psObj, GBool bCont);const char *AVCE00GenArc(AVCE00GenInfo *psInfo, AVCArc *psArc, GBool bCont);const char *AVCE00GenPal(AVCE00GenInfo *psInfo, AVCPal *psPal, GBool bCont);const char *AVCE00GenCnt(AVCE00GenInfo *psInfo, AVCCnt *psCnt, GBool bCont);const char *AVCE00GenLab(AVCE00GenInfo *psInfo, AVCLab *psLab, GBool bCont);const char *AVCE00GenTol(AVCE00GenInfo *psInfo, AVCTol *psTol, GBool bCont);const char *AVCE00GenTxt(AVCE00GenInfo *psInfo, AVCTxt *psTxt, GBool bCont);const char *AVCE00GenTx6(AVCE00GenInfo *psInfo, AVCTxt *psTxt, GBool bCont);const char *AVCE00GenPrj(AVCE00GenInfo *psInfo, char **papszPrj, GBool bCont);const char *AVCE00GenRxp(AVCE00GenInfo *psInfo, AVCRxp *psRxp, GBool bCont);const char *AVCE00GenTableHdr(AVCE00GenInfo *psInfo, AVCTableDef *psDef, GBool bCont);const char *AVCE00GenTableRec(AVCE00GenInfo *psInfo, int numFields, AVCFieldInfo *pasDef, AVCField *pasFields, GBool bCont);/*--------------------------------------------------------------------- * Functions related to parsing E00 lines *--------------------------------------------------------------------*/AVCE00ParseInfo *AVCE00ParseInfoAlloc();void AVCE00ParseInfoFree(AVCE00ParseInfo *psInfo);void AVCE00ParseReset(AVCE00ParseInfo *psInfo);AVCFileType AVCE00ParseSectionHeader(AVCE00ParseInfo *psInfo, const char *pszLine);GBool AVCE00ParseSectionEnd(AVCE00ParseInfo *psInfo, const char *pszLine, GBool bResetParseInfo);AVCFileType AVCE00ParseSuperSectionHeader(AVCE00ParseInfo *psInfo, const char *pszLine);GBool AVCE00ParseSuperSectionEnd(AVCE00ParseInfo *psInfo, const char *pszLine );void *AVCE00ParseNextLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCArc *AVCE00ParseNextArcLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCPal *AVCE00ParseNextPalLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCCnt *AVCE00ParseNextCntLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCLab *AVCE00ParseNextLabLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCTol *AVCE00ParseNextTolLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCTxt *AVCE00ParseNextTxtLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCTxt *AVCE00ParseNextTx6Line(AVCE00ParseInfo *psInfo, const char *pszLine);char **AVCE00ParseNextPrjLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCRxp *AVCE00ParseNextRxpLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCTableDef *AVCE00ParseNextTableDefLine(AVCE00ParseInfo *psInfo, const char *pszLine);AVCField *AVCE00ParseNextTableRecLine(AVCE00ParseInfo *psInfo, const char *pszLine);/*--------------------------------------------------------------------- * Misc. functions shared by several parts of the lib. *--------------------------------------------------------------------*/int _AVCE00ComputeRecSize(int numFields, AVCFieldInfo *pasDef, GBool bMapType40ToDouble);void _AVCDestroyTableFields(AVCTableDef *psTableDef, AVCField *pasFields);void _AVCDestroyTableDef(AVCTableDef *psTableDef);AVCTableDef *_AVCDupTableDef(AVCTableDef *psSrcDef);GBool AVCFileExists(const char *pszPath, const char *pszName);char *AVCAdjustCaseSensitiveFilename(char *pszFname);int AVCPrintRealValue(char *pszBuf, int nPrecision, AVCFileType eType, double dValue);/*===================================================================== Function prototypes (THE PUBLIC ONES) =====================================================================*//*--------------------------------------------------------------------- * Functions to make a binary coverage appear as E00 *--------------------------------------------------------------------*/AVCE00ReadPtr AVCE00ReadOpen(const char *pszCoverPath);void AVCE00ReadClose(AVCE00ReadPtr psInfo);const char *AVCE00ReadNextLine(AVCE00ReadPtr psInfo);int AVCE00ReadRewind(AVCE00ReadPtr psInfo);AVCE00Section *AVCE00ReadSectionsList(AVCE00ReadPtr psInfo, int *numSect);int AVCE00ReadGotoSection(AVCE00ReadPtr psInfo, AVCE00Section *psSect, GBool bContinue);/*--------------------------------------------------------------------- * Functions to write E00 lines to a binary coverage *--------------------------------------------------------------------*/AVCE00WritePtr AVCE00WriteOpen(const char *pszCoverPath, AVCCoverType eNewCoverType, int nPrecision);void AVCE00WriteClose(AVCE00WritePtr psInfo);int AVCE00WriteNextLine(AVCE00WritePtr psInfo, const char *pszLine);int AVCE00DeleteCoverage(const char *pszCoverPath);CPL_C_END#endif /* _AVC_H_INCLUDED_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -