diff --git a/src/include/ZMap/zmapGFF.h b/src/include/ZMap/zmapGFF.h index 1671c4201bf486c8e4607fa381bba981da1ddb4e..4c126413352b4af5fdf0e21f86a4aea65b302aa7 100755 --- a/src/include/ZMap/zmapGFF.h +++ b/src/include/ZMap/zmapGFF.h @@ -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) ; diff --git a/src/zmapGFF/gffparser.c b/src/zmapGFF/gffparser.c index 2c9504f60f04ec39e0577ba05a6e6f624a92b5e7..d49a8beffb1fab71f15f762596550df1868fd016 100755 --- a/src/zmapGFF/gffparser.c +++ b/src/zmapGFF/gffparser.c @@ -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) ; diff --git a/src/zmapGFF/zmapGFF2parser.c b/src/zmapGFF/zmapGFF2parser.c index d72f7f9c47a3395571aaebdc74454410799c3303..3e7f5e7f02d5b2434d40f0e8c8fffa784077eeb3 100755 --- a/src/zmapGFF/zmapGFF2parser.c +++ b/src/zmapGFF/zmapGFF2parser.c @@ -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 ;