//--------------------------------------------------------------------// // M e t h o d // // p a r s e C o n t i n u a t i o n // //--------------------------------------------------------------------// // // // Handle continuation situation signalled on last pass. // // // //--------------------------------------------------------------------// private Boolean parseContinuation( ref Int32 bufRem, ref Int32 bufOffset, ref ToolCommonData.ePrintLang crntPDL, ref Boolean endReached) { PrnParseConstants.eContType contType; contType = PrnParseConstants.eContType.None; Int32 prefixLen = 0, contDataLen = 0, downloadRem = 0; Boolean backTrack = false; Boolean invalidSeqFound = false; Byte prefixA = 0x00, prefixB = 0x00; _linkData.getContData(ref contType, ref prefixLen, ref contDataLen, ref downloadRem, ref backTrack, ref prefixA, ref prefixB); if ((contType == PrnParseConstants.eContType.PJL) || (contType == PrnParseConstants.eContType.Special) || (contType == PrnParseConstants.eContType.Unknown) || (contType == PrnParseConstants.eContType.Reset)) { //------------------------------------------------------------// // // // Previous 'block' ended with a partial match of a PJL // // sequence, or with insufficient characters to identify // // the type of sequence. // // The continuation action has already reset the buffer, so // // now unset the markers. // // // //------------------------------------------------------------// _linkData.resetContData(); } if ((_endOffset != -1) && ((_fileOffset + bufOffset) > _endOffset)) { endReached = true; } return(invalidSeqFound); }
//--------------------------------------------------------------------// // M e t h o d // // a n a l y s e F o n t H d d r // //--------------------------------------------------------------------// // // // Provide an interpretation of the contents of a PCL XL soft font // // header. // // // //--------------------------------------------------------------------// public Boolean analyseFontHddr(Int32 hddrLen, Byte [] buf, Int32 fileOffset, ref Int32 bufRem, ref Int32 bufOffset, PrnParseLinkData linkData, PrnParseOptions options, DataTable table) { Int32 binDataLen; Boolean validSegs = false; PrnParseConstants.eContType contType; Boolean continuation = false; //----------------------------------------------------------------// // // // Initialise. // // // //----------------------------------------------------------------// _table = table; _buf = buf; _fileOffset = fileOffset; _analysisLevel = linkData.AnalysisLevel; _options = options; contType = linkData.getContType(); _indxOffsetFormat = _options.IndxGenOffsetFormat; _showBinData = _options.FlagPCLXLMiscBinData; //----------------------------------------------------------------// if (contType == PrnParseConstants.eContType.None) { _nextStage = eStage.Start; _validHddr = true; _firstSeg = true; _hddrLen = hddrLen; _hddrRem = hddrLen; _hddrPos = fileOffset + bufOffset; } else { contType = PrnParseConstants.eContType.None; linkData.resetContData(); } //----------------------------------------------------------------// if (_nextStage == eStage.Start) { if (bufRem < _cHddrDescLen) { //--------------------------------------------------------// // // // Font header descriptor is not all in buffer. // // Initiate continuation. // // // //--------------------------------------------------------// contType = PrnParseConstants.eContType.PCLXLFontHddr; linkData.setBacktrack(contType, -bufRem); } else { _nextStage = eStage.ShowHddr; } } if (_nextStage == eStage.ShowHddr) { //------------------------------------------------------------// // // // Process font header. // // // //------------------------------------------------------------// processFontHeader(ref bufRem, ref bufOffset); bufRem = bufRem - _cHddrDescLen; _hddrRem = _hddrRem - _cHddrDescLen; bufOffset = bufOffset + _cHddrDescLen; if (_validHddr) { _nextStage = eStage.ShowData; } else { _nextStage = eStage.BadSeqA; } } if (_nextStage == eStage.ShowData) { //------------------------------------------------------------// // // // Output details of segmented data: // // // //------------------------------------------------------------// Int32 dummy = 0; continuation = _parseSegs.processSegData(_buf, _fileOffset, false, _firstSeg, true, ref bufRem, ref bufOffset, ref _hddrDataRem, ref _hddrRem, ref dummy, ref validSegs, linkData, _options, _table); _firstSeg = false; } if (_nextStage == eStage.EndOK) { //------------------------------------------------------------// // // // End of processing of valid header. // // // //------------------------------------------------------------// return(_validHddr); } if (_nextStage == eStage.BadSeqA) { //------------------------------------------------------------// // // // Inconsistency found. // // // //------------------------------------------------------------// _nextStage = eStage.BadSeqB; PrnParseCommon.addTextRow( PrnParseRowTypes.eType.MsgError, _table, PrnParseConstants.eOvlShow.None, "", "", "", "Processing of header abandoned!"); } if ((_nextStage == eStage.BadSeqB) && (_hddrRem != 0)) { //------------------------------------------------------------// // // // Header does not appear to be valid. // // Treat remainder of header as a binary sequence without // // interpretation. // // Check if remainder of download sequence is within the // // buffer. // // // //------------------------------------------------------------// if (_hddrRem > bufRem) { //--------------------------------------------------------// // // // Remainder of sequence is not in buffer. // // Initiate continuation. // // // //--------------------------------------------------------// contType = PrnParseConstants.eContType.PCLXLFontHddr; binDataLen = bufRem; _hddrRem = _hddrRem - bufRem; linkData.setContinuation(contType); } else { contType = PrnParseConstants.eContType.None; linkData.resetContData(); binDataLen = _hddrRem; _hddrRem = 0; } if ((binDataLen) != 0) { //--------------------------------------------------------// // // // Some, or all, of the download data is contained within // // the current 'block'. // // // //--------------------------------------------------------// PrnParseData.processBinary( _table, PrnParseConstants.eOvlShow.None, buf, fileOffset, bufOffset, binDataLen, "PCLXL Binary", _showBinData, false, true, _indxOffsetFormat, _analysisLevel); bufRem = bufRem - binDataLen; bufOffset = bufOffset + binDataLen; } } return(_validHddr); }