Index: Source/DOH/doh.h =================================================================== RCS file: /cvsroot/SWIG/Source/DOH/doh.h,v retrieving revision 1.7 diff -u -r1.7 doh.h --- Source/DOH/doh.h 11 Sep 2003 20:26:53 -0000 1.7 +++ Source/DOH/doh.h 24 Oct 2003 00:00:41 -0000 @@ -99,6 +99,7 @@ #define DohNewHash DOH_NAMESPACE(NewHash) #define DohNewVoid DOH_NAMESPACE(NewVoid) #define DohSplit DOH_NAMESPACE(Split) +#define DohSplitLines DOH_NAMESPACE(SplitLines) #define DohNone DOH_NAMESPACE(None) #define DohCall DOH_NAMESPACE(Call) #define DohObjMalloc DOH_NAMESPACE(ObjMalloc) @@ -304,6 +305,7 @@ extern DOHVoid *DohNewVoid(void *ptr, void (*del)(void *)); extern DOHList *DohSplit(DOHFile *input, char ch, int nsplits); +extern DOHList *DohSplitLines(DOHFile *input); extern DOH *DohNone; extern void DohMemoryDebug(void); @@ -378,6 +380,7 @@ #define Strchr DohStrchr #define Copyto DohCopyto #define Split DohSplit +#define SplitLines DohSplitLines #define Setmark DohSetmark #define Getmark DohGetmark #define None DohNone Index: Source/DOH/fio.c =================================================================== RCS file: /cvsroot/SWIG/Source/DOH/fio.c,v retrieving revision 1.2 diff -u -r1.2 fio.c --- Source/DOH/fio.c 15 Aug 2003 19:37:27 -0000 1.2 +++ Source/DOH/fio.c 24 Oct 2003 00:00:42 -0000 @@ -497,6 +497,36 @@ } /* ----------------------------------------------------------------------------- + * DohSplitLines() + * + * Split an input stream into a list of strings delimited by newline characters. + * ----------------------------------------------------------------------------- */ + +DOH * +DohSplitLines(DOH *in) { + DOH *list; + DOH *str; + int c = 0; + + list = NewList(); + + if (DohIsString(in)) { + Seek(in,0,SEEK_SET); + } + + while (c != EOF) { + str = NewString(""); + while ((c = Getc(in)) != '\n' && c != EOF) { + Putc(c, str); + } + Append(list,str); + Delete(str); + } + return list; +} + + +/* ----------------------------------------------------------------------------- * DohReadline() * * Read a single input line and return it as a string.