00001 /***************************************************************************** 00002 * Copyright (C) 2002, F. Hoffmann-La Roche & Co., AG, Basel, Switzerland. * 00003 * * 00004 * This file is part of "Roche Bioinformatics Software Objects and Services" * 00005 * * 00006 * This file is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Lesser General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2.1 of the License, or (at your option) any later version. * 00010 * * 00011 * This file is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * To obtain a copy of the GNU Lesser General Public License * 00017 * please write to the Free Software * 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00019 * or visit the WWW site http://www.gnu.org/copyleft/lesser.txt * 00020 * * 00021 * SCOPE: this licence applies to this file. Other files of the * 00022 * "Roche Bioinformatics Software Objects and Services" may be * 00023 * subject to other licences. * 00024 * * 00025 * CONTACT: clemens.broger@roche.com or detlef.wolf@roche.com * 00026 * * 00027 *****************************************************************************/ 00028 00035 #ifndef _nextline_h_ 00036 #define _nextline_h_ 00037 00038 #include "format.h" 00039 00043 typedef struct _lineStreamStruct_ { 00044 /* the members of this struct are PRIVATE for the 00045 LineStream module -- DO NOT access from outside 00046 the LineStream module */ 00047 FILE *fp; 00048 char *line; 00049 int lineLen; 00050 WordIter wi; 00051 int count; 00052 int status ; /* exit status of popen() */ 00053 char *(*nextLine_hook)(struct _lineStreamStruct_ *); 00054 Stringa buffer ; /* NULL if not in buffered mode, else used 00055 used for remembering last line seen */ 00056 char *bufferLine ; /* pointer to 'buffer' or NULL if EOF */ 00057 int bufferBack ; /* 0=normal, 1=take next line from buffer */ 00058 } *LineStream; 00059 00060 extern LineStream ls_createFromFile (char *fn); 00061 extern LineStream ls_createFromPipe (char *command); 00062 extern LineStream ls_createFromBuffer (char *buffer); 00063 extern char *ls_nextLine (LineStream this1); 00064 extern void ls_destroy_func (LineStream this1); /* do not use this function */ 00065 00070 #define ls_destroy(this1) (ls_destroy_func(this1),this1=NULL) /* use this one */ 00071 extern int ls_lineCountGet (LineStream this1); 00072 extern void ls_cat(LineStream this1, char *filename) ; 00073 extern int ls_skipStatusGet(LineStream this1) ; 00074 extern int ls_isEof(LineStream this1) ; 00075 extern void ls_bufferSet(LineStream this1, int lineCnt) ; 00076 extern void ls_back(LineStream this1, int lineCnt) ; 00077 #endif