Skip to content
Snippets Groups Projects
Commit 9ada7ba5 authored by edgrif's avatar edgrif
Browse files

chanage parse_header func to return when finished.

parent 96f375b7
No related branches found
No related tags found
No related merge requests found
......@@ -28,9 +28,9 @@
* of ZMapFeatureStruct's, one for each GFF source.
*
* HISTORY:
* Last edited: Feb 19 13:26 2007 (edgrif)
* Last edited: Oct 17 14:14 2008 (edgrif)
* Created: Sat May 29 13:18:32 2004 (edgrif)
* CVS info: $Id: zmapGFF.h,v 1.12 2007-03-01 09:11:47 edgrif Exp $
* CVS info: $Id: zmapGFF.h,v 1.13 2008-10-29 16:09:38 edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_GFF_H
......@@ -71,7 +71,7 @@ typedef struct
ZMapGFFParser zMapGFFCreateParser(GData *sources, gboolean parse_only) ;
gboolean zMapGFFParseHeader(ZMapGFFParser parser, char *line) ;
gboolean zMapGFFParseHeader(ZMapGFFParser parser, char *line, gboolean *header_finished) ;
gboolean zMapGFFParseLine(ZMapGFFParser parser, char *line) ;
void zMapGFFSetStopOnError(ZMapGFFParser parser, gboolean stop_on_error) ;
void zMapGFFSetParseOnly(ZMapGFFParser parser, gboolean parse_only) ;
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Jul 21 17:57 2007 (rds)
* Last edited: Oct 17 14:18 2008 (edgrif)
* Created: Wed Jan 11 11:30:39 2006 (rds)
* CVS info: $Id: gffparser.c,v 1.5 2007-07-22 09:15:41 rds Exp $
* CVS info: $Id: gffparser.c,v 1.6 2008-10-29 16:09:38 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
zMapLogCreate(NULL) ;
styles = zMapFeatureTypeGetFromFile(argv[2]) ;
styles = zMapFeatureTypeGetFromFile(argv[2], argv[3]) ;
main_rc = parseFile(argv[1], styles) ;
zMapLogDestroy() ;
......@@ -132,10 +132,12 @@ static int readHeader(parserFile data)
&terminator_pos,
&gff_file_err)) == G_IO_STATUS_NORMAL)
{
gboolean done_header = FALSE ;
*(data->gff_line->str + terminator_pos) = '\0';
if(!zMapGFFParseHeader(data->parser, data->gff_line->str))
if(!zMapGFFParseHeader(data->parser, data->gff_line->str, &done_header))
{
if (!zMapGFFParseHeader(data->parser, data->gff_line->str))
if (!zMapGFFParseHeader(data->parser, data->gff_line->str, &done_header))
{
GError *error = zMapGFFGetError(data->parser) ;
......
......@@ -26,9 +26,9 @@
*
* Exported functions: See ZMap/zmapGFF.h
* HISTORY:
* Last edited: Aug 29 13:54 2008 (edgrif)
* Last edited: Oct 17 13:38 2008 (edgrif)
* Created: Fri May 28 14:25:12 2004 (edgrif)
* CVS info: $Id: zmapGFF2parser.c,v 1.83 2008-08-29 12:55:44 edgrif Exp $
* CVS info: $Id: zmapGFF2parser.c,v 1.84 2008-10-29 16:09:38 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -261,7 +261,7 @@ gboolean zMapGFFParseLine(ZMapGFFParser parser, char *line)
/* Parses a single line of GFF data, should be called repeatedly with successive lines
* GFF data from a GFF source. This function expects to find the GFF header, once all
* the required header lines have been found or a non-comment line is found it will stop.
* The zMapGFFParseLine() function can be used to parse the rest of the file.
* The zMapGFFParseLine() function can then be used to parse the rest of the file.
*
* This function expects a null-terminated C string that contains a complete GFF line
* (comment or non-comment line), the function expects the caller to already have removed the
......@@ -273,19 +273,15 @@ gboolean zMapGFFParseLine(ZMapGFFParser parser, char *line)
* Once an error has been returned the parser object cannot be used anymore and
* zMapGFFDestroyParser() should be called to free it.
*
*/
/* ISSUE: need to decide on rules for comments, can they be embedded within other gff lines, are
* the header comments compulsory ? etc. etc.
*
* Current code assumes that the header block will be a contiguous set of header lines
* at the top of the file and that the first non-header line marks the beginning
* of the GFF data. If this is not true then its an error.
*/
gboolean zMapGFFParseHeader(ZMapGFFParser parser, char *line)
gboolean zMapGFFParseHeader(ZMapGFFParser parser, char *line, gboolean *header_finished)
{
gboolean result = FALSE ;
zMapAssert(parser && line && header_finished) ;
parser->line_count++ ;
......@@ -308,9 +304,16 @@ gboolean zMapGFFParseHeader(ZMapGFFParser parser, char *line)
/* If we found all the header parts move on to the body. */
if (parser->done_header)
parser->state = ZMAPGFF_PARSE_BODY ;
{
parser->state = ZMAPGFF_PARSE_BODY ;
*header_finished = TRUE ;
}
}
}
else
{
*header_finished = FALSE ;
}
}
return result ;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment