Mercurial > hg > octave-nkf
comparison src/ls-oct-ascii.cc @ 5765:7ba9ad1fec11
[project @ 2006-04-17 05:05:15 by jwe]
author | jwe |
---|---|
date | Mon, 17 Apr 2006 05:05:17 +0000 |
parents | a9ac02e9fda5 |
children | ace8d8d26933 |
comparison
equal
deleted
inserted
replaced
5764:80409c2defcc | 5765:7ba9ad1fec11 |
---|---|
31 #include <cctype> | 31 #include <cctype> |
32 | 32 |
33 #include <fstream> | 33 #include <fstream> |
34 #include <iomanip> | 34 #include <iomanip> |
35 #include <iostream> | 35 #include <iostream> |
36 #include <sstream> | |
36 #include <string> | 37 #include <string> |
37 | 38 |
38 #include "byte-swap.h" | 39 #include "byte-swap.h" |
39 #include "data-conv.h" | 40 #include "data-conv.h" |
40 #include "file-ops.h" | 41 #include "file-ops.h" |
41 #include "glob-match.h" | 42 #include "glob-match.h" |
42 #include "lo-mappers.h" | 43 #include "lo-mappers.h" |
43 #include "lo-sstream.h" | |
44 #include "mach-info.h" | 44 #include "mach-info.h" |
45 #include "oct-env.h" | 45 #include "oct-env.h" |
46 #include "oct-time.h" | 46 #include "oct-time.h" |
47 #include "quit.h" | 47 #include "quit.h" |
48 #include "str-vec.h" | 48 #include "str-vec.h" |
118 char c; | 118 char c; |
119 while (is.get (c)) | 119 while (is.get (c)) |
120 { | 120 { |
121 if (c == '%' || c == '#') | 121 if (c == '%' || c == '#') |
122 { | 122 { |
123 OSSTREAM buf; | 123 std::ostringstream buf; |
124 | 124 |
125 while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) | 125 while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) |
126 ; // Skip whitespace and comment characters. | 126 ; // Skip whitespace and comment characters. |
127 | 127 |
128 if (isalpha (c)) | 128 if (isalpha (c)) |
129 buf << c; | 129 buf << c; |
130 | 130 |
131 while (is.get (c) && isalpha (c)) | 131 while (is.get (c) && isalpha (c)) |
132 buf << c; | 132 buf << c; |
133 | 133 |
134 buf << OSSTREAM_ENDS; | 134 std::string tmp = buf.str (); |
135 std::string tmp = OSSTREAM_STR (buf); | |
136 bool match = (tmp.compare (0, strlen (keyword), keyword) == 0); | 135 bool match = (tmp.compare (0, strlen (keyword), keyword) == 0); |
137 OSSTREAM_FREEZE (buf); | |
138 | 136 |
139 if (match) | 137 if (match) |
140 { | 138 { |
141 OSSTREAM value; | 139 std::ostringstream value; |
142 while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) | 140 while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) |
143 ; // Skip whitespace and the colon. | 141 ; // Skip whitespace and the colon. |
144 | 142 |
145 if (c != '\n') | 143 if (c != '\n') |
146 { | 144 { |
147 value << c; | 145 value << c; |
148 while (is.get (c) && c != '\n') | 146 while (is.get (c) && c != '\n') |
149 value << c; | 147 value << c; |
150 } | 148 } |
151 value << OSSTREAM_ENDS; | 149 |
152 retval = OSSTREAM_STR (value); | 150 retval = value.str (); |
153 OSSTREAM_FREEZE (value); | |
154 break; | 151 break; |
155 } | 152 } |
156 else if (next_only) | 153 else if (next_only) |
157 break; | 154 break; |
158 } | 155 } |