Changeset 607 for CMT/HEAD/source/cmt_awk.cxx
- Timestamp:
- Apr 3, 2012, 3:54:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_awk.cxx
r569 r607 40 40 41 41 cmt_string line; 42 /* 42 43 int pos; 43 44 int max_pos; … … 45 46 pos = 0; 46 47 max_pos = text.size (); 47 48 */ 48 49 m_accumulator.erase (0); 49 50 51 int nl; 52 int begin = 0; 53 int end = text.size (); 54 55 while ((nl = text.find (begin, '\n')) != cmt_string::npos) 56 { 57 if (begin < nl && text[nl - 1] == '\r') 58 { 59 text.substr (begin, nl - 1 - begin, line); 60 } 61 else 62 { 63 text.substr (begin, nl - begin, line); 64 } 65 // cerr << "|Awk::condition parse> [" << line << "]" << endl; 66 begin = nl + 1; 67 if (m_awk != 0) m_awk->inc_line_number (); 68 69 result = parse_line (line); 70 if (result != Awk::ok) return result; 71 } // while ((nl = text.find (begin, '\n')) != cmt_string::npos) 72 73 if (begin < end) 74 { 75 text.substr (begin, end - begin, line); 76 if (m_awk != 0) m_awk->inc_line_number (); 77 78 result = parse_line (line); 79 } 80 81 /* 50 82 for (pos = 0; pos < max_pos;) 51 83 { … … 90 122 if (result != Awk::ok) break; 91 123 } 92 124 */ 93 125 return (result); 94 126 } … … 232 264 if (m_condition != ok) return (m_condition); 233 265 234 if (CmtSystem::testenv ("CMTTESTAWK")) 266 if (Cmt::get_debug () && 267 CmtSystem::testenv ("CMTTESTAWK")) 235 268 { 236 269 Parser p (this, pattern, 0); … … 242 275 { 243 276 cmt_string line; 277 int nl; 278 int begin = 0; 279 int end = text.size (); 280 281 while ((nl = text.find (begin, '\n')) != cmt_string::npos) 282 { 283 if (begin < nl && text[nl - 1] == '\r') 284 { 285 text.substr (begin, nl - 1 - begin, line); 286 } 287 else 288 { 289 text.substr (begin, nl - begin, line); 290 } 291 // cerr << "|Awk::condition run> [" << line << "]" << endl; 292 begin = nl + 1; 293 m_line_number++; 294 295 if (line != "") 296 { 297 if ((pattern == "") || 298 (line.find (pattern) != cmt_string::npos)) 299 { 300 filter (line); 301 if (m_condition != ok) return (m_condition); 302 } 303 } 304 } // while ((nl = text.find (begin, '\n')) != cmt_string::npos) 305 306 if (begin < end) 307 { 308 text.substr (begin, end - begin, line); 309 m_line_number++; 310 311 if (line != "") 312 { 313 if ((pattern == "") || 314 (line.find (pattern) != cmt_string::npos)) 315 { 316 filter (line); 317 if (m_condition != ok) return (m_condition); 318 } 319 } 320 } 321 /* 244 322 int pos = 0; 245 323 int max_pos; … … 315 393 } 316 394 } 395 */ 317 396 } 318 397
Note: See TracChangeset
for help on using the changeset viewer.