void VcfFile::openForRead(const char* filename, int nbuf) { reset(); iFile = ifopen(filename,"rb"); if ( iFile == NULL ) { throw VcfFileException("Failed opening file %s - %s",filename, strerror(errno)); } nBuffers = nbuf; nNumMarkers = 0; nHead = 0; if ( nBuffers == 0 ) { // infinite buffer size // do not set size of markers } else { vpVcfMarkers.resize( nBuffers ); for(int i=0; i < nBuffers; ++i) { VcfMarker* p = new VcfMarker; vpVcfMarkers[i] = p; } } parseMeta(); parseHeader(); if ( bUpgrade ) { upgradeMetaLines(); } }
TEST_F(BuildFromXmlUnionAlign, align1_basic) { parseMeta( "<metalib tagsetversion='1' name='net' version='10'>" " <union name='S1' version='1' id='33'>" " <entry name='b1' type='int8'/>" " <entry name='b2' type='int16'/>" " </union>" " <struct name='S2' version='1' id='34'>" " <entry name='a1' type='int8'/>" " <entry name='m_u' type='S1'/>" " </struct>" "</metalib>" ); ASSERT_TRUE(t_em_no_error()); EXPECT_EQ(1, dr_meta_align(meta("S1"))); EXPECT_EQ((size_t)2, dr_meta_size(meta("S1"))); EXPECT_EQ(0, entry("S1", "b1")->m_data_start_pos); EXPECT_EQ(0, entry("S1", "b2")->m_data_start_pos); EXPECT_EQ(1, dr_meta_align(meta("S2"))); EXPECT_EQ((size_t)3, dr_meta_size(meta("S2"))); EXPECT_EQ(0, entry("S2", "a1")->m_data_start_pos); EXPECT_EQ(1, entry("S2", "m_u")->m_data_start_pos); }
MFILE *fileRead(char *fname) { MFILE *mfin=mfopen(), *mfout=mfopen(), *mfbuf=mfopen(); FILE *f=fopen(fname, "r"); const char *flastok, *fhit, *fend; if(f==NULL) pexit("Cannot read input file ", fname); mfFileToMFile(f, mfin); fclose(f); flastok=fhit=fend=mfGetData(mfin); while((fhit=strstr(flastok, "<!--#"))!=NULL){ searchInput(flastok, fhit); fend=strstr(fhit, "-->"); if(fend==NULL) pexit("Parse error - '-->' expected - exiting\n", fhit); if(commdepth==0) escapeWrite((void*)flastok, fhit-flastok, mfout); flastok=(const char*)(fend+3); mfSetLength(mfbuf, 0); mfwrite((void*)(fhit+5), 1, fend-(fhit+5), mfbuf); parseMeta(mfout, mfGetData(mfbuf)); } searchInput(flastok, (char*)0x8FFFFFFF); escapeWrite((void*)flastok, strlen(flastok), mfout); mfprintf(mfout, "\";\n"); mfclose(mfin); return(mfout); }
static void parseLine(struct gff3File *g3f, char *line) /* parse one line of a gff3 file */ { if (startsWith("##", line)) parseMeta(g3f, line); else if (!startsWith("#", line) && (strlen(line) > 0)) parseAnn(g3f, line); }
bool MorkParser::parseTable() { bool Result = true; QString TextId; int Id = 0, Scope = 0; char cur = nextChar(); // Get id while (cur != '{' && cur != '[' && cur != '}' && cur) { if (!isWhiteSpace(cur)) { TextId += cur; } cur = nextChar(); } parseScopeId(TextId, Id, Scope); // Parse the table while (Result && cur != '}' && cur) { if (!isWhiteSpace(cur)) { switch (cur) { case '{': Result = parseMeta('}'); break; case '[': Result = parseRow(Id, Scope); break; case '-': case '+': break; default: { QString JustId; while (!isWhiteSpace(cur) && cur) { JustId += cur; cur = nextChar(); if (cur == '}') { return Result; } } int JustIdNum = 0, JustScopeNum = 0; parseScopeId(JustId, JustIdNum, JustScopeNum); setCurrentRow(Scope, Id, JustScopeNum, JustIdNum); } break; } } cur = nextChar(); } return Result; }
int eDVBMetaParser::parseFile(const std::string &basename) { /* first, try parsing the .meta file */ if (!parseMeta(basename)) return 0; /* otherwise, use recordings.epl */ if (!parseRecordings(basename)) return 0; m_filesize = fileSize(basename); return -1; }
qint64 ShoutCastIODevice::readData(char *data, qint64 maxlen) { // the decoder wants more data from the stream // but first we must filter out any headers and metadata if (m_buffer->readBufAvail() == 0) { LOG(VB_PLAYBACK, LOG_ERR, "ShoutCastIODevice: No data in buffer!!"); switchToState(STOPPED); return -1; } if (m_state == STREAMING_META && parseMeta()) switchToState(STREAMING); if (m_state == STREAMING) { if (m_bytesTillNextMeta > 0) { // take maxlen or what ever is left till the next metadata if (maxlen > m_bytesTillNextMeta) maxlen = m_bytesTillNextMeta; maxlen = m_buffer->read(data, maxlen); m_bytesTillNextMeta -= maxlen; if (m_bytesTillNextMeta == 0) switchToState(STREAMING_META); } else maxlen = m_buffer->read(data, maxlen); } if (m_state != STOPPED) LOG(VB_NETWORK, LOG_INFO, QString("ShoutCastIODevice: %1 kb in buffer, btnm=%2/%3 " "state=%4, len=%5") .arg(m_buffer->readBufAvail() / 1024, 4) .arg(m_bytesTillNextMeta, 4) .arg(m_response->getMetaint()) .arg(stateString (m_state)) .arg(maxlen)); else LOG(VB_NETWORK, LOG_INFO, QString("ShoutCastIODevice: stopped")); return maxlen; }
OpticPackMeta OpticPack::loadMeta(HZIP handle) { try { auto buffer(fetchFile<char>(handle, "meta.txt", true)); std::map<std::string, std::string> loaded = parseMeta(std::move(buffer.second)); OpticPackMeta meta; meta.name = loaded.at("name"); meta.author = loaded.at("author"); meta.description = loaded.at("description"); meta.apiVersion = loaded.at("api_version"); return meta; } catch(std::out_of_range) { throw OpticPackException("missing meta"); } catch(OpticPackException) { throw OpticPackException("meta fail"); } }
bool MorkParser::parseRow( int TableId, int TableScope ) { bool Result = true; std::string TextId; int Id = 0, Scope = 0; nowParsing_ = NPRows; char cur = nextChar(); // Get id while ( cur != '(' && cur != ']' && cur != '[' && cur ) { if ( !isWhiteSpace( cur ) ) { TextId += cur; } cur = nextChar(); } parseScopeId( TextId, &Id, &Scope ); setCurrentRow( TableScope, TableId, Scope, Id ); // Parse the row while ( Result && cur != ']' && cur ) { if ( !isWhiteSpace( cur ) ) { switch ( cur ) { case '(': Result = parseCell(); break; case '[': Result = parseMeta( ']' ); break; default: Result = false; break; } } cur = nextChar(); } return Result; }
TEST_P(BuildFromXmlTypeSizeTest, CheckSize) { TypeSizeCase caseData = GetParam(); char buf[256]; snprintf( buf, 256 , "<metalib tagsetversion='1' name='net' version='10'>" " <struct name='S1' version='1' id='33'>" " <entry name='a1' type='%s'/>" " </struct>" "</metalib>" , caseData.m_name); parseMeta(buf); EXPECT_EQ(caseData.m_size, dr_meta_size(meta("S1"))) << "size of type " << caseData.m_name << " error!"; }
void Bundler::parseBundlerOut(void) { std::cout<<"1.Start to parse bundler.out file..."<<std::endl; try { std::string bundlerName = mBundlerDir + "/bundle.rd.out"; ifstream f1(bundlerName.c_str()); if ( f1.is_open()) { parseMeta(f1); parseCamera(f1); } else cout<<"File open failed!"; f1.close(); } catch (exception e) { cerr<<e.what()<<endl; //getchar(); exit(1); } std::cout<<"2.Parse bundler.out file successfully!"<<std::endl; }
bool MorkParser::parseGroup() { return parseMeta('@'); }
QString KoOasisLoadingContext::generator() const { parseMeta(); return m_generator; }
void AISUpdate::parseUpdate(const LLSD& update) { clearParseResults(); parseMeta(update); parseContent(update); }