b45b10995959ef874cb0f198d32c8fd475c0970f galt Mon Apr 16 21:20:40 2012 -0700 remove -lm dependency on linefile; also enables others to use callback methods to support other types diff --git src/inc/linefile.h src/inc/linefile.h index c9ab40b..d00f93e 100644 --- src/inc/linefile.h +++ src/inc/linefile.h @@ -46,34 +46,34 @@ enum nlType nlType; /* type of line endings: dos, unix, mac or undet */ bool reuse; /* Set if reusing input. */ char *buf; /* Buffer. */ struct pipeline *pl; /* pipeline if reading compressed */ struct metaOutput *metaOutput; /* list of FILE handles to write metaData to */ bool isMetaUnique; /* if set, do not repeat comments in output */ struct hash *metaLines; /* save lines to suppress repetition */ #ifdef USE_TABIX tabix_t *tabix; /* A tabix-compressed file and its binary index file (.tbi) */ ti_iter_t tabixIter; /* An iterator to get decompressed indexed lines of text */ #endif struct dyString *fullLine; // Filled with full line when a lineFileNextFull is called struct dyString *rawLines; // Filled with raw lines used to create the full line boolean fullLineReuse; // If TRUE, next call to lineFileNextFull will get already built fullLine - struct bbiFile *bbiHandle; // BigBed handle - struct bbiChromInfo *bbiChrom, *bbiChromList; // BigBed chrom info - struct lm *bbiLm; // BigBed local memory - struct bigBedInterval *bbiInterval, *bbiIntervalList; // BigBed intervals + void *dataForCallBack; // ptr to data needed for callbacks + void(*checkSupport)(struct lineFile *lf, char *where); // check if operation supported + boolean(*nextCallBack)(struct lineFile *lf, char **retStart, int *retSize); // next line callback + void(*closeCallBack)(struct lineFile *lf); // close callback }; char *getFileNameFromHdrSig(char *m); /* Check if header has signature of supported compression stream, and return a phoney filename for it, or NULL if no sig found. */ struct lineFile *lineFileDecompressFd(char *name, bool zTerm, int fd); /* open a linefile with decompression from a file or socket descriptor */ struct lineFile *lineFileDecompressMem(bool zTerm, char *mem, long size); /* open a linefile with decompression from a memory stream */ struct lineFile *lineFileMayOpen(char *fileName, bool zTerm); /* Try and open up a lineFile. If fileName ends in .gz, .Z, or .bz2, * it will be read from a decompress pipeline. */ @@ -248,30 +248,32 @@ /* Extract HTTP response header from lf into hdr, tell if it's * "Transfer-Encoding: chunked" or if it has a contentLength. */ struct dyString *lineFileSlurpHttpBody(struct lineFile *lf, boolean chunked, int contentLength); /* Return a dyString that contains the http response body in lf. Handle * chunk-encoding and content-length. */ void lineFileSetMetaDataOutput(struct lineFile *lf, FILE *f); /* set file to write meta data to, * should be called before reading from input file */ void lineFileSetUniqueMetaData(struct lineFile *lf); /* suppress duplicate lines in metadata */ +void lineFileExpandBuf(struct lineFile *lf, int newSize); +/* Expand line file buffer. */ void lineFileRemoveInitialCustomTrackLines(struct lineFile *lf); /* remove initial browser and track lines */ /*----- Optionally-compiled wrapper on tabix (compression + indexing): -----*/ #define COMPILE_WITH_TABIX "%s: Sorry, this functionality is available only when\n" \ "you have installed the tabix library from\n" \ "http://samtools.sourceforge.net/ and rebuilt kent/src with USE_TABIX=1\n" \ "(see http://genomewiki.ucsc.edu/index.php/Build_Environment_Variables)." struct lineFile *lineFileTabixMayOpen(char *fileOrUrl, bool zTerm); /* Wrap a line file around a data file that has been compressed and indexed * by the tabix command line program. The index file <fileName>.tbi must be * readable in addition to fileName. If there's a problem, warn & return NULL.