void scanFile(FILE *fp, Args *args){ char *tag; int numRead, *lengths; Profile *profiles; int n; tag = (char *)emalloc(3*sizeof(char)); numRead = fread(tag,sizeof(char),3,fp); assert(numRead == 3); while(!feof(fp)){ if(strcmp(tag,"sum")==0){ numRead = fread(&n,sizeof(int),1,fp); assert(numRead == 1); profiles = (Profile *)emalloc(n*sizeof(Profile)); numRead = fread(profiles,sizeof(Profile),n,fp); assert(numRead == n); writeProfiles(profiles, n); free(profiles); }else if(strcmp(tag,"con")==0){ numRead = fread(&n,sizeof(int),1,fp); assert(numRead == 1); lengths = (int *)emalloc(n*sizeof(int)); numRead = fread(lengths,sizeof(int),n,fp); assert(numRead == n); writeLengths(lengths, n); free(lengths); }else if(strcmp(tag,"pos")==0){ writePositions(fp); }else if(strcmp(tag,"lik")==0){ writeLikelihoods(fp); }else assert(0); numRead = fread(tag,sizeof(char),3,fp); } free(tag); }
void CompilationConfigWriter::writeConfig() { EL::MapType map; map["version"] = EL::Value(1.0); map["profiles"] = writeProfiles(m_config); m_stream << EL::Value(map) << "\n"; }