a6266677d433cec482c6c28b0787d84bff1e01a8 hiram Tue Sep 6 10:30:23 2011 -0700 rearrange static function definitions to avoid compiler problems on Suse linux diff --git src/lib/oldGff.c src/lib/oldGff.c index 307fd90..3b84229 100644 --- src/lib/oldGff.c +++ src/lib/oldGff.c @@ -28,31 +28,57 @@ char score[62]; /* A number between 0 and 1 */ char strand[4]; /* + or - */ char frame[4]; /* 0, 1, 2, or . */ char group[128]; /* Name of gene cosmid.number. */ }; static int gffSegLineScan(struct gff* gff, struct gffSegLine *seg) { int scanned = sscanf(gff->buf, "%s %s %s %ld %ld %s %1s %s %s", seg->seqname, seg->source, seg->feature, &seg->start, &seg->end, seg->score, seg->strand, seg->frame, seg->group); return scanned; } -static boolean _gffSeekDoubleSharpLine(); +static boolean _gffGetLine(struct gff *gff) +/* Get the next line into a gff file. (private) + * return FALSE at EOF or if problem. */ +{ +char *s; +s = fgets(gff->buf, gff->bufSize, gff->file); +if (s == NULL) + { + return FALSE; + } +gff->bytesInBuf = strlen(gff->buf); +gff->readIx = 0; +gff->lineNumber += 1; +return TRUE; +} + +static boolean _gffSeekDoubleSharpLine(struct gff *gff) +/* Go find next line that begins with ## */ +{ +for (;;) + { + if (!_gffGetLine(gff)) return FALSE; + if (gff->bytesInBuf >= 2) + if (gff->buf[0] == '#' && gff->buf[1] == '#') + return TRUE; + } +} boolean gffOpen(struct gff *gff, char *fileName) /* Initialize gff structure and open file for it. */ { dnaUtilOpen(); /* Initialize structure and open file. */ zeroBytes(gff, sizeof(*gff)); gff->memPool = lmInit(16*1024); gff->fileSize = fileSize(fileName); if (gff->fileSize < 0 || (gff->file = fopen(fileName, "rb")) == NULL) { warn("Couldn't find the file named %s\n", fileName); return FALSE; @@ -69,79 +95,51 @@ } return TRUE; } void gffClose(struct gff *gff) /* Close down gff structure. */ { if (gff->file != NULL) fclose(gff->file); freeMem(gff->dna); lmCleanup(&gff->memPool); zeroBytes(gff, sizeof(*gff)); } -static boolean _gffGetLine(struct gff *gff) -/* Get the next line into a gff file. (private) - * return FALSE at EOF or if problem. */ -{ -char *s; -s = fgets(gff->buf, gff->bufSize, gff->file); -if (s == NULL) - { - return FALSE; - } -gff->bytesInBuf = strlen(gff->buf); -gff->readIx = 0; -gff->lineNumber += 1; -return TRUE; -} - #if 0 /* unused */ static boolean _gffAtEof(struct gff *gff) /* Returns TRUE if at the end of gff file. */ { return gff->file == NULL; } #endif #if 0 /* unused */ static char _getGffChar(struct gff *gff) /* Return next byte (not next base) in gff file. Return zero * if at end of file. */ { if (gff->readIx >= gff->bytesInBuf) { if (!_gffGetLine(gff)) return 0; } return gff->buf[gff->readIx++]; } #endif -static boolean _gffSeekDoubleSharpLine(struct gff *gff) -/* Go find next line that begins with ## */ -{ -for (;;) - { - if (!_gffGetLine(gff)) return FALSE; - if (gff->bytesInBuf >= 2) - if (gff->buf[0] == '#' && gff->buf[1] == '#') - return TRUE; - } -} - static boolean _gffSeekDna(struct gff *gff) /* Skip through file until you get the DNA */ { static char dnaIdent[] = "##DNA"; rewind(gff->file); for (;;) { if (!_gffGetLine(gff)) return FALSE; if (strncmp(gff->buf, dnaIdent, strlen(dnaIdent)) == 0) { sscanf(gff->buf, "##DNA %s", gff->dnaName); gff->bytesInBuf = 0; /* We're done with gff line. */ return TRUE; }