diff options
Diffstat (limited to 'src/viewerplainpct.cpp')
| -rw-r--r-- | src/viewerplainpct.cpp | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/src/viewerplainpct.cpp b/src/viewerplainpct.cpp new file mode 100644 index 0000000..a7baff1 --- /dev/null +++ b/src/viewerplainpct.cpp | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | #include "viewerplainpct.h" | ||
| 2 | #include "perform.h" | ||
| 3 | #include "plugger.h" | ||
| 4 | #include "math.h" | ||
| 5 | |||
| 6 | PluginInterface2( plainpct, ViewerPlainPct, Viewer, "Mike Buland", 0, 1 ); | ||
| 7 | |||
| 8 | ViewerPlainPct::ViewerPlainPct() : | ||
| 9 | bRunClean( true ) | ||
| 10 | { | ||
| 11 | } | ||
| 12 | |||
| 13 | ViewerPlainPct::~ViewerPlainPct() | ||
| 14 | { | ||
| 15 | } | ||
| 16 | |||
| 17 | void ViewerPlainPct::beginCommand( Action::eAction nAct, const std::string &sTarget ) | ||
| 18 | { | ||
| 19 | Cmd cmd; | ||
| 20 | if( sCmd.empty() ) | ||
| 21 | cmd.nLevel = 0; | ||
| 22 | else | ||
| 23 | cmd.nLevel = sCmd.front().nLevel+1; | ||
| 24 | |||
| 25 | cmd.bCmdClean = true; | ||
| 26 | cmd.sTarget = sTarget; | ||
| 27 | |||
| 28 | sCmd.push_front( cmd ); | ||
| 29 | } | ||
| 30 | |||
| 31 | void ViewerPlainPct::endCommand() | ||
| 32 | { | ||
| 33 | if( sCmd.front().bCmdClean == false ) | ||
| 34 | printf("\n"); | ||
| 35 | sCmd.pop_front(); | ||
| 36 | iCC++; | ||
| 37 | } | ||
| 38 | |||
| 39 | void ViewerPlainPct::indent() | ||
| 40 | { | ||
| 41 | if( sCmd.empty() ) return; | ||
| 42 | int jmax = sCmd.front().nLevel; | ||
| 43 | for( int j = 0; j < jmax; j++ ) | ||
| 44 | { | ||
| 45 | printf(" "); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | void ViewerPlainPct::printHead() | ||
| 50 | { | ||
| 51 | if( sCmd.front().bCmdClean == true ) | ||
| 52 | { | ||
| 53 | bRunClean = false; | ||
| 54 | sCmd.front().bCmdClean = false; | ||
| 55 | indent(); | ||
| 56 | printf("--- [%d/%d] %s ---\n", iCC, iTC, sCmd.front().sTarget.c_str() ); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | void ViewerPlainPct::beginRequiresCheck( bool bCached, const std::string &sName ) | ||
| 61 | { | ||
| 62 | printHead(); | ||
| 63 | indent(); | ||
| 64 | printf("[%3d%%] deps: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), sName.c_str() ); | ||
| 65 | } | ||
| 66 | |||
| 67 | void ViewerPlainPct::endRequiresCheck() | ||
| 68 | { | ||
| 69 | iCP++; | ||
| 70 | bDidReq = true; | ||
| 71 | } | ||
| 72 | |||
| 73 | void ViewerPlainPct::beginPerform( Perform *pPerform ) | ||
| 74 | { | ||
| 75 | printHead(); | ||
| 76 | indent(); | ||
| 77 | printf("[%3d%%] %8s: %s\n", (int)round(((double)iCP/(double)iTP)*100.0), pPerform->getRule().c_str(), pPerform->getTarget().c_str() ); | ||
| 78 | } | ||
| 79 | |||
| 80 | void ViewerPlainPct::endPerform() | ||
| 81 | { | ||
| 82 | if(!bDidReq) | ||
| 83 | iCP++; | ||
| 84 | bDidReq = false; | ||
| 85 | } | ||
| 86 | |||
| 87 | void ViewerPlainPct::beginPerforms( int nCount ) | ||
| 88 | { | ||
| 89 | iTP = nCount; | ||
| 90 | iCP = 1; | ||
| 91 | bDidReq = false; | ||
| 92 | } | ||
| 93 | |||
| 94 | void ViewerPlainPct::beginAction( const std::string &sName, int nCommands ) | ||
| 95 | { | ||
| 96 | iTC = nCommands; | ||
| 97 | iCC = 1; | ||
| 98 | } | ||
| 99 | |||
| 100 | void ViewerPlainPct::endAction() | ||
| 101 | { | ||
| 102 | if( bRunClean == true ) | ||
| 103 | { | ||
| 104 | printf("Nothing to be done.\n\n"); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
