]> git.saurik.com Git - wxWidgets.git/blame - wxPython/SWIG/swig.SplitLines.patch
Made more useable from the command-line, since that is its primary purpose.
[wxWidgets.git] / wxPython / SWIG / swig.SplitLines.patch
CommitLineData
d14a1e28
RD
1Index: Source/DOH/doh.h
2===================================================================
3RCS file: /cvsroot/SWIG/Source/DOH/doh.h,v
4retrieving revision 1.7
5diff -u -r1.7 doh.h
6--- Source/DOH/doh.h 11 Sep 2003 20:26:53 -0000 1.7
7+++ Source/DOH/doh.h 24 Oct 2003 00:00:41 -0000
8@@ -99,6 +99,7 @@
9 #define DohNewHash DOH_NAMESPACE(NewHash)
10 #define DohNewVoid DOH_NAMESPACE(NewVoid)
11 #define DohSplit DOH_NAMESPACE(Split)
12+#define DohSplitLines DOH_NAMESPACE(SplitLines)
13 #define DohNone DOH_NAMESPACE(None)
14 #define DohCall DOH_NAMESPACE(Call)
15 #define DohObjMalloc DOH_NAMESPACE(ObjMalloc)
16@@ -304,6 +305,7 @@
17
18 extern DOHVoid *DohNewVoid(void *ptr, void (*del)(void *));
19 extern DOHList *DohSplit(DOHFile *input, char ch, int nsplits);
20+extern DOHList *DohSplitLines(DOHFile *input);
21 extern DOH *DohNone;
22
23 extern void DohMemoryDebug(void);
24@@ -378,6 +380,7 @@
25 #define Strchr DohStrchr
26 #define Copyto DohCopyto
27 #define Split DohSplit
28+#define SplitLines DohSplitLines
29 #define Setmark DohSetmark
30 #define Getmark DohGetmark
31 #define None DohNone
32Index: Source/DOH/fio.c
33===================================================================
34RCS file: /cvsroot/SWIG/Source/DOH/fio.c,v
35retrieving revision 1.2
36diff -u -r1.2 fio.c
37--- Source/DOH/fio.c 15 Aug 2003 19:37:27 -0000 1.2
38+++ Source/DOH/fio.c 24 Oct 2003 00:00:42 -0000
39@@ -497,6 +497,36 @@
40 }
41
42 /* -----------------------------------------------------------------------------
43+ * DohSplitLines()
44+ *
45+ * Split an input stream into a list of strings delimited by newline characters.
46+ * ----------------------------------------------------------------------------- */
47+
48+DOH *
49+DohSplitLines(DOH *in) {
50+ DOH *list;
51+ DOH *str;
52+ int c = 0;
53+
54+ list = NewList();
55+
56+ if (DohIsString(in)) {
57+ Seek(in,0,SEEK_SET);
58+ }
59+
60+ while (c != EOF) {
61+ str = NewString("");
62+ while ((c = Getc(in)) != '\n' && c != EOF) {
63+ Putc(c, str);
64+ }
65+ Append(list,str);
66+ Delete(str);
67+ }
68+ return list;
69+}
70+
71+
72+/* -----------------------------------------------------------------------------
73 * DohReadline()
74 *
75 * Read a single input line and return it as a string.