aboutsummaryrefslogtreecommitdiff
path: root/src/viewerplainpct.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/viewerplainpct.cpp128
1 files changed, 0 insertions, 128 deletions
diff --git a/src/viewerplainpct.cpp b/src/viewerplainpct.cpp
deleted file mode 100644
index 4d9fa7b..0000000
--- a/src/viewerplainpct.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
1#include "viewerplainpct.h"
2#include "perform.h"
3#include "bu/plugger.h"
4#include "math.h"
5
6PluginInterface2( plainpct, ViewerPlainPct, Viewer, "Mike Buland", 0, 1 );
7
8ViewerPlainPct::ViewerPlainPct() :
9 bRunClean( true )
10{
11}
12
13ViewerPlainPct::~ViewerPlainPct()
14{
15}
16
17void 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
31void ViewerPlainPct::endCommand()
32{
33 if( sCmd.front().bCmdClean == false )
34 printf("\n");
35 sCmd.pop_front();
36 if(sCmd.empty())
37 iCC++;
38}
39
40void ViewerPlainPct::indent()
41{
42 if( sCmd.empty() ) return;
43 int jmax = sCmd.front().nLevel;
44 for( int j = 0; j < jmax; j++ )
45 {
46 printf(" ");
47 }
48}
49
50void ViewerPlainPct::printHead()
51{
52 if( sCmd.front().bCmdClean == true )
53 {
54 bRunClean = false;
55 sCmd.front().bCmdClean = false;
56 indent();
57 if(sCmd.size() > 1)
58 printf("--- %s ---\n", sCmd.front().sTarget.c_str() );
59 else
60 printf("--- [%d/%d] %s ---\n", iCC, iTC, sCmd.front().sTarget.c_str() );
61 }
62}
63
64void ViewerPlainPct::printPerform(const char *sRule, const char *sTarget)
65{
66 int iPct = (int)round(
67 ((double)sCmd.front().iCP/(double)sCmd.front().iTP)*100.0
68 );
69 if(sCmd.size() > 1)
70 printf( "[%3d%%] %8s: %s\n", iPct, sRule, sTarget );
71 else
72 printf( "[%3d%%] %8s: %s\n", iPct, sRule, sTarget );
73}
74
75void ViewerPlainPct::beginRequiresCheck( bool bCached, const std::string &sName )
76{
77 printHead();
78 indent();
79 printPerform("deps", sName.c_str());
80}
81
82void ViewerPlainPct::endRequiresCheck()
83{
84 sCmd.front().iCP++;
85}
86
87void ViewerPlainPct::skipRequiresCheck( bool bCached, const std::string &sName )
88{
89 sCmd.front().iCP++;
90}
91
92void ViewerPlainPct::beginPerform( Perform *pPerform )
93{
94 printHead();
95 indent();
96 printPerform(pPerform->getRule().c_str(), pPerform->getTarget().c_str());
97}
98
99void ViewerPlainPct::endPerform()
100{
101 sCmd.front().iCP++;
102}
103
104void ViewerPlainPct::skipPerform( Perform *pPerform )
105{
106 sCmd.front().iCP++;
107}
108
109void ViewerPlainPct::beginPerforms( int nCount )
110{
111 sCmd.front().iTP = nCount*2;
112 sCmd.front().iCP = 1;
113}
114
115void ViewerPlainPct::beginAction( const std::string &sName, int nCommands )
116{
117 iTC = nCommands;
118 iCC = 1;
119}
120
121void ViewerPlainPct::endAction()
122{
123 if( bRunClean == true )
124 {
125 printf("Nothing to be done.\n\n");
126 }
127}
128