aboutsummaryrefslogtreecommitdiff
path: root/src/viewdefault.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/viewdefault.cpp242
1 files changed, 121 insertions, 121 deletions
diff --git a/src/viewdefault.cpp b/src/viewdefault.cpp
index 8b7e345..815be39 100644
--- a/src/viewdefault.cpp
+++ b/src/viewdefault.cpp
@@ -7,44 +7,44 @@
7using namespace Bu; 7using namespace Bu;
8 8
9PluginInterface3( pluginViewDefault, default, ViewDefault, View, 9PluginInterface3( pluginViewDefault, default, ViewDefault, View,
10 "Mike Buland", 0, 1 ); 10 "Mike Buland", 0, 1 );
11 11
12#define ESC "\x1b" 12#define ESC "\x1b"
13 13
14#define C_RESET ESC "[0m" 14#define C_RESET ESC "[0m"
15#define C_RED ESC "[31m" 15#define C_RED ESC "[31m"
16#define C_GREEN ESC "[32m" 16#define C_GREEN ESC "[32m"
17#define C_YELLOW ESC "[33m" 17#define C_YELLOW ESC "[33m"
18#define C_BLUE ESC "[34m" 18#define C_BLUE ESC "[34m"
19#define C_MAGENTA ESC "[35m" 19#define C_MAGENTA ESC "[35m"
20#define C_CYAN ESC "[36m" 20#define C_CYAN ESC "[36m"
21#define C_WHITE ESC "[37m" 21#define C_WHITE ESC "[37m"
22#define C_DEFAULT ESC "[39m" 22#define C_DEFAULT ESC "[39m"
23 23
24#define C_BR_RED ESC "[1;31m" 24#define C_BR_RED ESC "[1;31m"
25#define C_BR_GREEN ESC "[1;32m" 25#define C_BR_GREEN ESC "[1;32m"
26#define C_BR_YELLOW ESC "[1;33m" 26#define C_BR_YELLOW ESC "[1;33m"
27#define C_BR_BLUE ESC "[1;34m" 27#define C_BR_BLUE ESC "[1;34m"
28#define C_BR_MAGENTA ESC "[1;35m" 28#define C_BR_MAGENTA ESC "[1;35m"
29#define C_BR_CYAN ESC "[1;36m" 29#define C_BR_CYAN ESC "[1;36m"
30#define C_BR_WHITE ESC "[1;37m" 30#define C_BR_WHITE ESC "[1;37m"
31 31
32ViewDefault::ViewDefault() : 32ViewDefault::ViewDefault() :
33 bFirst( true ), 33 bFirst( true ),
34 bDisped( false ), 34 bDisped( false ),
35 bDispedTrg( false ), 35 bDispedTrg( false ),
36 iDepth( 0 ), 36 iDepth( 0 ),
37 iTotal( 0 ), 37 iTotal( 0 ),
38 iCurrent( 0 ) 38 iCurrent( 0 )
39{ 39{
40} 40}
41 41
42ViewDefault::~ViewDefault() 42ViewDefault::~ViewDefault()
43{ 43{
44 if( bDisped == false ) 44 if( bDisped == false )
45 { 45 {
46 sio << "Nothing to be done." << sio.nl << sio.nl; 46 sio << "Nothing to be done." << sio.nl << sio.nl;
47 } 47 }
48} 48}
49 49
50void ViewDefault::beginAction( const Bu::String &/*sAction*/ ) 50void ViewDefault::beginAction( const Bu::String &/*sAction*/ )
@@ -56,73 +56,73 @@ void ViewDefault::endAction()
56} 56}
57 57
58void ViewDefault::skipTarget( const Bu::String &/*sProfile*/, 58void ViewDefault::skipTarget( const Bu::String &/*sProfile*/,
59 const Target &/*rTarget*/ ) 59 const Target &/*rTarget*/ )
60{ 60{
61 iCurrent++; 61 iCurrent++;
62} 62}
63 63
64void ViewDefault::beginTarget( const Bu::String &sProfile, 64void ViewDefault::beginTarget( const Bu::String &sProfile,
65 const Target &rTarget ) 65 const Target &rTarget )
66{ 66{
67 if( iDepth == 0 ) 67 if( iDepth == 0 )
68 { 68 {
69 bDispedTrg = false; 69 bDispedTrg = false;
70 iTotal = rTarget.getDepCount(); 70 iTotal = rTarget.getDepCount();
71 iCurrent = 0; 71 iCurrent = 0;
72 sTopTarget = rTarget.getOutputList().first(); 72 sTopTarget = rTarget.getOutputList().first();
73 } 73 }
74 iDepth++; 74 iDepth++;
75 75
76 sCurProfile = sProfile; 76 sCurProfile = sProfile;
77} 77}
78 78
79void ViewDefault::drawTargetHdr( const Bu::String &sProfile, 79void ViewDefault::drawTargetHdr( const Bu::String &sProfile,
80 const Target &rTarget ) 80 const Target &rTarget )
81{ 81{
82 if( bDispedTrg == false ) 82 if( bDispedTrg == false )
83 { 83 {
84 bDispedTrg = true; 84 bDispedTrg = true;
85 if( bFirst == false ) 85 if( bFirst == false )
86 { 86 {
87 sio << sio.nl; 87 sio << sio.nl;
88 } 88 }
89 bFirst = false; 89 bFirst = false;
90 sio << C_BR_WHITE << " --- " << C_BR_CYAN << sProfile << " " 90 sio << C_BR_WHITE << " --- " << C_BR_CYAN << sProfile << " "
91 << sTopTarget << C_BR_WHITE << " --- " 91 << sTopTarget << C_BR_WHITE << " --- "
92 << C_RESET << sio.nl; 92 << C_RESET << sio.nl;
93 } 93 }
94} 94}
95 95
96void ViewDefault::processTarget( const Bu::String &sProfile, 96void ViewDefault::processTarget( const Bu::String &sProfile,
97 const Target &rTarget ) 97 const Target &rTarget )
98{ 98{
99 drawTargetHdr( sProfile, rTarget ); 99 drawTargetHdr( sProfile, rTarget );
100 iCurrent++; 100 iCurrent++;
101 101
102 int iPct = (iTotal>0)?(iCurrent*100/iTotal):(100); 102 int iPct = (iTotal>0)?(iCurrent*100/iTotal):(100);
103 sio << C_BR_WHITE << "[" << C_BR_GREEN << Fmt(3) << iPct 103 sio << C_BR_WHITE << "[" << C_BR_GREEN << Fmt(3) << iPct
104 << "%" << C_BR_WHITE << "] " << C_BR_MAGENTA 104 << "%" << C_BR_WHITE << "] " << C_BR_MAGENTA
105 << Fmt(10) << rTarget.getDisplay() << C_BR_WHITE 105 << Fmt(10) << rTarget.getDisplay() << C_BR_WHITE
106 << ": " << rTarget.getOutputList().first() << C_RESET << sio.nl; 106 << ": " << rTarget.getOutputList().first() << C_RESET << sio.nl;
107 107
108 bDisped = true; 108 bDisped = true;
109} 109}
110 110
111void ViewDefault::endTarget() 111void ViewDefault::endTarget()
112{ 112{
113 iDepth--; 113 iDepth--;
114} 114}
115 115
116void ViewDefault::buildRequires( const Target &rTarget ) 116void ViewDefault::buildRequires( const Target &rTarget )
117{ 117{
118 drawTargetHdr( sCurProfile, rTarget ); 118 drawTargetHdr( sCurProfile, rTarget );
119 119
120 int iPct = (iTotal>0)?(iCurrent*100/iTotal):(100); 120 int iPct = (iTotal>0)?(iCurrent*100/iTotal):(100);
121 sio << C_BR_WHITE << "[" << C_BR_GREEN << Fmt(3) << iPct 121 sio << C_BR_WHITE << "[" << C_BR_GREEN << Fmt(3) << iPct
122 << "%" << C_BR_WHITE << "] " << C_BR_MAGENTA 122 << "%" << C_BR_WHITE << "] " << C_BR_MAGENTA
123 << Fmt(10) << "deps" << C_BR_WHITE 123 << Fmt(10) << "deps" << C_BR_WHITE
124 << ": " << rTarget.getOutputList().first() << C_RESET << sio.nl; 124 << ": " << rTarget.getOutputList().first() << C_RESET << sio.nl;
125 bDisped = true; 125 bDisped = true;
126} 126}
127 127
128void ViewDefault::cmdStarted( const Bu::String &/*sCmd*/ ) 128void ViewDefault::cmdStarted( const Bu::String &/*sCmd*/ )
@@ -130,72 +130,72 @@ void ViewDefault::cmdStarted( const Bu::String &/*sCmd*/ )
130} 130}
131 131
132void ViewDefault::cmdFinished( const Bu::String &sStdOut, 132void ViewDefault::cmdFinished( const Bu::String &sStdOut,
133 const Bu::String &sStdErr, long /*iExit*/ ) 133 const Bu::String &sStdErr, long /*iExit*/ )
134{ 134{
135 if( sStdOut.isSet() ) 135 if( sStdOut.isSet() )
136 { 136 {
137 Bu::String::const_iterator b; 137 Bu::String::const_iterator b;
138 b = sStdOut.begin(); 138 b = sStdOut.begin();
139 while( b ) 139 while( b )
140 { 140 {
141 Bu::String::const_iterator e, max; 141 Bu::String::const_iterator e, max;
142 max = b + 78; 142 max = b + 78;
143 for( e = b; e != max && *e != '\n'; e++ ) { } 143 for( e = b; e != max && *e != '\n'; e++ ) { }
144 sio << C_BR_GREEN << "| " << C_RESET << String( b, e ) << sio.nl; 144 sio << C_BR_GREEN << "| " << C_RESET << String( b, e ) << sio.nl;
145 b = e; 145 b = e;
146 if( *b == '\n' ) 146 if( *b == '\n' )
147 b++; 147 b++;
148 } 148 }
149 sio << C_BR_GREEN << "\\-----" << C_RESET << sio.nl; 149 sio << C_BR_GREEN << "\\-----" << C_RESET << sio.nl;
150 } 150 }
151 if( sStdErr.isSet() ) 151 if( sStdErr.isSet() )
152 { 152 {
153 Bu::String::const_iterator b; 153 Bu::String::const_iterator b;
154 b = sStdErr.begin(); 154 b = sStdErr.begin();
155 while( b ) 155 while( b )
156 { 156 {
157 Bu::String::const_iterator e, max; 157 Bu::String::const_iterator e, max;
158 max = b + 78; 158 max = b + 78;
159 for( e = b; e != max && *e != '\n'; e++ ) { } 159 for( e = b; e != max && *e != '\n'; e++ ) { }
160 sio << C_BR_RED << "| " << C_RESET << String( b, e ) << sio.nl; 160 sio << C_BR_RED << "| " << C_RESET << String( b, e ) << sio.nl;
161 b = e; 161 b = e;
162 if( *b == '\n' ) 162 if( *b == '\n' )
163 b++; 163 b++;
164 } 164 }
165 sio << C_BR_RED << "\\-----" << C_RESET << sio.nl; 165 sio << C_BR_RED << "\\-----" << C_RESET << sio.nl;
166 } 166 }
167 //sio << C_BR_WHITE << "[" << C_BR_GREEN << sStdOut << C_BR_WHITE << "]" << sio.nl; 167 //sio << C_BR_WHITE << "[" << C_BR_GREEN << sStdOut << C_BR_WHITE << "]" << sio.nl;
168 //sio << C_BR_WHITE << "[" << C_BR_RED << sStdErr << C_BR_WHITE << "]" << sio.nl; 168 //sio << C_BR_WHITE << "[" << C_BR_RED << sStdErr << C_BR_WHITE << "]" << sio.nl;
169 bDisped = true; 169 bDisped = true;
170} 170}
171 171
172void ViewDefault::userError( const Bu::String &sMsg ) 172void ViewDefault::userError( const Bu::String &sMsg )
173{ 173{
174 sio << C_BR_RED << "Error: " << sMsg << C_RESET << sio.nl; 174 sio << C_BR_RED << "Error: " << sMsg << C_RESET << sio.nl;
175 bDisped = true; 175 bDisped = true;
176} 176}
177 177
178void ViewDefault::userWarning( const Bu::String &sMsg ) 178void ViewDefault::userWarning( const Bu::String &sMsg )
179{ 179{
180 sio << C_BR_YELLOW << "Warning: " << sMsg << C_RESET << sio.nl; 180 sio << C_BR_YELLOW << "Warning: " << sMsg << C_RESET << sio.nl;
181 bDisped = true; 181 bDisped = true;
182} 182}
183 183
184void ViewDefault::userNotice( const Bu::String &sMsg ) 184void ViewDefault::userNotice( const Bu::String &sMsg )
185{ 185{
186 sio << C_BR_GREEN << "Notice: " << sMsg << C_RESET << sio.nl; 186 sio << C_BR_GREEN << "Notice: " << sMsg << C_RESET << sio.nl;
187 bDisped = true; 187 bDisped = true;
188} 188}
189 189
190void ViewDefault::sysError( const Bu::String &sMsg ) 190void ViewDefault::sysError( const Bu::String &sMsg )
191{ 191{
192 sio << C_BR_RED << sMsg << C_RESET << sio.nl; 192 sio << C_BR_RED << sMsg << C_RESET << sio.nl;
193 bDisped = true; 193 bDisped = true;
194} 194}
195 195
196void ViewDefault::sysWarning( const Bu::String &sMsg ) 196void ViewDefault::sysWarning( const Bu::String &sMsg )
197{ 197{
198 sio << C_BR_YELLOW << sMsg << C_RESET << sio.nl; 198 sio << C_BR_YELLOW << sMsg << C_RESET << sio.nl;
199 bDisped = true; 199 bDisped = true;
200} 200}
201 201