#include <cmt_awk.h>
Inheritance diagram for Awk:
Public Types |
|
| enum ? | condition { ok, stopped, failed } |
Public Methods |
|
| ? | Awk () |
| virtual? | ~Awk () |
| condition? | run (const cmt_string &text, const cmt_string &pattern="") |
| condition? | run (const cmt_string &text, const cmt_regexp &expression) |
| void? | stop () |
| void? | abort () |
| void? | allow_continuation () |
| condition? | get_last_condition () const |
| virtual void? | begin () |
| virtual void? | filter (const cmt_string &line) |
| virtual void? | end () |
| void? | inc_line_number () |
Protected Attributes |
|
| int? | m_line_number |
| condition? | m_condition |
| bool? | m_continuation_allowed |
|
| ? |
Definition at line 62 of file cmt_awk.h. Referenced by get_last_condition(), Parser::parse(), Parser::parse_line(), PAwk::run(), FAwk::run(), and run(). |
|
| ? |
Definition at line 214 of file cmt_awk.cxx. References m_condition, and ok. 00215 {
00216 m_condition = ok;
00217 }
|
|
| ? |
Definition at line 220 of file cmt_awk.cxx. 00221 {
00222 }
|
|
| ? |
Definition at line 418 of file cmt_awk.cxx. References failed, and m_condition. 00419 {
00420 m_condition = failed;
00421 }
|
|
| ? |
Definition at line 424 of file cmt_awk.cxx. References m_continuation_allowed. 00425 {
00426 m_continuation_allowed = true;
00427 }
|
|
| ? |
Reimplemented in Grep, Cut, RecursivePass1, RecursivePass2, WinDefAwk, Packager, Prototyper, DependencyFilter, SequenceRunner, TriggerAnalyzer, and DependencyAnalyzer. Definition at line 436 of file cmt_awk.cxx. Referenced by PAwk::run(), and run(). 00437 {
00438 }
|
|
| ? |
Reimplemented in WinDefAwk, Prototyper, SequenceRunner, TriggerAnalyzer, DependencyAnalyzer, LibraryAnalyzer, and ApplicationAnalyzer. Definition at line 447 of file cmt_awk.cxx. Referenced by PAwk::run(), and run(). 00448 {
00449 }
|
|
| ? |
Reimplemented in Grep, Cut, RecursivePass1, RecursivePass2, WinDefAwk, Packager, Prototyper, DependencyFilter, CmtMountFilterParser, AwkActor, ProjectReader, ProjectPatcher, SequenceRunner, TriggerAnalyzer, and DependencyAnalyzer. Definition at line 441 of file cmt_awk.cxx. Referenced by Parser::parse_line(), PAwk::run(), and run(). 00442 {
00443 //cout << "awk> " << line << endl;
00444 }
|
|
| ? |
Definition at line 430 of file cmt_awk.cxx. References condition. Referenced by Parser::parse_line(). 00431 {
00432 return (m_condition);
00433 }
|
|
| ? |
Definition at line 452 of file cmt_awk.cxx. References m_line_number. Referenced by Parser::parse(). 00453 {
00454 m_line_number++;
00455 }
|
|
||||||||||||
| ? |
Reimplemented in FAwk, and PAwk. Definition at line 325 of file cmt_awk.cxx. References begin(), condition, end(), m_condition, m_line_number, ok, and Parser::parse(). 00327 {
00328 m_line_number = 0;
00329 m_condition = ok;
00330
00331 begin ();
00332 if (m_condition != ok) return (m_condition);
00333
00334 Parser p (this, "", &expression);
00335
00336 m_condition = p.parse (text);
00337 if (m_condition != ok) return (m_condition);
00338
00339 /*
00340 if (CmtSystem::testenv ("CMTTESTAWK"))
00341 {
00342 }
00343 else
00344 {
00345 cmt_string line;
00346 int pos = 0;
00347 int max_pos;
00348
00349 max_pos = text.size ();
00350
00351 for (pos = 0; pos < max_pos;)
00352 {
00353 int cr = text.find (pos, "\r\n");
00354 int nl = text.find (pos, '\n');
00355
00356 // Get the first end-of-line (either lf or cr-lf)
00357
00358 int first = nl;
00359
00360 if (cr != cmt_string::npos)
00361 {
00362 if (nl == cmt_string::npos)
00363 {
00364 first = cr;
00365 }
00366 else
00367 {
00368 first = (nl < cr) ? nl : cr;
00369 }
00370 }
00371
00372 if (first == cmt_string::npos)
00373 {
00374 // This is likely the last line since there is no end-of-line
00375 text.substr (pos, line);
00376 pos = max_pos;
00377 }
00378 else if (first > pos)
00379 {
00380 // The eol was found beyond the current position
00381 // (ie. this is a non empty line)
00382 text.substr (pos, first - pos, line);
00383 pos = first + 1;
00384 }
00385 else
00386 {
00387 // an empty line
00388 line = "";
00389 pos++;
00390 }
00391
00392 m_line_number++;
00393
00394 if (line != "")
00395 {
00396 if (expression.match (line))
00397 {
00398 filter (line);
00399 if (m_condition != ok) return (m_condition);
00400 }
00401 }
00402 }
00403 }
00404 */
00405
00406 end ();
00407
00408 return (m_condition);
00409 }
|
|
||||||||||||
| ? |
Reimplemented in FAwk, and PAwk. Definition at line 225 of file cmt_awk.cxx. References begin(), condition, end(), filter(), cmt_string::find(), m_condition, m_line_number, cmt_string::npos, ok, Parser::parse(), cmt_string::size(), cmt_string::substr(), and CmtSystem::testenv(). Referenced by DependencyGenerator::build(), CvsImplementation::checkout_from_requirements(), Project::create(), ProjectFactory::create_project(), Cmt::do_awk(), CvsImplementation::do_checkout(), FAwk::run(), and CvsImplementation::show_cvs_infos(). 00227 {
00228 m_line_number = 0;
00229 m_condition = ok;
00230
00231 begin ();
00232 if (m_condition != ok) return (m_condition);
00233
00234 if (CmtSystem::testenv ("CMTTESTAWK"))
00235 {
00236 Parser p (this, pattern, 0);
00237
00238 m_condition = p.parse (text);
00239 if (m_condition != ok) return (m_condition);
00240 }
00241 else
00242 {
00243 cmt_string line;
00244 int pos = 0;
00245 int max_pos;
00246
00247 max_pos = text.size ();
00248
00249 for (pos = 0; pos < max_pos;)
00250 {
00251 int cr = text.find (pos, "\r\n");
00252 int nl = text.find (pos, '\n');
00253
00254 // Get the first end-of-line (either lf or cr-lf)
00255
00256 //--------------------
00257 //
00258 // cr 1 0
00259 // nl
00260 //
00261 // 1 a b
00262 //
00263 // 0 c d
00264 //
00265 //--------------------
00266
00267 int first = nl;
00268
00269 if (cr != cmt_string::npos)
00270 {
00271 // cases a or c
00272
00273 if (nl == cmt_string::npos)
00274 {
00275 // case a
00276 first = cr;
00277 }
00278 else
00279 {
00280 // case c
00281 first = (nl < cr) ? nl : cr;
00282 }
00283 }
00284
00285 if (first == cmt_string::npos)
00286 {
00287 // This is likely the last line since there is no end-of-line
00288 text.substr (pos, line);
00289 pos = max_pos;
00290 }
00291 else if (first > pos)
00292 {
00293 // The eol was found beyond the current position
00294 // (ie. this is a non empty line)
00295 text.substr (pos, first - pos, line);
00296 pos = first + 1;
00297 }
00298 else
00299 {
00300 // an empty line
00301 line = "";
00302 pos++;
00303 }
00304
00305 m_line_number++;
00306
00307 if (line != "")
00308 {
00309 if ((pattern == "") ||
00310 (line.find (pattern) != cmt_string::npos))
00311 {
00312 filter (line);
00313 if (m_condition != ok) return (m_condition);
00314 }
00315 }
00316 }
00317 }
00318
00319 end ();
00320
00321 return (m_condition);
00322 }
|
|
| ? |
Definition at line 412 of file cmt_awk.cxx. References m_condition, and stopped. Referenced by Prototyper::begin(), and CmtMountFilterParser::filter(). 00413 {
00414 m_condition = stopped;
00415 }
|
|
| ? |
Definition at line 80 of file cmt_awk.h. Referenced by abort(), Awk(), PAwk::run(), run(), and stop(). |
|
| ? |
Definition at line 81 of file cmt_awk.h. Referenced by allow_continuation(). |
|
| ? |
Definition at line 79 of file cmt_awk.h. Referenced by inc_line_number(), PAwk::run(), and run(). |