[ 829317 ] Adds DohSplitLines function
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5214 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ff61b0f0f8
commit
f0b686d62c
2 changed files with 33 additions and 0 deletions
|
|
@ -99,6 +99,7 @@
|
||||||
#define DohNewHash DOH_NAMESPACE(NewHash)
|
#define DohNewHash DOH_NAMESPACE(NewHash)
|
||||||
#define DohNewVoid DOH_NAMESPACE(NewVoid)
|
#define DohNewVoid DOH_NAMESPACE(NewVoid)
|
||||||
#define DohSplit DOH_NAMESPACE(Split)
|
#define DohSplit DOH_NAMESPACE(Split)
|
||||||
|
#define DohSplitLines DOH_NAMESPACE(SplitLines)
|
||||||
#define DohNone DOH_NAMESPACE(None)
|
#define DohNone DOH_NAMESPACE(None)
|
||||||
#define DohCall DOH_NAMESPACE(Call)
|
#define DohCall DOH_NAMESPACE(Call)
|
||||||
#define DohObjMalloc DOH_NAMESPACE(ObjMalloc)
|
#define DohObjMalloc DOH_NAMESPACE(ObjMalloc)
|
||||||
|
|
@ -304,6 +305,7 @@ extern DOHHash *DohNewHash();
|
||||||
|
|
||||||
extern DOHVoid *DohNewVoid(void *ptr, void (*del)(void *));
|
extern DOHVoid *DohNewVoid(void *ptr, void (*del)(void *));
|
||||||
extern DOHList *DohSplit(DOHFile *input, char ch, int nsplits);
|
extern DOHList *DohSplit(DOHFile *input, char ch, int nsplits);
|
||||||
|
extern DOHList *DohSplitLines(DOHFile *input);
|
||||||
extern DOH *DohNone;
|
extern DOH *DohNone;
|
||||||
|
|
||||||
extern void DohMemoryDebug(void);
|
extern void DohMemoryDebug(void);
|
||||||
|
|
@ -378,6 +380,7 @@ extern void DohMemoryDebug(void);
|
||||||
#define Strchr DohStrchr
|
#define Strchr DohStrchr
|
||||||
#define Copyto DohCopyto
|
#define Copyto DohCopyto
|
||||||
#define Split DohSplit
|
#define Split DohSplit
|
||||||
|
#define SplitLines DohSplitLines
|
||||||
#define Setmark DohSetmark
|
#define Setmark DohSetmark
|
||||||
#define Getmark DohGetmark
|
#define Getmark DohGetmark
|
||||||
#define None DohNone
|
#define None DohNone
|
||||||
|
|
|
||||||
|
|
@ -496,6 +496,36 @@ DohSplit(DOH *in, char ch, int nsplits) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* 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()
|
* DohReadline()
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue